coverity fix
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALQADataMakerRec.cxx
CommitLineData
9e47432c 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15/*
16Based on the QA code for PHOS written by Yves Schutz July 2007
17
18Authors: J.Klay (Cal Poly) May 2008
19 S. Salur LBL April 2008
20
38986b78 21Created one histogram for QA shifter;-- Yaxian Mao: 11/2009
9e47432c 22The idea:average counts for all the towers should be flat
23Change all existing histograms as experts
9e47432c 24
38986b78 25Change histograms for DQM shifter: -- Yaxian Mao 04/2010
26Calcuate the amplitude ratio from current run and the LED reference, for QAChecker use
27Also calculate the ratio of amplitude from LED Monitor system (current/Reference), to check LED system
28
9e47432c 29*/
30
31// --- ROOT system ---
32#include <TClonesArray.h>
33#include <TFile.h>
34#include <TH1F.h>
35#include <TH1I.h>
36#include <TH2F.h>
38986b78 37#include <TLine.h>
38#include <TText.h>
9e47432c 39#include <TProfile.h>
38986b78 40#include <TStyle.h>
9e47432c 41// --- Standard library ---
42
43
44// --- AliRoot header files ---
e03bcdd4 45#include "AliDAQ.h"
9e47432c 46#include "AliESDCaloCluster.h"
47#include "AliESDCaloCells.h"
48#include "AliESDEvent.h"
49#include "AliLog.h"
50#include "AliEMCALQADataMakerRec.h"
51#include "AliQAChecker.h"
52#include "AliEMCALDigit.h"
53#include "AliEMCALRecPoint.h"
54#include "AliEMCALRawUtils.h"
55#include "AliEMCALReconstructor.h"
56#include "AliEMCALRecParam.h"
57#include "AliRawReader.h"
58#include "AliCaloRawStreamV3.h"
59#include "AliEMCALGeoParams.h"
def665cb 60#include "AliRawEventHeaderBase.h"
38986b78 61#include "AliQAManager.h"
62#include "AliCDBEntry.h"
def665cb 63
64#include "AliCaloBunchInfo.h"
65#include "AliCaloFitResults.h"
66#include "AliCaloRawAnalyzerFastFit.h"
67#include "AliCaloRawAnalyzerNN.h"
68#include "AliCaloRawAnalyzerLMS.h"
69#include "AliCaloRawAnalyzerPeakFinder.h"
70#include "AliCaloRawAnalyzerCrude.h"
9e47432c 71
ce95bae9 72using namespace std;
73
9e47432c 74ClassImp(AliEMCALQADataMakerRec)
75
76//____________________________________________________________________________
def665cb 77AliEMCALQADataMakerRec::AliEMCALQADataMakerRec(fitAlgorithm fitAlgo) :
78 AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kEMCAL), "EMCAL Quality Assurance Data Maker"),
79 fFittingAlgorithm(0),
80 fRawAnalyzer(0),
81 fRawAnalyzerTRU(0),
707805fc 82 fSuperModules(10), // FIXME!!! number of SuperModules; 10 for 2011; update default for later runs
def665cb 83 fFirstPedestalSample(0),
84 fLastPedestalSample(3),
85 fFirstPedestalSampleTRU(0),
86 fLastPedestalSampleTRU(3),
87 fMinSignalLG(0),
88 fMaxSignalLG(AliEMCALGeoParams::fgkSampleMax),
89 fMinSignalHG(0),
90 fMaxSignalHG(AliEMCALGeoParams::fgkSampleMax),
91 fMinSignalTRU(0),
92 fMaxSignalTRU(AliEMCALGeoParams::fgkSampleMax),
93 fMinSignalLGLEDMon(0),
94 fMaxSignalLGLEDMon(AliEMCALGeoParams::fgkSampleMax),
95 fMinSignalHGLEDMon(0),
38986b78 96 fMaxSignalHGLEDMon(AliEMCALGeoParams::fgkSampleMax),
97 fCalibRefHistoPro(NULL),
98 fCalibRefHistoH2F(NULL),
99 fLEDMonRefHistoPro(NULL),
100 fHighEmcHistoH2F(NULL)
101// fTextSM(new TText*[fSuperModules]) ,
102// fLineCol(NULL),
103// fLineRow(NULL)
104
def665cb 105{
9e47432c 106 // ctor
def665cb 107 SetFittingAlgorithm(fitAlgo);
108 fRawAnalyzerTRU = new AliCaloRawAnalyzerLMS();
109 fRawAnalyzerTRU->SetFixTau(kTRUE);
110 fRawAnalyzerTRU->SetTau(2.5); // default for TRU shaper
38986b78 111// for (Int_t sm = 0 ; sm < fSuperModules ; sm++){
112// fTextSM[sm] = NULL ;
113// }
9e47432c 114}
115
116//____________________________________________________________________________
117AliEMCALQADataMakerRec::AliEMCALQADataMakerRec(const AliEMCALQADataMakerRec& qadm) :
118 AliQADataMakerRec(),
def665cb 119 fFittingAlgorithm(0),
120 fRawAnalyzer(0),
121 fRawAnalyzerTRU(0),
9e47432c 122 fSuperModules(qadm.GetSuperModules()),
123 fFirstPedestalSample(qadm.GetFirstPedestalSample()),
124 fLastPedestalSample(qadm.GetLastPedestalSample()),
def665cb 125 fFirstPedestalSampleTRU(qadm.GetFirstPedestalSampleTRU()),
126 fLastPedestalSampleTRU(qadm.GetLastPedestalSampleTRU()),
127 fMinSignalLG(qadm.GetMinSignalLG()),
128 fMaxSignalLG(qadm.GetMaxSignalLG()),
9e47432c 129 fMinSignalHG(qadm.GetMinSignalHG()),
def665cb 130 fMaxSignalHG(qadm.GetMaxSignalHG()),
131 fMinSignalTRU(qadm.GetMinSignalTRU()),
132 fMaxSignalTRU(qadm.GetMaxSignalTRU()),
133 fMinSignalLGLEDMon(qadm.GetMinSignalLGLEDMon()),
134 fMaxSignalLGLEDMon(qadm.GetMaxSignalLGLEDMon()),
135 fMinSignalHGLEDMon(qadm.GetMinSignalHGLEDMon()),
38986b78 136 fMaxSignalHGLEDMon(qadm.GetMaxSignalHGLEDMon()),
137 fCalibRefHistoPro(NULL),
138 fCalibRefHistoH2F(NULL),
139 fLEDMonRefHistoPro(NULL),
140 fHighEmcHistoH2F(NULL)
141// fTextSM(new TText*[fSuperModules]) ,
142// fLineCol(NULL),
143// fLineRow(NULL)
9e47432c 144{
145 //copy ctor
146 SetName((const char*)qadm.GetName()) ;
147 SetTitle((const char*)qadm.GetTitle());
def665cb 148 SetFittingAlgorithm(qadm.GetFittingAlgorithm());
149 fRawAnalyzerTRU = new AliCaloRawAnalyzerLMS();
150 fRawAnalyzerTRU->SetFixTau(kTRUE);
151 fRawAnalyzerTRU->SetTau(2.5); // default for TRU shaper
38986b78 152// for (Int_t sm = 0 ; sm < fSuperModules ; sm++){
153// fTextSM[sm] = qadm.fTextSM[sm] ;
154// }
9e47432c 155}
156
157//__________________________________________________________________
158AliEMCALQADataMakerRec& AliEMCALQADataMakerRec::operator = (const AliEMCALQADataMakerRec& qadm )
159{
160 // Equal operator.
161 this->~AliEMCALQADataMakerRec();
162 new(this) AliEMCALQADataMakerRec(qadm);
38986b78 163// fLineCol = NULL;
164// fLineRow = NULL;
165// for (Int_t sm = 0 ; sm < fSuperModules ; sm++){
166// fTextSM[sm] = qadm.fTextSM[sm] ;
167// }
9e47432c 168 return *this;
169}
170
171//____________________________________________________________________________
172void AliEMCALQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
173{
174 //Detector specific actions at end of cycle
175
176// if(fCycleCounter)
177// GetRawsData(kNEventsPerTower)->Scale(1./fCycleCounter);
178
179 // do the QA checking
180 AliQAChecker::Instance()->Run(AliQAv1::kEMCAL, task, list) ;
181}
182
183//____________________________________________________________________________
38986b78 184void AliEMCALQADataMakerRec::GetCalibRefFromOCDB()
185{
186 //Get the reference histogram from OCDB
187 TString sName1("hHighEmcalRawMaxMinusMin") ;
188 TString sName2("hLowLEDMonEmcalRawMaxMinusMin") ;
189 sName1.Prepend(Form("%s_", AliRecoParam::GetEventSpecieName(AliRecoParam::kCalib))) ;
190 sName2.Prepend(Form("%s_", AliRecoParam::GetEventSpecieName(AliRecoParam::kCalib))) ;
191
192 TString refStorage(AliQAv1::GetQARefStorage()) ;
193 if (!refStorage.Contains(AliQAv1::GetLabLocalOCDB()) && !refStorage.Contains(AliQAv1::GetLabAliEnOCDB())) {
194 AliFatal(Form("%s is not a valid location for reference data", refStorage.Data())) ;
195 } else {
196 AliQAManager* manQA = AliQAManager::QAManager(AliQAv1::kRAWS) ;
197 AliQAv1::SetQARefDataDirName(AliRecoParam::kCalib) ;
198 if ( ! manQA->GetLock() ) {
199 manQA->SetDefaultStorage(AliQAv1::GetQARefStorage()) ;
200 manQA->SetSpecificStorage("*", AliQAv1::GetQARefStorage()) ;
201 manQA->SetRun(AliCDBManager::Instance()->GetRun()) ;
202 manQA->SetLock() ;
203 }
204 char * detOCDBDir = Form("%s/%s/%s", GetName(), AliQAv1::GetRefOCDBDirName(), AliQAv1::GetRefDataDirName()) ;
205 AliCDBEntry * entry = manQA->Get(detOCDBDir, manQA->GetRun()) ;
206 if (entry) {
207 TList * listDetQAD =static_cast<TList *>(entry->GetObject()) ;
208 if ( strcmp(listDetQAD->ClassName(), "TList") != 0 ) {
209 AliError(Form("Expected a Tlist and found a %s for detector %s", listDetQAD->ClassName(), GetName())) ;
210 listDetQAD = NULL ;
211 }
212 TObjArray * dirOCDB= NULL ;
213 if ( listDetQAD )
214 dirOCDB = static_cast<TObjArray *>(listDetQAD->FindObject(Form("%s/%s", AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), AliRecoParam::GetEventSpecieName(AliRecoParam::kCalib)))) ;
215 if (dirOCDB){
216 fCalibRefHistoPro = dynamic_cast<TProfile *>(dirOCDB->FindObject(sName1.Data())) ;
217 fLEDMonRefHistoPro = dynamic_cast<TProfile *>(dirOCDB->FindObject(sName2.Data())) ;
218 }
219 }
220 }
221
222 if(fCalibRefHistoPro && fLEDMonRefHistoPro){
223
224 //Defining histograms binning, each 2D histogram covers all SMs
225 Int_t nSMSectors = fSuperModules / 2; // 2 SMs per sector
226 Int_t nbinsZ = 2*AliEMCALGeoParams::fgkEMCALCols;
227 Int_t nbinsPhi = nSMSectors * AliEMCALGeoParams::fgkEMCALRows;
228
229 if(!fCalibRefHistoH2F)
230 fCalibRefHistoH2F = new TH2F("hCalibRefHisto", "hCalibRefHisto", nbinsZ, -0.5, nbinsZ - 0.5, nbinsPhi, -0.5, nbinsPhi -0.5);
231 ConvertProfile2H(fCalibRefHistoPro,fCalibRefHistoH2F) ;
232 } else {
233 AliFatal(Form("No reference object with name %s or %s found", sName1.Data(), sName2.Data())) ;
234 }
235}
236//____________________________________________________________________________
9e47432c 237void AliEMCALQADataMakerRec::InitESDs()
238{
239 //Create histograms to controll ESD
240 const Bool_t expert = kTRUE ;
241 const Bool_t image = kTRUE ;
242
243 TH1F * h1 = new TH1F("hESDCaloClusterE", "ESDs CaloCluster energy in EMCAL;Energy [GeV];Counts", 200, 0., 100.) ;
244 h1->Sumw2() ;
245 Add2ESDsList(h1, kESDCaloClusE, !expert, image) ;
246
247 TH1I * h2 = new TH1I("hESDCaloClusterM", "ESDs CaloCluster multiplicity in EMCAL;# of Clusters;Entries", 100, 0, 100) ;
248 h2->Sumw2() ;
249 Add2ESDsList(h2, kESDCaloClusM, !expert, image) ;
250
251 TH1F * h3 = new TH1F("hESDCaloCellA", "ESDs CaloCell amplitude in EMCAL;Energy [GeV];Counts", 500, 0., 50.) ;
252 h3->Sumw2() ;
253 Add2ESDsList(h3, kESDCaloCellA, !expert, image) ;
254
255 TH1I * h4 = new TH1I("hESDCaloCellM", "ESDs CaloCell multiplicity in EMCAL;# of Clusters;Entries", 200, 0, 1000) ;
256 h4->Sumw2() ;
257 Add2ESDsList(h4, kESDCaloCellM, !expert, image) ;
258
259}
260
261//____________________________________________________________________________
262void AliEMCALQADataMakerRec::InitDigits()
263{
264 // create Digits histograms in Digits subdir
265 const Bool_t expert = kTRUE ;
266 const Bool_t image = kTRUE ;
267
268 TH1I * h0 = new TH1I("hEmcalDigits", "Digits amplitude distribution in EMCAL;Amplitude [ADC counts];Counts", 500, 0, 500) ;
269 h0->Sumw2() ;
270 Add2DigitsList(h0, 0, !expert, image) ;
271 TH1I * h1 = new TH1I("hEmcalDigitsMul", "Digits multiplicity distribution in EMCAL;# of Digits;Entries", 200, 0, 2000) ;
272 h1->Sumw2() ;
273 Add2DigitsList(h1, 1, !expert, image) ;
274}
275
276//____________________________________________________________________________
277void AliEMCALQADataMakerRec::InitRecPoints()
278{
38986b78 279 // create Reconstructed PoInt_ts histograms in RecPoints subdir
9e47432c 280 const Bool_t expert = kTRUE ;
281 const Bool_t image = kTRUE ;
282
283 TH1F* h0 = new TH1F("hEMCALRpE","EMCAL RecPoint energies;Energy [GeV];Counts",200, 0.,20.); //GeV
284 h0->Sumw2();
285 Add2RecPointsList(h0,kRecPE, !expert, image);
286
287 TH1I* h1 = new TH1I("hEMCALRpM","EMCAL RecPoint multiplicities;# of Clusters;Entries",100,0,100);
288 h1->Sumw2();
289 Add2RecPointsList(h1,kRecPM, !expert, image);
290
291 TH1I* h2 = new TH1I("hEMCALRpDigM","EMCAL RecPoint Digit Multiplicities;# of Digits;Entries",20,0,20);
292 h2->Sumw2();
293 Add2RecPointsList(h2,kRecPDigM, !expert, image);
294
295}
296
297//____________________________________________________________________________
298void AliEMCALQADataMakerRec::InitRaws()
299{
300 // create Raws histograms in Raws subdir
1557b01a 301 const Bool_t expert = kTRUE ;
302 const Bool_t saveCorr = kTRUE ;
303 const Bool_t image = kTRUE ;
304 const Option_t *profileOption = "s";
9e47432c 305
38986b78 306 Int_t nTowersPerSM = AliEMCALGeoParams::fgkEMCALRows * AliEMCALGeoParams::fgkEMCALCols; // number of towers in a SuperModule; 24x48
307 Int_t nTot = fSuperModules * nTowersPerSM; // max number of towers in all SuperModules
922017a7 308
1557b01a 309 //Defining histograms binning, each 2D histogram covers all SMs
310 Int_t nSMSectors = fSuperModules / 2; // 2 SMs per sector
311 Int_t nbinsZ = 2*AliEMCALGeoParams::fgkEMCALCols;
312 Int_t nbinsPhi = nSMSectors * AliEMCALGeoParams::fgkEMCALRows;
38986b78 313
314 // counter info: number of channels per event (bins are SM index)
9e47432c 315 TProfile * h0 = new TProfile("hLowEmcalSupermodules", "Low Gain EMC: # of towers vs SuperMod;SM Id;# of towers",
1557b01a 316 fSuperModules, -0.5, fSuperModules-0.5, profileOption) ;
00957c37 317 Add2RawsList(h0, kNsmodLG, expert, !image, !saveCorr) ;
9e47432c 318 TProfile * h1 = new TProfile("hHighEmcalSupermodules", "High Gain EMC: # of towers vs SuperMod;SM Id;# of towers",
1557b01a 319 fSuperModules, -0.5, fSuperModules-0.5, profileOption) ;
00957c37 320 Add2RawsList(h1, kNsmodHG, expert, !image, !saveCorr) ;
9e47432c 321
322 // where did max sample occur? (bins are towers)
323 TProfile * h2 = new TProfile("hLowEmcalRawtime", "Low Gain EMC: Time at Max vs towerId;Tower Id;Time [ticks]",
1557b01a 324 nTot, -0.5, nTot-0.5, profileOption) ;
00957c37 325 Add2RawsList(h2, kTimeLG, expert, !image, !saveCorr) ;
9e47432c 326 TProfile * h3 = new TProfile("hHighEmcalRawtime", "High Gain EMC: Time at Max vs towerId;Tower Id;Time [ticks]",
1557b01a 327 nTot, -0.5, nTot-0.5, profileOption) ;
00957c37 328 Add2RawsList(h3, kTimeHG, expert, !image, !saveCorr) ;
9e47432c 329
330 // how much above pedestal was the max sample? (bins are towers)
331 TProfile * h4 = new TProfile("hLowEmcalRawMaxMinusMin", "Low Gain EMC: Max - Min vs towerId;Tower Id;Max-Min [ADC counts]",
1557b01a 332 nTot, -0.5, nTot-0.5, profileOption) ;
9e47432c 333 Add2RawsList(h4, kSigLG, expert, image, !saveCorr) ;
334 TProfile * h5 = new TProfile("hHighEmcalRawMaxMinusMin", "High Gain EMC: Max - Min vs towerId;Tower Id;Max-Min [ADC counts]",
1557b01a 335 nTot, -0.5, nTot-0.5, profileOption) ;
9e47432c 336 Add2RawsList(h5, kSigHG, expert, image, !saveCorr) ;
337
338 // total counter: channels per event
339 TH1I * h6 = new TH1I("hLowNtot", "Low Gain EMC: Total Number of found towers;# of Towers;Counts", 200, 0, nTot) ;
340 h6->Sumw2() ;
00957c37 341 Add2RawsList(h6, kNtotLG, expert, !image, !saveCorr) ;
9e47432c 342 TH1I * h7 = new TH1I("hHighNtot", "High Gain EMC: Total Number of found towers;# of Towers;Counts", 200,0, nTot) ;
343 h7->Sumw2() ;
00957c37 344 Add2RawsList(h7, kNtotHG, expert, !image, !saveCorr) ;
9e47432c 345
346 // pedestal (bins are towers)
347 TProfile * h8 = new TProfile("hLowEmcalRawPed", "Low Gain EMC: Pedestal vs towerId;Tower Id;Pedestal [ADC counts]",
1557b01a 348 nTot, -0.5, nTot-0.5, profileOption) ;
00957c37 349 Add2RawsList(h8, kPedLG, expert, !image, !saveCorr) ;
9e47432c 350 TProfile * h9 = new TProfile("hHighEmcalRawPed", "High Gain EMC: Pedestal vs towerId;Tower Id;Pedestal [ADC counts]",
1557b01a 351 nTot, -0.5, nTot-0.5, profileOption) ;
00957c37 352 Add2RawsList(h9, kPedHG, expert, !image, !saveCorr) ;
9e47432c 353
38986b78 354 //temp 2D amplitude histogram for the current run
355 fHighEmcHistoH2F = new TH2F("h2DHighEC2", "High Gain EMC:Max - Min [ADC counts]", nbinsZ, -0.5 , nbinsZ-0.5, nbinsPhi, -0.5, nbinsPhi-0.5);
f05c8877 356 fHighEmcHistoH2F->SetDirectory(0) ; // this histo must be memory resident
38986b78 357 //add ratio histograms: to comapre the current run with the reference data
358 TH2F * h15 = new TH2F("h2DRatioAmp", "High Gain Ratio to Reference:Amplitude_{current run}/Amplitude_{reference run}", nbinsZ, -0.5 , nbinsZ-0.5,
359 nbinsPhi, -0.5, nbinsPhi-0.5);
360 //settings for display in amore
361 h15->SetTitle("Amplitude_{current run}/Amplitude_{reference run}");
00957c37 362 h15->SetMaximum(2.0);
363 h15->SetMinimum(0.1);
364 h15->SetOption("COLZ");
365 gStyle->SetOptStat(0);
366 Int_t color[] = {4,3,2} ;
367 gStyle->SetPalette(3,color);
368 h15->GetZaxis()->SetNdivisions(3);
369 h15->UseCurrentStyle();
370 h15->SetDirectory(0);
38986b78 371 Add2RawsList(h15, k2DRatioAmp, !expert, image, !saveCorr) ;
372
373 TH1F * h16 = new TH1F("hRatioDist", "Amplitude_{current run}/Amplitude_{reference run} ratio distribution", nTot, 0., 2.);
00957c37 374 h16->SetMinimum(0.1);
375 h16->SetMaximum(100.);
376 gStyle->SetOptStat(0);
377 h16->UseCurrentStyle();
f05c8877 378 h16->SetDirectory(0);
38986b78 379 Add2RawsList(h16, kRatioDist, !expert, image, !saveCorr) ;
380
9e47432c 381 // now repeat the same for TRU and LEDMon data
38986b78 382 Int_t nTot2x2 = fSuperModules * AliEMCALGeoParams::fgkEMCALTRUsPerSM * AliEMCALGeoParams::fgkEMCAL2x2PerTRU; // max number of TRU channels for all SuperModules
9e47432c 383
384 // counter info: number of channels per event (bins are SM index)
385 TProfile * hT0 = new TProfile("hTRUEmcalSupermodules", "TRU EMC: # of TRU channels vs SuperMod;SM Id;# of TRU channels",
1557b01a 386 fSuperModules, -0.5, fSuperModules-0.5, profileOption) ;
00957c37 387 Add2RawsList(hT0, kNsmodTRU, expert, !image, !saveCorr) ;
9e47432c 388
389 // where did max sample occur? (bins are TRU channels)
390 TProfile * hT1 = new TProfile("hTRUEmcalRawtime", "TRU EMC: Time at Max vs 2x2Id;2x2 Id;Time [ticks]",
1557b01a 391 nTot2x2, -0.5, nTot2x2-0.5, profileOption) ;
00957c37 392 Add2RawsList(hT1, kTimeTRU, expert, !image, !saveCorr) ;
9e47432c 393
394 // how much above pedestal was the max sample? (bins are TRU channels)
395 TProfile * hT2 = new TProfile("hTRUEmcalRawMaxMinusMin", "TRU EMC: Max - Min vs 2x2Id;2x2 Id;Max-Min [ADC counts]",
1557b01a 396 nTot2x2, -0.5, nTot2x2-0.5, profileOption) ;
00957c37 397 Add2RawsList(hT2, kSigTRU, expert, !image, !saveCorr) ;
9e47432c 398
399 // total counter: channels per event
400 TH1I * hT3 = new TH1I("hTRUNtot", "TRU EMC: Total Number of found TRU channels;# of TRU Channels;Counts", 200, 0, nTot2x2) ;
401 hT3->Sumw2() ;
00957c37 402 Add2RawsList(hT3, kNtotTRU, expert, !image, !saveCorr) ;
9e47432c 403
404 // pedestal (bins are TRU channels)
405 TProfile * hT4 = new TProfile("hTRUEmcalRawPed", "TRU EMC: Pedestal vs 2x2Id;2x2 Id;Pedestal [ADC counts]",
1557b01a 406 nTot2x2, -0.5, nTot2x2-0.5, profileOption) ;
00957c37 407 Add2RawsList(hT4, kPedTRU, expert, !image, !saveCorr) ;
9e47432c 408
5c6517c3 409 // L0 trigger hits: # of hits (bins are TRU channels)
410 TH1I * hT5 = new TH1I("hTRUEmcalL0hits", "L0 trigger hits: Total number of 2x2 L0 generated", nTot2x2, -0.5, nTot2x2);
411 hT5->Sumw2();
00957c37 412 Add2RawsList(hT5, kNL0TRU, expert, !image, !saveCorr);
5c6517c3 413
414 // L0 trigger hits: average time (bins are TRU channels)
1557b01a 415 TProfile * hT6 = new TProfile("hTRUEmcalL0hitsAvgTime", "L0 trigger hits: average time bin", nTot2x2, -0.5, nTot2x2, profileOption);
00957c37 416 Add2RawsList(hT6, kTimeL0TRU, expert, !image, !saveCorr);
5c6517c3 417
9e47432c 418 // and also LED Mon..
419 // LEDMon has both high and low gain channels, just as regular FEE/towers
38986b78 420 Int_t nTotLEDMon = fSuperModules * AliEMCALGeoParams::fgkEMCALLEDRefs; // max number of LEDMon channels for all SuperModules
9e47432c 421
422 // counter info: number of channels per event (bins are SM index)
423 TProfile * hL0 = new TProfile("hLowLEDMonEmcalSupermodules", "LowLEDMon Gain EMC: # of strips vs SuperMod;SM Id;# of strips",
1557b01a 424 fSuperModules, -0.5, fSuperModules-0.5, profileOption) ;
00957c37 425 Add2RawsList(hL0, kNsmodLGLEDMon, expert, !image, !saveCorr) ;
9e47432c 426 TProfile * hL1 = new TProfile("hHighLEDMonEmcalSupermodules", "HighLEDMon Gain EMC: # of strips vs SuperMod;SM Id;# of strips",
1557b01a 427 fSuperModules, -0.5, fSuperModules-0.5, profileOption) ;
00957c37 428 Add2RawsList(hL1, kNsmodHGLEDMon, expert, !image, !saveCorr) ;
9e47432c 429
430 // where did max sample occur? (bins are strips)
431 TProfile * hL2 = new TProfile("hLowLEDMonEmcalRawtime", "LowLEDMon Gain EMC: Time at Max vs stripId;Strip Id;Time [ticks]",
1557b01a 432 nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ;
00957c37 433 Add2RawsList(hL2, kTimeLGLEDMon, expert, !image, !saveCorr) ;
9e47432c 434 TProfile * hL3 = new TProfile("hHighLEDMonEmcalRawtime", "HighLEDMon Gain EMC: Time at Max vs stripId;Strip Id;Time [ticks]",
1557b01a 435 nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ;
00957c37 436 Add2RawsList(hL3, kTimeHGLEDMon, expert, !image, !saveCorr) ;
9e47432c 437
438 // how much above pedestal was the max sample? (bins are strips)
439 TProfile * hL4 = new TProfile("hLowLEDMonEmcalRawMaxMinusMin", "LowLEDMon Gain EMC: Max - Min vs stripId;Strip Id;Max-Min [ADC counts]",
1557b01a 440 nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ;
00957c37 441 Add2RawsList(hL4, kSigLGLEDMon, expert, !image, !saveCorr) ;
9e47432c 442 TProfile * hL5 = new TProfile("hHighLEDMonEmcalRawMaxMinusMin", "HighLEDMon Gain EMC: Max - Min vs stripId;Strip Id;Max-Min [ADC counts]",
1557b01a 443 nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ;
00957c37 444 Add2RawsList(hL5, kSigHGLEDMon, expert, !image, !saveCorr) ;
38986b78 445
446 // total counter: channels per event
9e47432c 447 TH1I * hL6 = new TH1I("hLowLEDMonNtot", "LowLEDMon Gain EMC: Total Number of found strips;# of Strips;Counts", 200, 0, nTotLEDMon) ;
448 hL6->Sumw2() ;
00957c37 449 Add2RawsList(hL6, kNtotLGLEDMon, expert, !image, !saveCorr) ;
9e47432c 450 TH1I * hL7 = new TH1I("hHighLEDMonNtot", "HighLEDMon Gain EMC: Total Number of found strips;# of Strips;Counts", 200,0, nTotLEDMon) ;
451 hL7->Sumw2() ;
00957c37 452 Add2RawsList(hL7, kNtotHGLEDMon, expert, !image, !saveCorr) ;
9e47432c 453
454 // pedestal (bins are strips)
455 TProfile * hL8 = new TProfile("hLowLEDMonEmcalRawPed", "LowLEDMon Gain EMC: Pedestal vs stripId;Strip Id;Pedestal [ADC counts]",
1557b01a 456 nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ;
00957c37 457 Add2RawsList(hL8, kPedLGLEDMon, expert, !image, !saveCorr) ;
9e47432c 458 TProfile * hL9 = new TProfile("hHighLEDMonEmcalRawPed", "HighLEDMon Gain EMC: Pedestal vs stripId;Strip Id;Pedestal [ADC counts]",
1557b01a 459 nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ;
00957c37 460 Add2RawsList(hL9, kPedHGLEDMon, expert, !image, !saveCorr) ;
38986b78 461
462 //add two histograms for shifter from the LED monitor system: comapre LED monitor with the reference run
463 //to be used for decision whether we need to change reference data
464 TH1F * hL10 = new TH1F("hMaxMinusMinLEDMonRatio", "LEDMon amplitude, Ratio to reference run", nTotLEDMon, -0.5, nTotLEDMon-0.5) ;
38986b78 465 //settings for display in amore
466 hL10->SetTitle("Amplitude_{LEDMon current}/Amplitude_{LEDMon reference}");
00957c37 467 hL10->SetMaximum(2.0);
468 hL10->SetMinimum(0.1);
469 gStyle->SetOptStat(0);
470 hL10->UseCurrentStyle();
471 hL10->SetDirectory(0);
38986b78 472// hL10->SetOption("E");
00957c37 473 Add2RawsList(hL10, kLEDMonRatio, !expert, image, !saveCorr) ;
474
922017a7 475 TH1F * hL11 = new TH1F("hMaxMinusMinLEDMonRatioDist", "LEDMon amplitude, Ratio distribution", nTotLEDMon, 0, 2);
00957c37 476 hL11->SetMinimum(0.1) ;
00957c37 477 gStyle->SetOptStat(0);
478 hL11->UseCurrentStyle();
479 hL11->SetDirectory(0);
38986b78 480 Add2RawsList(hL11, kLEDMonRatioDist, !expert, image, !saveCorr) ;
481
922017a7 482 GetCalibRefFromOCDB();
9e47432c 483}
484
485//____________________________________________________________________________
486void AliEMCALQADataMakerRec::MakeESDs(AliESDEvent * esd)
487{
488 // make QA data from ESDs
489
490 Int_t nTot = 0 ;
491 for ( Int_t index = 0; index < esd->GetNumberOfCaloClusters() ; index++ ) {
492 AliESDCaloCluster * clu = esd->GetCaloCluster(index) ;
493 if( clu->IsEMCAL() ) {
494 GetESDsData(kESDCaloClusE)->Fill(clu->E()) ;
495 nTot++ ;
496 }
497 }
498 GetESDsData(kESDCaloClusM)->Fill(nTot) ;
499
500 //fill calo cells
501 AliESDCaloCells* cells = esd->GetEMCALCells();
502 GetESDsData(kESDCaloCellM)->Fill(cells->GetNumberOfCells()) ;
503
504 for ( Int_t index = 0; index < cells->GetNumberOfCells() ; index++ ) {
505 GetESDsData(kESDCaloCellA)->Fill(cells->GetAmplitude(index)) ;
506 }
507
508}
509
510//____________________________________________________________________________
511void AliEMCALQADataMakerRec::MakeRaws(AliRawReader* rawReader)
512{
922017a7 513 // Check that all the reference histograms exist before we try to use them - otherwise call InitRaws
514 if (!fCalibRefHistoPro || !fCalibRefHistoH2F || !fLEDMonRefHistoPro || !fHighEmcHistoH2F) {
515 InitRaws();
516 }
517
e03bcdd4 518 // make sure EMCal was readout during the event
519 Int_t emcID = AliDAQ::DetectorID("EMCAL"); // bit 18..
7b2c20bb 520 const UInt_t *detPattern = rawReader->GetDetectorPattern();
e03bcdd4 521 UInt_t emcInReadout = ( ((1 << emcID) & detPattern[0]) >> emcID);
38986b78 522 if (! emcInReadout) return; // no poInt_t in looking at this event, if no EMCal data
e03bcdd4 523
def665cb 524 // setup
9e47432c 525 rawReader->Reset() ;
526 AliCaloRawStreamV3 in(rawReader,"EMCAL");
30aa89b0 527 rawReader->Select("EMCAL", 0, AliEMCALGeoParams::fgkLastAltroDDL) ; //select EMCAL DDL's
9e47432c 528
5c6517c3 529 AliRecoParam::EventSpecie_t saveSpecie = fEventSpecie ;
530
def665cb 531 if (rawReader->GetType() == AliRawEventHeaderBase::kCalibrationEvent) {
532 SetEventSpecie(AliRecoParam::kCalib) ;
533 }
38986b78 534
38986b78 535 const Int_t nTowersPerSM = AliEMCALGeoParams::fgkEMCALRows * AliEMCALGeoParams::fgkEMCALCols; // number of towers in a SuperModule; 24x48
536 const Int_t nRows = AliEMCALGeoParams::fgkEMCALRows; // number of rows per SuperModule
537 const Int_t nStripsPerSM = AliEMCALGeoParams::fgkEMCALLEDRefs; // number of strips per SuperModule
538 const Int_t n2x2PerSM = AliEMCALGeoParams::fgkEMCALTRUsPerSM * AliEMCALGeoParams::fgkEMCAL2x2PerTRU; // number of TRU 2x2's per SuperModule
539 const Int_t n2x2PerTRU = AliEMCALGeoParams::fgkEMCAL2x2PerTRU;
9e47432c 540
9e47432c 541 // SM counters; decl. should be safe, assuming we don't get more than expected SuperModules..
38986b78 542 Int_t nTotalSMLG[AliEMCALGeoParams::fgkEMCALModules] = {0};
543 Int_t nTotalSMHG[AliEMCALGeoParams::fgkEMCALModules] = {0};
544 Int_t nTotalSMTRU[AliEMCALGeoParams::fgkEMCALModules] = {0};
545 Int_t nTotalSMLGLEDMon[AliEMCALGeoParams::fgkEMCALModules] = {0};
546 Int_t nTotalSMHGLEDMon[AliEMCALGeoParams::fgkEMCALModules] = {0};
547
548 const Int_t nTRUL0ChannelBits = 10; // used for L0 trigger bits checks
549 Int_t iSM = 0; // SuperModule index
def665cb 550 // start loop over input stream
def665cb 551 while (in.NextDDL()) {
38986b78 552 Int_t iRCU = in.GetDDLNumber() % 2; // RCU0 or RCU1, within SuperModule
dc16c015 553 fRawAnalyzer->SetIsZeroSuppressed( in.GetZeroSupp() );
9e47432c 554
98d6fe2e 555 while (in.NextChannel()) {
556 iSM = in.GetModule(); // SuperModule
38986b78 557 //prInt_tf("iSM %d DDL %d", iSM, in.GetDDLNumber());
98d6fe2e 558 if (iSM>=0 && iSM<fSuperModules) { // valid module reading
9e47432c 559
38986b78 560 Int_t nsamples = 0;
def665cb 561 vector<AliCaloBunchInfo> bunchlist;
562 while (in.NextBunch()) {
563 nsamples += in.GetBunchLength();
564 bunchlist.push_back( AliCaloBunchInfo(in.GetStartTimeBin(), in.GetBunchLength(), in.GetSignals() ) );
565 }
566
567 if (nsamples > 0) { // this check is needed for when we have zero-supp. on, but not sparse readout
38986b78 568 Float_t time = 0.;
569 Float_t amp = 0.;
def665cb 570 // indices for pedestal calc.
38986b78 571 Int_t firstPedSample = 0;
572 Int_t lastPedSample = 0;
573 bool isTRUL0IdData = false;
def665cb 574
575 if (! in.IsTRUData() ) { // high gain, low gain, LED Mon data - all have the same shaper/sampling
576 AliCaloFitResults fitResults = fRawAnalyzer->Evaluate( bunchlist, in.GetAltroCFG1(), in.GetAltroCFG2());
38986b78 577 amp = fitResults.GetAmp();
def665cb 578 time = fitResults.GetTof();
579 firstPedSample = fFirstPedestalSample;
38986b78 580 lastPedSample = fLastPedestalSample;
9e47432c 581 }
def665cb 582 else { // TRU data is special, needs its own analyzer
583 AliCaloFitResults fitResults = fRawAnalyzerTRU->Evaluate( bunchlist, in.GetAltroCFG1(), in.GetAltroCFG2());
38986b78 584 amp = fitResults.GetAmp();
def665cb 585 time = fitResults.GetTof();
586 firstPedSample = fFirstPedestalSampleTRU;
38986b78 587 lastPedSample = fLastPedestalSampleTRU;
5c6517c3 588 if (in.GetColumn() > n2x2PerTRU) {
589 isTRUL0IdData = true;
590 }
def665cb 591 }
592
593 // pedestal samples
38986b78 594 Int_t nPed = 0;
595 vector<Int_t> pedSamples;
9e47432c 596
def665cb 597 // select earliest bunch
598 unsigned int bunchIndex = 0;
599 unsigned int startBin = bunchlist.at(0).GetStartBin();
600 if (bunchlist.size() > 0) {
601 for(unsigned int ui=1; ui < bunchlist.size(); ui++ ) {
602 if (startBin > bunchlist.at(ui).GetStartBin() ) {
603 startBin = bunchlist.at(ui).GetStartBin();
604 bunchIndex = ui;
605 }
9e47432c 606 }
607 }
def665cb 608
609 // check bunch for entries in the pedestal sample range
38986b78 610 Int_t bunchLength = bunchlist.at(bunchIndex).GetLength();
def665cb 611 const UShort_t *sig = bunchlist.at(bunchIndex).GetData();
38986b78 612 Int_t timebin = 0;
5c6517c3 613
614 if (! isTRUL0IdData) { // regular data, can look at pedestals
38986b78 615 for (Int_t i = 0; i<bunchLength; i++) {
5c6517c3 616 timebin = startBin--;
617 if ( firstPedSample<=timebin && timebin<=lastPedSample ) {
618 pedSamples.push_back( sig[i] );
619 nPed++;
620 }
621 } // i
5c6517c3 622 }
623 else { // TRU L0 Id Data
624 // which TRU the channel belongs to?
38986b78 625 Int_t iTRUId = in.GetModule()*3 + (iRCU*in.GetBranch() + iRCU);
5c6517c3 626
38986b78 627 for (Int_t i = 0; i< bunchLength; i++) {
628 for( Int_t j = 0; j < nTRUL0ChannelBits; j++ ){
5c6517c3 629 // check if the bit j is 1
630 if( (sig[i] & ( 1 << j )) > 0 ){
38986b78 631 Int_t iTRUIdInSM = (in.GetColumn() - n2x2PerTRU)*nTRUL0ChannelBits+j;
ce95bae9 632 if(iTRUIdInSM < n2x2PerTRU) {
38986b78 633 Int_t iTRUAbsId = iTRUIdInSM + n2x2PerTRU * iTRUId;
5c6517c3 634 // Fill the histograms
ce95bae9 635 GetRawsData(kNL0TRU)->Fill(iTRUAbsId);
636 GetRawsData(kTimeL0TRU)->Fill(iTRUAbsId, startBin);
5c6517c3 637 }
638 }
639 }
640 startBin--;
641 } // i
642 } // TRU L0 Id data
def665cb 643
644 // fill histograms
645 if ( in.IsLowGain() || in.IsHighGain() ) { // regular towers
38986b78 646 Int_t towerId = iSM*nTowersPerSM + in.GetColumn()*nRows + in.GetRow();
def665cb 647 if ( in.IsLowGain() ) {
648 nTotalSMLG[iSM]++;
def665cb 649 if ( (amp > fMinSignalLG) && (amp < fMaxSignalLG) ) {
650 GetRawsData(kSigLG)->Fill(towerId, amp);
651 GetRawsData(kTimeLG)->Fill(towerId, time);
652 }
653 if (nPed > 0) {
38986b78 654 for (Int_t i=0; i<nPed; i++) {
def665cb 655 GetRawsData(kPedLG)->Fill(towerId, pedSamples[i]);
656 }
657 }
658 } // gain==0
659 else if ( in.IsHighGain() ) {
660 nTotalSMHG[iSM]++;
def665cb 661 if ( (amp > fMinSignalHG) && (amp < fMaxSignalHG) ) {
662 GetRawsData(kSigHG)->Fill(towerId, amp);
663 GetRawsData(kTimeHG)->Fill(towerId, time);
664 }
665 if (nPed > 0) {
38986b78 666 for (Int_t i=0; i<nPed; i++) {
def665cb 667 GetRawsData(kPedHG)->Fill(towerId, pedSamples[i]);
668 }
669 }
670 } // gain==1
671 } // low or high gain
38986b78 672 // TRU
def665cb 673 else if ( in.IsTRUData() && in.GetColumn()<AliEMCALGeoParams::fgkEMCAL2x2PerTRU) {
38986b78 674 // for TRU data, the mapping class holds the TRU Int_ternal 2x2 number (0..95) in the Column var..
675 Int_t iTRU = (iRCU*in.GetBranch() + iRCU); //TRU0 is from RCU0, TRU1 from RCU1, TRU2 is from branch B on RCU1
676 Int_t iTRU2x2Id = iSM*n2x2PerSM + iTRU*AliEMCALGeoParams::fgkEMCAL2x2PerTRU
def665cb 677 + in.GetColumn();
def665cb 678 nTotalSMTRU[iSM]++;
679 if ( (amp > fMinSignalTRU) && (amp < fMaxSignalTRU) ) {
680 GetRawsData(kSigTRU)->Fill(iTRU2x2Id, amp);
681 GetRawsData(kTimeTRU)->Fill(iTRU2x2Id, time);
9e47432c 682 }
def665cb 683 if (nPed > 0) {
38986b78 684 for (Int_t i=0; i<nPed; i++) {
def665cb 685 GetRawsData(kPedTRU)->Fill(iTRU2x2Id, pedSamples[i]);
686 }
9e47432c 687 }
def665cb 688 }
689 // LED Mon
690 else if ( in.IsLEDMonData() ) {
691 // for LED Mon data, the mapping class holds the gain info in the Row variable
692 // and the Strip number in the Column..
38986b78 693 Int_t gain = in.GetRow();
694 Int_t stripId = iSM*nStripsPerSM + in.GetColumn();
def665cb 695
696 if ( gain == 0 ) {
697 nTotalSMLGLEDMon[iSM]++;
698 if ( (amp > fMinSignalLGLEDMon) && (amp < fMaxSignalLGLEDMon) ) {
699 GetRawsData(kSigLGLEDMon)->Fill(stripId, amp);
700 GetRawsData(kTimeLGLEDMon)->Fill(stripId, time);
701 }
702 if (nPed > 0) {
38986b78 703 for (Int_t i=0; i<nPed; i++) {
def665cb 704 GetRawsData(kPedLGLEDMon)->Fill(stripId, pedSamples[i]);
705 }
706 }
707 } // gain==0
708 else if ( gain == 1 ) {
709 nTotalSMHGLEDMon[iSM]++;
710 if ( (amp > fMinSignalHGLEDMon) && (amp < fMaxSignalHGLEDMon) ) {
711 GetRawsData(kSigHGLEDMon)->Fill(stripId, amp);
712 GetRawsData(kTimeHGLEDMon)->Fill(stripId, time);
713 }
714 if (nPed > 0) {
38986b78 715 for (Int_t i=0; i<nPed; i++) {
def665cb 716 GetRawsData(kPedHGLEDMon)->Fill(stripId, pedSamples[i]);
717 }
718 }
719 } // low or high gain
720 } // LEDMon
721
722 } // SM index OK
9e47432c 723
724 } // nsamples>0 check, some data found for this channel; not only trailer/header
725 }// end while over channel
726
727 }//end while over DDL's, of input stream
728
38986b78 729 // TProfile * p = dynamic_cast<TProfile *>(GetRawsData(kSigHG)) ;
730 ConvertProfile2H(dynamic_cast<TProfile *>(GetRawsData(kSigHG)), fHighEmcHistoH2F) ;
731 Double_t binContent = 0. ;
00957c37 732
00957c37 733
38986b78 734 //calculate the ratio of the amplitude and fill the histograms, only if the events type is Calib
12ef6821 735 if (rawReader->GetType() == AliRawEventHeaderBase::kCalibrationEvent) {
736 //reset ratio histograms
737 GetRawsData(k2DRatioAmp)->Reset("ICE");
738 GetRawsData(kRatioDist)->Reset("ICE");
739 GetRawsData(kLEDMonRatio)->Reset("ICE");
740 GetRawsData(kLEDMonRatioDist)->Reset("ICE");
741 GetRawsData(k2DRatioAmp)->ResetStats();
742 GetRawsData(kRatioDist)->ResetStats();
743 GetRawsData(kLEDMonRatio)->ResetStats();
744 GetRawsData(kLEDMonRatioDist)->ResetStats();
745
746 for(Int_t ix = 1; ix <= fHighEmcHistoH2F->GetNbinsX(); ix++) {
747 for(Int_t iy = 1; iy <= fHighEmcHistoH2F->GetNbinsY(); iy++) {
748 if(fCalibRefHistoH2F->GetBinContent(ix, iy))binContent = fHighEmcHistoH2F->GetBinContent(ix, iy)/fCalibRefHistoH2F->GetBinContent(ix, iy) ;
749 GetRawsData(k2DRatioAmp)->SetBinContent(ix, iy, binContent);
750 GetRawsData(kRatioDist)->Fill(GetRawsData(k2DRatioAmp)->GetBinContent(ix, iy));
751 }
752 }
00957c37 753
12ef6821 754 //Now for LED monitor system, to calculate the ratio as well
755 Double_t binError = 0. ;
756 // for the binError, we add the relative errors, squared
757 Double_t relativeErrorSqr = 0. ;
38986b78 758
12ef6821 759 for(int ib = 1; ib <= fLEDMonRefHistoPro->GetNbinsX(); ib++) {
38986b78 760
12ef6821 761 if(fLEDMonRefHistoPro->GetBinContent(ib) != 0) {
762 binContent = GetRawsData(kSigLGLEDMon)->GetBinContent(ib) / fLEDMonRefHistoPro->GetBinContent(ib);
763
764 relativeErrorSqr = TMath::Power( (fLEDMonRefHistoPro->GetBinError(ib) / fLEDMonRefHistoPro->GetBinContent(ib)), 2);
765 if(GetRawsData(kSigLGLEDMon)->GetBinContent(ib) != 0) {
766 relativeErrorSqr += TMath::Power( (GetRawsData(kSigLGLEDMon)->GetBinError(ib)/GetRawsData(kSigLGLEDMon)->GetBinContent(ib)), 2);
767 }
768 }
769 else {
770 binContent = 0;
771 relativeErrorSqr = 0;
772 }
773 GetRawsData(kLEDMonRatio)->SetBinContent(ib, binContent);
38986b78 774
12ef6821 775 binError = sqrt(relativeErrorSqr) * binContent;
776 GetRawsData(kLEDMonRatio)->SetBinError(ib, binError);
777 GetRawsData(kLEDMonRatioDist)->Fill(GetRawsData(kLEDMonRatio)->GetBinContent(ib));
778 }
38986b78 779
12ef6821 780 }
9e47432c 781 // let's also fill the SM and event counter histograms
38986b78 782 Int_t nTotalHG = 0;
783 Int_t nTotalLG = 0;
784 Int_t nTotalTRU = 0;
785 Int_t nTotalHGLEDMon = 0;
786 Int_t nTotalLGLEDMon = 0;
1a78a765 787 for (iSM=0; iSM<fSuperModules; iSM++) {
9e47432c 788 nTotalLG += nTotalSMLG[iSM];
789 nTotalHG += nTotalSMHG[iSM];
790 nTotalTRU += nTotalSMTRU[iSM];
98d6fe2e 791 nTotalLGLEDMon += nTotalSMLGLEDMon[iSM];
792 nTotalHGLEDMon += nTotalSMHGLEDMon[iSM];
9e47432c 793 GetRawsData(kNsmodLG)->Fill(iSM, nTotalSMLG[iSM]);
794 GetRawsData(kNsmodHG)->Fill(iSM, nTotalSMHG[iSM]);
795 GetRawsData(kNsmodTRU)->Fill(iSM, nTotalSMTRU[iSM]);
796 GetRawsData(kNsmodLGLEDMon)->Fill(iSM, nTotalSMLGLEDMon[iSM]);
797 GetRawsData(kNsmodHGLEDMon)->Fill(iSM, nTotalSMHGLEDMon[iSM]);
798 }
def665cb 799
9e47432c 800 GetRawsData(kNtotLG)->Fill(nTotalLG);
801 GetRawsData(kNtotHG)->Fill(nTotalHG);
802 GetRawsData(kNtotTRU)->Fill(nTotalTRU);
803 GetRawsData(kNtotLGLEDMon)->Fill(nTotalLGLEDMon);
804 GetRawsData(kNtotHGLEDMon)->Fill(nTotalHGLEDMon);
5c6517c3 805
806
def665cb 807 SetEventSpecie(saveSpecie) ;
9e47432c 808 // just in case the next rawreader consumer forgets to reset; let's do it here again..
809 rawReader->Reset() ;
810
811 return;
812}
813
814//____________________________________________________________________________
815void AliEMCALQADataMakerRec::MakeDigits()
816{
817 // makes data from Digits
818
819 GetDigitsData(1)->Fill(fDigitsArray->GetEntriesFast()) ;
820 TIter next(fDigitsArray) ;
821 AliEMCALDigit * digit ;
822 while ( (digit = dynamic_cast<AliEMCALDigit *>(next())) ) {
829ba234 823 GetDigitsData(0)->Fill( digit->GetAmplitude()) ;
9e47432c 824 }
825
826}
827
828//____________________________________________________________________________
829void AliEMCALQADataMakerRec::MakeDigits(TTree * digitTree)
830{
831 // makes data from Digit Tree
832 if (fDigitsArray)
e0dc3f7d 833 fDigitsArray->Clear("C") ;
9e47432c 834 else
835 fDigitsArray = new TClonesArray("AliEMCALDigit", 1000) ;
836
837 TBranch * branch = digitTree->GetBranch("EMCAL") ;
838 if ( ! branch ) {
839 AliWarning("EMCAL branch in Digit Tree not found") ;
840 } else {
841 branch->SetAddress(&fDigitsArray) ;
842 branch->GetEntry(0) ;
843 MakeDigits() ;
844 }
845
846}
847
848//____________________________________________________________________________
849void AliEMCALQADataMakerRec::MakeRecPoints(TTree * clustersTree)
850{
851 // makes data from RecPoints
852 TBranch *emcbranch = clustersTree->GetBranch("EMCALECARP");
853 if (!emcbranch) {
854 AliError("can't get the branch with the EMCAL clusters !");
855 return;
856 }
857
38986b78 858 TObjArray * emcRecPoints = new TObjArray(100) ;
859 emcbranch->SetAddress(&emcRecPoints);
9e47432c 860 emcbranch->GetEntry(0);
861
38986b78 862 GetRecPointsData(kRecPM)->Fill(emcRecPoints->GetEntriesFast()) ;
863 TIter next(emcRecPoints) ;
9e47432c 864 AliEMCALRecPoint * rp ;
865 while ( (rp = dynamic_cast<AliEMCALRecPoint *>(next())) ) {
38986b78 866 GetRecPointsData(kRecPE)->Fill(rp->GetEnergy()) ;
9e47432c 867 GetRecPointsData(kRecPDigM)->Fill(rp->GetMultiplicity());
868 }
38986b78 869 emcRecPoints->Delete();
870 delete emcRecPoints;
9e47432c 871
872}
873
874//____________________________________________________________________________
875void AliEMCALQADataMakerRec::StartOfDetectorCycle()
876{
877 //Detector specific actions at start of cycle
878
879}
880
def665cb 881//____________________________________________________________________________
882void AliEMCALQADataMakerRec::SetFittingAlgorithm(Int_t fitAlgo)
883{
884 //Set fitting algorithm and initialize it if this same algorithm was not set before.
885 //printf("**** Set Algorithm , number %d ****\n",fitAlgo);
886
887 if(fitAlgo == fFittingAlgorithm && fRawAnalyzer) {
888 //Do nothing, this same algorithm already set before.
889 //printf("**** Algorithm already set before, number %d, %s ****\n",fitAlgo, fRawAnalyzer->GetName());
890 return;
891 }
892 //Initialize the requested algorithm
893 if(fitAlgo != fFittingAlgorithm || !fRawAnalyzer) {
894 //printf("**** Init Algorithm , number %d ****\n",fitAlgo);
895
896 fFittingAlgorithm = fitAlgo;
897 if (fRawAnalyzer) delete fRawAnalyzer; // delete prev. analyzer if existed.
898
899 if (fitAlgo == kFastFit) {
900 fRawAnalyzer = new AliCaloRawAnalyzerFastFit();
901 }
902 else if (fitAlgo == kNeuralNet) {
903 fRawAnalyzer = new AliCaloRawAnalyzerNN();
904 }
905 else if (fitAlgo == kLMS) {
906 fRawAnalyzer = new AliCaloRawAnalyzerLMS();
907 }
908 else if (fitAlgo == kPeakFinder) {
909 fRawAnalyzer = new AliCaloRawAnalyzerPeakFinder();
910 }
911 else if (fitAlgo == kCrude) {
912 fRawAnalyzer = new AliCaloRawAnalyzerCrude();
913 }
914 else {
915 AliWarning("EMCAL QA invalid fit algorithm choice") ;
916 }
917
918 }
919 return;
920}
921
38986b78 922//_____________________________________________________________________________________
923void AliEMCALQADataMakerRec::ConvertProfile2H(TProfile * p, TH2 * histo)
924{
922017a7 925 // reset histogram
926 histo->Reset("ICE") ;
927 histo->ResetStats();
928
38986b78 929 Int_t nbinsProf = p->GetNbinsX();
930
931 // loop through the TProfile p and fill the TH2F histo
932 Int_t row = 0;
933 Int_t col = 0;
934 Double_t binContent = 0;
935 Int_t towerNum = 0; // global tower Id
936 // i = 0; // tower Id within SuperModule
937 Int_t iSM = 0; // SuperModule index
938 Int_t iSMSide = 0; // 0=A, 1=C side
939 Int_t iSMSector = 0; // 2 SM's per sector
940
941 // indices for 2D plots
942 Int_t col2d = 0;
943 Int_t row2d = 0;
944
945 for (Int_t ibin = 1; ibin <= nbinsProf; ibin++) {
946 towerNum = (Int_t) p->GetBinCenter(ibin);
947 binContent = p->GetBinContent(ibin);
948
949 // figure out what the tower indices are: col, row within a SuperModule
950 iSM = towerNum/(AliEMCALGeoParams::fgkEMCALRows * AliEMCALGeoParams::fgkEMCALCols);
951 col = (towerNum/AliEMCALGeoParams::fgkEMCALRows) % (AliEMCALGeoParams::fgkEMCALCols);
952 row = towerNum % (AliEMCALGeoParams::fgkEMCALRows);
953
954 //DecodeTowerNum(towerNum, &SM, &col, &row);
955 // then we calculate what the global 2D coord are, based on which SM
956 // we are in
957 iSMSector = iSM / 2;
958 iSMSide = iSM % 2;
959
960 if (iSMSide == 1) { // C side, shown to the right
961 col2d = col + AliEMCALGeoParams::fgkEMCALCols;
962 }
963 else { // A side, shown to the left
964 col2d = col;
965 }
966
967 row2d = row + iSMSector * AliEMCALGeoParams::fgkEMCALRows;
968
969 histo->SetBinContent(col2d+1, row2d+1, binContent);
970 }
971}