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;
22 The idea:average counts for all the towers should be flat
23 Change all existing histograms as experts
28 // --- ROOT system ---
29 #include <TClonesArray.h>
36 // --- Standard library ---
39 // --- AliRoot header files ---
40 #include "AliESDCaloCluster.h"
41 #include "AliESDCaloCells.h"
42 #include "AliESDEvent.h"
44 #include "AliEMCALQADataMakerRec.h"
45 #include "AliQAChecker.h"
46 #include "AliEMCALDigit.h"
47 #include "AliEMCALRecPoint.h"
48 #include "AliEMCALRawUtils.h"
49 #include "AliEMCALReconstructor.h"
50 #include "AliEMCALRecParam.h"
51 #include "AliRawReader.h"
52 #include "AliCaloRawStreamV3.h"
53 #include "AliEMCALGeoParams.h"
54 #include "AliRawEventHeaderBase.h"
56 #include "AliCaloBunchInfo.h"
57 #include "AliCaloFitResults.h"
58 #include "AliCaloRawAnalyzerFastFit.h"
59 #include "AliCaloRawAnalyzerNN.h"
60 #include "AliCaloRawAnalyzerLMS.h"
61 #include "AliCaloRawAnalyzerPeakFinder.h"
62 #include "AliCaloRawAnalyzerCrude.h"
64 ClassImp(AliEMCALQADataMakerRec)
66 //____________________________________________________________________________
67 AliEMCALQADataMakerRec::AliEMCALQADataMakerRec(fitAlgorithm fitAlgo) :
68 AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kEMCAL), "EMCAL Quality Assurance Data Maker"),
72 fSuperModules(4), // FIXME!!! number of SuperModules; 4 for 2009; update default to 12 for later runs..
73 fFirstPedestalSample(0),
74 fLastPedestalSample(3),
75 fFirstPedestalSampleTRU(0),
76 fLastPedestalSampleTRU(3),
78 fMaxSignalLG(AliEMCALGeoParams::fgkSampleMax),
80 fMaxSignalHG(AliEMCALGeoParams::fgkSampleMax),
82 fMaxSignalTRU(AliEMCALGeoParams::fgkSampleMax),
83 fMinSignalLGLEDMon(0),
84 fMaxSignalLGLEDMon(AliEMCALGeoParams::fgkSampleMax),
85 fMinSignalHGLEDMon(0),
86 fMaxSignalHGLEDMon(AliEMCALGeoParams::fgkSampleMax)
89 SetFittingAlgorithm(fitAlgo);
90 fRawAnalyzerTRU = new AliCaloRawAnalyzerLMS();
91 fRawAnalyzerTRU->SetFixTau(kTRUE);
92 fRawAnalyzerTRU->SetTau(2.5); // default for TRU shaper
95 //____________________________________________________________________________
96 AliEMCALQADataMakerRec::AliEMCALQADataMakerRec(const AliEMCALQADataMakerRec& qadm) :
101 fSuperModules(qadm.GetSuperModules()),
102 fFirstPedestalSample(qadm.GetFirstPedestalSample()),
103 fLastPedestalSample(qadm.GetLastPedestalSample()),
104 fFirstPedestalSampleTRU(qadm.GetFirstPedestalSampleTRU()),
105 fLastPedestalSampleTRU(qadm.GetLastPedestalSampleTRU()),
106 fMinSignalLG(qadm.GetMinSignalLG()),
107 fMaxSignalLG(qadm.GetMaxSignalLG()),
108 fMinSignalHG(qadm.GetMinSignalHG()),
109 fMaxSignalHG(qadm.GetMaxSignalHG()),
110 fMinSignalTRU(qadm.GetMinSignalTRU()),
111 fMaxSignalTRU(qadm.GetMaxSignalTRU()),
112 fMinSignalLGLEDMon(qadm.GetMinSignalLGLEDMon()),
113 fMaxSignalLGLEDMon(qadm.GetMaxSignalLGLEDMon()),
114 fMinSignalHGLEDMon(qadm.GetMinSignalHGLEDMon()),
115 fMaxSignalHGLEDMon(qadm.GetMaxSignalHGLEDMon())
118 SetName((const char*)qadm.GetName()) ;
119 SetTitle((const char*)qadm.GetTitle());
120 SetFittingAlgorithm(qadm.GetFittingAlgorithm());
121 fRawAnalyzerTRU = new AliCaloRawAnalyzerLMS();
122 fRawAnalyzerTRU->SetFixTau(kTRUE);
123 fRawAnalyzerTRU->SetTau(2.5); // default for TRU shaper
126 //__________________________________________________________________
127 AliEMCALQADataMakerRec& AliEMCALQADataMakerRec::operator = (const AliEMCALQADataMakerRec& qadm )
130 this->~AliEMCALQADataMakerRec();
131 new(this) AliEMCALQADataMakerRec(qadm);
135 //____________________________________________________________________________
136 void AliEMCALQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
138 //Detector specific actions at end of cycle
141 // GetRawsData(kNEventsPerTower)->Scale(1./fCycleCounter);
143 // do the QA checking
144 AliQAChecker::Instance()->Run(AliQAv1::kEMCAL, task, list) ;
147 //____________________________________________________________________________
148 void AliEMCALQADataMakerRec::InitESDs()
150 //Create histograms to controll ESD
151 const Bool_t expert = kTRUE ;
152 const Bool_t image = kTRUE ;
154 TH1F * h1 = new TH1F("hESDCaloClusterE", "ESDs CaloCluster energy in EMCAL;Energy [GeV];Counts", 200, 0., 100.) ;
156 Add2ESDsList(h1, kESDCaloClusE, !expert, image) ;
158 TH1I * h2 = new TH1I("hESDCaloClusterM", "ESDs CaloCluster multiplicity in EMCAL;# of Clusters;Entries", 100, 0, 100) ;
160 Add2ESDsList(h2, kESDCaloClusM, !expert, image) ;
162 TH1F * h3 = new TH1F("hESDCaloCellA", "ESDs CaloCell amplitude in EMCAL;Energy [GeV];Counts", 500, 0., 50.) ;
164 Add2ESDsList(h3, kESDCaloCellA, !expert, image) ;
166 TH1I * h4 = new TH1I("hESDCaloCellM", "ESDs CaloCell multiplicity in EMCAL;# of Clusters;Entries", 200, 0, 1000) ;
168 Add2ESDsList(h4, kESDCaloCellM, !expert, image) ;
172 //____________________________________________________________________________
173 void AliEMCALQADataMakerRec::InitDigits()
175 // create Digits histograms in Digits subdir
176 const Bool_t expert = kTRUE ;
177 const Bool_t image = kTRUE ;
179 TH1I * h0 = new TH1I("hEmcalDigits", "Digits amplitude distribution in EMCAL;Amplitude [ADC counts];Counts", 500, 0, 500) ;
181 Add2DigitsList(h0, 0, !expert, image) ;
182 TH1I * h1 = new TH1I("hEmcalDigitsMul", "Digits multiplicity distribution in EMCAL;# of Digits;Entries", 200, 0, 2000) ;
184 Add2DigitsList(h1, 1, !expert, image) ;
187 //____________________________________________________________________________
188 void AliEMCALQADataMakerRec::InitRecPoints()
190 // create Reconstructed Points histograms in RecPoints subdir
191 const Bool_t expert = kTRUE ;
192 const Bool_t image = kTRUE ;
194 TH1F* h0 = new TH1F("hEMCALRpE","EMCAL RecPoint energies;Energy [GeV];Counts",200, 0.,20.); //GeV
196 Add2RecPointsList(h0,kRecPE, !expert, image);
198 TH1I* h1 = new TH1I("hEMCALRpM","EMCAL RecPoint multiplicities;# of Clusters;Entries",100,0,100);
200 Add2RecPointsList(h1,kRecPM, !expert, image);
202 TH1I* h2 = new TH1I("hEMCALRpDigM","EMCAL RecPoint Digit Multiplicities;# of Digits;Entries",20,0,20);
204 Add2RecPointsList(h2,kRecPDigM, !expert, image);
208 //____________________________________________________________________________
209 void AliEMCALQADataMakerRec::InitRaws()
211 // create Raws histograms in Raws subdir
212 const Bool_t expert = kTRUE ;
213 const Bool_t saveCorr = kTRUE ;
214 const Bool_t image = kTRUE ;
216 int nTowersPerSM = AliEMCALGeoParams::fgkEMCALRows * AliEMCALGeoParams::fgkEMCALCols; // number of towers in a SuperModule; 24x48
217 int nTot = fSuperModules * nTowersPerSM; // max number of towers in all SuperModules
219 // counter info: number of channels per event (bins are SM index)
220 TProfile * h0 = new TProfile("hLowEmcalSupermodules", "Low Gain EMC: # of towers vs SuperMod;SM Id;# of towers",
221 fSuperModules, -0.5, fSuperModules-0.5) ;
222 Add2RawsList(h0, kNsmodLG, expert, image, !saveCorr) ;
223 TProfile * h1 = new TProfile("hHighEmcalSupermodules", "High Gain EMC: # of towers vs SuperMod;SM Id;# of towers",
224 fSuperModules, -0.5, fSuperModules-0.5) ;
225 Add2RawsList(h1, kNsmodHG, expert, image, !saveCorr) ;
227 // where did max sample occur? (bins are towers)
228 TProfile * h2 = new TProfile("hLowEmcalRawtime", "Low Gain EMC: Time at Max vs towerId;Tower Id;Time [ticks]",
229 nTot, -0.5, nTot-0.5) ;
230 Add2RawsList(h2, kTimeLG, expert, image, !saveCorr) ;
231 TProfile * h3 = new TProfile("hHighEmcalRawtime", "High Gain EMC: Time at Max vs towerId;Tower Id;Time [ticks]",
232 nTot, -0.5, nTot-0.5) ;
233 Add2RawsList(h3, kTimeHG, expert, image, !saveCorr) ;
235 // how much above pedestal was the max sample? (bins are towers)
236 TProfile * h4 = new TProfile("hLowEmcalRawMaxMinusMin", "Low Gain EMC: Max - Min vs towerId;Tower Id;Max-Min [ADC counts]",
237 nTot, -0.5, nTot-0.5) ;
238 Add2RawsList(h4, kSigLG, expert, image, !saveCorr) ;
239 TProfile * h5 = new TProfile("hHighEmcalRawMaxMinusMin", "High Gain EMC: Max - Min vs towerId;Tower Id;Max-Min [ADC counts]",
240 nTot, -0.5, nTot-0.5) ;
241 Add2RawsList(h5, kSigHG, expert, image, !saveCorr) ;
243 // total counter: channels per event
244 TH1I * h6 = new TH1I("hLowNtot", "Low Gain EMC: Total Number of found towers;# of Towers;Counts", 200, 0, nTot) ;
246 Add2RawsList(h6, kNtotLG, expert, image, !saveCorr) ;
247 TH1I * h7 = new TH1I("hHighNtot", "High Gain EMC: Total Number of found towers;# of Towers;Counts", 200,0, nTot) ;
249 Add2RawsList(h7, kNtotHG, expert, image, !saveCorr) ;
251 // pedestal (bins are towers)
252 TProfile * h8 = new TProfile("hLowEmcalRawPed", "Low Gain EMC: Pedestal vs towerId;Tower Id;Pedestal [ADC counts]",
253 nTot, -0.5, nTot-0.5) ;
254 Add2RawsList(h8, kPedLG, expert, image, !saveCorr) ;
255 TProfile * h9 = new TProfile("hHighEmcalRawPed", "High Gain EMC: Pedestal vs towerId;Tower Id;Pedestal [ADC counts]",
256 nTot, -0.5, nTot-0.5) ;
257 Add2RawsList(h9, kPedHG, expert, image, !saveCorr) ;
259 //number of events per tower, for shifter fast check
260 TH1I * h12 = new TH1I("hTowerHG", "High Gains on the Tower;Tower", nTot,0, nTot) ;
262 Add2RawsList(h12, kTowerHG, !expert, image, !saveCorr) ;
263 TH1I * h13 = new TH1I("hTowerLG", "Low Gains on the Tower;Tower", nTot,0, nTot) ;
265 Add2RawsList(h13, kTowerLG, !expert, image, !saveCorr) ;
267 // now repeat the same for TRU and LEDMon data
268 int nTot2x2 = fSuperModules * AliEMCALGeoParams::fgkEMCALTRUsPerSM * AliEMCALGeoParams::fgkEMCAL2x2PerTRU; // max number of TRU channels for all SuperModules
270 // counter info: number of channels per event (bins are SM index)
271 TProfile * hT0 = new TProfile("hTRUEmcalSupermodules", "TRU EMC: # of TRU channels vs SuperMod;SM Id;# of TRU channels",
272 fSuperModules, -0.5, fSuperModules-0.5) ;
273 Add2RawsList(hT0, kNsmodTRU, expert, image, !saveCorr) ;
275 // where did max sample occur? (bins are TRU channels)
276 TProfile * hT1 = new TProfile("hTRUEmcalRawtime", "TRU EMC: Time at Max vs 2x2Id;2x2 Id;Time [ticks]",
277 nTot2x2, -0.5, nTot2x2-0.5) ;
278 Add2RawsList(hT1, kTimeTRU, expert, image, !saveCorr) ;
280 // how much above pedestal was the max sample? (bins are TRU channels)
281 TProfile * hT2 = new TProfile("hTRUEmcalRawMaxMinusMin", "TRU EMC: Max - Min vs 2x2Id;2x2 Id;Max-Min [ADC counts]",
282 nTot2x2, -0.5, nTot2x2-0.5) ;
283 Add2RawsList(hT2, kSigTRU, expert, image, !saveCorr) ;
285 // total counter: channels per event
286 TH1I * hT3 = new TH1I("hTRUNtot", "TRU EMC: Total Number of found TRU channels;# of TRU Channels;Counts", 200, 0, nTot2x2) ;
288 Add2RawsList(hT3, kNtotTRU, expert, image, !saveCorr) ;
290 // pedestal (bins are TRU channels)
291 TProfile * hT4 = new TProfile("hTRUEmcalRawPed", "TRU EMC: Pedestal vs 2x2Id;2x2 Id;Pedestal [ADC counts]",
292 nTot2x2, -0.5, nTot2x2-0.5) ;
293 Add2RawsList(hT4, kPedTRU, expert, image, !saveCorr) ;
295 // L0 trigger hits: # of hits (bins are TRU channels)
296 TH1I * hT5 = new TH1I("hTRUEmcalL0hits", "L0 trigger hits: Total number of 2x2 L0 generated", nTot2x2, -0.5, nTot2x2);
298 Add2RawsList(hT5, kNL0TRU, expert, image, !saveCorr);
300 // L0 trigger hits: average time (bins are TRU channels)
301 TProfile * hT6 = new TProfile("hTRUEmcalL0hitsAvgTime", "L0 trigger hits: average time bin", nTot2x2, -0.5, nTot2x2);
302 Add2RawsList(hT6, kTimeL0TRU, expert, image, !saveCorr);
304 // and also LED Mon..
305 // LEDMon has both high and low gain channels, just as regular FEE/towers
306 int nTotLEDMon = fSuperModules * AliEMCALGeoParams::fgkEMCALLEDRefs; // max number of LEDMon channels for all SuperModules
308 // counter info: number of channels per event (bins are SM index)
309 TProfile * hL0 = new TProfile("hLowLEDMonEmcalSupermodules", "LowLEDMon Gain EMC: # of strips vs SuperMod;SM Id;# of strips",
310 fSuperModules, -0.5, fSuperModules-0.5) ;
311 Add2RawsList(hL0, kNsmodLGLEDMon, expert, image, !saveCorr) ;
312 TProfile * hL1 = new TProfile("hHighLEDMonEmcalSupermodules", "HighLEDMon Gain EMC: # of strips vs SuperMod;SM Id;# of strips",
313 fSuperModules, -0.5, fSuperModules-0.5) ;
314 Add2RawsList(hL1, kNsmodHGLEDMon, expert, image, !saveCorr) ;
316 // where did max sample occur? (bins are strips)
317 TProfile * hL2 = new TProfile("hLowLEDMonEmcalRawtime", "LowLEDMon Gain EMC: Time at Max vs stripId;Strip Id;Time [ticks]",
318 nTotLEDMon, -0.5, nTotLEDMon-0.5) ;
319 Add2RawsList(hL2, kTimeLGLEDMon, expert, image, !saveCorr) ;
320 TProfile * hL3 = new TProfile("hHighLEDMonEmcalRawtime", "HighLEDMon Gain EMC: Time at Max vs stripId;Strip Id;Time [ticks]",
321 nTotLEDMon, -0.5, nTotLEDMon-0.5) ;
322 Add2RawsList(hL3, kTimeHGLEDMon, expert, image, !saveCorr) ;
324 // how much above pedestal was the max sample? (bins are strips)
325 TProfile * hL4 = new TProfile("hLowLEDMonEmcalRawMaxMinusMin", "LowLEDMon Gain EMC: Max - Min vs stripId;Strip Id;Max-Min [ADC counts]",
326 nTotLEDMon, -0.5, nTotLEDMon-0.5) ;
327 Add2RawsList(hL4, kSigLGLEDMon, expert, image, !saveCorr) ;
328 TProfile * hL5 = new TProfile("hHighLEDMonEmcalRawMaxMinusMin", "HighLEDMon Gain EMC: Max - Min vs stripId;Strip Id;Max-Min [ADC counts]",
329 nTotLEDMon, -0.5, nTotLEDMon-0.5) ;
330 Add2RawsList(hL5, kSigHGLEDMon, expert, image, !saveCorr) ;
332 // total counter: channels per event
333 TH1I * hL6 = new TH1I("hLowLEDMonNtot", "LowLEDMon Gain EMC: Total Number of found strips;# of Strips;Counts", 200, 0, nTotLEDMon) ;
335 Add2RawsList(hL6, kNtotLGLEDMon, expert, image, !saveCorr) ;
336 TH1I * hL7 = new TH1I("hHighLEDMonNtot", "HighLEDMon Gain EMC: Total Number of found strips;# of Strips;Counts", 200,0, nTotLEDMon) ;
338 Add2RawsList(hL7, kNtotHGLEDMon, expert, image, !saveCorr) ;
340 // pedestal (bins are strips)
341 TProfile * hL8 = new TProfile("hLowLEDMonEmcalRawPed", "LowLEDMon Gain EMC: Pedestal vs stripId;Strip Id;Pedestal [ADC counts]",
342 nTotLEDMon, -0.5, nTotLEDMon-0.5) ;
343 Add2RawsList(hL8, kPedLGLEDMon, expert, image, !saveCorr) ;
344 TProfile * hL9 = new TProfile("hHighLEDMonEmcalRawPed", "HighLEDMon Gain EMC: Pedestal vs stripId;Strip Id;Pedestal [ADC counts]",
345 nTotLEDMon, -0.5, nTotLEDMon-0.5) ;
346 Add2RawsList(hL9, kPedHGLEDMon, expert, image, !saveCorr) ;
350 //____________________________________________________________________________
351 void AliEMCALQADataMakerRec::MakeESDs(AliESDEvent * esd)
353 // make QA data from ESDs
356 for ( Int_t index = 0; index < esd->GetNumberOfCaloClusters() ; index++ ) {
357 AliESDCaloCluster * clu = esd->GetCaloCluster(index) ;
358 if( clu->IsEMCAL() ) {
359 GetESDsData(kESDCaloClusE)->Fill(clu->E()) ;
363 GetESDsData(kESDCaloClusM)->Fill(nTot) ;
366 AliESDCaloCells* cells = esd->GetEMCALCells();
367 GetESDsData(kESDCaloCellM)->Fill(cells->GetNumberOfCells()) ;
369 for ( Int_t index = 0; index < cells->GetNumberOfCells() ; index++ ) {
370 GetESDsData(kESDCaloCellA)->Fill(cells->GetAmplitude(index)) ;
375 //____________________________________________________________________________
376 void AliEMCALQADataMakerRec::MakeRaws(AliRawReader* rawReader)
378 //Fill prepared histograms with Raw digit properties
381 AliCaloRawStreamV3 in(rawReader,"EMCAL");
382 rawReader->Select("EMCAL", 0, AliEMCALGeoParams::fgkLastAltroDDL) ; //select EMCAL DDL's
384 AliRecoParam::EventSpecie_t saveSpecie = fEventSpecie ;
386 if (rawReader->GetType() == AliRawEventHeaderBase::kCalibrationEvent) {
387 SetEventSpecie(AliRecoParam::kCalib) ;
390 fRawAnalyzer->SetIsZeroSuppressed(true); // TMP - should use stream->IsZeroSuppressed(), or altro cfg registers later
392 int nTowersPerSM = AliEMCALGeoParams::fgkEMCALRows * AliEMCALGeoParams::fgkEMCALCols; // number of towers in a SuperModule; 24x48
393 int nRows = AliEMCALGeoParams::fgkEMCALRows; // number of rows per SuperModule
394 int nStripsPerSM = AliEMCALGeoParams::fgkEMCALLEDRefs; // number of strips per SuperModule
395 int n2x2PerSM = AliEMCALGeoParams::fgkEMCALTRUsPerSM * AliEMCALGeoParams::fgkEMCAL2x2PerTRU; // number of TRU 2x2's per SuperModule
396 int n2x2PerTRU = AliEMCALGeoParams::fgkEMCAL2x2PerTRU;
398 // SM counters; decl. should be safe, assuming we don't get more than expected SuperModules..
399 int nTotalSMLG[AliEMCALGeoParams::fgkEMCALModules] = {0};
400 int nTotalSMHG[AliEMCALGeoParams::fgkEMCALModules] = {0};
401 int nTotalSMTRU[AliEMCALGeoParams::fgkEMCALModules] = {0};
402 int nTotalSMLGLEDMon[AliEMCALGeoParams::fgkEMCALModules] = {0};
403 int nTotalSMHGLEDMon[AliEMCALGeoParams::fgkEMCALModules] = {0};
405 int nTRUL0ChannelBits = 10; // used for L0 trigger bits checks
407 // start loop over input stream
409 while (in.NextDDL()) {
410 int iRCU = in.GetDDLNumber() % 2; // RCU0 or RCU1, within SuperModule
412 while (in.NextChannel()) {
413 iSM = in.GetModule(); // SuperModule
414 //printf("iSM %d DDL %d", iSM, in.GetDDLNumber());
415 if (iSM>=0 && iSM<fSuperModules) { // valid module reading
418 vector<AliCaloBunchInfo> bunchlist;
419 while (in.NextBunch()) {
420 nsamples += in.GetBunchLength();
421 bunchlist.push_back( AliCaloBunchInfo(in.GetStartTimeBin(), in.GetBunchLength(), in.GetSignals() ) );
424 if (nsamples > 0) { // this check is needed for when we have zero-supp. on, but not sparse readout
427 // indices for pedestal calc.
428 int firstPedSample = 0;
429 int lastPedSample = 0;
430 bool isTRUL0IdData = false;
432 if (! in.IsTRUData() ) { // high gain, low gain, LED Mon data - all have the same shaper/sampling
433 AliCaloFitResults fitResults = fRawAnalyzer->Evaluate( bunchlist, in.GetAltroCFG1(), in.GetAltroCFG2());
434 amp = fitResults.GetAmp();
435 time = fitResults.GetTof();
436 firstPedSample = fFirstPedestalSample;
437 lastPedSample = fLastPedestalSample;
439 else { // TRU data is special, needs its own analyzer
440 AliCaloFitResults fitResults = fRawAnalyzerTRU->Evaluate( bunchlist, in.GetAltroCFG1(), in.GetAltroCFG2());
441 amp = fitResults.GetAmp();
442 time = fitResults.GetTof();
443 firstPedSample = fFirstPedestalSampleTRU;
444 lastPedSample = fLastPedestalSampleTRU;
445 if (in.GetColumn() > n2x2PerTRU) {
446 isTRUL0IdData = true;
452 vector<int> pedSamples;
454 // select earliest bunch
455 unsigned int bunchIndex = 0;
456 unsigned int startBin = bunchlist.at(0).GetStartBin();
457 if (bunchlist.size() > 0) {
458 for(unsigned int ui=1; ui < bunchlist.size(); ui++ ) {
459 if (startBin > bunchlist.at(ui).GetStartBin() ) {
460 startBin = bunchlist.at(ui).GetStartBin();
466 // check bunch for entries in the pedestal sample range
467 int bunchLength = bunchlist.at(bunchIndex).GetLength();
468 const UShort_t *sig = bunchlist.at(bunchIndex).GetData();
471 if (! isTRUL0IdData) { // regular data, can look at pedestals
472 for (int i = 0; i<bunchLength; i++) {
473 timebin = startBin--;
474 if ( firstPedSample<=timebin && timebin<=lastPedSample ) {
475 pedSamples.push_back( sig[i] );
479 // printf("nPed %d\n", nPed);
481 else { // TRU L0 Id Data
482 // which TRU the channel belongs to?
483 int TRUId = in.GetModule()*3 + (iRCU*in.GetBranch() + iRCU);
485 for (int i = 0; i< bunchLength; i++) {
486 for( int j = 0; j < nTRUL0ChannelBits; j++ ){
487 // check if the bit j is 1
488 if( (sig[i] & ( 1 << j )) > 0 ){
489 int TRUIdInSM = (in.GetColumn() - n2x2PerTRU)*nTRUL0ChannelBits+j;
490 if(TRUIdInSM < n2x2PerTRU) {
491 int TRUAbsId = TRUIdInSM + n2x2PerTRU * TRUId;
492 // Fill the histograms
493 GetRawsData(kNL0TRU)->Fill(TRUAbsId);
494 GetRawsData(kTimeL0TRU)->Fill(TRUAbsId, startBin);
503 if ( in.IsLowGain() || in.IsHighGain() ) { // regular towers
504 int towerId = iSM*nTowersPerSM + in.GetColumn()*nRows + in.GetRow();
505 if ( in.IsLowGain() ) {
507 GetRawsData(kTowerLG)->Fill(towerId);
508 if ( (amp > fMinSignalLG) && (amp < fMaxSignalLG) ) {
509 GetRawsData(kSigLG)->Fill(towerId, amp);
510 GetRawsData(kTimeLG)->Fill(towerId, time);
513 for (int i=0; i<nPed; i++) {
514 GetRawsData(kPedLG)->Fill(towerId, pedSamples[i]);
518 else if ( in.IsHighGain() ) {
520 GetRawsData(kTowerHG)->Fill(towerId);
521 if ( (amp > fMinSignalHG) && (amp < fMaxSignalHG) ) {
522 GetRawsData(kSigHG)->Fill(towerId, amp);
523 GetRawsData(kTimeHG)->Fill(towerId, time);
526 for (int i=0; i<nPed; i++) {
527 GetRawsData(kPedHG)->Fill(towerId, pedSamples[i]);
531 } // low or high gain
533 else if ( in.IsTRUData() && in.GetColumn()<AliEMCALGeoParams::fgkEMCAL2x2PerTRU) {
534 // for TRU data, the mapping class holds the TRU internal 2x2 number (0..95) in the Column var..
535 int iTRU = (iRCU*in.GetBranch() + iRCU); //TRU0 is from RCU0, TRU1 from RCU1, TRU2 is from branch B on RCU1
536 int iTRU2x2Id = iSM*n2x2PerSM + iTRU*AliEMCALGeoParams::fgkEMCAL2x2PerTRU
539 if ( (amp > fMinSignalTRU) && (amp < fMaxSignalTRU) ) {
540 GetRawsData(kSigTRU)->Fill(iTRU2x2Id, amp);
541 GetRawsData(kTimeTRU)->Fill(iTRU2x2Id, time);
544 for (int i=0; i<nPed; i++) {
545 GetRawsData(kPedTRU)->Fill(iTRU2x2Id, pedSamples[i]);
550 else if ( in.IsLEDMonData() ) {
551 // for LED Mon data, the mapping class holds the gain info in the Row variable
552 // and the Strip number in the Column..
553 int gain = in.GetRow();
554 int stripId = iSM*nStripsPerSM + in.GetColumn();
557 nTotalSMLGLEDMon[iSM]++;
558 if ( (amp > fMinSignalLGLEDMon) && (amp < fMaxSignalLGLEDMon) ) {
559 GetRawsData(kSigLGLEDMon)->Fill(stripId, amp);
560 GetRawsData(kTimeLGLEDMon)->Fill(stripId, time);
563 for (int i=0; i<nPed; i++) {
564 GetRawsData(kPedLGLEDMon)->Fill(stripId, pedSamples[i]);
568 else if ( gain == 1 ) {
569 nTotalSMHGLEDMon[iSM]++;
570 if ( (amp > fMinSignalHGLEDMon) && (amp < fMaxSignalHGLEDMon) ) {
571 GetRawsData(kSigHGLEDMon)->Fill(stripId, amp);
572 GetRawsData(kTimeHGLEDMon)->Fill(stripId, time);
575 for (int i=0; i<nPed; i++) {
576 GetRawsData(kPedHGLEDMon)->Fill(stripId, pedSamples[i]);
579 } // low or high gain
584 } // nsamples>0 check, some data found for this channel; not only trailer/header
585 }// end while over channel
587 }//end while over DDL's, of input stream
589 // let's also fill the SM and event counter histograms
593 int nTotalHGLEDMon = 0;
594 int nTotalLGLEDMon = 0;
595 for (iSM=0; iSM<fSuperModules; iSM++) {
596 nTotalLG += nTotalSMLG[iSM];
597 nTotalHG += nTotalSMHG[iSM];
598 nTotalTRU += nTotalSMTRU[iSM];
599 nTotalLGLEDMon += nTotalSMLGLEDMon[iSM];
600 nTotalHGLEDMon += nTotalSMHGLEDMon[iSM];
601 GetRawsData(kNsmodLG)->Fill(iSM, nTotalSMLG[iSM]);
602 GetRawsData(kNsmodHG)->Fill(iSM, nTotalSMHG[iSM]);
603 GetRawsData(kNsmodTRU)->Fill(iSM, nTotalSMTRU[iSM]);
604 GetRawsData(kNsmodLGLEDMon)->Fill(iSM, nTotalSMLGLEDMon[iSM]);
605 GetRawsData(kNsmodHGLEDMon)->Fill(iSM, nTotalSMHGLEDMon[iSM]);
608 GetRawsData(kNtotLG)->Fill(nTotalLG);
609 GetRawsData(kNtotHG)->Fill(nTotalHG);
610 GetRawsData(kNtotTRU)->Fill(nTotalTRU);
611 GetRawsData(kNtotLGLEDMon)->Fill(nTotalLGLEDMon);
612 GetRawsData(kNtotHGLEDMon)->Fill(nTotalHGLEDMon);
615 SetEventSpecie(saveSpecie) ;
616 // just in case the next rawreader consumer forgets to reset; let's do it here again..
622 //____________________________________________________________________________
623 void AliEMCALQADataMakerRec::MakeDigits()
625 // makes data from Digits
627 GetDigitsData(1)->Fill(fDigitsArray->GetEntriesFast()) ;
628 TIter next(fDigitsArray) ;
629 AliEMCALDigit * digit ;
630 while ( (digit = dynamic_cast<AliEMCALDigit *>(next())) ) {
631 GetDigitsData(0)->Fill( digit->GetAmp()) ;
636 //____________________________________________________________________________
637 void AliEMCALQADataMakerRec::MakeDigits(TTree * digitTree)
639 // makes data from Digit Tree
641 fDigitsArray->Clear() ;
643 fDigitsArray = new TClonesArray("AliEMCALDigit", 1000) ;
645 TBranch * branch = digitTree->GetBranch("EMCAL") ;
647 AliWarning("EMCAL branch in Digit Tree not found") ;
649 branch->SetAddress(&fDigitsArray) ;
650 branch->GetEntry(0) ;
656 //____________________________________________________________________________
657 void AliEMCALQADataMakerRec::MakeRecPoints(TTree * clustersTree)
659 // makes data from RecPoints
660 TBranch *emcbranch = clustersTree->GetBranch("EMCALECARP");
662 AliError("can't get the branch with the EMCAL clusters !");
666 TObjArray * emcrecpoints = new TObjArray(100) ;
667 emcbranch->SetAddress(&emcrecpoints);
668 emcbranch->GetEntry(0);
670 GetRecPointsData(kRecPM)->Fill(emcrecpoints->GetEntriesFast()) ;
671 TIter next(emcrecpoints) ;
672 AliEMCALRecPoint * rp ;
673 while ( (rp = dynamic_cast<AliEMCALRecPoint *>(next())) ) {
674 GetRecPointsData(kRecPE)->Fill( rp->GetEnergy()) ;
675 GetRecPointsData(kRecPDigM)->Fill(rp->GetMultiplicity());
677 emcrecpoints->Delete();
682 //____________________________________________________________________________
683 void AliEMCALQADataMakerRec::StartOfDetectorCycle()
685 //Detector specific actions at start of cycle
689 //____________________________________________________________________________
690 void AliEMCALQADataMakerRec::SetFittingAlgorithm(Int_t fitAlgo)
692 //Set fitting algorithm and initialize it if this same algorithm was not set before.
693 //printf("**** Set Algorithm , number %d ****\n",fitAlgo);
695 if(fitAlgo == fFittingAlgorithm && fRawAnalyzer) {
696 //Do nothing, this same algorithm already set before.
697 //printf("**** Algorithm already set before, number %d, %s ****\n",fitAlgo, fRawAnalyzer->GetName());
700 //Initialize the requested algorithm
701 if(fitAlgo != fFittingAlgorithm || !fRawAnalyzer) {
702 //printf("**** Init Algorithm , number %d ****\n",fitAlgo);
704 fFittingAlgorithm = fitAlgo;
705 if (fRawAnalyzer) delete fRawAnalyzer; // delete prev. analyzer if existed.
707 if (fitAlgo == kFastFit) {
708 fRawAnalyzer = new AliCaloRawAnalyzerFastFit();
710 else if (fitAlgo == kNeuralNet) {
711 fRawAnalyzer = new AliCaloRawAnalyzerNN();
713 else if (fitAlgo == kLMS) {
714 fRawAnalyzer = new AliCaloRawAnalyzerLMS();
716 else if (fitAlgo == kPeakFinder) {
717 fRawAnalyzer = new AliCaloRawAnalyzerPeakFinder();
719 else if (fitAlgo == kCrude) {
720 fRawAnalyzer = new AliCaloRawAnalyzerCrude();
723 AliWarning("EMCAL QA invalid fit algorithm choice") ;