]>
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 | |
189 | AliQAChecker::Instance()->Run(AliQAv1::kEMCAL, task, list) ; | |
190 | } | |
191 | ||
38986b78 | 192 | //____________________________________________________________________________ |
193 | void AliEMCALQADataMakerRec::GetCalibRefFromOCDB() | |
194 | { | |
195 | //Get the reference histogram from OCDB | |
196 | TString sName1("hHighEmcalRawMaxMinusMin") ; | |
197 | TString sName2("hLowLEDMonEmcalRawMaxMinusMin") ; | |
198 | sName1.Prepend(Form("%s_", AliRecoParam::GetEventSpecieName(AliRecoParam::kCalib))) ; | |
199 | sName2.Prepend(Form("%s_", AliRecoParam::GetEventSpecieName(AliRecoParam::kCalib))) ; | |
200 | ||
201 | TString refStorage(AliQAv1::GetQARefStorage()) ; | |
202 | if (!refStorage.Contains(AliQAv1::GetLabLocalOCDB()) && !refStorage.Contains(AliQAv1::GetLabAliEnOCDB())) { | |
203 | AliFatal(Form("%s is not a valid location for reference data", refStorage.Data())) ; | |
204 | } else { | |
205 | AliQAManager* manQA = AliQAManager::QAManager(AliQAv1::kRAWS) ; | |
206 | AliQAv1::SetQARefDataDirName(AliRecoParam::kCalib) ; | |
207 | if ( ! manQA->GetLock() ) { | |
208 | manQA->SetDefaultStorage(AliQAv1::GetQARefStorage()) ; | |
209 | manQA->SetSpecificStorage("*", AliQAv1::GetQARefStorage()) ; | |
210 | manQA->SetRun(AliCDBManager::Instance()->GetRun()) ; | |
211 | manQA->SetLock() ; | |
212 | } | |
213 | char * detOCDBDir = Form("%s/%s/%s", GetName(), AliQAv1::GetRefOCDBDirName(), AliQAv1::GetRefDataDirName()) ; | |
214 | AliCDBEntry * entry = manQA->Get(detOCDBDir, manQA->GetRun()) ; | |
215 | if (entry) { | |
216 | TList * listDetQAD =static_cast<TList *>(entry->GetObject()) ; | |
217 | if ( strcmp(listDetQAD->ClassName(), "TList") != 0 ) { | |
218 | AliError(Form("Expected a Tlist and found a %s for detector %s", listDetQAD->ClassName(), GetName())) ; | |
219 | listDetQAD = NULL ; | |
220 | } | |
221 | TObjArray * dirOCDB= NULL ; | |
222 | if ( listDetQAD ) | |
223 | dirOCDB = static_cast<TObjArray *>(listDetQAD->FindObject(Form("%s/%s", AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), AliRecoParam::GetEventSpecieName(AliRecoParam::kCalib)))) ; | |
224 | if (dirOCDB){ | |
225 | fCalibRefHistoPro = dynamic_cast<TProfile *>(dirOCDB->FindObject(sName1.Data())) ; | |
226 | fLEDMonRefHistoPro = dynamic_cast<TProfile *>(dirOCDB->FindObject(sName2.Data())) ; | |
227 | } | |
228 | } | |
229 | } | |
230 | ||
231 | if(fCalibRefHistoPro && fLEDMonRefHistoPro){ | |
232 | ||
233 | //Defining histograms binning, each 2D histogram covers all SMs | |
234 | Int_t nSMSectors = fSuperModules / 2; // 2 SMs per sector | |
235 | Int_t nbinsZ = 2*AliEMCALGeoParams::fgkEMCALCols; | |
236 | Int_t nbinsPhi = nSMSectors * AliEMCALGeoParams::fgkEMCALRows; | |
237 | ||
238 | if(!fCalibRefHistoH2F) | |
239 | fCalibRefHistoH2F = new TH2F("hCalibRefHisto", "hCalibRefHisto", nbinsZ, -0.5, nbinsZ - 0.5, nbinsPhi, -0.5, nbinsPhi -0.5); | |
240 | ConvertProfile2H(fCalibRefHistoPro,fCalibRefHistoH2F) ; | |
241 | } else { | |
242 | AliFatal(Form("No reference object with name %s or %s found", sName1.Data(), sName2.Data())) ; | |
243 | } | |
244 | } | |
9e47432c | 245 | //____________________________________________________________________________ |
246 | void AliEMCALQADataMakerRec::InitESDs() | |
247 | { | |
248 | //Create histograms to controll ESD | |
249 | const Bool_t expert = kTRUE ; | |
250 | const Bool_t image = kTRUE ; | |
251 | ||
252 | TH1F * h1 = new TH1F("hESDCaloClusterE", "ESDs CaloCluster energy in EMCAL;Energy [GeV];Counts", 200, 0., 100.) ; | |
253 | h1->Sumw2() ; | |
254 | Add2ESDsList(h1, kESDCaloClusE, !expert, image) ; | |
255 | ||
256 | TH1I * h2 = new TH1I("hESDCaloClusterM", "ESDs CaloCluster multiplicity in EMCAL;# of Clusters;Entries", 100, 0, 100) ; | |
257 | h2->Sumw2() ; | |
258 | Add2ESDsList(h2, kESDCaloClusM, !expert, image) ; | |
259 | ||
260 | TH1F * h3 = new TH1F("hESDCaloCellA", "ESDs CaloCell amplitude in EMCAL;Energy [GeV];Counts", 500, 0., 50.) ; | |
261 | h3->Sumw2() ; | |
262 | Add2ESDsList(h3, kESDCaloCellA, !expert, image) ; | |
263 | ||
264 | TH1I * h4 = new TH1I("hESDCaloCellM", "ESDs CaloCell multiplicity in EMCAL;# of Clusters;Entries", 200, 0, 1000) ; | |
265 | h4->Sumw2() ; | |
266 | Add2ESDsList(h4, kESDCaloCellM, !expert, image) ; | |
267 | ||
268 | } | |
269 | ||
270 | //____________________________________________________________________________ | |
271 | void AliEMCALQADataMakerRec::InitDigits() | |
272 | { | |
273 | // create Digits histograms in Digits subdir | |
274 | const Bool_t expert = kTRUE ; | |
275 | const Bool_t image = kTRUE ; | |
276 | ||
277 | TH1I * h0 = new TH1I("hEmcalDigits", "Digits amplitude distribution in EMCAL;Amplitude [ADC counts];Counts", 500, 0, 500) ; | |
278 | h0->Sumw2() ; | |
279 | Add2DigitsList(h0, 0, !expert, image) ; | |
280 | TH1I * h1 = new TH1I("hEmcalDigitsMul", "Digits multiplicity distribution in EMCAL;# of Digits;Entries", 200, 0, 2000) ; | |
281 | h1->Sumw2() ; | |
282 | Add2DigitsList(h1, 1, !expert, image) ; | |
283 | } | |
284 | ||
285 | //____________________________________________________________________________ | |
286 | void AliEMCALQADataMakerRec::InitRecPoints() | |
287 | { | |
38986b78 | 288 | // create Reconstructed PoInt_ts histograms in RecPoints subdir |
9e47432c | 289 | const Bool_t expert = kTRUE ; |
290 | const Bool_t image = kTRUE ; | |
291 | ||
292 | TH1F* h0 = new TH1F("hEMCALRpE","EMCAL RecPoint energies;Energy [GeV];Counts",200, 0.,20.); //GeV | |
293 | h0->Sumw2(); | |
294 | Add2RecPointsList(h0,kRecPE, !expert, image); | |
295 | ||
296 | TH1I* h1 = new TH1I("hEMCALRpM","EMCAL RecPoint multiplicities;# of Clusters;Entries",100,0,100); | |
297 | h1->Sumw2(); | |
298 | Add2RecPointsList(h1,kRecPM, !expert, image); | |
299 | ||
300 | TH1I* h2 = new TH1I("hEMCALRpDigM","EMCAL RecPoint Digit Multiplicities;# of Digits;Entries",20,0,20); | |
301 | h2->Sumw2(); | |
302 | Add2RecPointsList(h2,kRecPDigM, !expert, image); | |
303 | ||
304 | } | |
305 | ||
306 | //____________________________________________________________________________ | |
307 | void AliEMCALQADataMakerRec::InitRaws() | |
308 | { | |
309 | // create Raws histograms in Raws subdir | |
1557b01a | 310 | const Bool_t expert = kTRUE ; |
311 | const Bool_t saveCorr = kTRUE ; | |
312 | const Bool_t image = kTRUE ; | |
313 | const Option_t *profileOption = "s"; | |
9e47432c | 314 | |
38986b78 | 315 | Int_t nTowersPerSM = AliEMCALGeoParams::fgkEMCALRows * AliEMCALGeoParams::fgkEMCALCols; // number of towers in a SuperModule; 24x48 |
316 | Int_t nTot = fSuperModules * nTowersPerSM; // max number of towers in all SuperModules | |
922017a7 | 317 | |
1557b01a | 318 | //Defining histograms binning, each 2D histogram covers all SMs |
319 | Int_t nSMSectors = fSuperModules / 2; // 2 SMs per sector | |
320 | Int_t nbinsZ = 2*AliEMCALGeoParams::fgkEMCALCols; | |
321 | Int_t nbinsPhi = nSMSectors * AliEMCALGeoParams::fgkEMCALRows; | |
38986b78 | 322 | |
323 | // counter info: number of channels per event (bins are SM index) | |
9e47432c | 324 | TProfile * h0 = new TProfile("hLowEmcalSupermodules", "Low Gain EMC: # of towers vs SuperMod;SM Id;# of towers", |
1557b01a | 325 | fSuperModules, -0.5, fSuperModules-0.5, profileOption) ; |
00957c37 | 326 | Add2RawsList(h0, kNsmodLG, expert, !image, !saveCorr) ; |
9e47432c | 327 | TProfile * h1 = new TProfile("hHighEmcalSupermodules", "High Gain EMC: # of towers vs SuperMod;SM Id;# of towers", |
1557b01a | 328 | fSuperModules, -0.5, fSuperModules-0.5, profileOption) ; |
00957c37 | 329 | Add2RawsList(h1, kNsmodHG, expert, !image, !saveCorr) ; |
9e47432c | 330 | |
331 | // where did max sample occur? (bins are towers) | |
332 | TProfile * h2 = new TProfile("hLowEmcalRawtime", "Low Gain EMC: Time at Max vs towerId;Tower Id;Time [ticks]", | |
1557b01a | 333 | nTot, -0.5, nTot-0.5, profileOption) ; |
00957c37 | 334 | Add2RawsList(h2, kTimeLG, expert, !image, !saveCorr) ; |
9e47432c | 335 | TProfile * h3 = new TProfile("hHighEmcalRawtime", "High Gain EMC: Time at Max vs towerId;Tower Id;Time [ticks]", |
1557b01a | 336 | nTot, -0.5, nTot-0.5, profileOption) ; |
00957c37 | 337 | Add2RawsList(h3, kTimeHG, expert, !image, !saveCorr) ; |
9e47432c | 338 | |
339 | // how much above pedestal was the max sample? (bins are towers) | |
340 | TProfile * h4 = new TProfile("hLowEmcalRawMaxMinusMin", "Low Gain EMC: Max - Min vs towerId;Tower Id;Max-Min [ADC counts]", | |
1557b01a | 341 | nTot, -0.5, nTot-0.5, profileOption) ; |
9e47432c | 342 | Add2RawsList(h4, kSigLG, expert, image, !saveCorr) ; |
343 | TProfile * h5 = new TProfile("hHighEmcalRawMaxMinusMin", "High Gain EMC: Max - Min vs towerId;Tower Id;Max-Min [ADC counts]", | |
1557b01a | 344 | nTot, -0.5, nTot-0.5, profileOption) ; |
9e47432c | 345 | Add2RawsList(h5, kSigHG, expert, image, !saveCorr) ; |
346 | ||
347 | // total counter: channels per event | |
348 | TH1I * h6 = new TH1I("hLowNtot", "Low Gain EMC: Total Number of found towers;# of Towers;Counts", 200, 0, nTot) ; | |
349 | h6->Sumw2() ; | |
00957c37 | 350 | Add2RawsList(h6, kNtotLG, expert, !image, !saveCorr) ; |
9e47432c | 351 | TH1I * h7 = new TH1I("hHighNtot", "High Gain EMC: Total Number of found towers;# of Towers;Counts", 200,0, nTot) ; |
352 | h7->Sumw2() ; | |
00957c37 | 353 | Add2RawsList(h7, kNtotHG, expert, !image, !saveCorr) ; |
9e47432c | 354 | |
355 | // pedestal (bins are towers) | |
356 | TProfile * h8 = new TProfile("hLowEmcalRawPed", "Low Gain EMC: Pedestal vs towerId;Tower Id;Pedestal [ADC counts]", | |
1557b01a | 357 | nTot, -0.5, nTot-0.5, profileOption) ; |
00957c37 | 358 | Add2RawsList(h8, kPedLG, expert, !image, !saveCorr) ; |
9e47432c | 359 | TProfile * h9 = new TProfile("hHighEmcalRawPed", "High Gain EMC: Pedestal vs towerId;Tower Id;Pedestal [ADC counts]", |
1557b01a | 360 | nTot, -0.5, nTot-0.5, profileOption) ; |
00957c37 | 361 | Add2RawsList(h9, kPedHG, expert, !image, !saveCorr) ; |
9e47432c | 362 | |
38986b78 | 363 | //temp 2D amplitude histogram for the current run |
364 | fHighEmcHistoH2F = new TH2F("h2DHighEC2", "High Gain EMC:Max - Min [ADC counts]", nbinsZ, -0.5 , nbinsZ-0.5, nbinsPhi, -0.5, nbinsPhi-0.5); | |
f05c8877 | 365 | fHighEmcHistoH2F->SetDirectory(0) ; // this histo must be memory resident |
38986b78 | 366 | //add ratio histograms: to comapre the current run with the reference data |
367 | TH2F * h15 = new TH2F("h2DRatioAmp", "High Gain Ratio to Reference:Amplitude_{current run}/Amplitude_{reference run}", nbinsZ, -0.5 , nbinsZ-0.5, | |
368 | nbinsPhi, -0.5, nbinsPhi-0.5); | |
369 | //settings for display in amore | |
370 | h15->SetTitle("Amplitude_{current run}/Amplitude_{reference run}"); | |
00957c37 | 371 | h15->SetMaximum(2.0); |
372 | h15->SetMinimum(0.1); | |
373 | h15->SetOption("COLZ"); | |
374 | gStyle->SetOptStat(0); | |
375 | Int_t color[] = {4,3,2} ; | |
376 | gStyle->SetPalette(3,color); | |
377 | h15->GetZaxis()->SetNdivisions(3); | |
378 | h15->UseCurrentStyle(); | |
379 | h15->SetDirectory(0); | |
38986b78 | 380 | Add2RawsList(h15, k2DRatioAmp, !expert, image, !saveCorr) ; |
381 | ||
382 | TH1F * h16 = new TH1F("hRatioDist", "Amplitude_{current run}/Amplitude_{reference run} ratio distribution", nTot, 0., 2.); | |
00957c37 | 383 | h16->SetMinimum(0.1); |
384 | h16->SetMaximum(100.); | |
385 | gStyle->SetOptStat(0); | |
386 | h16->UseCurrentStyle(); | |
f05c8877 | 387 | h16->SetDirectory(0); |
38986b78 | 388 | Add2RawsList(h16, kRatioDist, !expert, image, !saveCorr) ; |
389 | ||
9e47432c | 390 | // now repeat the same for TRU and LEDMon data |
38986b78 | 391 | Int_t nTot2x2 = fSuperModules * AliEMCALGeoParams::fgkEMCALTRUsPerSM * AliEMCALGeoParams::fgkEMCAL2x2PerTRU; // max number of TRU channels for all SuperModules |
9e47432c | 392 | |
393 | // counter info: number of channels per event (bins are SM index) | |
394 | TProfile * hT0 = new TProfile("hTRUEmcalSupermodules", "TRU EMC: # of TRU channels vs SuperMod;SM Id;# of TRU channels", | |
1557b01a | 395 | fSuperModules, -0.5, fSuperModules-0.5, profileOption) ; |
00957c37 | 396 | Add2RawsList(hT0, kNsmodTRU, expert, !image, !saveCorr) ; |
9e47432c | 397 | |
398 | // where did max sample occur? (bins are TRU channels) | |
399 | TProfile * hT1 = new TProfile("hTRUEmcalRawtime", "TRU EMC: Time at Max vs 2x2Id;2x2 Id;Time [ticks]", | |
1557b01a | 400 | nTot2x2, -0.5, nTot2x2-0.5, profileOption) ; |
00957c37 | 401 | Add2RawsList(hT1, kTimeTRU, expert, !image, !saveCorr) ; |
9e47432c | 402 | |
403 | // how much above pedestal was the max sample? (bins are TRU channels) | |
404 | TProfile * hT2 = new TProfile("hTRUEmcalRawMaxMinusMin", "TRU EMC: Max - Min vs 2x2Id;2x2 Id;Max-Min [ADC counts]", | |
1557b01a | 405 | nTot2x2, -0.5, nTot2x2-0.5, profileOption) ; |
00957c37 | 406 | Add2RawsList(hT2, kSigTRU, expert, !image, !saveCorr) ; |
9e47432c | 407 | |
408 | // total counter: channels per event | |
409 | TH1I * hT3 = new TH1I("hTRUNtot", "TRU EMC: Total Number of found TRU channels;# of TRU Channels;Counts", 200, 0, nTot2x2) ; | |
410 | hT3->Sumw2() ; | |
00957c37 | 411 | Add2RawsList(hT3, kNtotTRU, expert, !image, !saveCorr) ; |
9e47432c | 412 | |
413 | // pedestal (bins are TRU channels) | |
414 | TProfile * hT4 = new TProfile("hTRUEmcalRawPed", "TRU EMC: Pedestal vs 2x2Id;2x2 Id;Pedestal [ADC counts]", | |
1557b01a | 415 | nTot2x2, -0.5, nTot2x2-0.5, profileOption) ; |
00957c37 | 416 | Add2RawsList(hT4, kPedTRU, expert, !image, !saveCorr) ; |
9e47432c | 417 | |
5c6517c3 | 418 | // L0 trigger hits: # of hits (bins are TRU channels) |
419 | TH1I * hT5 = new TH1I("hTRUEmcalL0hits", "L0 trigger hits: Total number of 2x2 L0 generated", nTot2x2, -0.5, nTot2x2); | |
420 | hT5->Sumw2(); | |
00957c37 | 421 | Add2RawsList(hT5, kNL0TRU, expert, !image, !saveCorr); |
5c6517c3 | 422 | |
423 | // L0 trigger hits: average time (bins are TRU channels) | |
1557b01a | 424 | TProfile * hT6 = new TProfile("hTRUEmcalL0hitsAvgTime", "L0 trigger hits: average time bin", nTot2x2, -0.5, nTot2x2, profileOption); |
00957c37 | 425 | Add2RawsList(hT6, kTimeL0TRU, expert, !image, !saveCorr); |
5c6517c3 | 426 | |
9e47432c | 427 | // and also LED Mon.. |
428 | // LEDMon has both high and low gain channels, just as regular FEE/towers | |
38986b78 | 429 | Int_t nTotLEDMon = fSuperModules * AliEMCALGeoParams::fgkEMCALLEDRefs; // max number of LEDMon channels for all SuperModules |
9e47432c | 430 | |
431 | // counter info: number of channels per event (bins are SM index) | |
432 | TProfile * hL0 = new TProfile("hLowLEDMonEmcalSupermodules", "LowLEDMon Gain EMC: # of strips vs SuperMod;SM Id;# of strips", | |
1557b01a | 433 | fSuperModules, -0.5, fSuperModules-0.5, profileOption) ; |
00957c37 | 434 | Add2RawsList(hL0, kNsmodLGLEDMon, expert, !image, !saveCorr) ; |
9e47432c | 435 | TProfile * hL1 = new TProfile("hHighLEDMonEmcalSupermodules", "HighLEDMon Gain EMC: # of strips vs SuperMod;SM Id;# of strips", |
1557b01a | 436 | fSuperModules, -0.5, fSuperModules-0.5, profileOption) ; |
00957c37 | 437 | Add2RawsList(hL1, kNsmodHGLEDMon, expert, !image, !saveCorr) ; |
9e47432c | 438 | |
439 | // where did max sample occur? (bins are strips) | |
440 | TProfile * hL2 = new TProfile("hLowLEDMonEmcalRawtime", "LowLEDMon Gain EMC: Time at Max vs stripId;Strip Id;Time [ticks]", | |
1557b01a | 441 | nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ; |
00957c37 | 442 | Add2RawsList(hL2, kTimeLGLEDMon, expert, !image, !saveCorr) ; |
9e47432c | 443 | TProfile * hL3 = new TProfile("hHighLEDMonEmcalRawtime", "HighLEDMon Gain EMC: Time at Max vs stripId;Strip Id;Time [ticks]", |
1557b01a | 444 | nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ; |
00957c37 | 445 | Add2RawsList(hL3, kTimeHGLEDMon, expert, !image, !saveCorr) ; |
9e47432c | 446 | |
447 | // how much above pedestal was the max sample? (bins are strips) | |
448 | TProfile * hL4 = new TProfile("hLowLEDMonEmcalRawMaxMinusMin", "LowLEDMon Gain EMC: Max - Min vs stripId;Strip Id;Max-Min [ADC counts]", | |
1557b01a | 449 | nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ; |
00957c37 | 450 | Add2RawsList(hL4, kSigLGLEDMon, expert, !image, !saveCorr) ; |
9e47432c | 451 | TProfile * hL5 = new TProfile("hHighLEDMonEmcalRawMaxMinusMin", "HighLEDMon Gain EMC: Max - Min vs stripId;Strip Id;Max-Min [ADC counts]", |
1557b01a | 452 | nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ; |
00957c37 | 453 | Add2RawsList(hL5, kSigHGLEDMon, expert, !image, !saveCorr) ; |
38986b78 | 454 | |
455 | // total counter: channels per event | |
9e47432c | 456 | TH1I * hL6 = new TH1I("hLowLEDMonNtot", "LowLEDMon Gain EMC: Total Number of found strips;# of Strips;Counts", 200, 0, nTotLEDMon) ; |
457 | hL6->Sumw2() ; | |
00957c37 | 458 | Add2RawsList(hL6, kNtotLGLEDMon, expert, !image, !saveCorr) ; |
9e47432c | 459 | TH1I * hL7 = new TH1I("hHighLEDMonNtot", "HighLEDMon Gain EMC: Total Number of found strips;# of Strips;Counts", 200,0, nTotLEDMon) ; |
460 | hL7->Sumw2() ; | |
00957c37 | 461 | Add2RawsList(hL7, kNtotHGLEDMon, expert, !image, !saveCorr) ; |
9e47432c | 462 | |
463 | // pedestal (bins are strips) | |
464 | TProfile * hL8 = new TProfile("hLowLEDMonEmcalRawPed", "LowLEDMon Gain EMC: Pedestal vs stripId;Strip Id;Pedestal [ADC counts]", | |
1557b01a | 465 | nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ; |
00957c37 | 466 | Add2RawsList(hL8, kPedLGLEDMon, expert, !image, !saveCorr) ; |
9e47432c | 467 | TProfile * hL9 = new TProfile("hHighLEDMonEmcalRawPed", "HighLEDMon Gain EMC: Pedestal vs stripId;Strip Id;Pedestal [ADC counts]", |
1557b01a | 468 | nTotLEDMon, -0.5, nTotLEDMon-0.5, profileOption) ; |
00957c37 | 469 | Add2RawsList(hL9, kPedHGLEDMon, expert, !image, !saveCorr) ; |
38986b78 | 470 | |
471 | //add two histograms for shifter from the LED monitor system: comapre LED monitor with the reference run | |
472 | //to be used for decision whether we need to change reference data | |
473 | TH1F * hL10 = new TH1F("hMaxMinusMinLEDMonRatio", "LEDMon amplitude, Ratio to reference run", nTotLEDMon, -0.5, nTotLEDMon-0.5) ; | |
38986b78 | 474 | //settings for display in amore |
475 | hL10->SetTitle("Amplitude_{LEDMon current}/Amplitude_{LEDMon reference}"); | |
00957c37 | 476 | hL10->SetMaximum(2.0); |
477 | hL10->SetMinimum(0.1); | |
478 | gStyle->SetOptStat(0); | |
479 | hL10->UseCurrentStyle(); | |
480 | hL10->SetDirectory(0); | |
38986b78 | 481 | // hL10->SetOption("E"); |
00957c37 | 482 | Add2RawsList(hL10, kLEDMonRatio, !expert, image, !saveCorr) ; |
483 | ||
922017a7 | 484 | TH1F * hL11 = new TH1F("hMaxMinusMinLEDMonRatioDist", "LEDMon amplitude, Ratio distribution", nTotLEDMon, 0, 2); |
00957c37 | 485 | hL11->SetMinimum(0.1) ; |
00957c37 | 486 | gStyle->SetOptStat(0); |
487 | hL11->UseCurrentStyle(); | |
488 | hL11->SetDirectory(0); | |
38986b78 | 489 | Add2RawsList(hL11, kLEDMonRatioDist, !expert, image, !saveCorr) ; |
490 | ||
922017a7 | 491 | GetCalibRefFromOCDB(); |
9e47432c | 492 | } |
493 | ||
494 | //____________________________________________________________________________ | |
495 | void AliEMCALQADataMakerRec::MakeESDs(AliESDEvent * esd) | |
496 | { | |
497 | // make QA data from ESDs | |
498 | ||
499 | Int_t nTot = 0 ; | |
500 | for ( Int_t index = 0; index < esd->GetNumberOfCaloClusters() ; index++ ) { | |
501 | AliESDCaloCluster * clu = esd->GetCaloCluster(index) ; | |
502 | if( clu->IsEMCAL() ) { | |
503 | GetESDsData(kESDCaloClusE)->Fill(clu->E()) ; | |
504 | nTot++ ; | |
505 | } | |
506 | } | |
507 | GetESDsData(kESDCaloClusM)->Fill(nTot) ; | |
508 | ||
509 | //fill calo cells | |
510 | AliESDCaloCells* cells = esd->GetEMCALCells(); | |
511 | GetESDsData(kESDCaloCellM)->Fill(cells->GetNumberOfCells()) ; | |
512 | ||
513 | for ( Int_t index = 0; index < cells->GetNumberOfCells() ; index++ ) { | |
514 | GetESDsData(kESDCaloCellA)->Fill(cells->GetAmplitude(index)) ; | |
515 | } | |
516 | ||
517 | } | |
518 | ||
519 | //____________________________________________________________________________ | |
520 | void AliEMCALQADataMakerRec::MakeRaws(AliRawReader* rawReader) | |
521 | { | |
922017a7 | 522 | // Check that all the reference histograms exist before we try to use them - otherwise call InitRaws |
523 | if (!fCalibRefHistoPro || !fCalibRefHistoH2F || !fLEDMonRefHistoPro || !fHighEmcHistoH2F) { | |
524 | InitRaws(); | |
525 | } | |
526 | ||
e03bcdd4 | 527 | // make sure EMCal was readout during the event |
528 | Int_t emcID = AliDAQ::DetectorID("EMCAL"); // bit 18.. | |
7b2c20bb | 529 | const UInt_t *detPattern = rawReader->GetDetectorPattern(); |
e03bcdd4 | 530 | UInt_t emcInReadout = ( ((1 << emcID) & detPattern[0]) >> emcID); |
38986b78 | 531 | if (! emcInReadout) return; // no poInt_t in looking at this event, if no EMCal data |
e03bcdd4 | 532 | |
def665cb | 533 | // setup |
9e47432c | 534 | rawReader->Reset() ; |
535 | AliCaloRawStreamV3 in(rawReader,"EMCAL"); | |
30aa89b0 | 536 | rawReader->Select("EMCAL", 0, AliEMCALGeoParams::fgkLastAltroDDL) ; //select EMCAL DDL's |
9e47432c | 537 | |
5c6517c3 | 538 | AliRecoParam::EventSpecie_t saveSpecie = fEventSpecie ; |
539 | ||
def665cb | 540 | if (rawReader->GetType() == AliRawEventHeaderBase::kCalibrationEvent) { |
541 | SetEventSpecie(AliRecoParam::kCalib) ; | |
542 | } | |
38986b78 | 543 | |
38986b78 | 544 | const Int_t nTowersPerSM = AliEMCALGeoParams::fgkEMCALRows * AliEMCALGeoParams::fgkEMCALCols; // number of towers in a SuperModule; 24x48 |
545 | const Int_t nRows = AliEMCALGeoParams::fgkEMCALRows; // number of rows per SuperModule | |
546 | const Int_t nStripsPerSM = AliEMCALGeoParams::fgkEMCALLEDRefs; // number of strips per SuperModule | |
547 | const Int_t n2x2PerSM = AliEMCALGeoParams::fgkEMCALTRUsPerSM * AliEMCALGeoParams::fgkEMCAL2x2PerTRU; // number of TRU 2x2's per SuperModule | |
548 | const Int_t n2x2PerTRU = AliEMCALGeoParams::fgkEMCAL2x2PerTRU; | |
9e47432c | 549 | |
9e47432c | 550 | // SM counters; decl. should be safe, assuming we don't get more than expected SuperModules.. |
38986b78 | 551 | Int_t nTotalSMLG[AliEMCALGeoParams::fgkEMCALModules] = {0}; |
552 | Int_t nTotalSMHG[AliEMCALGeoParams::fgkEMCALModules] = {0}; | |
553 | Int_t nTotalSMTRU[AliEMCALGeoParams::fgkEMCALModules] = {0}; | |
554 | Int_t nTotalSMLGLEDMon[AliEMCALGeoParams::fgkEMCALModules] = {0}; | |
555 | Int_t nTotalSMHGLEDMon[AliEMCALGeoParams::fgkEMCALModules] = {0}; | |
556 | ||
557 | const Int_t nTRUL0ChannelBits = 10; // used for L0 trigger bits checks | |
558 | Int_t iSM = 0; // SuperModule index | |
def665cb | 559 | // start loop over input stream |
def665cb | 560 | while (in.NextDDL()) { |
38986b78 | 561 | Int_t iRCU = in.GetDDLNumber() % 2; // RCU0 or RCU1, within SuperModule |
dc16c015 | 562 | fRawAnalyzer->SetIsZeroSuppressed( in.GetZeroSupp() ); |
9e47432c | 563 | |
98d6fe2e | 564 | while (in.NextChannel()) { |
565 | iSM = in.GetModule(); // SuperModule | |
38986b78 | 566 | //prInt_tf("iSM %d DDL %d", iSM, in.GetDDLNumber()); |
98d6fe2e | 567 | if (iSM>=0 && iSM<fSuperModules) { // valid module reading |
9e47432c | 568 | |
38986b78 | 569 | Int_t nsamples = 0; |
def665cb | 570 | vector<AliCaloBunchInfo> bunchlist; |
571 | while (in.NextBunch()) { | |
572 | nsamples += in.GetBunchLength(); | |
573 | bunchlist.push_back( AliCaloBunchInfo(in.GetStartTimeBin(), in.GetBunchLength(), in.GetSignals() ) ); | |
574 | } | |
575 | ||
576 | if (nsamples > 0) { // this check is needed for when we have zero-supp. on, but not sparse readout | |
38986b78 | 577 | Float_t time = 0.; |
578 | Float_t amp = 0.; | |
def665cb | 579 | // indices for pedestal calc. |
38986b78 | 580 | Int_t firstPedSample = 0; |
581 | Int_t lastPedSample = 0; | |
582 | bool isTRUL0IdData = false; | |
def665cb | 583 | |
584 | if (! in.IsTRUData() ) { // high gain, low gain, LED Mon data - all have the same shaper/sampling | |
585 | AliCaloFitResults fitResults = fRawAnalyzer->Evaluate( bunchlist, in.GetAltroCFG1(), in.GetAltroCFG2()); | |
38986b78 | 586 | amp = fitResults.GetAmp(); |
def665cb | 587 | time = fitResults.GetTof(); |
588 | firstPedSample = fFirstPedestalSample; | |
38986b78 | 589 | lastPedSample = fLastPedestalSample; |
9e47432c | 590 | } |
def665cb | 591 | else { // TRU data is special, needs its own analyzer |
592 | AliCaloFitResults fitResults = fRawAnalyzerTRU->Evaluate( bunchlist, in.GetAltroCFG1(), in.GetAltroCFG2()); | |
38986b78 | 593 | amp = fitResults.GetAmp(); |
def665cb | 594 | time = fitResults.GetTof(); |
595 | firstPedSample = fFirstPedestalSampleTRU; | |
38986b78 | 596 | lastPedSample = fLastPedestalSampleTRU; |
5c6517c3 | 597 | if (in.GetColumn() > n2x2PerTRU) { |
598 | isTRUL0IdData = true; | |
599 | } | |
def665cb | 600 | } |
601 | ||
602 | // pedestal samples | |
38986b78 | 603 | Int_t nPed = 0; |
604 | vector<Int_t> pedSamples; | |
9e47432c | 605 | |
def665cb | 606 | // select earliest bunch |
607 | unsigned int bunchIndex = 0; | |
608 | unsigned int startBin = bunchlist.at(0).GetStartBin(); | |
609 | if (bunchlist.size() > 0) { | |
610 | for(unsigned int ui=1; ui < bunchlist.size(); ui++ ) { | |
611 | if (startBin > bunchlist.at(ui).GetStartBin() ) { | |
612 | startBin = bunchlist.at(ui).GetStartBin(); | |
613 | bunchIndex = ui; | |
614 | } | |
9e47432c | 615 | } |
616 | } | |
def665cb | 617 | |
618 | // check bunch for entries in the pedestal sample range | |
38986b78 | 619 | Int_t bunchLength = bunchlist.at(bunchIndex).GetLength(); |
def665cb | 620 | const UShort_t *sig = bunchlist.at(bunchIndex).GetData(); |
38986b78 | 621 | Int_t timebin = 0; |
5c6517c3 | 622 | |
623 | if (! isTRUL0IdData) { // regular data, can look at pedestals | |
38986b78 | 624 | for (Int_t i = 0; i<bunchLength; i++) { |
5c6517c3 | 625 | timebin = startBin--; |
626 | if ( firstPedSample<=timebin && timebin<=lastPedSample ) { | |
627 | pedSamples.push_back( sig[i] ); | |
628 | nPed++; | |
629 | } | |
630 | } // i | |
5c6517c3 | 631 | } |
632 | else { // TRU L0 Id Data | |
633 | // which TRU the channel belongs to? | |
38986b78 | 634 | Int_t iTRUId = in.GetModule()*3 + (iRCU*in.GetBranch() + iRCU); |
5c6517c3 | 635 | |
38986b78 | 636 | for (Int_t i = 0; i< bunchLength; i++) { |
637 | for( Int_t j = 0; j < nTRUL0ChannelBits; j++ ){ | |
5c6517c3 | 638 | // check if the bit j is 1 |
639 | if( (sig[i] & ( 1 << j )) > 0 ){ | |
38986b78 | 640 | Int_t iTRUIdInSM = (in.GetColumn() - n2x2PerTRU)*nTRUL0ChannelBits+j; |
ce95bae9 | 641 | if(iTRUIdInSM < n2x2PerTRU) { |
38986b78 | 642 | Int_t iTRUAbsId = iTRUIdInSM + n2x2PerTRU * iTRUId; |
5c6517c3 | 643 | // Fill the histograms |
ce95bae9 | 644 | GetRawsData(kNL0TRU)->Fill(iTRUAbsId); |
645 | GetRawsData(kTimeL0TRU)->Fill(iTRUAbsId, startBin); | |
5c6517c3 | 646 | } |
647 | } | |
648 | } | |
649 | startBin--; | |
650 | } // i | |
651 | } // TRU L0 Id data | |
def665cb | 652 | |
653 | // fill histograms | |
654 | if ( in.IsLowGain() || in.IsHighGain() ) { // regular towers | |
38986b78 | 655 | Int_t towerId = iSM*nTowersPerSM + in.GetColumn()*nRows + in.GetRow(); |
def665cb | 656 | if ( in.IsLowGain() ) { |
657 | nTotalSMLG[iSM]++; | |
def665cb | 658 | if ( (amp > fMinSignalLG) && (amp < fMaxSignalLG) ) { |
659 | GetRawsData(kSigLG)->Fill(towerId, amp); | |
660 | GetRawsData(kTimeLG)->Fill(towerId, time); | |
661 | } | |
662 | if (nPed > 0) { | |
38986b78 | 663 | for (Int_t i=0; i<nPed; i++) { |
def665cb | 664 | GetRawsData(kPedLG)->Fill(towerId, pedSamples[i]); |
665 | } | |
666 | } | |
667 | } // gain==0 | |
668 | else if ( in.IsHighGain() ) { | |
669 | nTotalSMHG[iSM]++; | |
def665cb | 670 | if ( (amp > fMinSignalHG) && (amp < fMaxSignalHG) ) { |
671 | GetRawsData(kSigHG)->Fill(towerId, amp); | |
672 | GetRawsData(kTimeHG)->Fill(towerId, time); | |
673 | } | |
674 | if (nPed > 0) { | |
38986b78 | 675 | for (Int_t i=0; i<nPed; i++) { |
def665cb | 676 | GetRawsData(kPedHG)->Fill(towerId, pedSamples[i]); |
677 | } | |
678 | } | |
679 | } // gain==1 | |
680 | } // low or high gain | |
38986b78 | 681 | // TRU |
def665cb | 682 | else if ( in.IsTRUData() && in.GetColumn()<AliEMCALGeoParams::fgkEMCAL2x2PerTRU) { |
38986b78 | 683 | // for TRU data, the mapping class holds the TRU Int_ternal 2x2 number (0..95) in the Column var.. |
684 | Int_t iTRU = (iRCU*in.GetBranch() + iRCU); //TRU0 is from RCU0, TRU1 from RCU1, TRU2 is from branch B on RCU1 | |
685 | Int_t iTRU2x2Id = iSM*n2x2PerSM + iTRU*AliEMCALGeoParams::fgkEMCAL2x2PerTRU | |
def665cb | 686 | + in.GetColumn(); |
def665cb | 687 | nTotalSMTRU[iSM]++; |
688 | if ( (amp > fMinSignalTRU) && (amp < fMaxSignalTRU) ) { | |
689 | GetRawsData(kSigTRU)->Fill(iTRU2x2Id, amp); | |
690 | GetRawsData(kTimeTRU)->Fill(iTRU2x2Id, time); | |
9e47432c | 691 | } |
def665cb | 692 | if (nPed > 0) { |
38986b78 | 693 | for (Int_t i=0; i<nPed; i++) { |
def665cb | 694 | GetRawsData(kPedTRU)->Fill(iTRU2x2Id, pedSamples[i]); |
695 | } | |
9e47432c | 696 | } |
def665cb | 697 | } |
698 | // LED Mon | |
699 | else if ( in.IsLEDMonData() ) { | |
700 | // for LED Mon data, the mapping class holds the gain info in the Row variable | |
701 | // and the Strip number in the Column.. | |
38986b78 | 702 | Int_t gain = in.GetRow(); |
703 | Int_t stripId = iSM*nStripsPerSM + in.GetColumn(); | |
def665cb | 704 | |
705 | if ( gain == 0 ) { | |
706 | nTotalSMLGLEDMon[iSM]++; | |
707 | if ( (amp > fMinSignalLGLEDMon) && (amp < fMaxSignalLGLEDMon) ) { | |
708 | GetRawsData(kSigLGLEDMon)->Fill(stripId, amp); | |
709 | GetRawsData(kTimeLGLEDMon)->Fill(stripId, time); | |
710 | } | |
711 | if (nPed > 0) { | |
38986b78 | 712 | for (Int_t i=0; i<nPed; i++) { |
def665cb | 713 | GetRawsData(kPedLGLEDMon)->Fill(stripId, pedSamples[i]); |
714 | } | |
715 | } | |
716 | } // gain==0 | |
717 | else if ( gain == 1 ) { | |
718 | nTotalSMHGLEDMon[iSM]++; | |
719 | if ( (amp > fMinSignalHGLEDMon) && (amp < fMaxSignalHGLEDMon) ) { | |
720 | GetRawsData(kSigHGLEDMon)->Fill(stripId, amp); | |
721 | GetRawsData(kTimeHGLEDMon)->Fill(stripId, time); | |
722 | } | |
723 | if (nPed > 0) { | |
38986b78 | 724 | for (Int_t i=0; i<nPed; i++) { |
def665cb | 725 | GetRawsData(kPedHGLEDMon)->Fill(stripId, pedSamples[i]); |
726 | } | |
727 | } | |
728 | } // low or high gain | |
729 | } // LEDMon | |
730 | ||
731 | } // SM index OK | |
9e47432c | 732 | |
733 | } // nsamples>0 check, some data found for this channel; not only trailer/header | |
734 | }// end while over channel | |
735 | ||
736 | }//end while over DDL's, of input stream | |
737 | ||
38986b78 | 738 | // TProfile * p = dynamic_cast<TProfile *>(GetRawsData(kSigHG)) ; |
739 | ConvertProfile2H(dynamic_cast<TProfile *>(GetRawsData(kSigHG)), fHighEmcHistoH2F) ; | |
740 | Double_t binContent = 0. ; | |
00957c37 | 741 | |
00957c37 | 742 | |
38986b78 | 743 | //calculate the ratio of the amplitude and fill the histograms, only if the events type is Calib |
12ef6821 | 744 | if (rawReader->GetType() == AliRawEventHeaderBase::kCalibrationEvent) { |
745 | //reset ratio histograms | |
746 | GetRawsData(k2DRatioAmp)->Reset("ICE"); | |
747 | GetRawsData(kRatioDist)->Reset("ICE"); | |
748 | GetRawsData(kLEDMonRatio)->Reset("ICE"); | |
749 | GetRawsData(kLEDMonRatioDist)->Reset("ICE"); | |
750 | GetRawsData(k2DRatioAmp)->ResetStats(); | |
751 | GetRawsData(kRatioDist)->ResetStats(); | |
752 | GetRawsData(kLEDMonRatio)->ResetStats(); | |
753 | GetRawsData(kLEDMonRatioDist)->ResetStats(); | |
754 | ||
755 | for(Int_t ix = 1; ix <= fHighEmcHistoH2F->GetNbinsX(); ix++) { | |
756 | for(Int_t iy = 1; iy <= fHighEmcHistoH2F->GetNbinsY(); iy++) { | |
757 | if(fCalibRefHistoH2F->GetBinContent(ix, iy))binContent = fHighEmcHistoH2F->GetBinContent(ix, iy)/fCalibRefHistoH2F->GetBinContent(ix, iy) ; | |
758 | GetRawsData(k2DRatioAmp)->SetBinContent(ix, iy, binContent); | |
759 | GetRawsData(kRatioDist)->Fill(GetRawsData(k2DRatioAmp)->GetBinContent(ix, iy)); | |
760 | } | |
761 | } | |
00957c37 | 762 | |
12ef6821 | 763 | //Now for LED monitor system, to calculate the ratio as well |
764 | Double_t binError = 0. ; | |
765 | // for the binError, we add the relative errors, squared | |
766 | Double_t relativeErrorSqr = 0. ; | |
38986b78 | 767 | |
12ef6821 | 768 | for(int ib = 1; ib <= fLEDMonRefHistoPro->GetNbinsX(); ib++) { |
38986b78 | 769 | |
12ef6821 | 770 | if(fLEDMonRefHistoPro->GetBinContent(ib) != 0) { |
771 | binContent = GetRawsData(kSigLGLEDMon)->GetBinContent(ib) / fLEDMonRefHistoPro->GetBinContent(ib); | |
772 | ||
773 | relativeErrorSqr = TMath::Power( (fLEDMonRefHistoPro->GetBinError(ib) / fLEDMonRefHistoPro->GetBinContent(ib)), 2); | |
774 | if(GetRawsData(kSigLGLEDMon)->GetBinContent(ib) != 0) { | |
775 | relativeErrorSqr += TMath::Power( (GetRawsData(kSigLGLEDMon)->GetBinError(ib)/GetRawsData(kSigLGLEDMon)->GetBinContent(ib)), 2); | |
776 | } | |
777 | } | |
778 | else { | |
779 | binContent = 0; | |
780 | relativeErrorSqr = 0; | |
781 | } | |
782 | GetRawsData(kLEDMonRatio)->SetBinContent(ib, binContent); | |
38986b78 | 783 | |
12ef6821 | 784 | binError = sqrt(relativeErrorSqr) * binContent; |
785 | GetRawsData(kLEDMonRatio)->SetBinError(ib, binError); | |
786 | GetRawsData(kLEDMonRatioDist)->Fill(GetRawsData(kLEDMonRatio)->GetBinContent(ib)); | |
787 | } | |
38986b78 | 788 | |
12ef6821 | 789 | } |
9e47432c | 790 | // let's also fill the SM and event counter histograms |
38986b78 | 791 | Int_t nTotalHG = 0; |
792 | Int_t nTotalLG = 0; | |
793 | Int_t nTotalTRU = 0; | |
794 | Int_t nTotalHGLEDMon = 0; | |
795 | Int_t nTotalLGLEDMon = 0; | |
1a78a765 | 796 | for (iSM=0; iSM<fSuperModules; iSM++) { |
9e47432c | 797 | nTotalLG += nTotalSMLG[iSM]; |
798 | nTotalHG += nTotalSMHG[iSM]; | |
799 | nTotalTRU += nTotalSMTRU[iSM]; | |
98d6fe2e | 800 | nTotalLGLEDMon += nTotalSMLGLEDMon[iSM]; |
801 | nTotalHGLEDMon += nTotalSMHGLEDMon[iSM]; | |
9e47432c | 802 | GetRawsData(kNsmodLG)->Fill(iSM, nTotalSMLG[iSM]); |
803 | GetRawsData(kNsmodHG)->Fill(iSM, nTotalSMHG[iSM]); | |
804 | GetRawsData(kNsmodTRU)->Fill(iSM, nTotalSMTRU[iSM]); | |
805 | GetRawsData(kNsmodLGLEDMon)->Fill(iSM, nTotalSMLGLEDMon[iSM]); | |
806 | GetRawsData(kNsmodHGLEDMon)->Fill(iSM, nTotalSMHGLEDMon[iSM]); | |
807 | } | |
def665cb | 808 | |
9e47432c | 809 | GetRawsData(kNtotLG)->Fill(nTotalLG); |
810 | GetRawsData(kNtotHG)->Fill(nTotalHG); | |
811 | GetRawsData(kNtotTRU)->Fill(nTotalTRU); | |
812 | GetRawsData(kNtotLGLEDMon)->Fill(nTotalLGLEDMon); | |
813 | GetRawsData(kNtotHGLEDMon)->Fill(nTotalHGLEDMon); | |
5c6517c3 | 814 | |
815 | ||
def665cb | 816 | SetEventSpecie(saveSpecie) ; |
9e47432c | 817 | // just in case the next rawreader consumer forgets to reset; let's do it here again.. |
818 | rawReader->Reset() ; | |
819 | ||
820 | return; | |
821 | } | |
822 | ||
823 | //____________________________________________________________________________ | |
824 | void AliEMCALQADataMakerRec::MakeDigits() | |
825 | { | |
826 | // makes data from Digits | |
827 | ||
828 | GetDigitsData(1)->Fill(fDigitsArray->GetEntriesFast()) ; | |
829 | TIter next(fDigitsArray) ; | |
830 | AliEMCALDigit * digit ; | |
831 | while ( (digit = dynamic_cast<AliEMCALDigit *>(next())) ) { | |
829ba234 | 832 | GetDigitsData(0)->Fill( digit->GetAmplitude()) ; |
9e47432c | 833 | } |
834 | ||
835 | } | |
836 | ||
837 | //____________________________________________________________________________ | |
838 | void AliEMCALQADataMakerRec::MakeDigits(TTree * digitTree) | |
839 | { | |
840 | // makes data from Digit Tree | |
841 | if (fDigitsArray) | |
e0dc3f7d | 842 | fDigitsArray->Clear("C") ; |
9e47432c | 843 | else |
844 | fDigitsArray = new TClonesArray("AliEMCALDigit", 1000) ; | |
845 | ||
846 | TBranch * branch = digitTree->GetBranch("EMCAL") ; | |
847 | if ( ! branch ) { | |
848 | AliWarning("EMCAL branch in Digit Tree not found") ; | |
849 | } else { | |
850 | branch->SetAddress(&fDigitsArray) ; | |
851 | branch->GetEntry(0) ; | |
852 | MakeDigits() ; | |
853 | } | |
854 | ||
855 | } | |
856 | ||
857 | //____________________________________________________________________________ | |
858 | void AliEMCALQADataMakerRec::MakeRecPoints(TTree * clustersTree) | |
859 | { | |
860 | // makes data from RecPoints | |
861 | TBranch *emcbranch = clustersTree->GetBranch("EMCALECARP"); | |
862 | if (!emcbranch) { | |
863 | AliError("can't get the branch with the EMCAL clusters !"); | |
864 | return; | |
865 | } | |
866 | ||
38986b78 | 867 | TObjArray * emcRecPoints = new TObjArray(100) ; |
868 | emcbranch->SetAddress(&emcRecPoints); | |
9e47432c | 869 | emcbranch->GetEntry(0); |
870 | ||
38986b78 | 871 | GetRecPointsData(kRecPM)->Fill(emcRecPoints->GetEntriesFast()) ; |
872 | TIter next(emcRecPoints) ; | |
9e47432c | 873 | AliEMCALRecPoint * rp ; |
874 | while ( (rp = dynamic_cast<AliEMCALRecPoint *>(next())) ) { | |
38986b78 | 875 | GetRecPointsData(kRecPE)->Fill(rp->GetEnergy()) ; |
9e47432c | 876 | GetRecPointsData(kRecPDigM)->Fill(rp->GetMultiplicity()); |
877 | } | |
38986b78 | 878 | emcRecPoints->Delete(); |
879 | delete emcRecPoints; | |
9e47432c | 880 | |
881 | } | |
882 | ||
883 | //____________________________________________________________________________ | |
884 | void AliEMCALQADataMakerRec::StartOfDetectorCycle() | |
885 | { | |
886 | //Detector specific actions at start of cycle | |
887 | ||
888 | } | |
889 | ||
def665cb | 890 | //____________________________________________________________________________ |
891 | void AliEMCALQADataMakerRec::SetFittingAlgorithm(Int_t fitAlgo) | |
892 | { | |
893 | //Set fitting algorithm and initialize it if this same algorithm was not set before. | |
894 | //printf("**** Set Algorithm , number %d ****\n",fitAlgo); | |
92d9f317 | 895 | |
896 | ||
430e7d8e | 897 | fRawAnalyzer = AliCaloRawAnalyzerFactory::CreateAnalyzer(fitAlgo); |
898 | fFittingAlgorithm = fitAlgo; | |
92d9f317 | 899 | |
900 | /* | |
def665cb | 901 | if(fitAlgo == fFittingAlgorithm && fRawAnalyzer) { |
902 | //Do nothing, this same algorithm already set before. | |
903 | //printf("**** Algorithm already set before, number %d, %s ****\n",fitAlgo, fRawAnalyzer->GetName()); | |
904 | return; | |
905 | } | |
906 | //Initialize the requested algorithm | |
907 | if(fitAlgo != fFittingAlgorithm || !fRawAnalyzer) { | |
908 | //printf("**** Init Algorithm , number %d ****\n",fitAlgo); | |
909 | ||
910 | fFittingAlgorithm = fitAlgo; | |
911 | if (fRawAnalyzer) delete fRawAnalyzer; // delete prev. analyzer if existed. | |
912 | ||
913 | if (fitAlgo == kFastFit) { | |
914 | fRawAnalyzer = new AliCaloRawAnalyzerFastFit(); | |
915 | } | |
916 | else if (fitAlgo == kNeuralNet) { | |
917 | fRawAnalyzer = new AliCaloRawAnalyzerNN(); | |
918 | } | |
919 | else if (fitAlgo == kLMS) { | |
920 | fRawAnalyzer = new AliCaloRawAnalyzerLMS(); | |
921 | } | |
922 | else if (fitAlgo == kPeakFinder) { | |
923 | fRawAnalyzer = new AliCaloRawAnalyzerPeakFinder(); | |
924 | } | |
925 | else if (fitAlgo == kCrude) { | |
926 | fRawAnalyzer = new AliCaloRawAnalyzerCrude(); | |
927 | } | |
928 | else { | |
929 | AliWarning("EMCAL QA invalid fit algorithm choice") ; | |
930 | } | |
931 | ||
932 | } | |
933 | return; | |
92d9f317 | 934 | */ |
def665cb | 935 | } |
936 | ||
38986b78 | 937 | //_____________________________________________________________________________________ |
938 | void AliEMCALQADataMakerRec::ConvertProfile2H(TProfile * p, TH2 * histo) | |
939 | { | |
922017a7 | 940 | // reset histogram |
941 | histo->Reset("ICE") ; | |
942 | histo->ResetStats(); | |
943 | ||
38986b78 | 944 | Int_t nbinsProf = p->GetNbinsX(); |
945 | ||
946 | // loop through the TProfile p and fill the TH2F histo | |
947 | Int_t row = 0; | |
948 | Int_t col = 0; | |
949 | Double_t binContent = 0; | |
950 | Int_t towerNum = 0; // global tower Id | |
951 | // i = 0; // tower Id within SuperModule | |
952 | Int_t iSM = 0; // SuperModule index | |
953 | Int_t iSMSide = 0; // 0=A, 1=C side | |
954 | Int_t iSMSector = 0; // 2 SM's per sector | |
955 | ||
956 | // indices for 2D plots | |
957 | Int_t col2d = 0; | |
958 | Int_t row2d = 0; | |
959 | ||
960 | for (Int_t ibin = 1; ibin <= nbinsProf; ibin++) { | |
961 | towerNum = (Int_t) p->GetBinCenter(ibin); | |
962 | binContent = p->GetBinContent(ibin); | |
963 | ||
964 | // figure out what the tower indices are: col, row within a SuperModule | |
965 | iSM = towerNum/(AliEMCALGeoParams::fgkEMCALRows * AliEMCALGeoParams::fgkEMCALCols); | |
966 | col = (towerNum/AliEMCALGeoParams::fgkEMCALRows) % (AliEMCALGeoParams::fgkEMCALCols); | |
967 | row = towerNum % (AliEMCALGeoParams::fgkEMCALRows); | |
968 | ||
969 | //DecodeTowerNum(towerNum, &SM, &col, &row); | |
970 | // then we calculate what the global 2D coord are, based on which SM | |
971 | // we are in | |
972 | iSMSector = iSM / 2; | |
973 | iSMSide = iSM % 2; | |
974 | ||
975 | if (iSMSide == 1) { // C side, shown to the right | |
976 | col2d = col + AliEMCALGeoParams::fgkEMCALCols; | |
977 | } | |
978 | else { // A side, shown to the left | |
979 | col2d = col; | |
980 | } | |
981 | ||
982 | row2d = row + iSMSector * AliEMCALGeoParams::fgkEMCALRows; | |
983 | ||
984 | histo->SetBinContent(col2d+1, row2d+1, binContent); | |
985 | } | |
986 | } |