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