]>
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) ; |
e4a4c62f | 347 | Add2RawsList(h4, kSigLG, expert, !image, !saveCorr) ; |
9e47432c | 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) ; |
e4a4c62f | 350 | Add2RawsList(h5, kSigHG, expert, !image, !saveCorr) ; |
9e47432c | 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 | |
9e47432c | 369 | // now repeat the same for TRU and LEDMon data |
38986b78 | 370 | Int_t nTot2x2 = fSuperModules * AliEMCALGeoParams::fgkEMCALTRUsPerSM * AliEMCALGeoParams::fgkEMCAL2x2PerTRU; // max number of TRU channels for all SuperModules |
9e47432c | 371 | |
372 | // counter info: number of channels per event (bins are SM index) | |
373 | TProfile * hT0 = new TProfile("hTRUEmcalSupermodules", "TRU EMC: # of TRU channels vs SuperMod;SM Id;# of TRU channels", | |
1557b01a | 374 | fSuperModules, -0.5, fSuperModules-0.5, profileOption) ; |
00957c37 | 375 | Add2RawsList(hT0, kNsmodTRU, expert, !image, !saveCorr) ; |
9e47432c | 376 | |
9e47432c | 377 | // how much above pedestal was the max sample? (bins are TRU channels) |
e4a4c62f | 378 | TProfile * hT1 = new TProfile("hTRUEmcalRawMaxMinusMin", "TRU EMC: Max - Min vs 2x2Id;2x2 Id;Max-Min [ADC counts]", |
1557b01a | 379 | nTot2x2, -0.5, nTot2x2-0.5, profileOption) ; |
e4a4c62f | 380 | Add2RawsList(hT1, kSigTRU, expert, !image, !saveCorr) ; |
9e47432c | 381 | |
382 | // total counter: channels per event | |
e4a4c62f | 383 | TH1I * hT2 = new TH1I("hTRUNtot", "TRU EMC: Total Number of found TRU channels;# of TRU Channels;Counts", 200, 0, nTot2x2) ; |
384 | hT2->Sumw2() ; | |
385 | Add2RawsList(hT2, kNtotTRU, expert, !image, !saveCorr) ; | |
9e47432c | 386 | |
5c6517c3 | 387 | // L0 trigger hits: # of hits (bins are TRU channels) |
e4a4c62f | 388 | TH1I * hT3 = new TH1I("hTRUEmcalL0hits", "L0 trigger hits: Total number of 2x2 L0 generated", nTot2x2, -0.5, nTot2x2); |
389 | hT3->Sumw2(); | |
390 | Add2RawsList(hT3, kNL0TRU, !expert, image, !saveCorr); | |
5c6517c3 | 391 | |
392 | // L0 trigger hits: average time (bins are TRU channels) | |
e4a4c62f | 393 | TProfile * hT4 = new TProfile("hTRUEmcalL0hitsAvgTime", "L0 trigger hits: average time bin", nTot2x2, -0.5, nTot2x2, profileOption); |
394 | Add2RawsList(hT4, kTimeL0TRU, !expert, image, !saveCorr); | |
395 | ||
396 | // L0 trigger hits: first in the event (bins are TRU channels) | |
397 | TH1I * hT5 = new TH1I("hTRUEmcalL0hitsFirst", "L0 trigger hits: First hit in the event", nTot2x2, -0.5, nTot2x2); | |
398 | hT5->Sumw2(); | |
399 | Add2RawsList(hT5, kNL0FirstTRU, expert, !image, !saveCorr); | |
400 | ||
401 | // L0 trigger hits: average time of first hit in the event (bins are TRU channels) | |
402 | TProfile * hT6 = new TProfile("hTRUEmcalL0hitsFirstAvgTime", "L0 trigger hits: average time of first hit", nTot2x2, -0.5, nTot2x2, profileOption); | |
403 | Add2RawsList(hT6, kTimeL0FirstTRU, expert, !image, !saveCorr); | |
5c6517c3 | 404 | |
9e47432c | 405 | // and also LED Mon.. |
406 | // LEDMon has both high and low gain channels, just as regular FEE/towers | |
38986b78 | 407 | Int_t nTotLEDMon = fSuperModules * AliEMCALGeoParams::fgkEMCALLEDRefs; // max number of LEDMon channels for all SuperModules |
9e47432c | 408 | |
409 | // counter info: number of channels per event (bins are SM index) | |
410 | TProfile * hL0 = new TProfile("hLowLEDMonEmcalSupermodules", "LowLEDMon Gain EMC: # of strips vs SuperMod;SM Id;# of strips", | |
1557b01a | 411 | fSuperModules, -0.5, fSuperModules-0.5, profileOption) ; |
00957c37 | 412 | Add2RawsList(hL0, kNsmodLGLEDMon, expert, !image, !saveCorr) ; |
9e47432c | 413 | TProfile * hL1 = new TProfile("hHighLEDMonEmcalSupermodules", "HighLEDMon Gain EMC: # of strips vs SuperMod;SM Id;# of strips", |
1557b01a | 414 | fSuperModules, -0.5, fSuperModules-0.5, profileOption) ; |
00957c37 | 415 | Add2RawsList(hL1, kNsmodHGLEDMon, expert, !image, !saveCorr) ; |
9e47432c | 416 | |
417 | // where did max sample occur? (bins are strips) | |
418 | TProfile * hL2 = new TProfile("hLowLEDMonEmcalRawtime", "LowLEDMon Gain EMC: Time at Max vs stripId;Strip Id;Time [ticks]", | |
1557b01a | 419 | nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ; |
00957c37 | 420 | Add2RawsList(hL2, kTimeLGLEDMon, expert, !image, !saveCorr) ; |
9e47432c | 421 | TProfile * hL3 = new TProfile("hHighLEDMonEmcalRawtime", "HighLEDMon Gain EMC: Time at Max vs stripId;Strip Id;Time [ticks]", |
1557b01a | 422 | nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ; |
00957c37 | 423 | Add2RawsList(hL3, kTimeHGLEDMon, expert, !image, !saveCorr) ; |
9e47432c | 424 | |
425 | // how much above pedestal was the max sample? (bins are strips) | |
426 | TProfile * hL4 = new TProfile("hLowLEDMonEmcalRawMaxMinusMin", "LowLEDMon Gain EMC: Max - Min vs stripId;Strip Id;Max-Min [ADC counts]", | |
1557b01a | 427 | nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ; |
00957c37 | 428 | Add2RawsList(hL4, kSigLGLEDMon, expert, !image, !saveCorr) ; |
9e47432c | 429 | TProfile * hL5 = new TProfile("hHighLEDMonEmcalRawMaxMinusMin", "HighLEDMon Gain EMC: Max - Min vs stripId;Strip Id;Max-Min [ADC counts]", |
1557b01a | 430 | nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ; |
00957c37 | 431 | Add2RawsList(hL5, kSigHGLEDMon, expert, !image, !saveCorr) ; |
38986b78 | 432 | |
433 | // total counter: channels per event | |
9e47432c | 434 | TH1I * hL6 = new TH1I("hLowLEDMonNtot", "LowLEDMon Gain EMC: Total Number of found strips;# of Strips;Counts", 200, 0, nTotLEDMon) ; |
435 | hL6->Sumw2() ; | |
00957c37 | 436 | Add2RawsList(hL6, kNtotLGLEDMon, expert, !image, !saveCorr) ; |
9e47432c | 437 | TH1I * hL7 = new TH1I("hHighLEDMonNtot", "HighLEDMon Gain EMC: Total Number of found strips;# of Strips;Counts", 200,0, nTotLEDMon) ; |
438 | hL7->Sumw2() ; | |
00957c37 | 439 | Add2RawsList(hL7, kNtotHGLEDMon, expert, !image, !saveCorr) ; |
9e47432c | 440 | |
441 | // pedestal (bins are strips) | |
442 | TProfile * hL8 = new TProfile("hLowLEDMonEmcalRawPed", "LowLEDMon Gain EMC: Pedestal vs stripId;Strip Id;Pedestal [ADC counts]", | |
1557b01a | 443 | nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ; |
00957c37 | 444 | Add2RawsList(hL8, kPedLGLEDMon, expert, !image, !saveCorr) ; |
9e47432c | 445 | TProfile * hL9 = new TProfile("hHighLEDMonEmcalRawPed", "HighLEDMon Gain EMC: Pedestal vs stripId;Strip Id;Pedestal [ADC counts]", |
1557b01a | 446 | nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ; |
00957c37 | 447 | Add2RawsList(hL9, kPedHGLEDMon, expert, !image, !saveCorr) ; |
38986b78 | 448 | |
e4a4c62f | 449 | //temp 2D amplitude histogram for the current run |
450 | fHighEmcHistoH2F = new TH2F("h2DHighEC2", "High Gain EMC:Max - Min [ADC counts]", nbinsZ, -0.5 , nbinsZ-0.5, nbinsPhi, -0.5, nbinsPhi-0.5); | |
451 | fHighEmcHistoH2F->SetDirectory(0) ; // this histo must be memory resident | |
452 | //add ratio histograms: to comapre the current run with the reference data | |
453 | TH2F * h15 = new TH2F("h2DRatioAmp", "High Gain Ratio to Reference:Amplitude_{current run}/Amplitude_{reference run}", nbinsZ, -0.5 , nbinsZ-0.5, | |
454 | nbinsPhi, -0.5, nbinsPhi-0.5); | |
455 | //settings for display in amore | |
456 | h15->SetTitle("Amplitude_{current run}/Amplitude_{reference run}"); | |
457 | h15->SetMaximum(2.0); | |
458 | h15->SetMinimum(0.1); | |
459 | h15->SetOption("COLZ"); | |
460 | gStyle->SetOptStat(0); | |
461 | Int_t color[] = {4,3,2} ; | |
462 | gStyle->SetPalette(3,color); | |
463 | h15->GetZaxis()->SetNdivisions(3); | |
464 | h15->UseCurrentStyle(); | |
465 | h15->SetDirectory(0); | |
466 | Add2RawsList(h15, k2DRatioAmp, !expert, image, !saveCorr) ; | |
467 | ||
468 | TH1F * h16 = new TH1F("hRatioDist", "Amplitude_{current run}/Amplitude_{reference run} ratio distribution", nTot, 0., 2.); | |
469 | h16->SetMinimum(0.1); | |
470 | h16->SetMaximum(100.); | |
471 | gStyle->SetOptStat(0); | |
472 | h16->UseCurrentStyle(); | |
473 | h16->SetDirectory(0); | |
474 | Add2RawsList(h16, kRatioDist, !expert, image, !saveCorr) ; | |
475 | ||
38986b78 | 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) { |
e4a4c62f | 550 | SetEventSpecie(AliRecoParam::kCalib) ; |
def665cb | 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; | |
e4a4c62f | 558 | const Int_t nTot2x2 = fSuperModules * n2x2PerSM; // total TRU channels |
559 | ||
9e47432c | 560 | |
9e47432c | 561 | // SM counters; decl. should be safe, assuming we don't get more than expected SuperModules.. |
38986b78 | 562 | Int_t nTotalSMLG[AliEMCALGeoParams::fgkEMCALModules] = {0}; |
563 | Int_t nTotalSMHG[AliEMCALGeoParams::fgkEMCALModules] = {0}; | |
564 | Int_t nTotalSMTRU[AliEMCALGeoParams::fgkEMCALModules] = {0}; | |
565 | Int_t nTotalSMLGLEDMon[AliEMCALGeoParams::fgkEMCALModules] = {0}; | |
566 | Int_t nTotalSMHGLEDMon[AliEMCALGeoParams::fgkEMCALModules] = {0}; | |
567 | ||
568 | const Int_t nTRUL0ChannelBits = 10; // used for L0 trigger bits checks | |
e4a4c62f | 569 | int firstL0TimeBin = 999; |
570 | int triggers[nTot2x2][24]; //auxiliary array for L0 trigger - TODO remove hardcoded 24 | |
571 | memset(triggers, 0, sizeof(int) * 24 * nTot2x2); | |
572 | ||
38986b78 | 573 | Int_t iSM = 0; // SuperModule index |
def665cb | 574 | // start loop over input stream |
def665cb | 575 | while (in.NextDDL()) { |
38986b78 | 576 | Int_t iRCU = in.GetDDLNumber() % 2; // RCU0 or RCU1, within SuperModule |
dc16c015 | 577 | fRawAnalyzer->SetIsZeroSuppressed( in.GetZeroSupp() ); |
9e47432c | 578 | |
98d6fe2e | 579 | while (in.NextChannel()) { |
580 | iSM = in.GetModule(); // SuperModule | |
38986b78 | 581 | //prInt_tf("iSM %d DDL %d", iSM, in.GetDDLNumber()); |
98d6fe2e | 582 | if (iSM>=0 && iSM<fSuperModules) { // valid module reading |
9e47432c | 583 | |
38986b78 | 584 | Int_t nsamples = 0; |
def665cb | 585 | vector<AliCaloBunchInfo> bunchlist; |
586 | while (in.NextBunch()) { | |
587 | nsamples += in.GetBunchLength(); | |
588 | bunchlist.push_back( AliCaloBunchInfo(in.GetStartTimeBin(), in.GetBunchLength(), in.GetSignals() ) ); | |
589 | } | |
590 | ||
591 | if (nsamples > 0) { // this check is needed for when we have zero-supp. on, but not sparse readout | |
38986b78 | 592 | Float_t time = 0.; |
593 | Float_t amp = 0.; | |
def665cb | 594 | // indices for pedestal calc. |
38986b78 | 595 | Int_t firstPedSample = 0; |
596 | Int_t lastPedSample = 0; | |
597 | bool isTRUL0IdData = false; | |
def665cb | 598 | |
599 | if (! in.IsTRUData() ) { // high gain, low gain, LED Mon data - all have the same shaper/sampling | |
600 | AliCaloFitResults fitResults = fRawAnalyzer->Evaluate( bunchlist, in.GetAltroCFG1(), in.GetAltroCFG2()); | |
38986b78 | 601 | amp = fitResults.GetAmp(); |
def665cb | 602 | time = fitResults.GetTof(); |
603 | firstPedSample = fFirstPedestalSample; | |
38986b78 | 604 | lastPedSample = fLastPedestalSample; |
9e47432c | 605 | } |
def665cb | 606 | else { // TRU data is special, needs its own analyzer |
607 | AliCaloFitResults fitResults = fRawAnalyzerTRU->Evaluate( bunchlist, in.GetAltroCFG1(), in.GetAltroCFG2()); | |
38986b78 | 608 | amp = fitResults.GetAmp(); |
def665cb | 609 | time = fitResults.GetTof(); |
610 | firstPedSample = fFirstPedestalSampleTRU; | |
38986b78 | 611 | lastPedSample = fLastPedestalSampleTRU; |
e4a4c62f | 612 | if (in.GetColumn() >= n2x2PerTRU) { |
5c6517c3 | 613 | isTRUL0IdData = true; |
614 | } | |
def665cb | 615 | } |
616 | ||
617 | // pedestal samples | |
38986b78 | 618 | Int_t nPed = 0; |
619 | vector<Int_t> pedSamples; | |
9e47432c | 620 | |
def665cb | 621 | // select earliest bunch |
622 | unsigned int bunchIndex = 0; | |
623 | unsigned int startBin = bunchlist.at(0).GetStartBin(); | |
624 | if (bunchlist.size() > 0) { | |
625 | for(unsigned int ui=1; ui < bunchlist.size(); ui++ ) { | |
626 | if (startBin > bunchlist.at(ui).GetStartBin() ) { | |
627 | startBin = bunchlist.at(ui).GetStartBin(); | |
628 | bunchIndex = ui; | |
629 | } | |
9e47432c | 630 | } |
631 | } | |
def665cb | 632 | |
633 | // check bunch for entries in the pedestal sample range | |
38986b78 | 634 | Int_t bunchLength = bunchlist.at(bunchIndex).GetLength(); |
def665cb | 635 | const UShort_t *sig = bunchlist.at(bunchIndex).GetData(); |
38986b78 | 636 | Int_t timebin = 0; |
5c6517c3 | 637 | |
638 | if (! isTRUL0IdData) { // regular data, can look at pedestals | |
38986b78 | 639 | for (Int_t i = 0; i<bunchLength; i++) { |
5c6517c3 | 640 | timebin = startBin--; |
641 | if ( firstPedSample<=timebin && timebin<=lastPedSample ) { | |
642 | pedSamples.push_back( sig[i] ); | |
643 | nPed++; | |
644 | } | |
645 | } // i | |
5c6517c3 | 646 | } |
647 | else { // TRU L0 Id Data | |
648 | // which TRU the channel belongs to? | |
38986b78 | 649 | Int_t iTRUId = in.GetModule()*3 + (iRCU*in.GetBranch() + iRCU); |
5c6517c3 | 650 | |
38986b78 | 651 | for (Int_t i = 0; i< bunchLength; i++) { |
652 | for( Int_t j = 0; j < nTRUL0ChannelBits; j++ ){ | |
5c6517c3 | 653 | // check if the bit j is 1 |
654 | if( (sig[i] & ( 1 << j )) > 0 ){ | |
38986b78 | 655 | Int_t iTRUIdInSM = (in.GetColumn() - n2x2PerTRU)*nTRUL0ChannelBits+j; |
ce95bae9 | 656 | if(iTRUIdInSM < n2x2PerTRU) { |
38986b78 | 657 | Int_t iTRUAbsId = iTRUIdInSM + n2x2PerTRU * iTRUId; |
5c6517c3 | 658 | // Fill the histograms |
92664bc8 | 659 | FillRawsData(kNL0TRU,iTRUAbsId); |
660 | FillRawsData(kTimeL0TRU,iTRUAbsId, startBin); | |
e4a4c62f | 661 | triggers[iTRUAbsId][startBin] = 1; |
662 | ||
663 | if((int)startBin < firstL0TimeBin) firstL0TimeBin = startBin; | |
5c6517c3 | 664 | } |
665 | } | |
666 | } | |
667 | startBin--; | |
668 | } // i | |
669 | } // TRU L0 Id data | |
def665cb | 670 | |
671 | // fill histograms | |
672 | if ( in.IsLowGain() || in.IsHighGain() ) { // regular towers | |
38986b78 | 673 | Int_t towerId = iSM*nTowersPerSM + in.GetColumn()*nRows + in.GetRow(); |
def665cb | 674 | if ( in.IsLowGain() ) { |
675 | nTotalSMLG[iSM]++; | |
def665cb | 676 | if ( (amp > fMinSignalLG) && (amp < fMaxSignalLG) ) { |
92664bc8 | 677 | FillRawsData(kSigLG,towerId, amp); |
678 | FillRawsData(kTimeLG,towerId, time); | |
def665cb | 679 | } |
680 | if (nPed > 0) { | |
38986b78 | 681 | for (Int_t i=0; i<nPed; i++) { |
92664bc8 | 682 | FillRawsData(kPedLG,towerId, pedSamples[i]); |
def665cb | 683 | } |
684 | } | |
685 | } // gain==0 | |
686 | else if ( in.IsHighGain() ) { | |
687 | nTotalSMHG[iSM]++; | |
def665cb | 688 | if ( (amp > fMinSignalHG) && (amp < fMaxSignalHG) ) { |
92664bc8 | 689 | FillRawsData(kSigHG,towerId, amp); |
690 | FillRawsData(kTimeHG,towerId, time); | |
def665cb | 691 | } |
692 | if (nPed > 0) { | |
38986b78 | 693 | for (Int_t i=0; i<nPed; i++) { |
92664bc8 | 694 | FillRawsData(kPedHG,towerId, pedSamples[i]); |
def665cb | 695 | } |
696 | } | |
697 | } // gain==1 | |
698 | } // low or high gain | |
38986b78 | 699 | // TRU |
def665cb | 700 | else if ( in.IsTRUData() && in.GetColumn()<AliEMCALGeoParams::fgkEMCAL2x2PerTRU) { |
38986b78 | 701 | // for TRU data, the mapping class holds the TRU Int_ternal 2x2 number (0..95) in the Column var.. |
702 | Int_t iTRU = (iRCU*in.GetBranch() + iRCU); //TRU0 is from RCU0, TRU1 from RCU1, TRU2 is from branch B on RCU1 | |
703 | Int_t iTRU2x2Id = iSM*n2x2PerSM + iTRU*AliEMCALGeoParams::fgkEMCAL2x2PerTRU | |
def665cb | 704 | + in.GetColumn(); |
def665cb | 705 | nTotalSMTRU[iSM]++; |
706 | if ( (amp > fMinSignalTRU) && (amp < fMaxSignalTRU) ) { | |
92664bc8 | 707 | FillRawsData(kSigTRU,iTRU2x2Id, amp); |
e4a4c62f | 708 | //FillRawsData(kTimeTRU,iTRU2x2Id, time); |
9e47432c | 709 | } |
e4a4c62f | 710 | //if (nPed > 0) { |
711 | //for (Int_t i=0; i<nPed; i++) { | |
712 | //FillRawsData(kPedTRU,iTRU2x2Id, pedSamples[i]); | |
713 | //} | |
714 | //} | |
def665cb | 715 | } |
716 | // LED Mon | |
717 | else if ( in.IsLEDMonData() ) { | |
718 | // for LED Mon data, the mapping class holds the gain info in the Row variable | |
719 | // and the Strip number in the Column.. | |
38986b78 | 720 | Int_t gain = in.GetRow(); |
721 | Int_t stripId = iSM*nStripsPerSM + in.GetColumn(); | |
def665cb | 722 | |
723 | if ( gain == 0 ) { | |
724 | nTotalSMLGLEDMon[iSM]++; | |
5df32a1d | 725 | if ( (amp > fMinSignalLGLEDMon) && (amp < fMaxSignalLGLEDMon) ) { |
92664bc8 | 726 | FillRawsData(kSigLGLEDMon,stripId, amp); |
727 | FillRawsData(kTimeLGLEDMon,stripId, time); | |
def665cb | 728 | } |
729 | if (nPed > 0) { | |
38986b78 | 730 | for (Int_t i=0; i<nPed; i++) { |
92664bc8 | 731 | FillRawsData(kPedLGLEDMon,stripId, pedSamples[i]); |
def665cb | 732 | } |
733 | } | |
734 | } // gain==0 | |
735 | else if ( gain == 1 ) { | |
736 | nTotalSMHGLEDMon[iSM]++; | |
737 | if ( (amp > fMinSignalHGLEDMon) && (amp < fMaxSignalHGLEDMon) ) { | |
92664bc8 | 738 | FillRawsData(kSigHGLEDMon,stripId, amp); |
739 | FillRawsData(kTimeHGLEDMon,stripId, time); | |
def665cb | 740 | } |
741 | if (nPed > 0) { | |
38986b78 | 742 | for (Int_t i=0; i<nPed; i++) { |
92664bc8 | 743 | FillRawsData(kPedHGLEDMon,stripId, pedSamples[i]); |
def665cb | 744 | } |
745 | } | |
746 | } // low or high gain | |
747 | } // LEDMon | |
748 | ||
749 | } // SM index OK | |
9e47432c | 750 | |
751 | } // nsamples>0 check, some data found for this channel; not only trailer/header | |
752 | }// end while over channel | |
753 | ||
754 | }//end while over DDL's, of input stream | |
e4a4c62f | 755 | //filling some L0 trigger histos |
756 | if( firstL0TimeBin < 999 ){ | |
757 | for(Int_t i = 0; i < nTot2x2; i++) { | |
758 | if( triggers[i][firstL0TimeBin] > 0 ) { | |
759 | //histo->Fill(i,j); | |
760 | FillRawsData(kNL0FirstTRU, i); | |
761 | FillRawsData(kTimeL0FirstTRU, i, firstL0TimeBin); | |
762 | } | |
763 | } | |
764 | } | |
00957c37 | 765 | |
38986b78 | 766 | //calculate the ratio of the amplitude and fill the histograms, only if the events type is Calib |
92664bc8 | 767 | // RS: operation on the group of histos kSigHG,k2DRatioAmp,kRatioDist,kLEDMonRatio,kLEDMonRatio,kSigLGLEDMon |
5df32a1d | 768 | const int hGrp[] = {kSigHG,k2DRatioAmp,kRatioDist,kLEDMonRatio,kLEDMonRatioDist,kSigLGLEDMon}; |
92664bc8 | 769 | if ( rawReader->GetType() == AliRawEventHeaderBase::kCalibrationEvent && |
770 | CheckCloningConsistency(fRawsQAList, hGrp, sizeof(hGrp)/sizeof(int)) ) { // RS converting original code to loop over all matching triggers | |
771 | int nTrig =IsClonedPerTrigClass(kSigHG,fRawsQAList) ? GetNEventTrigClasses() : 0; // loop over triggers only if histos were cloned | |
772 | // | |
773 | for (int itr=-1;itr<nTrig;itr++) { // start from -1 to acknowledge original histos if they were kept | |
774 | TObjArray* trArr = GetMatchingRawsHistosSet(hGrp, sizeof(hGrp)/sizeof(int) ,itr); | |
775 | if (!trArr) continue; // no histos for current trigger | |
776 | // | |
777 | Double_t binContent = 0.; | |
778 | TProfile* prSigHG = (TProfile *)trArr->At(0); //kSigHG | |
779 | TH1* th2DRatioAmp = (TH1*) trArr->At(1); //k2DRatioAmp | |
780 | TH1* thRatioDist = (TH1*) trArr->At(2); //kRatioDist | |
781 | TH1* thLEDMonRatio = (TH1*) trArr->At(3); //kLEDMonRatio | |
782 | TH1* thLEDMonRatioDist = (TH1*) trArr->At(4); //kLEDMonRatio | |
783 | TH1* hSigLGLEDMon = (TH1*) trArr->At(5); //kSigLGLEDMon | |
784 | th2DRatioAmp->Reset("ICE"); | |
785 | thRatioDist->Reset("ICE"); | |
786 | thLEDMonRatio->Reset("ICE"); | |
787 | thLEDMonRatioDist->Reset("ICE"); | |
788 | th2DRatioAmp->ResetStats(); | |
789 | thRatioDist->ResetStats(); | |
790 | thLEDMonRatio->ResetStats(); | |
791 | thLEDMonRatioDist->ResetStats(); | |
792 | ConvertProfile2H(prSigHG, fHighEmcHistoH2F); | |
793 | // | |
794 | for(Int_t ix = 1; ix <= fHighEmcHistoH2F->GetNbinsX(); ix++) { | |
795 | for(Int_t iy = 1; iy <= fHighEmcHistoH2F->GetNbinsY(); iy++) { | |
796 | if(fCalibRefHistoH2F->GetBinContent(ix, iy)) | |
797 | binContent = fHighEmcHistoH2F->GetBinContent(ix, iy)/fCalibRefHistoH2F->GetBinContent(ix, iy); | |
798 | th2DRatioAmp->SetBinContent(ix, iy, binContent); | |
799 | thRatioDist->Fill(binContent); | |
800 | } | |
801 | } | |
802 | // | |
803 | //Now for LED monitor system, to calculate the ratio as well | |
804 | Double_t binError = 0. ; | |
805 | // for the binError, we add the relative errors, squared | |
806 | Double_t relativeErrorSqr = 0. ; | |
807 | // | |
808 | for(int ib = 1; ib <= fLEDMonRefHistoPro->GetNbinsX(); ib++) { | |
809 | // | |
810 | if(fLEDMonRefHistoPro->GetBinContent(ib) != 0) { | |
811 | binContent = hSigLGLEDMon->GetBinContent(ib) / fLEDMonRefHistoPro->GetBinContent(ib); | |
5df32a1d | 812 | |
92664bc8 | 813 | relativeErrorSqr = TMath::Power( (fLEDMonRefHistoPro->GetBinError(ib) / fLEDMonRefHistoPro->GetBinContent(ib)), 2); |
814 | if( hSigLGLEDMon->GetBinContent(ib) != 0) { | |
815 | relativeErrorSqr += TMath::Power( (hSigLGLEDMon->GetBinError(ib)/hSigLGLEDMon->GetBinContent(ib)), 2); | |
816 | } | |
817 | } | |
c76d0f92 | 818 | else { // ref. run info is zero |
819 | binContent = -1; | |
820 | relativeErrorSqr = 1; | |
92664bc8 | 821 | } |
5df32a1d | 822 | thLEDMonRatio->SetBinContent(ib, binContent); |
92664bc8 | 823 | |
824 | binError = sqrt(relativeErrorSqr) * binContent; | |
825 | thLEDMonRatio->SetBinError(ib, binError); | |
826 | thLEDMonRatioDist->Fill(thLEDMonRatio->GetBinContent(ib)); | |
12ef6821 | 827 | } |
92664bc8 | 828 | } // loop over eventual trigger clones |
829 | } | |
9e47432c | 830 | // let's also fill the SM and event counter histograms |
38986b78 | 831 | Int_t nTotalHG = 0; |
832 | Int_t nTotalLG = 0; | |
833 | Int_t nTotalTRU = 0; | |
834 | Int_t nTotalHGLEDMon = 0; | |
835 | Int_t nTotalLGLEDMon = 0; | |
1a78a765 | 836 | for (iSM=0; iSM<fSuperModules; iSM++) { |
9e47432c | 837 | nTotalLG += nTotalSMLG[iSM]; |
838 | nTotalHG += nTotalSMHG[iSM]; | |
839 | nTotalTRU += nTotalSMTRU[iSM]; | |
98d6fe2e | 840 | nTotalLGLEDMon += nTotalSMLGLEDMon[iSM]; |
841 | nTotalHGLEDMon += nTotalSMHGLEDMon[iSM]; | |
92664bc8 | 842 | FillRawsData(kNsmodLG,iSM, nTotalSMLG[iSM]); |
843 | FillRawsData(kNsmodHG,iSM, nTotalSMHG[iSM]); | |
844 | FillRawsData(kNsmodTRU,iSM, nTotalSMTRU[iSM]); | |
845 | FillRawsData(kNsmodLGLEDMon,iSM, nTotalSMLGLEDMon[iSM]); | |
846 | FillRawsData(kNsmodHGLEDMon,iSM, nTotalSMHGLEDMon[iSM]); | |
9e47432c | 847 | } |
5c6517c3 | 848 | |
92664bc8 | 849 | FillRawsData(kNtotLG,nTotalLG); |
850 | FillRawsData(kNtotHG,nTotalHG); | |
851 | FillRawsData(kNtotTRU,nTotalTRU); | |
852 | FillRawsData(kNtotLGLEDMon,nTotalLGLEDMon); | |
853 | FillRawsData(kNtotHGLEDMon,nTotalHGLEDMon); | |
854 | ||
855 | IncEvCountCycleESDs(); | |
856 | IncEvCountTotalESDs(); | |
def665cb | 857 | SetEventSpecie(saveSpecie) ; |
9e47432c | 858 | // just in case the next rawreader consumer forgets to reset; let's do it here again.. |
859 | rawReader->Reset() ; | |
92664bc8 | 860 | |
9e47432c | 861 | return; |
862 | } | |
863 | ||
864 | //____________________________________________________________________________ | |
865 | void AliEMCALQADataMakerRec::MakeDigits() | |
866 | { | |
867 | // makes data from Digits | |
92664bc8 | 868 | FillDigitsData(1,fDigitsArray->GetEntriesFast()) ; |
9e47432c | 869 | TIter next(fDigitsArray) ; |
870 | AliEMCALDigit * digit ; | |
871 | while ( (digit = dynamic_cast<AliEMCALDigit *>(next())) ) { | |
92664bc8 | 872 | FillDigitsData(0, digit->GetAmplitude()) ; |
9e47432c | 873 | } |
92664bc8 | 874 | // |
9e47432c | 875 | } |
876 | ||
877 | //____________________________________________________________________________ | |
878 | void AliEMCALQADataMakerRec::MakeDigits(TTree * digitTree) | |
879 | { | |
880 | // makes data from Digit Tree | |
92664bc8 | 881 | // RS: Attention: the counters are increments in the MakeDigits() |
9e47432c | 882 | if (fDigitsArray) |
e0dc3f7d | 883 | fDigitsArray->Clear("C") ; |
9e47432c | 884 | else |
885 | fDigitsArray = new TClonesArray("AliEMCALDigit", 1000) ; | |
886 | ||
887 | TBranch * branch = digitTree->GetBranch("EMCAL") ; | |
92664bc8 | 888 | if ( ! branch ) { AliWarning("EMCAL branch in Digit Tree not found"); return; } |
889 | // | |
890 | branch->SetAddress(&fDigitsArray) ; | |
891 | branch->GetEntry(0) ; | |
892 | MakeDigits() ; | |
893 | // | |
894 | IncEvCountCycleDigits(); | |
895 | IncEvCountTotalDigits(); | |
896 | // | |
9e47432c | 897 | } |
898 | ||
899 | //____________________________________________________________________________ | |
900 | void AliEMCALQADataMakerRec::MakeRecPoints(TTree * clustersTree) | |
901 | { | |
902 | // makes data from RecPoints | |
903 | TBranch *emcbranch = clustersTree->GetBranch("EMCALECARP"); | |
904 | if (!emcbranch) { | |
905 | AliError("can't get the branch with the EMCAL clusters !"); | |
906 | return; | |
907 | } | |
908 | ||
38986b78 | 909 | TObjArray * emcRecPoints = new TObjArray(100) ; |
910 | emcbranch->SetAddress(&emcRecPoints); | |
9e47432c | 911 | emcbranch->GetEntry(0); |
912 | ||
92664bc8 | 913 | FillRecPointsData(kRecPM,emcRecPoints->GetEntriesFast()) ; |
38986b78 | 914 | TIter next(emcRecPoints) ; |
9e47432c | 915 | AliEMCALRecPoint * rp ; |
916 | while ( (rp = dynamic_cast<AliEMCALRecPoint *>(next())) ) { | |
92664bc8 | 917 | FillRecPointsData(kRecPE,rp->GetEnergy()) ; |
918 | FillRecPointsData(kRecPDigM,rp->GetMultiplicity()); | |
9e47432c | 919 | } |
38986b78 | 920 | emcRecPoints->Delete(); |
921 | delete emcRecPoints; | |
92664bc8 | 922 | IncEvCountCycleRecPoints(); |
923 | IncEvCountTotalRecPoints(); | |
9e47432c | 924 | } |
925 | ||
926 | //____________________________________________________________________________ | |
927 | void AliEMCALQADataMakerRec::StartOfDetectorCycle() | |
928 | { | |
929 | //Detector specific actions at start of cycle | |
930 | ||
931 | } | |
932 | ||
def665cb | 933 | //____________________________________________________________________________ |
934 | void AliEMCALQADataMakerRec::SetFittingAlgorithm(Int_t fitAlgo) | |
935 | { | |
936 | //Set fitting algorithm and initialize it if this same algorithm was not set before. | |
937 | //printf("**** Set Algorithm , number %d ****\n",fitAlgo); | |
92d9f317 | 938 | |
939 | ||
430e7d8e | 940 | fRawAnalyzer = AliCaloRawAnalyzerFactory::CreateAnalyzer(fitAlgo); |
941 | fFittingAlgorithm = fitAlgo; | |
92d9f317 | 942 | |
943 | /* | |
def665cb | 944 | if(fitAlgo == fFittingAlgorithm && fRawAnalyzer) { |
945 | //Do nothing, this same algorithm already set before. | |
946 | //printf("**** Algorithm already set before, number %d, %s ****\n",fitAlgo, fRawAnalyzer->GetName()); | |
947 | return; | |
948 | } | |
949 | //Initialize the requested algorithm | |
950 | if(fitAlgo != fFittingAlgorithm || !fRawAnalyzer) { | |
951 | //printf("**** Init Algorithm , number %d ****\n",fitAlgo); | |
952 | ||
953 | fFittingAlgorithm = fitAlgo; | |
954 | if (fRawAnalyzer) delete fRawAnalyzer; // delete prev. analyzer if existed. | |
955 | ||
956 | if (fitAlgo == kFastFit) { | |
957 | fRawAnalyzer = new AliCaloRawAnalyzerFastFit(); | |
958 | } | |
959 | else if (fitAlgo == kNeuralNet) { | |
960 | fRawAnalyzer = new AliCaloRawAnalyzerNN(); | |
961 | } | |
962 | else if (fitAlgo == kLMS) { | |
963 | fRawAnalyzer = new AliCaloRawAnalyzerLMS(); | |
964 | } | |
965 | else if (fitAlgo == kPeakFinder) { | |
966 | fRawAnalyzer = new AliCaloRawAnalyzerPeakFinder(); | |
967 | } | |
968 | else if (fitAlgo == kCrude) { | |
969 | fRawAnalyzer = new AliCaloRawAnalyzerCrude(); | |
970 | } | |
971 | else { | |
972 | AliWarning("EMCAL QA invalid fit algorithm choice") ; | |
973 | } | |
974 | ||
975 | } | |
976 | return; | |
92d9f317 | 977 | */ |
def665cb | 978 | } |
979 | ||
38986b78 | 980 | //_____________________________________________________________________________________ |
981 | void AliEMCALQADataMakerRec::ConvertProfile2H(TProfile * p, TH2 * histo) | |
982 | { | |
922017a7 | 983 | // reset histogram |
984 | histo->Reset("ICE") ; | |
985 | histo->ResetStats(); | |
986 | ||
38986b78 | 987 | Int_t nbinsProf = p->GetNbinsX(); |
988 | ||
989 | // loop through the TProfile p and fill the TH2F histo | |
990 | Int_t row = 0; | |
991 | Int_t col = 0; | |
992 | Double_t binContent = 0; | |
993 | Int_t towerNum = 0; // global tower Id | |
994 | // i = 0; // tower Id within SuperModule | |
995 | Int_t iSM = 0; // SuperModule index | |
996 | Int_t iSMSide = 0; // 0=A, 1=C side | |
997 | Int_t iSMSector = 0; // 2 SM's per sector | |
998 | ||
999 | // indices for 2D plots | |
1000 | Int_t col2d = 0; | |
1001 | Int_t row2d = 0; | |
1002 | ||
1003 | for (Int_t ibin = 1; ibin <= nbinsProf; ibin++) { | |
1004 | towerNum = (Int_t) p->GetBinCenter(ibin); | |
1005 | binContent = p->GetBinContent(ibin); | |
1006 | ||
1007 | // figure out what the tower indices are: col, row within a SuperModule | |
1008 | iSM = towerNum/(AliEMCALGeoParams::fgkEMCALRows * AliEMCALGeoParams::fgkEMCALCols); | |
1009 | col = (towerNum/AliEMCALGeoParams::fgkEMCALRows) % (AliEMCALGeoParams::fgkEMCALCols); | |
1010 | row = towerNum % (AliEMCALGeoParams::fgkEMCALRows); | |
1011 | ||
1012 | //DecodeTowerNum(towerNum, &SM, &col, &row); | |
1013 | // then we calculate what the global 2D coord are, based on which SM | |
1014 | // we are in | |
1015 | iSMSector = iSM / 2; | |
1016 | iSMSide = iSM % 2; | |
1017 | ||
1018 | if (iSMSide == 1) { // C side, shown to the right | |
1019 | col2d = col + AliEMCALGeoParams::fgkEMCALCols; | |
1020 | } | |
1021 | else { // A side, shown to the left | |
1022 | col2d = col; | |
1023 | } | |
1024 | ||
1025 | row2d = row + iSMSector * AliEMCALGeoParams::fgkEMCALRows; | |
1026 | ||
1027 | histo->SetBinContent(col2d+1, row2d+1, binContent); | |
1028 | } | |
1029 | } |