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 // and also LED Mon..
296 // LEDMon has both high and low gain channels, just as regular FEE/towers
297 int nTotLEDMon = fSuperModules * AliEMCALGeoParams::fgkEMCALLEDRefs; // max number of LEDMon channels for all SuperModules
299 // counter info: number of channels per event (bins are SM index)
300 TProfile * hL0 = new TProfile("hLowLEDMonEmcalSupermodules", "LowLEDMon Gain EMC: # of strips vs SuperMod;SM Id;# of strips",
301 fSuperModules, -0.5, fSuperModules-0.5) ;
302 Add2RawsList(hL0, kNsmodLGLEDMon, expert, image, !saveCorr) ;
303 TProfile * hL1 = new TProfile("hHighLEDMonEmcalSupermodules", "HighLEDMon Gain EMC: # of strips vs SuperMod;SM Id;# of strips",
304 fSuperModules, -0.5, fSuperModules-0.5) ;
305 Add2RawsList(hL1, kNsmodHGLEDMon, expert, image, !saveCorr) ;
307 // where did max sample occur? (bins are strips)
308 TProfile * hL2 = new TProfile("hLowLEDMonEmcalRawtime", "LowLEDMon Gain EMC: Time at Max vs stripId;Strip Id;Time [ticks]",
309 nTotLEDMon, -0.5, nTotLEDMon-0.5) ;
310 Add2RawsList(hL2, kTimeLGLEDMon, expert, image, !saveCorr) ;
311 TProfile * hL3 = new TProfile("hHighLEDMonEmcalRawtime", "HighLEDMon Gain EMC: Time at Max vs stripId;Strip Id;Time [ticks]",
312 nTotLEDMon, -0.5, nTotLEDMon-0.5) ;
313 Add2RawsList(hL3, kTimeHGLEDMon, expert, image, !saveCorr) ;
315 // how much above pedestal was the max sample? (bins are strips)
316 TProfile * hL4 = new TProfile("hLowLEDMonEmcalRawMaxMinusMin", "LowLEDMon Gain EMC: Max - Min vs stripId;Strip Id;Max-Min [ADC counts]",
317 nTotLEDMon, -0.5, nTotLEDMon-0.5) ;
318 Add2RawsList(hL4, kSigLGLEDMon, expert, image, !saveCorr) ;
319 TProfile * hL5 = new TProfile("hHighLEDMonEmcalRawMaxMinusMin", "HighLEDMon Gain EMC: Max - Min vs stripId;Strip Id;Max-Min [ADC counts]",
320 nTotLEDMon, -0.5, nTotLEDMon-0.5) ;
321 Add2RawsList(hL5, kSigHGLEDMon, expert, image, !saveCorr) ;
323 // total counter: channels per event
324 TH1I * hL6 = new TH1I("hLowLEDMonNtot", "LowLEDMon Gain EMC: Total Number of found strips;# of Strips;Counts", 200, 0, nTotLEDMon) ;
326 Add2RawsList(hL6, kNtotLGLEDMon, expert, image, !saveCorr) ;
327 TH1I * hL7 = new TH1I("hHighLEDMonNtot", "HighLEDMon Gain EMC: Total Number of found strips;# of Strips;Counts", 200,0, nTotLEDMon) ;
329 Add2RawsList(hL7, kNtotHGLEDMon, expert, image, !saveCorr) ;
331 // pedestal (bins are strips)
332 TProfile * hL8 = new TProfile("hLowLEDMonEmcalRawPed", "LowLEDMon Gain EMC: Pedestal vs stripId;Strip Id;Pedestal [ADC counts]",
333 nTotLEDMon, -0.5, nTotLEDMon-0.5) ;
334 Add2RawsList(hL8, kPedLGLEDMon, expert, image, !saveCorr) ;
335 TProfile * hL9 = new TProfile("hHighLEDMonEmcalRawPed", "HighLEDMon Gain EMC: Pedestal vs stripId;Strip Id;Pedestal [ADC counts]",
336 nTotLEDMon, -0.5, nTotLEDMon-0.5) ;
337 Add2RawsList(hL9, kPedHGLEDMon, expert, image, !saveCorr) ;
341 //____________________________________________________________________________
342 void AliEMCALQADataMakerRec::MakeESDs(AliESDEvent * esd)
344 // make QA data from ESDs
347 for ( Int_t index = 0; index < esd->GetNumberOfCaloClusters() ; index++ ) {
348 AliESDCaloCluster * clu = esd->GetCaloCluster(index) ;
349 if( clu->IsEMCAL() ) {
350 GetESDsData(kESDCaloClusE)->Fill(clu->E()) ;
354 GetESDsData(kESDCaloClusM)->Fill(nTot) ;
357 AliESDCaloCells* cells = esd->GetEMCALCells();
358 GetESDsData(kESDCaloCellM)->Fill(cells->GetNumberOfCells()) ;
360 for ( Int_t index = 0; index < cells->GetNumberOfCells() ; index++ ) {
361 GetESDsData(kESDCaloCellA)->Fill(cells->GetAmplitude(index)) ;
366 //____________________________________________________________________________
367 void AliEMCALQADataMakerRec::MakeRaws(AliRawReader* rawReader)
369 //Fill prepared histograms with Raw digit properties
372 AliCaloRawStreamV3 in(rawReader,"EMCAL");
373 rawReader->Select("EMCAL", 0, AliEMCALGeoParams::fgkLastAltroDDL) ; //select EMCAL DDL's
375 AliRecoParam::EventSpecie_t saveSpecie = fEventSpecie ;
376 if (rawReader->GetType() == AliRawEventHeaderBase::kCalibrationEvent) {
377 SetEventSpecie(AliRecoParam::kCalib) ;
380 fRawAnalyzer->SetIsZeroSuppressed(true); // TMP - should use stream->IsZeroSuppressed(), or altro cfg registers later
382 int nTowersPerSM = AliEMCALGeoParams::fgkEMCALRows * AliEMCALGeoParams::fgkEMCALCols; // number of towers in a SuperModule; 24x48
383 int nRows = AliEMCALGeoParams::fgkEMCALRows; // number of rows per SuperModule
384 int nStripsPerSM = AliEMCALGeoParams::fgkEMCALLEDRefs; // number of strips per SuperModule
385 int n2x2PerSM = AliEMCALGeoParams::fgkEMCALTRUsPerSM * AliEMCALGeoParams::fgkEMCAL2x2PerTRU; // number of TRU 2x2's per SuperModule
387 // SM counters; decl. should be safe, assuming we don't get more than expected SuperModules..
388 int nTotalSMLG[AliEMCALGeoParams::fgkEMCALModules] = {0};
389 int nTotalSMHG[AliEMCALGeoParams::fgkEMCALModules] = {0};
390 int nTotalSMTRU[AliEMCALGeoParams::fgkEMCALModules] = {0};
391 int nTotalSMLGLEDMon[AliEMCALGeoParams::fgkEMCALModules] = {0};
392 int nTotalSMHGLEDMon[AliEMCALGeoParams::fgkEMCALModules] = {0};
394 // start loop over input stream
396 while (in.NextDDL()) {
397 int iRCU = in.GetDDLNumber() % 2; // RCU0 or RCU1, within SuperModule
399 while (in.NextChannel()) {
400 iSM = in.GetModule(); // SuperModule
401 //printf("iSM %d DDL %d", iSM, in.GetDDLNumber());
402 if (iSM>=0 && iSM<fSuperModules) { // valid module reading
405 vector<AliCaloBunchInfo> bunchlist;
406 while (in.NextBunch()) {
407 nsamples += in.GetBunchLength();
408 bunchlist.push_back( AliCaloBunchInfo(in.GetStartTimeBin(), in.GetBunchLength(), in.GetSignals() ) );
411 if (nsamples > 0) { // this check is needed for when we have zero-supp. on, but not sparse readout
414 // indices for pedestal calc.
415 int firstPedSample = 0;
416 int lastPedSample = 0;
418 if (! in.IsTRUData() ) { // high gain, low gain, LED Mon data - all have the same shaper/sampling
419 AliCaloFitResults fitResults = fRawAnalyzer->Evaluate( bunchlist, in.GetAltroCFG1(), in.GetAltroCFG2());
420 amp = fitResults.GetAmp();
421 time = fitResults.GetTof();
422 firstPedSample = fFirstPedestalSample;
423 lastPedSample = fLastPedestalSample;
425 else { // TRU data is special, needs its own analyzer
426 AliCaloFitResults fitResults = fRawAnalyzerTRU->Evaluate( bunchlist, in.GetAltroCFG1(), in.GetAltroCFG2());
427 amp = fitResults.GetAmp();
428 time = fitResults.GetTof();
429 firstPedSample = fFirstPedestalSampleTRU;
430 lastPedSample = fLastPedestalSampleTRU;
435 vector<int> pedSamples;
437 // select earliest bunch
438 unsigned int bunchIndex = 0;
439 unsigned int startBin = bunchlist.at(0).GetStartBin();
440 if (bunchlist.size() > 0) {
441 for(unsigned int ui=1; ui < bunchlist.size(); ui++ ) {
442 if (startBin > bunchlist.at(ui).GetStartBin() ) {
443 startBin = bunchlist.at(ui).GetStartBin();
449 // check bunch for entries in the pedestal sample range
450 int bunchLength = bunchlist.at(bunchIndex).GetLength();
451 const UShort_t *sig = bunchlist.at(bunchIndex).GetData();
453 for (int i = 0; i<bunchLength; i++) {
454 timebin = startBin--;
455 if ( firstPedSample<=timebin && timebin<=lastPedSample ) {
456 pedSamples.push_back( sig[i] );
460 // printf("nPed %d\n", nPed);
463 if ( in.IsLowGain() || in.IsHighGain() ) { // regular towers
464 int towerId = iSM*nTowersPerSM + in.GetColumn()*nRows + in.GetRow();
466 if ( in.IsLowGain() ) {
468 GetRawsData(kTowerLG)->Fill(towerId);
469 if ( (amp > fMinSignalLG) && (amp < fMaxSignalLG) ) {
470 GetRawsData(kSigLG)->Fill(towerId, amp);
471 GetRawsData(kTimeLG)->Fill(towerId, time);
474 for (int i=0; i<nPed; i++) {
475 GetRawsData(kPedLG)->Fill(towerId, pedSamples[i]);
479 else if ( in.IsHighGain() ) {
481 GetRawsData(kTowerHG)->Fill(towerId);
482 if ( (amp > fMinSignalHG) && (amp < fMaxSignalHG) ) {
483 GetRawsData(kSigHG)->Fill(towerId, amp);
484 GetRawsData(kTimeHG)->Fill(towerId, time);
487 for (int i=0; i<nPed; i++) {
488 GetRawsData(kPedHG)->Fill(towerId, pedSamples[i]);
492 } // low or high gain
494 else if ( in.IsTRUData() && in.GetColumn()<AliEMCALGeoParams::fgkEMCAL2x2PerTRU) {
495 // for TRU data, the mapping class holds the TRU internal 2x2 number (0..95) in the Column var..
496 int iTRU = iRCU; //TRU0 is from RCU0, TRU1 from RCU1
497 if (iRCU>0 && in.GetBranch()>0) iTRU=2; // TRU2 is from branch B on RCU1
498 int iTRU2x2Id = iSM*n2x2PerSM + iTRU*AliEMCALGeoParams::fgkEMCAL2x2PerTRU
502 if ( (amp > fMinSignalTRU) && (amp < fMaxSignalTRU) ) {
503 GetRawsData(kSigTRU)->Fill(iTRU2x2Id, amp);
504 GetRawsData(kTimeTRU)->Fill(iTRU2x2Id, time);
507 for (int i=0; i<nPed; i++) {
508 GetRawsData(kPedTRU)->Fill(iTRU2x2Id, pedSamples[i]);
513 else if ( in.IsLEDMonData() ) {
514 // for LED Mon data, the mapping class holds the gain info in the Row variable
515 // and the Strip number in the Column..
516 int gain = in.GetRow();
517 int stripId = iSM*nStripsPerSM + in.GetColumn();
520 nTotalSMLGLEDMon[iSM]++;
521 if ( (amp > fMinSignalLGLEDMon) && (amp < fMaxSignalLGLEDMon) ) {
522 GetRawsData(kSigLGLEDMon)->Fill(stripId, amp);
523 GetRawsData(kTimeLGLEDMon)->Fill(stripId, time);
526 for (int i=0; i<nPed; i++) {
527 GetRawsData(kPedLGLEDMon)->Fill(stripId, pedSamples[i]);
531 else if ( gain == 1 ) {
532 nTotalSMHGLEDMon[iSM]++;
533 if ( (amp > fMinSignalHGLEDMon) && (amp < fMaxSignalHGLEDMon) ) {
534 GetRawsData(kSigHGLEDMon)->Fill(stripId, amp);
535 GetRawsData(kTimeHGLEDMon)->Fill(stripId, time);
538 for (int i=0; i<nPed; i++) {
539 GetRawsData(kPedHGLEDMon)->Fill(stripId, pedSamples[i]);
542 } // low or high gain
547 } // nsamples>0 check, some data found for this channel; not only trailer/header
548 }// end while over channel
550 }//end while over DDL's, of input stream
552 // let's also fill the SM and event counter histograms
556 int nTotalHGLEDMon = 0;
557 int nTotalLGLEDMon = 0;
558 for (iSM=0; iSM<fSuperModules; iSM++) {
559 nTotalLG += nTotalSMLG[iSM];
560 nTotalHG += nTotalSMHG[iSM];
561 nTotalTRU += nTotalSMTRU[iSM];
562 nTotalLGLEDMon += nTotalSMLGLEDMon[iSM];
563 nTotalHGLEDMon += nTotalSMHGLEDMon[iSM];
564 GetRawsData(kNsmodLG)->Fill(iSM, nTotalSMLG[iSM]);
565 GetRawsData(kNsmodHG)->Fill(iSM, nTotalSMHG[iSM]);
566 GetRawsData(kNsmodTRU)->Fill(iSM, nTotalSMTRU[iSM]);
567 GetRawsData(kNsmodLGLEDMon)->Fill(iSM, nTotalSMLGLEDMon[iSM]);
568 GetRawsData(kNsmodHGLEDMon)->Fill(iSM, nTotalSMHGLEDMon[iSM]);
571 GetRawsData(kNtotLG)->Fill(nTotalLG);
572 GetRawsData(kNtotHG)->Fill(nTotalHG);
573 GetRawsData(kNtotTRU)->Fill(nTotalTRU);
574 GetRawsData(kNtotLGLEDMon)->Fill(nTotalLGLEDMon);
575 GetRawsData(kNtotHGLEDMon)->Fill(nTotalHGLEDMon);
577 SetEventSpecie(saveSpecie) ;
578 // just in case the next rawreader consumer forgets to reset; let's do it here again..
584 //____________________________________________________________________________
585 void AliEMCALQADataMakerRec::MakeDigits()
587 // makes data from Digits
589 GetDigitsData(1)->Fill(fDigitsArray->GetEntriesFast()) ;
590 TIter next(fDigitsArray) ;
591 AliEMCALDigit * digit ;
592 while ( (digit = dynamic_cast<AliEMCALDigit *>(next())) ) {
593 GetDigitsData(0)->Fill( digit->GetAmp()) ;
598 //____________________________________________________________________________
599 void AliEMCALQADataMakerRec::MakeDigits(TTree * digitTree)
601 // makes data from Digit Tree
603 fDigitsArray->Clear() ;
605 fDigitsArray = new TClonesArray("AliEMCALDigit", 1000) ;
607 TBranch * branch = digitTree->GetBranch("EMCAL") ;
609 AliWarning("EMCAL branch in Digit Tree not found") ;
611 branch->SetAddress(&fDigitsArray) ;
612 branch->GetEntry(0) ;
618 //____________________________________________________________________________
619 void AliEMCALQADataMakerRec::MakeRecPoints(TTree * clustersTree)
621 // makes data from RecPoints
622 TBranch *emcbranch = clustersTree->GetBranch("EMCALECARP");
624 AliError("can't get the branch with the EMCAL clusters !");
628 TObjArray * emcrecpoints = new TObjArray(100) ;
629 emcbranch->SetAddress(&emcrecpoints);
630 emcbranch->GetEntry(0);
632 GetRecPointsData(kRecPM)->Fill(emcrecpoints->GetEntriesFast()) ;
633 TIter next(emcrecpoints) ;
634 AliEMCALRecPoint * rp ;
635 while ( (rp = dynamic_cast<AliEMCALRecPoint *>(next())) ) {
636 GetRecPointsData(kRecPE)->Fill( rp->GetEnergy()) ;
637 GetRecPointsData(kRecPDigM)->Fill(rp->GetMultiplicity());
639 emcrecpoints->Delete();
644 //____________________________________________________________________________
645 void AliEMCALQADataMakerRec::StartOfDetectorCycle()
647 //Detector specific actions at start of cycle
651 //____________________________________________________________________________
652 void AliEMCALQADataMakerRec::SetFittingAlgorithm(Int_t fitAlgo)
654 //Set fitting algorithm and initialize it if this same algorithm was not set before.
655 //printf("**** Set Algorithm , number %d ****\n",fitAlgo);
657 if(fitAlgo == fFittingAlgorithm && fRawAnalyzer) {
658 //Do nothing, this same algorithm already set before.
659 //printf("**** Algorithm already set before, number %d, %s ****\n",fitAlgo, fRawAnalyzer->GetName());
662 //Initialize the requested algorithm
663 if(fitAlgo != fFittingAlgorithm || !fRawAnalyzer) {
664 //printf("**** Init Algorithm , number %d ****\n",fitAlgo);
666 fFittingAlgorithm = fitAlgo;
667 if (fRawAnalyzer) delete fRawAnalyzer; // delete prev. analyzer if existed.
669 if (fitAlgo == kFastFit) {
670 fRawAnalyzer = new AliCaloRawAnalyzerFastFit();
672 else if (fitAlgo == kNeuralNet) {
673 fRawAnalyzer = new AliCaloRawAnalyzerNN();
675 else if (fitAlgo == kLMS) {
676 fRawAnalyzer = new AliCaloRawAnalyzerLMS();
678 else if (fitAlgo == kPeakFinder) {
679 fRawAnalyzer = new AliCaloRawAnalyzerPeakFinder();
681 else if (fitAlgo == kCrude) {
682 fRawAnalyzer = new AliCaloRawAnalyzerCrude();
685 AliWarning("EMCAL QA invalid fit algorithm choice") ;