1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 Based on the QA code for PHOS written by Yves Schutz July 2007
18 Authors: J.Klay (Cal Poly) May 2008
19 S. Salur LBL April 2008
21 Created one histogram for QA shifter;-- Yaxian Mao: 11/2009
22 The idea:average counts for all the towers should be flat
23 Change all existing histograms as experts
25 Change histograms for DQM shifter: -- Yaxian Mao 04/2010
26 Calcuate the amplitude ratio from current run and the LED reference, for QAChecker use
27 Also calculate the ratio of amplitude from LED Monitor system (current/Reference), to check LED system
31 // --- ROOT system ---
32 #include <TClonesArray.h>
40 #include <TProfile2D.h>
42 // --- Standard library ---
45 // --- AliRoot header files ---
47 #include "AliESDCaloCluster.h"
48 #include "AliESDCaloCells.h"
49 #include "AliESDEvent.h"
51 #include "AliEMCALQADataMakerRec.h"
52 #include "AliQAChecker.h"
53 #include "AliEMCALDigit.h"
54 #include "AliEMCALRecPoint.h"
55 #include "AliEMCALRawUtils.h"
56 #include "AliEMCALReconstructor.h"
57 #include "AliEMCALRecParam.h"
58 #include "AliRawReader.h"
59 #include "AliCaloRawStreamV3.h"
60 #include "AliEMCALGeoParams.h"
61 #include "AliRawEventHeaderBase.h"
62 #include "AliQAManager.h"
63 #include "AliCDBEntry.h"
65 #include "AliCaloBunchInfo.h"
66 #include "AliCaloFitResults.h"
67 #include "AliCaloRawAnalyzerFastFit.h"
68 #include "AliCaloRawAnalyzerNN.h"
69 //#include "AliCaloRawAnalyzerLMS.h"
70 #include "AliCaloRawAnalyzerKStandard.h"
71 #include "AliCaloRawAnalyzerPeakFinder.h"
72 #include "AliCaloRawAnalyzerCrude.h"
74 #include "AliCaloRawAnalyzerFactory.h"
78 ClassImp(AliEMCALQADataMakerRec)
80 //____________________________________________________________________________
81 AliEMCALQADataMakerRec::AliEMCALQADataMakerRec(fitAlgorithm fitAlgo) :
82 AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kEMCAL), "EMCAL Quality Assurance Data Maker"),
86 fSuperModules(10), // FIXME!!! number of SuperModules; 10 for 2011; update default for later runs
87 fFirstPedestalSample(0),
88 fLastPedestalSample(3),
89 fFirstPedestalSampleTRU(0),
90 fLastPedestalSampleTRU(3),
92 fMaxSignalLG(AliEMCALGeoParams::fgkSampleMax),
94 fMaxSignalHG(AliEMCALGeoParams::fgkSampleMax),
96 fMaxSignalTRU(AliEMCALGeoParams::fgkSampleMax),
97 fMinSignalLGLEDMon(0),
98 fMaxSignalLGLEDMon(AliEMCALGeoParams::fgkSampleMax),
99 fMinSignalHGLEDMon(0),
100 fMaxSignalHGLEDMon(AliEMCALGeoParams::fgkSampleMax),
101 fCalibRefHistoPro(NULL),
102 fCalibRefHistoH2F(NULL),
103 fLEDMonRefHistoPro(NULL),
104 fHighEmcHistoH2F(NULL)
105 // fTextSM(new TText*[fSuperModules]) ,
111 SetFittingAlgorithm(fitAlgo);
113 //fRawAnalyzerTRU = new AliCaloRawAnalyzerLMS();
115 fRawAnalyzerTRU = ( AliCaloRawAnalyzerKStandard*)AliCaloRawAnalyzerFactory::CreateAnalyzer(kLMS);
117 fRawAnalyzerTRU->SetFixTau(kTRUE);
118 fRawAnalyzerTRU->SetTau(2.5); // default for TRU shaper
119 // for (Int_t sm = 0 ; sm < fSuperModules ; sm++){
120 // fTextSM[sm] = NULL ;
124 //____________________________________________________________________________
125 AliEMCALQADataMakerRec::AliEMCALQADataMakerRec(const AliEMCALQADataMakerRec& qadm) :
127 fFittingAlgorithm(0),
130 fSuperModules(qadm.GetSuperModules()),
131 fFirstPedestalSample(qadm.GetFirstPedestalSample()),
132 fLastPedestalSample(qadm.GetLastPedestalSample()),
133 fFirstPedestalSampleTRU(qadm.GetFirstPedestalSampleTRU()),
134 fLastPedestalSampleTRU(qadm.GetLastPedestalSampleTRU()),
135 fMinSignalLG(qadm.GetMinSignalLG()),
136 fMaxSignalLG(qadm.GetMaxSignalLG()),
137 fMinSignalHG(qadm.GetMinSignalHG()),
138 fMaxSignalHG(qadm.GetMaxSignalHG()),
139 fMinSignalTRU(qadm.GetMinSignalTRU()),
140 fMaxSignalTRU(qadm.GetMaxSignalTRU()),
141 fMinSignalLGLEDMon(qadm.GetMinSignalLGLEDMon()),
142 fMaxSignalLGLEDMon(qadm.GetMaxSignalLGLEDMon()),
143 fMinSignalHGLEDMon(qadm.GetMinSignalHGLEDMon()),
144 fMaxSignalHGLEDMon(qadm.GetMaxSignalHGLEDMon()),
145 fCalibRefHistoPro(NULL),
146 fCalibRefHistoH2F(NULL),
147 fLEDMonRefHistoPro(NULL),
148 fHighEmcHistoH2F(NULL)
149 // fTextSM(new TText*[fSuperModules]) ,
154 SetName((const char*)qadm.GetName()) ;
155 SetTitle((const char*)qadm.GetTitle());
156 SetFittingAlgorithm(qadm.GetFittingAlgorithm());
158 //fRawAnalyzerTRU = new AliCaloRawAnalyzerLMS();
159 fRawAnalyzerTRU = (AliCaloRawAnalyzerKStandard*)AliCaloRawAnalyzerFactory::CreateAnalyzer(kLMS);
160 fRawAnalyzerTRU->SetFixTau(kTRUE);
161 fRawAnalyzerTRU->SetTau(2.5); // default for TRU shaper
162 // for (Int_t sm = 0 ; sm < fSuperModules ; sm++){
163 // fTextSM[sm] = qadm.fTextSM[sm] ;
167 //__________________________________________________________________
168 AliEMCALQADataMakerRec& AliEMCALQADataMakerRec::operator = (const AliEMCALQADataMakerRec& qadm )
171 this->~AliEMCALQADataMakerRec();
172 new(this) AliEMCALQADataMakerRec(qadm);
175 // for (Int_t sm = 0 ; sm < fSuperModules ; sm++){
176 // fTextSM[sm] = qadm.fTextSM[sm] ;
181 //____________________________________________________________________________
182 void AliEMCALQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
184 //Detector specific actions at end of cycle
187 // GetRawsData(kNEventsPerTower)->Scale(1./fCycleCounter);
189 // do the QA checking
190 ResetEventTrigClasses(); // reset triggers list to select all histos
191 AliQAChecker::Instance()->Run(AliQAv1::kEMCAL, task, list) ;
194 //____________________________________________________________________________
195 void AliEMCALQADataMakerRec::GetCalibRefFromOCDB()
197 //Get the reference histogram from OCDB
198 TString sName1("hHighEmcalRawMaxMinusMin") ;
199 TString sName2("hLowLEDMonEmcalRawMaxMinusMin") ;
200 sName1.Prepend(Form("%s_", AliRecoParam::GetEventSpecieName(AliRecoParam::kCalib))) ;
201 sName2.Prepend(Form("%s_", AliRecoParam::GetEventSpecieName(AliRecoParam::kCalib))) ;
203 TString refStorage(AliQAv1::GetQARefStorage()) ;
204 if (!refStorage.Contains(AliQAv1::GetLabLocalOCDB()) && !refStorage.Contains(AliQAv1::GetLabAliEnOCDB())) {
205 AliFatal(Form("%s is not a valid location for reference data", refStorage.Data())) ;
207 AliQAManager* manQA = AliQAManager::QAManager(AliQAv1::kRAWS) ;
208 AliQAv1::SetQARefDataDirName(AliRecoParam::kCalib) ;
209 if ( ! manQA->GetLock() ) {
210 manQA->SetDefaultStorage(AliQAv1::GetQARefStorage()) ;
211 manQA->SetSpecificStorage("*", AliQAv1::GetQARefStorage()) ;
212 manQA->SetRun(AliCDBManager::Instance()->GetRun()) ;
215 char * detOCDBDir = Form("%s/%s/%s", GetName(), AliQAv1::GetRefOCDBDirName(), AliQAv1::GetRefDataDirName()) ;
216 AliCDBEntry * entry = manQA->Get(detOCDBDir, manQA->GetRun()) ;
218 TList * listDetQAD =static_cast<TList *>(entry->GetObject()) ;
219 if ( strcmp(listDetQAD->ClassName(), "TList") != 0 ) {
220 AliError(Form("Expected a Tlist and found a %s for detector %s", listDetQAD->ClassName(), GetName())) ;
223 TObjArray * dirOCDB= NULL ;
225 dirOCDB = static_cast<TObjArray *>(listDetQAD->FindObject(Form("%s/%s", AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), AliRecoParam::GetEventSpecieName(AliRecoParam::kCalib)))) ;
227 fCalibRefHistoPro = dynamic_cast<TProfile *>(dirOCDB->FindObject(sName1.Data())) ;
228 fLEDMonRefHistoPro = dynamic_cast<TProfile *>(dirOCDB->FindObject(sName2.Data())) ;
233 if(fCalibRefHistoPro && fLEDMonRefHistoPro){
235 //Defining histograms binning, each 2D histogram covers all SMs
236 Int_t nSMSectors = fSuperModules / 2; // 2 SMs per sector
237 Int_t nbinsZ = 2*AliEMCALGeoParams::fgkEMCALCols;
238 Int_t nbinsPhi = nSMSectors * AliEMCALGeoParams::fgkEMCALRows;
240 if(!fCalibRefHistoH2F)
241 fCalibRefHistoH2F = new TH2F("hCalibRefHisto", "hCalibRefHisto", nbinsZ, -0.5, nbinsZ - 0.5, nbinsPhi, -0.5, nbinsPhi -0.5);
242 ConvertProfile2H(fCalibRefHistoPro,fCalibRefHistoH2F) ;
244 AliFatal(Form("No reference object with name %s or %s found", sName1.Data(), sName2.Data())) ;
247 //____________________________________________________________________________
248 void AliEMCALQADataMakerRec::InitESDs()
250 //Create histograms to controll ESD
251 const Bool_t expert = kTRUE ;
252 const Bool_t image = kTRUE ;
254 TH1F * h1 = new TH1F("hESDCaloClusterE", "ESDs CaloCluster energy in EMCAL;Energy [GeV];Counts", 200, 0., 100.) ;
256 Add2ESDsList(h1, kESDCaloClusE, !expert, image) ;
258 TH1I * h2 = new TH1I("hESDCaloClusterM", "ESDs CaloCluster multiplicity in EMCAL;# of Clusters;Entries", 100, 0, 100) ;
260 Add2ESDsList(h2, kESDCaloClusM, !expert, image) ;
262 TH1F * h3 = new TH1F("hESDCaloCellA", "ESDs CaloCell amplitude in EMCAL;Energy [GeV];Counts", 500, 0., 50.) ;
264 Add2ESDsList(h3, kESDCaloCellA, !expert, image) ;
266 TH1I * h4 = new TH1I("hESDCaloCellM", "ESDs CaloCell multiplicity in EMCAL;# of Clusters;Entries", 200, 0, 1000) ;
268 Add2ESDsList(h4, kESDCaloCellM, !expert, image) ;
270 ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line
273 //____________________________________________________________________________
274 void AliEMCALQADataMakerRec::InitDigits()
276 // create Digits histograms in Digits subdir
277 const Bool_t expert = kTRUE ;
278 const Bool_t image = kTRUE ;
280 TH1I * h0 = new TH1I("hEmcalDigits", "Digits amplitude distribution in EMCAL;Amplitude [ADC counts];Counts", 500, 0, 500) ;
282 Add2DigitsList(h0, 0, !expert, image) ;
283 TH1I * h1 = new TH1I("hEmcalDigitsMul", "Digits multiplicity distribution in EMCAL;# of Digits;Entries", 200, 0, 2000) ;
285 Add2DigitsList(h1, 1, !expert, image) ;
287 ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
290 //____________________________________________________________________________
291 void AliEMCALQADataMakerRec::InitRecPoints()
293 // create Reconstructed PoInt_ts histograms in RecPoints subdir
294 const Bool_t expert = kTRUE ;
295 const Bool_t image = kTRUE ;
297 TH1F* h0 = new TH1F("hEMCALRpE","EMCAL RecPoint energies;Energy [GeV];Counts",200, 0.,20.); //GeV
299 Add2RecPointsList(h0,kRecPE, !expert, image);
301 TH1I* h1 = new TH1I("hEMCALRpM","EMCAL RecPoint multiplicities;# of Clusters;Entries",100,0,100);
303 Add2RecPointsList(h1,kRecPM, !expert, image);
305 TH1I* h2 = new TH1I("hEMCALRpDigM","EMCAL RecPoint Digit Multiplicities;# of Digits;Entries",20,0,20);
307 Add2RecPointsList(h2,kRecPDigM, !expert, image);
309 ClonePerTrigClass(AliQAv1::kRECPOINTS); // this should be the last line
312 //____________________________________________________________________________
313 void AliEMCALQADataMakerRec::InitRaws()
315 // create Raws histograms in Raws subdir
316 const Bool_t expert = kTRUE ;
317 const Bool_t saveCorr = kTRUE ;
318 const Bool_t image = kTRUE ;
319 const Option_t *profileOption = "s";
321 Int_t nTowersPerSM = AliEMCALGeoParams::fgkEMCALRows * AliEMCALGeoParams::fgkEMCALCols; // number of towers in a SuperModule; 24x48
322 Int_t nTot = fSuperModules * nTowersPerSM; // max number of towers in all SuperModules
324 //Defining histograms binning, each 2D histogram covers all SMs
325 Int_t nSMSectors = fSuperModules / 2; // 2 SMs per sector
326 Int_t nbinsZ = 2*AliEMCALGeoParams::fgkEMCALCols;
327 Int_t nbinsPhi = nSMSectors * AliEMCALGeoParams::fgkEMCALRows;
329 Int_t nTRUCols = 2*AliEMCALGeoParams::fgkEMCALTRUCols; //total TRU columns for 2D TRU histos
330 Int_t nTRURows = nSMSectors*AliEMCALGeoParams::fgkEMCALTRUsPerSM*AliEMCALGeoParams::fgkEMCALTRURows; //total TRU rows for 2D TRU histos
331 // counter info: number of channels per event (bins are SM index)
332 TProfile * h0 = new TProfile("hLowEmcalSupermodules", "Low Gain EMC: # of towers vs SuperMod;SM Id;# of towers",
333 fSuperModules, -0.5, fSuperModules-0.5, profileOption) ;
334 Add2RawsList(h0, kNsmodLG, expert, !image, !saveCorr) ;
335 TProfile * h1 = new TProfile("hHighEmcalSupermodules", "High Gain EMC: # of towers vs SuperMod;SM Id;# of towers",
336 fSuperModules, -0.5, fSuperModules-0.5, profileOption) ;
337 Add2RawsList(h1, kNsmodHG, expert, !image, !saveCorr) ;
339 // where did max sample occur? (bins are towers)
340 TProfile * h2 = new TProfile("hLowEmcalRawtime", "Low Gain EMC: Time at Max vs towerId;Tower Id;Time [ticks]",
341 nTot, -0.5, nTot-0.5, profileOption) ;
342 Add2RawsList(h2, kTimeLG, expert, !image, !saveCorr) ;
343 TProfile * h3 = new TProfile("hHighEmcalRawtime", "High Gain EMC: Time at Max vs towerId;Tower Id;Time [ticks]",
344 nTot, -0.5, nTot-0.5, profileOption) ;
345 Add2RawsList(h3, kTimeHG, expert, !image, !saveCorr) ;
347 // how much above pedestal was the max sample? (bins are towers)
348 TProfile * h4 = new TProfile("hLowEmcalRawMaxMinusMin", "Low Gain EMC: Max - Min vs towerId;Tower Id;Max-Min [ADC counts]",
349 nTot, -0.5, nTot-0.5, profileOption) ;
350 Add2RawsList(h4, kSigLG, expert, !image, !saveCorr) ;
351 TProfile * h5 = new TProfile("hHighEmcalRawMaxMinusMin", "High Gain EMC: Max - Min vs towerId;Tower Id;Max-Min [ADC counts]",
352 nTot, -0.5, nTot-0.5, profileOption) ;
353 Add2RawsList(h5, kSigHG, expert, !image, !saveCorr) ;
355 // total counter: channels per event
356 TH1I * h6 = new TH1I("hLowNtot", "Low Gain EMC: Total Number of found towers;# of Towers;Counts", 200, 0, nTot) ;
358 Add2RawsList(h6, kNtotLG, expert, !image, !saveCorr) ;
359 TH1I * h7 = new TH1I("hHighNtot", "High Gain EMC: Total Number of found towers;# of Towers;Counts", 200,0, nTot) ;
361 Add2RawsList(h7, kNtotHG, expert, !image, !saveCorr) ;
363 // pedestal (bins are towers)
364 TProfile * h8 = new TProfile("hLowEmcalRawPed", "Low Gain EMC: Pedestal vs towerId;Tower Id;Pedestal [ADC counts]",
365 nTot, -0.5, nTot-0.5, profileOption) ;
366 Add2RawsList(h8, kPedLG, expert, !image, !saveCorr) ;
367 TProfile * h9 = new TProfile("hHighEmcalRawPed", "High Gain EMC: Pedestal vs towerId;Tower Id;Pedestal [ADC counts]",
368 nTot, -0.5, nTot-0.5, profileOption) ;
369 Add2RawsList(h9, kPedHG, expert, !image, !saveCorr) ;
372 // now repeat the same for TRU and LEDMon data
373 Int_t nTot2x2 = fSuperModules * AliEMCALGeoParams::fgkEMCALTRUsPerSM * AliEMCALGeoParams::fgkEMCAL2x2PerTRU; // max number of TRU channels for all SuperModules
375 // counter info: number of channels per event (bins are SM index)
376 TProfile * hT0 = new TProfile("hTRUEmcalSupermodules", "TRU EMC: # of TRU channels vs SuperMod;SM Id;# of TRU channels",
377 fSuperModules, -0.5, fSuperModules-0.5, profileOption) ;
378 Add2RawsList(hT0, kNsmodTRU, expert, !image, !saveCorr) ;
380 // how much above pedestal was the max sample? (bins are TRU channels)
381 TProfile * hT1 = new TProfile("hTRUEmcalRawMaxMinusMin", "TRU EMC: Max - Min vs 2x2Id;2x2 Id;Max-Min [ADC counts]",
382 nTot2x2, -0.5, nTot2x2-0.5, profileOption) ;
383 Add2RawsList(hT1, kSigTRU, expert, !image, !saveCorr) ;
385 // total counter: channels per event
386 TH1I * hT2 = new TH1I("hTRUNtot", "TRU EMC: Total Number of found TRU channels;# of TRU Channels;Counts", 200, 0, nTot2x2) ;
388 Add2RawsList(hT2, kNtotTRU, expert, !image, !saveCorr) ;
390 // L0 trigger hits: # of hits (bins are TRU channels)
391 TH2I * hT3 = new TH2I("hTRUEmcalL0hits", "L0 trigger hits: Total number of 2x2 L0 generated", nTRUCols, -0.5, nTRUCols - 0.5, nTRURows, -0.5, nTRURows-0.5);
392 hT3->SetOption("COLZ");
394 Add2RawsList(hT3, kNL0TRU, !expert, image, !saveCorr);
396 // L0 trigger hits: average time (bins are TRU channels)
397 TProfile2D * hT4 = new TProfile2D("hTRUEmcalL0hitsAvgTime", "L0 trigger hits: average time bin", nTRUCols, -0.5, nTRUCols - 0.5, nTRURows, -0.5, nTRURows-0.5, profileOption);
398 hT4->SetOption("COLZ");
399 Add2RawsList(hT4, kTimeL0TRU, !expert, image, !saveCorr);
401 // L0 trigger hits: first in the event (bins are TRU channels)
402 TH1I * hT5 = new TH1I("hTRUEmcalL0hitsFirst", "L0 trigger hits: First hit in the event", nTot2x2, -0.5, nTot2x2);
404 Add2RawsList(hT5, kNL0FirstTRU, expert, !image, !saveCorr);
406 // L0 trigger hits: average time of first hit in the event (bins are TRU channels)
407 TProfile * hT6 = new TProfile("hTRUEmcalL0hitsFirstAvgTime", "L0 trigger hits: average time of first hit", nTot2x2, -0.5, nTot2x2, profileOption);
408 Add2RawsList(hT6, kTimeL0FirstTRU, expert, !image, !saveCorr);
410 // and also LED Mon..
411 // LEDMon has both high and low gain channels, just as regular FEE/towers
412 Int_t nTotLEDMon = fSuperModules * AliEMCALGeoParams::fgkEMCALLEDRefs; // max number of LEDMon channels for all SuperModules
414 // counter info: number of channels per event (bins are SM index)
415 TProfile * hL0 = new TProfile("hLowLEDMonEmcalSupermodules", "LowLEDMon Gain EMC: # of strips vs SuperMod;SM Id;# of strips",
416 fSuperModules, -0.5, fSuperModules-0.5, profileOption) ;
417 Add2RawsList(hL0, kNsmodLGLEDMon, expert, !image, !saveCorr) ;
418 TProfile * hL1 = new TProfile("hHighLEDMonEmcalSupermodules", "HighLEDMon Gain EMC: # of strips vs SuperMod;SM Id;# of strips",
419 fSuperModules, -0.5, fSuperModules-0.5, profileOption) ;
420 Add2RawsList(hL1, kNsmodHGLEDMon, expert, !image, !saveCorr) ;
422 // where did max sample occur? (bins are strips)
423 TProfile * hL2 = new TProfile("hLowLEDMonEmcalRawtime", "LowLEDMon Gain EMC: Time at Max vs stripId;Strip Id;Time [ticks]",
424 nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ;
425 Add2RawsList(hL2, kTimeLGLEDMon, expert, !image, !saveCorr) ;
426 TProfile * hL3 = new TProfile("hHighLEDMonEmcalRawtime", "HighLEDMon Gain EMC: Time at Max vs stripId;Strip Id;Time [ticks]",
427 nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ;
428 Add2RawsList(hL3, kTimeHGLEDMon, expert, !image, !saveCorr) ;
430 // how much above pedestal was the max sample? (bins are strips)
431 TProfile * hL4 = new TProfile("hLowLEDMonEmcalRawMaxMinusMin", "LowLEDMon Gain EMC: Max - Min vs stripId;Strip Id;Max-Min [ADC counts]",
432 nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ;
433 Add2RawsList(hL4, kSigLGLEDMon, expert, !image, !saveCorr) ;
434 TProfile * hL5 = new TProfile("hHighLEDMonEmcalRawMaxMinusMin", "HighLEDMon Gain EMC: Max - Min vs stripId;Strip Id;Max-Min [ADC counts]",
435 nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ;
436 Add2RawsList(hL5, kSigHGLEDMon, expert, !image, !saveCorr) ;
438 // total counter: channels per event
439 TH1I * hL6 = new TH1I("hLowLEDMonNtot", "LowLEDMon Gain EMC: Total Number of found strips;# of Strips;Counts", 200, 0, nTotLEDMon) ;
441 Add2RawsList(hL6, kNtotLGLEDMon, expert, !image, !saveCorr) ;
442 TH1I * hL7 = new TH1I("hHighLEDMonNtot", "HighLEDMon Gain EMC: Total Number of found strips;# of Strips;Counts", 200,0, nTotLEDMon) ;
444 Add2RawsList(hL7, kNtotHGLEDMon, expert, !image, !saveCorr) ;
446 // pedestal (bins are strips)
447 TProfile * hL8 = new TProfile("hLowLEDMonEmcalRawPed", "LowLEDMon Gain EMC: Pedestal vs stripId;Strip Id;Pedestal [ADC counts]",
448 nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ;
449 Add2RawsList(hL8, kPedLGLEDMon, expert, !image, !saveCorr) ;
450 TProfile * hL9 = new TProfile("hHighLEDMonEmcalRawPed", "HighLEDMon Gain EMC: Pedestal vs stripId;Strip Id;Pedestal [ADC counts]",
451 nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ;
452 Add2RawsList(hL9, kPedHGLEDMon, expert, !image, !saveCorr) ;
454 //temp 2D amplitude histogram for the current run
455 fHighEmcHistoH2F = new TH2F("h2DHighEC2", "High Gain EMC:Max - Min [ADC counts]", nbinsZ, -0.5 , nbinsZ-0.5, nbinsPhi, -0.5, nbinsPhi-0.5);
456 fHighEmcHistoH2F->SetDirectory(0) ; // this histo must be memory resident
457 //add ratio histograms: to comapre the current run with the reference data
458 TH2F * h15 = new TH2F("h2DRatioAmp", "High Gain Ratio to Reference:Amplitude_{current run}/Amplitude_{reference run}", nbinsZ, -0.5 , nbinsZ-0.5,
459 nbinsPhi, -0.5, nbinsPhi-0.5);
460 //settings for display in amore
461 h15->SetTitle("Amplitude_{current run}/Amplitude_{reference run}");
462 h15->SetMaximum(2.0);
463 h15->SetMinimum(0.1);
464 h15->SetOption("COLZ");
465 gStyle->SetOptStat(0);
466 Int_t color[] = {4,3,2} ;
467 gStyle->SetPalette(3,color);
468 h15->GetZaxis()->SetNdivisions(3);
469 h15->UseCurrentStyle();
470 h15->SetDirectory(0);
471 Add2RawsList(h15, k2DRatioAmp, !expert, image, !saveCorr) ;
473 TH1F * h16 = new TH1F("hRatioDist", "Amplitude_{current run}/Amplitude_{reference run} ratio distribution", nTot, 0., 2.);
474 h16->SetMinimum(0.1);
475 h16->SetMaximum(100.);
476 gStyle->SetOptStat(0);
477 h16->UseCurrentStyle();
478 h16->SetDirectory(0);
479 Add2RawsList(h16, kRatioDist, !expert, image, !saveCorr) ;
481 //add two histograms for shifter from the LED monitor system: comapre LED monitor with the reference run
482 //to be used for decision whether we need to change reference data
483 TH1F * hL10 = new TH1F("hMaxMinusMinLEDMonRatio", "LEDMon amplitude, Ratio to reference run", nTotLEDMon, -0.5, nTotLEDMon-0.5) ;
484 //settings for display in amore
485 hL10->SetTitle("Amplitude_{LEDMon current}/Amplitude_{LEDMon reference}");
486 hL10->SetMaximum(2.0);
487 hL10->SetMinimum(0.1);
488 gStyle->SetOptStat(0);
489 hL10->UseCurrentStyle();
490 hL10->SetDirectory(0);
491 // hL10->SetOption("E");
492 Add2RawsList(hL10, kLEDMonRatio, !expert, image, !saveCorr) ;
494 TH1F * hL11 = new TH1F("hMaxMinusMinLEDMonRatioDist", "LEDMon amplitude, Ratio distribution", nTotLEDMon, 0, 2);
495 hL11->SetMinimum(0.1) ;
496 gStyle->SetOptStat(0);
497 hL11->UseCurrentStyle();
498 hL11->SetDirectory(0);
499 Add2RawsList(hL11, kLEDMonRatioDist, !expert, image, !saveCorr) ;
501 GetCalibRefFromOCDB();
503 ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line
506 //____________________________________________________________________________
507 void AliEMCALQADataMakerRec::MakeESDs(AliESDEvent * esd)
509 // make QA data from ESDs
512 for ( Int_t index = 0; index < esd->GetNumberOfCaloClusters() ; index++ ) {
513 AliESDCaloCluster * clu = esd->GetCaloCluster(index) ;
514 if( clu->IsEMCAL() ) {
515 FillESDsData(kESDCaloClusE,clu->E()) ;
519 FillESDsData(kESDCaloClusM,nTot) ;
522 AliESDCaloCells* cells = esd->GetEMCALCells();
523 FillESDsData(kESDCaloCellM,cells->GetNumberOfCells()) ;
525 for ( Int_t index = 0; index < cells->GetNumberOfCells() ; index++ ) {
526 FillESDsData(kESDCaloCellA,cells->GetAmplitude(index)) ;
529 IncEvCountCycleESDs();
530 IncEvCountTotalESDs();
533 //____________________________________________________________________________
534 void AliEMCALQADataMakerRec::MakeRaws(AliRawReader* rawReader)
536 // Check that all the reference histograms exist before we try to use them - otherwise call InitRaws
537 // RS: Attention: the counters are increments after custom modification of eventSpecie
538 if (!fCalibRefHistoPro || !fCalibRefHistoH2F || !fLEDMonRefHistoPro || !fHighEmcHistoH2F) {
542 // make sure EMCal was readout during the event
543 Int_t emcID = AliDAQ::DetectorID("EMCAL"); // bit 18..
544 const UInt_t *detPattern = rawReader->GetDetectorPattern();
545 UInt_t emcInReadout = ( ((1 << emcID) & detPattern[0]) >> emcID);
546 if (! emcInReadout) return; // no poInt_t in looking at this event, if no EMCal data
550 AliCaloRawStreamV3 in(rawReader,"EMCAL");
551 rawReader->Select("EMCAL", 0, AliEMCALGeoParams::fgkLastAltroDDL) ; //select EMCAL DDL's
553 AliRecoParam::EventSpecie_t saveSpecie = fEventSpecie ;
554 if (rawReader->GetType() == AliRawEventHeaderBase::kCalibrationEvent) {
555 SetEventSpecie(AliRecoParam::kCalib) ;
558 const Int_t nTowersPerSM = AliEMCALGeoParams::fgkEMCALRows * AliEMCALGeoParams::fgkEMCALCols; // number of towers in a SuperModule; 24x48
559 const Int_t nRows = AliEMCALGeoParams::fgkEMCALRows; // number of rows per SuperModule
560 const Int_t nStripsPerSM = AliEMCALGeoParams::fgkEMCALLEDRefs; // number of strips per SuperModule
561 const Int_t n2x2PerSM = AliEMCALGeoParams::fgkEMCALTRUsPerSM * AliEMCALGeoParams::fgkEMCAL2x2PerTRU; // number of TRU 2x2's per SuperModule
562 const Int_t n2x2PerTRU = AliEMCALGeoParams::fgkEMCAL2x2PerTRU;
563 const Int_t nTot2x2 = fSuperModules * n2x2PerSM; // total TRU channel
565 // SM counters; decl. should be safe, assuming we don't get more than expected SuperModules..
566 Int_t nTotalSMLG[AliEMCALGeoParams::fgkEMCALModules] = {0};
567 Int_t nTotalSMHG[AliEMCALGeoParams::fgkEMCALModules] = {0};
568 Int_t nTotalSMTRU[AliEMCALGeoParams::fgkEMCALModules] = {0};
569 Int_t nTotalSMLGLEDMon[AliEMCALGeoParams::fgkEMCALModules] = {0};
570 Int_t nTotalSMHGLEDMon[AliEMCALGeoParams::fgkEMCALModules] = {0};
572 const Int_t nTRUL0ChannelBits = 10; // used for L0 trigger bits checks
573 int firstL0TimeBin = 999;
574 int triggers[nTot2x2][24]; //auxiliary array for L0 trigger - TODO remove hardcoded 24
575 memset(triggers, 0, sizeof(int) * 24 * nTot2x2);
577 Int_t iSM = 0; // SuperModule index
578 // start loop over input stream
579 while (in.NextDDL()) {
580 Int_t iRCU = in.GetDDLNumber() % 2; // RCU0 or RCU1, within SuperModule
581 Int_t iDDL = in.GetDDLNumber();
582 fRawAnalyzer->SetIsZeroSuppressed( in.GetZeroSupp() );
584 while (in.NextChannel()) {
585 Int_t iBranch = in.GetBranch();
587 iSM = in.GetModule(); // SuperModule
588 //prInt_tf("iSM %d DDL %d", iSM, in.GetDDLNumber());
589 if (iSM>=0 && iSM<fSuperModules) { // valid module reading
592 vector<AliCaloBunchInfo> bunchlist;
593 while (in.NextBunch()) {
594 nsamples += in.GetBunchLength();
595 bunchlist.push_back( AliCaloBunchInfo(in.GetStartTimeBin(), in.GetBunchLength(), in.GetSignals() ) );
598 if (nsamples > 0) { // this check is needed for when we have zero-supp. on, but not sparse readout
601 // indices for pedestal calc.
602 Int_t firstPedSample = 0;
603 Int_t lastPedSample = 0;
604 bool isTRUL0IdData = false;
606 if (! in.IsTRUData() ) { // high gain, low gain, LED Mon data - all have the same shaper/sampling
607 AliCaloFitResults fitResults = fRawAnalyzer->Evaluate( bunchlist, in.GetAltroCFG1(), in.GetAltroCFG2());
608 amp = fitResults.GetAmp();
609 time = fitResults.GetTof();
610 firstPedSample = fFirstPedestalSample;
611 lastPedSample = fLastPedestalSample;
613 else { // TRU data is special, needs its own analyzer
614 AliCaloFitResults fitResults = fRawAnalyzerTRU->Evaluate( bunchlist, in.GetAltroCFG1(), in.GetAltroCFG2());
615 amp = fitResults.GetAmp();
616 time = fitResults.GetTof();
617 firstPedSample = fFirstPedestalSampleTRU;
618 lastPedSample = fLastPedestalSampleTRU;
619 if (in.GetColumn() >= n2x2PerTRU) {
620 isTRUL0IdData = true;
626 vector<Int_t> pedSamples;
628 // select earliest bunch
629 unsigned int bunchIndex = 0;
630 unsigned int startBin = bunchlist.at(0).GetStartBin();
631 if (bunchlist.size() > 0) {
632 for(unsigned int ui=1; ui < bunchlist.size(); ui++ ) {
633 if (startBin > bunchlist.at(ui).GetStartBin() ) {
634 startBin = bunchlist.at(ui).GetStartBin();
640 // check bunch for entries in the pedestal sample range
641 Int_t bunchLength = bunchlist.at(bunchIndex).GetLength();
642 const UShort_t *sig = bunchlist.at(bunchIndex).GetData();
645 if (! isTRUL0IdData) { // regular data, can look at pedestals
646 for (Int_t i = 0; i<bunchLength; i++) {
647 timebin = startBin--;
648 if ( firstPedSample<=timebin && timebin<=lastPedSample ) {
649 pedSamples.push_back( sig[i] );
654 else { // TRU L0 Id Data
655 // which TRU the channel belongs to?
656 Int_t iTRUId = in.GetModule()*3 + (iRCU*in.GetBranch() + iRCU);
658 for (Int_t i = 0; i< bunchLength; i++) {
659 for( Int_t j = 0; j < nTRUL0ChannelBits; j++ ){
660 // check if the bit j is 1
661 if( (sig[i] & ( 1 << j )) > 0 ){
662 Int_t iTRUIdInSM = (in.GetColumn() - n2x2PerTRU)*nTRUL0ChannelBits+j;
663 if(iTRUIdInSM < n2x2PerTRU) {
664 Int_t iTRUAbsId = iTRUIdInSM + n2x2PerTRU * iTRUId;
665 // Fill the histograms
666 Int_t globTRUCol, globTRURow;
667 GetTruChannelPosition(globTRURow, globTRUCol, iSM, iDDL, iBranch, iTRUIdInSM );
669 FillRawsData(kNL0TRU, globTRUCol, globTRURow);
670 FillRawsData(kTimeL0TRU, globTRUCol, globTRURow, startBin);
671 triggers[iTRUAbsId][startBin] = 1;
673 if((int)startBin < firstL0TimeBin) firstL0TimeBin = startBin;
682 if ( in.IsLowGain() || in.IsHighGain() ) { // regular towers
683 Int_t towerId = iSM*nTowersPerSM + in.GetColumn()*nRows + in.GetRow();
684 if ( in.IsLowGain() ) {
686 if ( (amp > fMinSignalLG) && (amp < fMaxSignalLG) ) {
687 FillRawsData(kSigLG,towerId, amp);
688 FillRawsData(kTimeLG,towerId, time);
691 for (Int_t i=0; i<nPed; i++) {
692 FillRawsData(kPedLG,towerId, pedSamples[i]);
696 else if ( in.IsHighGain() ) {
698 if ( (amp > fMinSignalHG) && (amp < fMaxSignalHG) ) {
699 FillRawsData(kSigHG,towerId, amp);
700 FillRawsData(kTimeHG,towerId, time);
703 for (Int_t i=0; i<nPed; i++) {
704 FillRawsData(kPedHG,towerId, pedSamples[i]);
708 } // low or high gain
710 else if ( in.IsTRUData() && in.GetColumn()<AliEMCALGeoParams::fgkEMCAL2x2PerTRU) {
711 // for TRU data, the mapping class holds the TRU Int_ternal 2x2 number (0..95) in the Column var..
712 Int_t iTRU = (iRCU*in.GetBranch() + iRCU); //TRU0 is from RCU0, TRU1 from RCU1, TRU2 is from branch B on RCU1
713 Int_t iTRU2x2Id = iSM*n2x2PerSM + iTRU*AliEMCALGeoParams::fgkEMCAL2x2PerTRU
716 if ( (amp > fMinSignalTRU) && (amp < fMaxSignalTRU) ) {
717 FillRawsData(kSigTRU,iTRU2x2Id, amp);
718 //FillRawsData(kTimeTRU,iTRU2x2Id, time);
721 //for (Int_t i=0; i<nPed; i++) {
722 //FillRawsData(kPedTRU,iTRU2x2Id, pedSamples[i]);
727 else if ( in.IsLEDMonData() ) {
728 // for LED Mon data, the mapping class holds the gain info in the Row variable
729 // and the Strip number in the Column..
730 Int_t gain = in.GetRow();
731 Int_t stripId = iSM*nStripsPerSM + in.GetColumn();
734 nTotalSMLGLEDMon[iSM]++;
735 if ( (amp > fMinSignalLGLEDMon) && (amp < fMaxSignalLGLEDMon) ) {
736 FillRawsData(kSigLGLEDMon,stripId, amp);
737 FillRawsData(kTimeLGLEDMon,stripId, time);
740 for (Int_t i=0; i<nPed; i++) {
741 FillRawsData(kPedLGLEDMon,stripId, pedSamples[i]);
745 else if ( gain == 1 ) {
746 nTotalSMHGLEDMon[iSM]++;
747 if ( (amp > fMinSignalHGLEDMon) && (amp < fMaxSignalHGLEDMon) ) {
748 FillRawsData(kSigHGLEDMon,stripId, amp);
749 FillRawsData(kTimeHGLEDMon,stripId, time);
752 for (Int_t i=0; i<nPed; i++) {
753 FillRawsData(kPedHGLEDMon,stripId, pedSamples[i]);
756 } // low or high gain
761 } // nsamples>0 check, some data found for this channel; not only trailer/header
762 }// end while over channel
764 }//end while over DDL's, of input stream
765 //filling some L0 trigger histos
766 if( firstL0TimeBin < 999 ){
767 for(Int_t i = 0; i < nTot2x2; i++) {
768 if( triggers[i][firstL0TimeBin] > 0 ) {
770 FillRawsData(kNL0FirstTRU, i);
771 FillRawsData(kTimeL0FirstTRU, i, firstL0TimeBin);
776 //calculate the ratio of the amplitude and fill the histograms, only if the events type is Calib
777 // RS: operation on the group of histos kSigHG,k2DRatioAmp,kRatioDist,kLEDMonRatio,kLEDMonRatio,kSigLGLEDMon
778 const int hGrp[] = {kSigHG,k2DRatioAmp,kRatioDist,kLEDMonRatio,kLEDMonRatioDist,kSigLGLEDMon};
779 if ( rawReader->GetType() == AliRawEventHeaderBase::kCalibrationEvent &&
780 CheckCloningConsistency(fRawsQAList, hGrp, sizeof(hGrp)/sizeof(int)) ) { // RS converting original code to loop over all matching triggers
781 int nTrig =IsClonedPerTrigClass(kSigHG,fRawsQAList) ? GetNEventTrigClasses() : 0; // loop over triggers only if histos were cloned
783 for (int itr=-1;itr<nTrig;itr++) { // start from -1 to acknowledge original histos if they were kept
784 TObjArray* trArr = GetMatchingRawsHistosSet(hGrp, sizeof(hGrp)/sizeof(int) ,itr);
785 if (!trArr) continue; // no histos for current trigger
787 Double_t binContent = 0.;
788 TProfile* prSigHG = (TProfile *)trArr->At(0); //kSigHG
789 TH1* th2DRatioAmp = (TH1*) trArr->At(1); //k2DRatioAmp
790 TH1* thRatioDist = (TH1*) trArr->At(2); //kRatioDist
791 TH1* thLEDMonRatio = (TH1*) trArr->At(3); //kLEDMonRatio
792 TH1* thLEDMonRatioDist = (TH1*) trArr->At(4); //kLEDMonRatio
793 TH1* hSigLGLEDMon = (TH1*) trArr->At(5); //kSigLGLEDMon
794 th2DRatioAmp->Reset("ICE");
795 thRatioDist->Reset("ICE");
796 thLEDMonRatio->Reset("ICE");
797 thLEDMonRatioDist->Reset("ICE");
798 th2DRatioAmp->ResetStats();
799 thRatioDist->ResetStats();
800 thLEDMonRatio->ResetStats();
801 thLEDMonRatioDist->ResetStats();
802 ConvertProfile2H(prSigHG, fHighEmcHistoH2F);
804 for(Int_t ix = 1; ix <= fHighEmcHistoH2F->GetNbinsX(); ix++) {
805 for(Int_t iy = 1; iy <= fHighEmcHistoH2F->GetNbinsY(); iy++) {
806 if(fCalibRefHistoH2F->GetBinContent(ix, iy))
807 binContent = fHighEmcHistoH2F->GetBinContent(ix, iy)/fCalibRefHistoH2F->GetBinContent(ix, iy);
808 th2DRatioAmp->SetBinContent(ix, iy, binContent);
809 thRatioDist->Fill(binContent);
813 //Now for LED monitor system, to calculate the ratio as well
814 Double_t binError = 0. ;
815 // for the binError, we add the relative errors, squared
816 Double_t relativeErrorSqr = 0. ;
818 for(int ib = 1; ib <= fLEDMonRefHistoPro->GetNbinsX(); ib++) {
820 if(fLEDMonRefHistoPro->GetBinContent(ib) != 0) {
821 binContent = hSigLGLEDMon->GetBinContent(ib) / fLEDMonRefHistoPro->GetBinContent(ib);
823 relativeErrorSqr = TMath::Power( (fLEDMonRefHistoPro->GetBinError(ib) / fLEDMonRefHistoPro->GetBinContent(ib)), 2);
824 if( hSigLGLEDMon->GetBinContent(ib) != 0) {
825 relativeErrorSqr += TMath::Power( (hSigLGLEDMon->GetBinError(ib)/hSigLGLEDMon->GetBinContent(ib)), 2);
828 else { // ref. run info is zero
830 relativeErrorSqr = 1;
832 thLEDMonRatio->SetBinContent(ib, binContent);
834 binError = sqrt(relativeErrorSqr) * binContent;
835 thLEDMonRatio->SetBinError(ib, binError);
836 thLEDMonRatioDist->Fill(thLEDMonRatio->GetBinContent(ib));
838 } // loop over eventual trigger clones
840 // let's also fill the SM and event counter histograms
844 Int_t nTotalHGLEDMon = 0;
845 Int_t nTotalLGLEDMon = 0;
846 for (iSM=0; iSM<fSuperModules; iSM++) {
847 nTotalLG += nTotalSMLG[iSM];
848 nTotalHG += nTotalSMHG[iSM];
849 nTotalTRU += nTotalSMTRU[iSM];
850 nTotalLGLEDMon += nTotalSMLGLEDMon[iSM];
851 nTotalHGLEDMon += nTotalSMHGLEDMon[iSM];
852 FillRawsData(kNsmodLG,iSM, nTotalSMLG[iSM]);
853 FillRawsData(kNsmodHG,iSM, nTotalSMHG[iSM]);
854 FillRawsData(kNsmodTRU,iSM, nTotalSMTRU[iSM]);
855 FillRawsData(kNsmodLGLEDMon,iSM, nTotalSMLGLEDMon[iSM]);
856 FillRawsData(kNsmodHGLEDMon,iSM, nTotalSMHGLEDMon[iSM]);
859 FillRawsData(kNtotLG,nTotalLG);
860 FillRawsData(kNtotHG,nTotalHG);
861 FillRawsData(kNtotTRU,nTotalTRU);
862 FillRawsData(kNtotLGLEDMon,nTotalLGLEDMon);
863 FillRawsData(kNtotHGLEDMon,nTotalHGLEDMon);
865 IncEvCountCycleESDs();
866 IncEvCountTotalESDs();
867 SetEventSpecie(saveSpecie) ;
868 // just in case the next rawreader consumer forgets to reset; let's do it here again..
874 //____________________________________________________________________________
875 void AliEMCALQADataMakerRec::MakeDigits()
877 // makes data from Digits
878 FillDigitsData(1,fDigitsArray->GetEntriesFast()) ;
879 TIter next(fDigitsArray) ;
880 AliEMCALDigit * digit ;
881 while ( (digit = dynamic_cast<AliEMCALDigit *>(next())) ) {
882 FillDigitsData(0, digit->GetAmplitude()) ;
887 //____________________________________________________________________________
888 void AliEMCALQADataMakerRec::MakeDigits(TTree * digitTree)
890 // makes data from Digit Tree
891 // RS: Attention: the counters are increments in the MakeDigits()
893 fDigitsArray->Clear("C") ;
895 fDigitsArray = new TClonesArray("AliEMCALDigit", 1000) ;
897 TBranch * branch = digitTree->GetBranch("EMCAL") ;
898 if ( ! branch ) { AliWarning("EMCAL branch in Digit Tree not found"); return; }
900 branch->SetAddress(&fDigitsArray) ;
901 branch->GetEntry(0) ;
904 IncEvCountCycleDigits();
905 IncEvCountTotalDigits();
909 //____________________________________________________________________________
910 void AliEMCALQADataMakerRec::MakeRecPoints(TTree * clustersTree)
912 // makes data from RecPoints
913 TBranch *emcbranch = clustersTree->GetBranch("EMCALECARP");
915 AliError("can't get the branch with the EMCAL clusters !");
919 TObjArray * emcRecPoints = new TObjArray(100) ;
920 emcbranch->SetAddress(&emcRecPoints);
921 emcbranch->GetEntry(0);
923 FillRecPointsData(kRecPM,emcRecPoints->GetEntriesFast()) ;
924 TIter next(emcRecPoints) ;
925 AliEMCALRecPoint * rp ;
926 while ( (rp = dynamic_cast<AliEMCALRecPoint *>(next())) ) {
927 FillRecPointsData(kRecPE,rp->GetEnergy()) ;
928 FillRecPointsData(kRecPDigM,rp->GetMultiplicity());
930 emcRecPoints->Delete();
932 IncEvCountCycleRecPoints();
933 IncEvCountTotalRecPoints();
936 //____________________________________________________________________________
937 void AliEMCALQADataMakerRec::StartOfDetectorCycle()
939 //Detector specific actions at start of cycle
943 //____________________________________________________________________________
944 void AliEMCALQADataMakerRec::SetFittingAlgorithm(Int_t fitAlgo)
946 //Set fitting algorithm and initialize it if this same algorithm was not set before.
947 //printf("**** Set Algorithm , number %d ****\n",fitAlgo);
950 fRawAnalyzer = AliCaloRawAnalyzerFactory::CreateAnalyzer(fitAlgo);
951 fFittingAlgorithm = fitAlgo;
954 if(fitAlgo == fFittingAlgorithm && fRawAnalyzer) {
955 //Do nothing, this same algorithm already set before.
956 //printf("**** Algorithm already set before, number %d, %s ****\n",fitAlgo, fRawAnalyzer->GetName());
959 //Initialize the requested algorithm
960 if(fitAlgo != fFittingAlgorithm || !fRawAnalyzer) {
961 //printf("**** Init Algorithm , number %d ****\n",fitAlgo);
963 fFittingAlgorithm = fitAlgo;
964 if (fRawAnalyzer) delete fRawAnalyzer; // delete prev. analyzer if existed.
966 if (fitAlgo == kFastFit) {
967 fRawAnalyzer = new AliCaloRawAnalyzerFastFit();
969 else if (fitAlgo == kNeuralNet) {
970 fRawAnalyzer = new AliCaloRawAnalyzerNN();
972 else if (fitAlgo == kLMS) {
973 fRawAnalyzer = new AliCaloRawAnalyzerLMS();
975 else if (fitAlgo == kPeakFinder) {
976 fRawAnalyzer = new AliCaloRawAnalyzerPeakFinder();
978 else if (fitAlgo == kCrude) {
979 fRawAnalyzer = new AliCaloRawAnalyzerCrude();
982 AliWarning("EMCAL QA invalid fit algorithm choice") ;
990 //_____________________________________________________________________________________
991 void AliEMCALQADataMakerRec::ConvertProfile2H(TProfile * p, TH2 * histo)
994 histo->Reset("ICE") ;
997 Int_t nbinsProf = p->GetNbinsX();
999 // loop through the TProfile p and fill the TH2F histo
1002 Double_t binContent = 0;
1003 Int_t towerNum = 0; // global tower Id
1004 // i = 0; // tower Id within SuperModule
1005 Int_t iSM = 0; // SuperModule index
1006 Int_t iSMSide = 0; // 0=A, 1=C side
1007 Int_t iSMSector = 0; // 2 SM's per sector
1009 // indices for 2D plots
1013 for (Int_t ibin = 1; ibin <= nbinsProf; ibin++) {
1014 towerNum = (Int_t) p->GetBinCenter(ibin);
1015 binContent = p->GetBinContent(ibin);
1017 // figure out what the tower indices are: col, row within a SuperModule
1018 iSM = towerNum/(AliEMCALGeoParams::fgkEMCALRows * AliEMCALGeoParams::fgkEMCALCols);
1019 col = (towerNum/AliEMCALGeoParams::fgkEMCALRows) % (AliEMCALGeoParams::fgkEMCALCols);
1020 row = towerNum % (AliEMCALGeoParams::fgkEMCALRows);
1022 //DecodeTowerNum(towerNum, &SM, &col, &row);
1023 // then we calculate what the global 2D coord are, based on which SM
1025 iSMSector = iSM / 2;
1028 if (iSMSide == 1) { // C side, shown to the right
1029 col2d = col + AliEMCALGeoParams::fgkEMCALCols;
1031 else { // A side, shown to the left
1035 row2d = row + iSMSector * AliEMCALGeoParams::fgkEMCALRows;
1037 histo->SetBinContent(col2d+1, row2d+1, binContent);
1043 void AliEMCALQADataMakerRec::GetTruChannelPosition( Int_t &globRow, Int_t &globColumn, Int_t module, Int_t ddl, Int_t branch, Int_t column )
1054 // 12 rows of 2x2s in a module (3 TRUs by 4 rows)
1055 mrow = (module/2) * 12;
1056 // 24 columns per module, odd module numbers increased by 24
1057 mcol = (module%2) * 24;
1059 // position within TRU coordinates
1064 if( module%2 == 0 ){ // A side
1068 // TRU in module row addition
1069 drow = (rcu*branch+rcu) * 4;
1076 // TRU in module row addition
1077 drow = (2 - (rcu*branch+rcu)) * 4;
1080 // output global row/collumn position (0,0 = SMA0, phi = 0, |eta| = max)
1081 globRow = mrow + drow + trow;
1082 globColumn = mcol + tcol;