]>
Commit | Line | Data |
---|---|---|
9e47432c | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | /* | |
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 | ||
38986b78 | 21 | Created one histogram for QA shifter;-- Yaxian Mao: 11/2009 |
9e47432c | 22 | The idea:average counts for all the towers should be flat |
23 | Change all existing histograms as experts | |
9e47432c | 24 | |
38986b78 | 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 | ||
9e47432c | 29 | */ |
30 | ||
31 | // --- ROOT system --- | |
32 | #include <TClonesArray.h> | |
33 | #include <TFile.h> | |
34 | #include <TH1F.h> | |
35 | #include <TH1I.h> | |
36 | #include <TH2F.h> | |
38986b78 | 37 | #include <TLine.h> |
38 | #include <TText.h> | |
9e47432c | 39 | #include <TProfile.h> |
38986b78 | 40 | #include <TStyle.h> |
9e47432c | 41 | // --- Standard library --- |
42 | ||
43 | ||
44 | // --- AliRoot header files --- | |
e03bcdd4 | 45 | #include "AliDAQ.h" |
9e47432c | 46 | #include "AliESDCaloCluster.h" |
47 | #include "AliESDCaloCells.h" | |
48 | #include "AliESDEvent.h" | |
49 | #include "AliLog.h" | |
50 | #include "AliEMCALQADataMakerRec.h" | |
51 | #include "AliQAChecker.h" | |
52 | #include "AliEMCALDigit.h" | |
53 | #include "AliEMCALRecPoint.h" | |
54 | #include "AliEMCALRawUtils.h" | |
55 | #include "AliEMCALReconstructor.h" | |
56 | #include "AliEMCALRecParam.h" | |
57 | #include "AliRawReader.h" | |
58 | #include "AliCaloRawStreamV3.h" | |
59 | #include "AliEMCALGeoParams.h" | |
def665cb | 60 | #include "AliRawEventHeaderBase.h" |
38986b78 | 61 | #include "AliQAManager.h" |
62 | #include "AliCDBEntry.h" | |
def665cb | 63 | |
64 | #include "AliCaloBunchInfo.h" | |
65 | #include "AliCaloFitResults.h" | |
66 | #include "AliCaloRawAnalyzerFastFit.h" | |
67 | #include "AliCaloRawAnalyzerNN.h" | |
9f966f11 | 68 | //#include "AliCaloRawAnalyzerLMS.h" |
69 | #include "AliCaloRawAnalyzerKStandard.h" | |
def665cb | 70 | #include "AliCaloRawAnalyzerPeakFinder.h" |
71 | #include "AliCaloRawAnalyzerCrude.h" | |
9e47432c | 72 | |
92d9f317 | 73 | #include "AliCaloRawAnalyzerFactory.h" |
74 | ||
ce95bae9 | 75 | using namespace std; |
76 | ||
9e47432c | 77 | ClassImp(AliEMCALQADataMakerRec) |
78 | ||
79 | //____________________________________________________________________________ | |
def665cb | 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), | |
707805fc | 85 | fSuperModules(10), // FIXME!!! number of SuperModules; 10 for 2011; update default for later runs |
def665cb | 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), | |
38986b78 | 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 | ||
def665cb | 108 | { |
9e47432c | 109 | // ctor |
def665cb | 110 | SetFittingAlgorithm(fitAlgo); |
92d9f317 | 111 | |
112 | //fRawAnalyzerTRU = new AliCaloRawAnalyzerLMS(); | |
113 | ||
9f966f11 | 114 | fRawAnalyzerTRU = ( AliCaloRawAnalyzerKStandard*)AliCaloRawAnalyzerFactory::CreateAnalyzer(kLMS); |
92d9f317 | 115 | |
def665cb | 116 | fRawAnalyzerTRU->SetFixTau(kTRUE); |
117 | fRawAnalyzerTRU->SetTau(2.5); // default for TRU shaper | |
38986b78 | 118 | // for (Int_t sm = 0 ; sm < fSuperModules ; sm++){ |
119 | // fTextSM[sm] = NULL ; | |
120 | // } | |
9e47432c | 121 | } |
122 | ||
123 | //____________________________________________________________________________ | |
124 | AliEMCALQADataMakerRec::AliEMCALQADataMakerRec(const AliEMCALQADataMakerRec& qadm) : | |
125 | AliQADataMakerRec(), | |
def665cb | 126 | fFittingAlgorithm(0), |
127 | fRawAnalyzer(0), | |
128 | fRawAnalyzerTRU(0), | |
9e47432c | 129 | fSuperModules(qadm.GetSuperModules()), |
130 | fFirstPedestalSample(qadm.GetFirstPedestalSample()), | |
131 | fLastPedestalSample(qadm.GetLastPedestalSample()), | |
def665cb | 132 | fFirstPedestalSampleTRU(qadm.GetFirstPedestalSampleTRU()), |
133 | fLastPedestalSampleTRU(qadm.GetLastPedestalSampleTRU()), | |
134 | fMinSignalLG(qadm.GetMinSignalLG()), | |
135 | fMaxSignalLG(qadm.GetMaxSignalLG()), | |
9e47432c | 136 | fMinSignalHG(qadm.GetMinSignalHG()), |
def665cb | 137 | fMaxSignalHG(qadm.GetMaxSignalHG()), |
138 | fMinSignalTRU(qadm.GetMinSignalTRU()), | |
139 | fMaxSignalTRU(qadm.GetMaxSignalTRU()), | |
140 | fMinSignalLGLEDMon(qadm.GetMinSignalLGLEDMon()), | |
141 | fMaxSignalLGLEDMon(qadm.GetMaxSignalLGLEDMon()), | |
142 | fMinSignalHGLEDMon(qadm.GetMinSignalHGLEDMon()), | |
38986b78 | 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) | |
9e47432c | 151 | { |
152 | //copy ctor | |
153 | SetName((const char*)qadm.GetName()) ; | |
154 | SetTitle((const char*)qadm.GetTitle()); | |
def665cb | 155 | SetFittingAlgorithm(qadm.GetFittingAlgorithm()); |
92d9f317 | 156 | |
157 | //fRawAnalyzerTRU = new AliCaloRawAnalyzerLMS(); | |
9f966f11 | 158 | fRawAnalyzerTRU = (AliCaloRawAnalyzerKStandard*)AliCaloRawAnalyzerFactory::CreateAnalyzer(kLMS); |
def665cb | 159 | fRawAnalyzerTRU->SetFixTau(kTRUE); |
160 | fRawAnalyzerTRU->SetTau(2.5); // default for TRU shaper | |
38986b78 | 161 | // for (Int_t sm = 0 ; sm < fSuperModules ; sm++){ |
162 | // fTextSM[sm] = qadm.fTextSM[sm] ; | |
163 | // } | |
9e47432c | 164 | } |
165 | ||
166 | //__________________________________________________________________ | |
167 | AliEMCALQADataMakerRec& AliEMCALQADataMakerRec::operator = (const AliEMCALQADataMakerRec& qadm ) | |
168 | { | |
169 | // Equal operator. | |
170 | this->~AliEMCALQADataMakerRec(); | |
171 | new(this) AliEMCALQADataMakerRec(qadm); | |
38986b78 | 172 | // fLineCol = NULL; |
173 | // fLineRow = NULL; | |
174 | // for (Int_t sm = 0 ; sm < fSuperModules ; sm++){ | |
175 | // fTextSM[sm] = qadm.fTextSM[sm] ; | |
176 | // } | |
9e47432c | 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 | |
92664bc8 | 189 | ResetEventTrigClasses(); // reset triggers list to select all histos |
9e47432c | 190 | AliQAChecker::Instance()->Run(AliQAv1::kEMCAL, task, list) ; |
191 | } | |
192 | ||
38986b78 | 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 | } | |
9e47432c | 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) ; | |
92664bc8 | 268 | // |
269 | ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line | |
9e47432c | 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) ; | |
92664bc8 | 285 | // |
286 | ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line | |
9e47432c | 287 | } |
288 | ||
289 | //____________________________________________________________________________ | |
290 | void AliEMCALQADataMakerRec::InitRecPoints() | |
291 | { | |
38986b78 | 292 | // create Reconstructed PoInt_ts histograms in RecPoints subdir |
9e47432c | 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); | |
92664bc8 | 307 | // |
308 | ClonePerTrigClass(AliQAv1::kRECPOINTS); // this should be the last line | |
9e47432c | 309 | } |
310 | ||
311 | //____________________________________________________________________________ | |
312 | void AliEMCALQADataMakerRec::InitRaws() | |
313 | { | |
314 | // create Raws histograms in Raws subdir | |
1557b01a | 315 | const Bool_t expert = kTRUE ; |
316 | const Bool_t saveCorr = kTRUE ; | |
317 | const Bool_t image = kTRUE ; | |
318 | const Option_t *profileOption = "s"; | |
9e47432c | 319 | |
38986b78 | 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 | |
922017a7 | 322 | |
1557b01a | 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; | |
38986b78 | 327 | |
328 | // counter info: number of channels per event (bins are SM index) | |
9e47432c | 329 | TProfile * h0 = new TProfile("hLowEmcalSupermodules", "Low Gain EMC: # of towers vs SuperMod;SM Id;# of towers", |
1557b01a | 330 | fSuperModules, -0.5, fSuperModules-0.5, profileOption) ; |
00957c37 | 331 | Add2RawsList(h0, kNsmodLG, expert, !image, !saveCorr) ; |
9e47432c | 332 | TProfile * h1 = new TProfile("hHighEmcalSupermodules", "High Gain EMC: # of towers vs SuperMod;SM Id;# of towers", |
1557b01a | 333 | fSuperModules, -0.5, fSuperModules-0.5, profileOption) ; |
00957c37 | 334 | Add2RawsList(h1, kNsmodHG, expert, !image, !saveCorr) ; |
9e47432c | 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]", | |
1557b01a | 338 | nTot, -0.5, nTot-0.5, profileOption) ; |
00957c37 | 339 | Add2RawsList(h2, kTimeLG, expert, !image, !saveCorr) ; |
9e47432c | 340 | TProfile * h3 = new TProfile("hHighEmcalRawtime", "High Gain EMC: Time at Max vs towerId;Tower Id;Time [ticks]", |
1557b01a | 341 | nTot, -0.5, nTot-0.5, profileOption) ; |
00957c37 | 342 | Add2RawsList(h3, kTimeHG, expert, !image, !saveCorr) ; |
9e47432c | 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]", | |
1557b01a | 346 | nTot, -0.5, nTot-0.5, profileOption) ; |
9e47432c | 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]", | |
1557b01a | 349 | nTot, -0.5, nTot-0.5, profileOption) ; |
9e47432c | 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() ; | |
00957c37 | 355 | Add2RawsList(h6, kNtotLG, expert, !image, !saveCorr) ; |
9e47432c | 356 | TH1I * h7 = new TH1I("hHighNtot", "High Gain EMC: Total Number of found towers;# of Towers;Counts", 200,0, nTot) ; |
357 | h7->Sumw2() ; | |
00957c37 | 358 | Add2RawsList(h7, kNtotHG, expert, !image, !saveCorr) ; |
9e47432c | 359 | |
360 | // pedestal (bins are towers) | |
361 | TProfile * h8 = new TProfile("hLowEmcalRawPed", "Low Gain EMC: Pedestal vs towerId;Tower Id;Pedestal [ADC counts]", | |
1557b01a | 362 | nTot, -0.5, nTot-0.5, profileOption) ; |
00957c37 | 363 | Add2RawsList(h8, kPedLG, expert, !image, !saveCorr) ; |
9e47432c | 364 | TProfile * h9 = new TProfile("hHighEmcalRawPed", "High Gain EMC: Pedestal vs towerId;Tower Id;Pedestal [ADC counts]", |
1557b01a | 365 | nTot, -0.5, nTot-0.5, profileOption) ; |
00957c37 | 366 | Add2RawsList(h9, kPedHG, expert, !image, !saveCorr) ; |
9e47432c | 367 | |
38986b78 | 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); | |
f05c8877 | 370 | fHighEmcHistoH2F->SetDirectory(0) ; // this histo must be memory resident |
38986b78 | 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}"); | |
00957c37 | 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); | |
38986b78 | 385 | Add2RawsList(h15, k2DRatioAmp, !expert, image, !saveCorr) ; |
386 | ||
92664bc8 | 387 | TH1F * h16 = new TH1F("hRatioDist", "Amplitude_{current run}/Amplitude_{reference run} ratio distribution", nTot, 0., 2.); |
00957c37 | 388 | h16->SetMinimum(0.1); |
389 | h16->SetMaximum(100.); | |
390 | gStyle->SetOptStat(0); | |
391 | h16->UseCurrentStyle(); | |
f05c8877 | 392 | h16->SetDirectory(0); |
38986b78 | 393 | Add2RawsList(h16, kRatioDist, !expert, image, !saveCorr) ; |
394 | ||
9e47432c | 395 | // now repeat the same for TRU and LEDMon data |
38986b78 | 396 | Int_t nTot2x2 = fSuperModules * AliEMCALGeoParams::fgkEMCALTRUsPerSM * AliEMCALGeoParams::fgkEMCAL2x2PerTRU; // max number of TRU channels for all SuperModules |
9e47432c | 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", | |
1557b01a | 400 | fSuperModules, -0.5, fSuperModules-0.5, profileOption) ; |
00957c37 | 401 | Add2RawsList(hT0, kNsmodTRU, expert, !image, !saveCorr) ; |
9e47432c | 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]", | |
1557b01a | 405 | nTot2x2, -0.5, nTot2x2-0.5, profileOption) ; |
00957c37 | 406 | Add2RawsList(hT1, kTimeTRU, expert, !image, !saveCorr) ; |
9e47432c | 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]", | |
1557b01a | 410 | nTot2x2, -0.5, nTot2x2-0.5, profileOption) ; |
00957c37 | 411 | Add2RawsList(hT2, kSigTRU, expert, !image, !saveCorr) ; |
9e47432c | 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() ; | |
00957c37 | 416 | Add2RawsList(hT3, kNtotTRU, expert, !image, !saveCorr) ; |
9e47432c | 417 | |
418 | // pedestal (bins are TRU channels) | |
419 | TProfile * hT4 = new TProfile("hTRUEmcalRawPed", "TRU EMC: Pedestal vs 2x2Id;2x2 Id;Pedestal [ADC counts]", | |
1557b01a | 420 | nTot2x2, -0.5, nTot2x2-0.5, profileOption) ; |
00957c37 | 421 | Add2RawsList(hT4, kPedTRU, expert, !image, !saveCorr) ; |
9e47432c | 422 | |
5c6517c3 | 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(); | |
00957c37 | 426 | Add2RawsList(hT5, kNL0TRU, expert, !image, !saveCorr); |
5c6517c3 | 427 | |
428 | // L0 trigger hits: average time (bins are TRU channels) | |
1557b01a | 429 | TProfile * hT6 = new TProfile("hTRUEmcalL0hitsAvgTime", "L0 trigger hits: average time bin", nTot2x2, -0.5, nTot2x2, profileOption); |
00957c37 | 430 | Add2RawsList(hT6, kTimeL0TRU, expert, !image, !saveCorr); |
5c6517c3 | 431 | |
9e47432c | 432 | // and also LED Mon.. |
433 | // LEDMon has both high and low gain channels, just as regular FEE/towers | |
38986b78 | 434 | Int_t nTotLEDMon = fSuperModules * AliEMCALGeoParams::fgkEMCALLEDRefs; // max number of LEDMon channels for all SuperModules |
9e47432c | 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", | |
1557b01a | 438 | fSuperModules, -0.5, fSuperModules-0.5, profileOption) ; |
00957c37 | 439 | Add2RawsList(hL0, kNsmodLGLEDMon, expert, !image, !saveCorr) ; |
9e47432c | 440 | TProfile * hL1 = new TProfile("hHighLEDMonEmcalSupermodules", "HighLEDMon Gain EMC: # of strips vs SuperMod;SM Id;# of strips", |
1557b01a | 441 | fSuperModules, -0.5, fSuperModules-0.5, profileOption) ; |
00957c37 | 442 | Add2RawsList(hL1, kNsmodHGLEDMon, expert, !image, !saveCorr) ; |
9e47432c | 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]", | |
1557b01a | 446 | nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ; |
00957c37 | 447 | Add2RawsList(hL2, kTimeLGLEDMon, expert, !image, !saveCorr) ; |
9e47432c | 448 | TProfile * hL3 = new TProfile("hHighLEDMonEmcalRawtime", "HighLEDMon Gain EMC: Time at Max vs stripId;Strip Id;Time [ticks]", |
1557b01a | 449 | nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ; |
00957c37 | 450 | Add2RawsList(hL3, kTimeHGLEDMon, expert, !image, !saveCorr) ; |
9e47432c | 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]", | |
1557b01a | 454 | nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ; |
00957c37 | 455 | Add2RawsList(hL4, kSigLGLEDMon, expert, !image, !saveCorr) ; |
9e47432c | 456 | TProfile * hL5 = new TProfile("hHighLEDMonEmcalRawMaxMinusMin", "HighLEDMon Gain EMC: Max - Min vs stripId;Strip Id;Max-Min [ADC counts]", |
1557b01a | 457 | nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ; |
00957c37 | 458 | Add2RawsList(hL5, kSigHGLEDMon, expert, !image, !saveCorr) ; |
38986b78 | 459 | |
460 | // total counter: channels per event | |
9e47432c | 461 | TH1I * hL6 = new TH1I("hLowLEDMonNtot", "LowLEDMon Gain EMC: Total Number of found strips;# of Strips;Counts", 200, 0, nTotLEDMon) ; |
462 | hL6->Sumw2() ; | |
00957c37 | 463 | Add2RawsList(hL6, kNtotLGLEDMon, expert, !image, !saveCorr) ; |
9e47432c | 464 | TH1I * hL7 = new TH1I("hHighLEDMonNtot", "HighLEDMon Gain EMC: Total Number of found strips;# of Strips;Counts", 200,0, nTotLEDMon) ; |
465 | hL7->Sumw2() ; | |
00957c37 | 466 | Add2RawsList(hL7, kNtotHGLEDMon, expert, !image, !saveCorr) ; |
9e47432c | 467 | |
468 | // pedestal (bins are strips) | |
469 | TProfile * hL8 = new TProfile("hLowLEDMonEmcalRawPed", "LowLEDMon Gain EMC: Pedestal vs stripId;Strip Id;Pedestal [ADC counts]", | |
1557b01a | 470 | nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ; |
00957c37 | 471 | Add2RawsList(hL8, kPedLGLEDMon, expert, !image, !saveCorr) ; |
9e47432c | 472 | TProfile * hL9 = new TProfile("hHighLEDMonEmcalRawPed", "HighLEDMon Gain EMC: Pedestal vs stripId;Strip Id;Pedestal [ADC counts]", |
1557b01a | 473 | nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ; |
00957c37 | 474 | Add2RawsList(hL9, kPedHGLEDMon, expert, !image, !saveCorr) ; |
38986b78 | 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) ; | |
38986b78 | 479 | //settings for display in amore |
480 | hL10->SetTitle("Amplitude_{LEDMon current}/Amplitude_{LEDMon reference}"); | |
00957c37 | 481 | hL10->SetMaximum(2.0); |
482 | hL10->SetMinimum(0.1); | |
483 | gStyle->SetOptStat(0); | |
484 | hL10->UseCurrentStyle(); | |
485 | hL10->SetDirectory(0); | |
38986b78 | 486 | // hL10->SetOption("E"); |
00957c37 | 487 | Add2RawsList(hL10, kLEDMonRatio, !expert, image, !saveCorr) ; |
488 | ||
922017a7 | 489 | TH1F * hL11 = new TH1F("hMaxMinusMinLEDMonRatioDist", "LEDMon amplitude, Ratio distribution", nTotLEDMon, 0, 2); |
00957c37 | 490 | hL11->SetMinimum(0.1) ; |
00957c37 | 491 | gStyle->SetOptStat(0); |
492 | hL11->UseCurrentStyle(); | |
493 | hL11->SetDirectory(0); | |
38986b78 | 494 | Add2RawsList(hL11, kLEDMonRatioDist, !expert, image, !saveCorr) ; |
495 | ||
922017a7 | 496 | GetCalibRefFromOCDB(); |
92664bc8 | 497 | // |
498 | ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line | |
9e47432c | 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() ) { | |
92664bc8 | 510 | FillESDsData(kESDCaloClusE,clu->E()) ; |
9e47432c | 511 | nTot++ ; |
512 | } | |
513 | } | |
92664bc8 | 514 | FillESDsData(kESDCaloClusM,nTot) ; |
9e47432c | 515 | |
516 | //fill calo cells | |
517 | AliESDCaloCells* cells = esd->GetEMCALCells(); | |
92664bc8 | 518 | FillESDsData(kESDCaloCellM,cells->GetNumberOfCells()) ; |
9e47432c | 519 | |
520 | for ( Int_t index = 0; index < cells->GetNumberOfCells() ; index++ ) { | |
92664bc8 | 521 | FillESDsData(kESDCaloCellA,cells->GetAmplitude(index)) ; |
9e47432c | 522 | } |
92664bc8 | 523 | // |
524 | IncEvCountCycleESDs(); | |
525 | IncEvCountTotalESDs(); | |
9e47432c | 526 | } |
527 | ||
528 | //____________________________________________________________________________ | |
529 | void AliEMCALQADataMakerRec::MakeRaws(AliRawReader* rawReader) | |
530 | { | |
92664bc8 | 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 | |
922017a7 | 533 | if (!fCalibRefHistoPro || !fCalibRefHistoH2F || !fLEDMonRefHistoPro || !fHighEmcHistoH2F) { |
534 | InitRaws(); | |
535 | } | |
536 | ||
e03bcdd4 | 537 | // make sure EMCal was readout during the event |
538 | Int_t emcID = AliDAQ::DetectorID("EMCAL"); // bit 18.. | |
7b2c20bb | 539 | const UInt_t *detPattern = rawReader->GetDetectorPattern(); |
e03bcdd4 | 540 | UInt_t emcInReadout = ( ((1 << emcID) & detPattern[0]) >> emcID); |
38986b78 | 541 | if (! emcInReadout) return; // no poInt_t in looking at this event, if no EMCal data |
e03bcdd4 | 542 | |
def665cb | 543 | // setup |
9e47432c | 544 | rawReader->Reset() ; |
545 | AliCaloRawStreamV3 in(rawReader,"EMCAL"); | |
30aa89b0 | 546 | rawReader->Select("EMCAL", 0, AliEMCALGeoParams::fgkLastAltroDDL) ; //select EMCAL DDL's |
9e47432c | 547 | |
5c6517c3 | 548 | AliRecoParam::EventSpecie_t saveSpecie = fEventSpecie ; |
def665cb | 549 | if (rawReader->GetType() == AliRawEventHeaderBase::kCalibrationEvent) { |
550 | SetEventSpecie(AliRecoParam::kCalib) ; | |
551 | } | |
92664bc8 | 552 | |
38986b78 | 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; | |
9e47432c | 558 | |
9e47432c | 559 | // SM counters; decl. should be safe, assuming we don't get more than expected SuperModules.. |
38986b78 | 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 | |
def665cb | 568 | // start loop over input stream |
def665cb | 569 | while (in.NextDDL()) { |
38986b78 | 570 | Int_t iRCU = in.GetDDLNumber() % 2; // RCU0 or RCU1, within SuperModule |
dc16c015 | 571 | fRawAnalyzer->SetIsZeroSuppressed( in.GetZeroSupp() ); |
9e47432c | 572 | |
98d6fe2e | 573 | while (in.NextChannel()) { |
574 | iSM = in.GetModule(); // SuperModule | |
38986b78 | 575 | //prInt_tf("iSM %d DDL %d", iSM, in.GetDDLNumber()); |
98d6fe2e | 576 | if (iSM>=0 && iSM<fSuperModules) { // valid module reading |
9e47432c | 577 | |
38986b78 | 578 | Int_t nsamples = 0; |
def665cb | 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 | |
38986b78 | 586 | Float_t time = 0.; |
587 | Float_t amp = 0.; | |
def665cb | 588 | // indices for pedestal calc. |
38986b78 | 589 | Int_t firstPedSample = 0; |
590 | Int_t lastPedSample = 0; | |
591 | bool isTRUL0IdData = false; | |
def665cb | 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()); | |
38986b78 | 595 | amp = fitResults.GetAmp(); |
def665cb | 596 | time = fitResults.GetTof(); |
597 | firstPedSample = fFirstPedestalSample; | |
38986b78 | 598 | lastPedSample = fLastPedestalSample; |
9e47432c | 599 | } |
def665cb | 600 | else { // TRU data is special, needs its own analyzer |
601 | AliCaloFitResults fitResults = fRawAnalyzerTRU->Evaluate( bunchlist, in.GetAltroCFG1(), in.GetAltroCFG2()); | |
38986b78 | 602 | amp = fitResults.GetAmp(); |
def665cb | 603 | time = fitResults.GetTof(); |
604 | firstPedSample = fFirstPedestalSampleTRU; | |
38986b78 | 605 | lastPedSample = fLastPedestalSampleTRU; |
5c6517c3 | 606 | if (in.GetColumn() > n2x2PerTRU) { |
607 | isTRUL0IdData = true; | |
608 | } | |
def665cb | 609 | } |
610 | ||
611 | // pedestal samples | |
38986b78 | 612 | Int_t nPed = 0; |
613 | vector<Int_t> pedSamples; | |
9e47432c | 614 | |
def665cb | 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 | } | |
9e47432c | 624 | } |
625 | } | |
def665cb | 626 | |
627 | // check bunch for entries in the pedestal sample range | |
38986b78 | 628 | Int_t bunchLength = bunchlist.at(bunchIndex).GetLength(); |
def665cb | 629 | const UShort_t *sig = bunchlist.at(bunchIndex).GetData(); |
38986b78 | 630 | Int_t timebin = 0; |
5c6517c3 | 631 | |
632 | if (! isTRUL0IdData) { // regular data, can look at pedestals | |
38986b78 | 633 | for (Int_t i = 0; i<bunchLength; i++) { |
5c6517c3 | 634 | timebin = startBin--; |
635 | if ( firstPedSample<=timebin && timebin<=lastPedSample ) { | |
636 | pedSamples.push_back( sig[i] ); | |
637 | nPed++; | |
638 | } | |
639 | } // i | |
5c6517c3 | 640 | } |
641 | else { // TRU L0 Id Data | |
642 | // which TRU the channel belongs to? | |
38986b78 | 643 | Int_t iTRUId = in.GetModule()*3 + (iRCU*in.GetBranch() + iRCU); |
5c6517c3 | 644 | |
38986b78 | 645 | for (Int_t i = 0; i< bunchLength; i++) { |
646 | for( Int_t j = 0; j < nTRUL0ChannelBits; j++ ){ | |
5c6517c3 | 647 | // check if the bit j is 1 |
648 | if( (sig[i] & ( 1 << j )) > 0 ){ | |
38986b78 | 649 | Int_t iTRUIdInSM = (in.GetColumn() - n2x2PerTRU)*nTRUL0ChannelBits+j; |
ce95bae9 | 650 | if(iTRUIdInSM < n2x2PerTRU) { |
38986b78 | 651 | Int_t iTRUAbsId = iTRUIdInSM + n2x2PerTRU * iTRUId; |
5c6517c3 | 652 | // Fill the histograms |
92664bc8 | 653 | FillRawsData(kNL0TRU,iTRUAbsId); |
654 | FillRawsData(kTimeL0TRU,iTRUAbsId, startBin); | |
5c6517c3 | 655 | } |
656 | } | |
657 | } | |
658 | startBin--; | |
659 | } // i | |
660 | } // TRU L0 Id data | |
def665cb | 661 | |
662 | // fill histograms | |
663 | if ( in.IsLowGain() || in.IsHighGain() ) { // regular towers | |
38986b78 | 664 | Int_t towerId = iSM*nTowersPerSM + in.GetColumn()*nRows + in.GetRow(); |
def665cb | 665 | if ( in.IsLowGain() ) { |
666 | nTotalSMLG[iSM]++; | |
def665cb | 667 | if ( (amp > fMinSignalLG) && (amp < fMaxSignalLG) ) { |
92664bc8 | 668 | FillRawsData(kSigLG,towerId, amp); |
669 | FillRawsData(kTimeLG,towerId, time); | |
def665cb | 670 | } |
671 | if (nPed > 0) { | |
38986b78 | 672 | for (Int_t i=0; i<nPed; i++) { |
92664bc8 | 673 | FillRawsData(kPedLG,towerId, pedSamples[i]); |
def665cb | 674 | } |
675 | } | |
676 | } // gain==0 | |
677 | else if ( in.IsHighGain() ) { | |
678 | nTotalSMHG[iSM]++; | |
def665cb | 679 | if ( (amp > fMinSignalHG) && (amp < fMaxSignalHG) ) { |
92664bc8 | 680 | FillRawsData(kSigHG,towerId, amp); |
681 | FillRawsData(kTimeHG,towerId, time); | |
def665cb | 682 | } |
683 | if (nPed > 0) { | |
38986b78 | 684 | for (Int_t i=0; i<nPed; i++) { |
92664bc8 | 685 | FillRawsData(kPedHG,towerId, pedSamples[i]); |
def665cb | 686 | } |
687 | } | |
688 | } // gain==1 | |
689 | } // low or high gain | |
38986b78 | 690 | // TRU |
def665cb | 691 | else if ( in.IsTRUData() && in.GetColumn()<AliEMCALGeoParams::fgkEMCAL2x2PerTRU) { |
38986b78 | 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 | |
def665cb | 695 | + in.GetColumn(); |
def665cb | 696 | nTotalSMTRU[iSM]++; |
697 | if ( (amp > fMinSignalTRU) && (amp < fMaxSignalTRU) ) { | |
92664bc8 | 698 | FillRawsData(kSigTRU,iTRU2x2Id, amp); |
699 | FillRawsData(kTimeTRU,iTRU2x2Id, time); | |
9e47432c | 700 | } |
def665cb | 701 | if (nPed > 0) { |
38986b78 | 702 | for (Int_t i=0; i<nPed; i++) { |
92664bc8 | 703 | FillRawsData(kPedTRU,iTRU2x2Id, pedSamples[i]); |
def665cb | 704 | } |
9e47432c | 705 | } |
def665cb | 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.. | |
38986b78 | 711 | Int_t gain = in.GetRow(); |
712 | Int_t stripId = iSM*nStripsPerSM + in.GetColumn(); | |
def665cb | 713 | |
714 | if ( gain == 0 ) { | |
715 | nTotalSMLGLEDMon[iSM]++; | |
5df32a1d | 716 | if ( (amp > fMinSignalLGLEDMon) && (amp < fMaxSignalLGLEDMon) ) { |
92664bc8 | 717 | FillRawsData(kSigLGLEDMon,stripId, amp); |
718 | FillRawsData(kTimeLGLEDMon,stripId, time); | |
def665cb | 719 | } |
720 | if (nPed > 0) { | |
38986b78 | 721 | for (Int_t i=0; i<nPed; i++) { |
92664bc8 | 722 | FillRawsData(kPedLGLEDMon,stripId, pedSamples[i]); |
def665cb | 723 | } |
724 | } | |
725 | } // gain==0 | |
726 | else if ( gain == 1 ) { | |
727 | nTotalSMHGLEDMon[iSM]++; | |
728 | if ( (amp > fMinSignalHGLEDMon) && (amp < fMaxSignalHGLEDMon) ) { | |
92664bc8 | 729 | FillRawsData(kSigHGLEDMon,stripId, amp); |
730 | FillRawsData(kTimeHGLEDMon,stripId, time); | |
def665cb | 731 | } |
732 | if (nPed > 0) { | |
38986b78 | 733 | for (Int_t i=0; i<nPed; i++) { |
92664bc8 | 734 | FillRawsData(kPedHGLEDMon,stripId, pedSamples[i]); |
def665cb | 735 | } |
736 | } | |
737 | } // low or high gain | |
738 | } // LEDMon | |
739 | ||
740 | } // SM index OK | |
9e47432c | 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 | ||
00957c37 | 747 | |
38986b78 | 748 | //calculate the ratio of the amplitude and fill the histograms, only if the events type is Calib |
92664bc8 | 749 | // RS: operation on the group of histos kSigHG,k2DRatioAmp,kRatioDist,kLEDMonRatio,kLEDMonRatio,kSigLGLEDMon |
5df32a1d | 750 | const int hGrp[] = {kSigHG,k2DRatioAmp,kRatioDist,kLEDMonRatio,kLEDMonRatioDist,kSigLGLEDMon}; |
92664bc8 | 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); | |
5df32a1d | 794 | |
92664bc8 | 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 | } | |
c76d0f92 | 800 | else { // ref. run info is zero |
801 | binContent = -1; | |
802 | relativeErrorSqr = 1; | |
92664bc8 | 803 | } |
5df32a1d | 804 | thLEDMonRatio->SetBinContent(ib, binContent); |
92664bc8 | 805 | |
806 | binError = sqrt(relativeErrorSqr) * binContent; | |
807 | thLEDMonRatio->SetBinError(ib, binError); | |
808 | thLEDMonRatioDist->Fill(thLEDMonRatio->GetBinContent(ib)); | |
12ef6821 | 809 | } |
92664bc8 | 810 | } // loop over eventual trigger clones |
811 | } | |
9e47432c | 812 | // let's also fill the SM and event counter histograms |
38986b78 | 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; | |
1a78a765 | 818 | for (iSM=0; iSM<fSuperModules; iSM++) { |
9e47432c | 819 | nTotalLG += nTotalSMLG[iSM]; |
820 | nTotalHG += nTotalSMHG[iSM]; | |
821 | nTotalTRU += nTotalSMTRU[iSM]; | |
98d6fe2e | 822 | nTotalLGLEDMon += nTotalSMLGLEDMon[iSM]; |
823 | nTotalHGLEDMon += nTotalSMHGLEDMon[iSM]; | |
92664bc8 | 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]); | |
9e47432c | 829 | } |
5c6517c3 | 830 | |
92664bc8 | 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(); | |
def665cb | 839 | SetEventSpecie(saveSpecie) ; |
9e47432c | 840 | // just in case the next rawreader consumer forgets to reset; let's do it here again.. |
841 | rawReader->Reset() ; | |
92664bc8 | 842 | |
9e47432c | 843 | return; |
844 | } | |
845 | ||
846 | //____________________________________________________________________________ | |
847 | void AliEMCALQADataMakerRec::MakeDigits() | |
848 | { | |
849 | // makes data from Digits | |
92664bc8 | 850 | FillDigitsData(1,fDigitsArray->GetEntriesFast()) ; |
9e47432c | 851 | TIter next(fDigitsArray) ; |
852 | AliEMCALDigit * digit ; | |
853 | while ( (digit = dynamic_cast<AliEMCALDigit *>(next())) ) { | |
92664bc8 | 854 | FillDigitsData(0, digit->GetAmplitude()) ; |
9e47432c | 855 | } |
92664bc8 | 856 | // |
9e47432c | 857 | } |
858 | ||
859 | //____________________________________________________________________________ | |
860 | void AliEMCALQADataMakerRec::MakeDigits(TTree * digitTree) | |
861 | { | |
862 | // makes data from Digit Tree | |
92664bc8 | 863 | // RS: Attention: the counters are increments in the MakeDigits() |
9e47432c | 864 | if (fDigitsArray) |
e0dc3f7d | 865 | fDigitsArray->Clear("C") ; |
9e47432c | 866 | else |
867 | fDigitsArray = new TClonesArray("AliEMCALDigit", 1000) ; | |
868 | ||
869 | TBranch * branch = digitTree->GetBranch("EMCAL") ; | |
92664bc8 | 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 | // | |
9e47432c | 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 | ||
38986b78 | 891 | TObjArray * emcRecPoints = new TObjArray(100) ; |
892 | emcbranch->SetAddress(&emcRecPoints); | |
9e47432c | 893 | emcbranch->GetEntry(0); |
894 | ||
92664bc8 | 895 | FillRecPointsData(kRecPM,emcRecPoints->GetEntriesFast()) ; |
38986b78 | 896 | TIter next(emcRecPoints) ; |
9e47432c | 897 | AliEMCALRecPoint * rp ; |
898 | while ( (rp = dynamic_cast<AliEMCALRecPoint *>(next())) ) { | |
92664bc8 | 899 | FillRecPointsData(kRecPE,rp->GetEnergy()) ; |
900 | FillRecPointsData(kRecPDigM,rp->GetMultiplicity()); | |
9e47432c | 901 | } |
38986b78 | 902 | emcRecPoints->Delete(); |
903 | delete emcRecPoints; | |
92664bc8 | 904 | IncEvCountCycleRecPoints(); |
905 | IncEvCountTotalRecPoints(); | |
9e47432c | 906 | } |
907 | ||
908 | //____________________________________________________________________________ | |
909 | void AliEMCALQADataMakerRec::StartOfDetectorCycle() | |
910 | { | |
911 | //Detector specific actions at start of cycle | |
912 | ||
913 | } | |
914 | ||
def665cb | 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); | |
92d9f317 | 920 | |
921 | ||
430e7d8e | 922 | fRawAnalyzer = AliCaloRawAnalyzerFactory::CreateAnalyzer(fitAlgo); |
923 | fFittingAlgorithm = fitAlgo; | |
92d9f317 | 924 | |
925 | /* | |
def665cb | 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; | |
92d9f317 | 959 | */ |
def665cb | 960 | } |
961 | ||
38986b78 | 962 | //_____________________________________________________________________________________ |
963 | void AliEMCALQADataMakerRec::ConvertProfile2H(TProfile * p, TH2 * histo) | |
964 | { | |
922017a7 | 965 | // reset histogram |
966 | histo->Reset("ICE") ; | |
967 | histo->ResetStats(); | |
968 | ||
38986b78 | 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 | } |