1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 ///////////////////////////////////////////////////////////////////////
18 // Produces the data needed to calculate the TOF quality assurance. //
19 // QA objects are 1 & 2 Dimensional histograms. //
20 // author: S.Arcelli //
22 ///////////////////////////////////////////////////////////////////////
25 Modified by bvonhall on 03/11/2010
26 - modified declaration of hTrmChannels035 and hTrmChannels3671 in EndOfDetectorCycle()
27 to prevent memory corruption
29 Modified by adecaro on 18/10/2010
30 - fTOFRawStream object set as private member
32 Modified by fbellini on 13/09/2010
33 - Set TLines as private members
34 - Set image flag for expert histos
36 Modified by fbellini on 14/06/2010
38 - use LoadRawDataBuffersV2()
40 Modified by fbellini on 10/05/2010
41 - Fixed EndOfDetectorCycle() memory corruption bug
43 Modified by fbellini on 22/04/2010
44 - Added filter for physics events
46 Modified by fbellini on 16/04/2010
47 - Added EnableDqmShifterOpt()
48 - Modified EndOfDetectorCycle() with options for DQM
51 Modified by fbellini on 30/03/2010
52 - Changed raws time histos range to 610ns
53 - Added FilterLTMData() and FilterSpare() methods
54 - Added check on enabled channels for raw data
55 - Updated RecPoints QA
57 Modified by fbellini on 02/03/2010
58 - Fixed raw data decoding methods (use AliTOFRawStream::LoadRawDataBuffer())
59 - Added filter for noisy channels and read map from OCDB
60 - Added GetCalibData() method
61 - Added CheckVolumeID() and CheckEquipID() methods
65 #include <TClonesArray.h>
70 #include "AliCDBManager.h"
71 #include "AliCDBEntry.h"
72 #include "AliESDEvent.h"
73 #include "AliESDtrack.h"
74 #include "AliQAChecker.h"
75 #include "AliRawReader.h"
76 #include "AliTOFRawStream.h"
77 #include "AliTOFcluster.h"
78 #include "AliTOFQADataMakerRec.h"
79 #include "AliTOFrawData.h"
80 #include "AliTOFGeometry.h"
81 #include "AliTOFChannelOnlineStatusArray.h"
85 ClassImp(AliTOFQADataMakerRec)
87 //____________________________________________________________________________
88 AliTOFQADataMakerRec::AliTOFQADataMakerRec() :
89 AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kTOF), "TOF Quality Assurance Data Maker"),
91 fEnableNoiseFiltering(kFALSE),
92 fEnableDqmShifterOpt(kFALSE),
93 fProcessedRawEventN(0),
94 fLineExpTimeMin(new TLine(200., 0., 200., 0.)),
95 fLineExpTimeMax(new TLine(250., 0., 250., 0.)),
96 fLineExpTotMin(new TLine(5., 0., 5., 0.)),
97 fLineExpTotMax(new TLine(20., 0., 20., 0.)),
98 fTOFRawStream(AliTOFRawStream())
104 for (Int_t sm=0;sm<10;sm++){
105 fLineSMid035[sm] = new TLine( 40*sm, 0., 40*sm, 0.);
106 fLineSMid3671[sm] = new TLine( 40*sm+360, 0., 40*sm+360, 0.);
107 //fLineSMid035[sm]=0x0;
108 //fLineSMid3671[sm]=0x0;
113 //____________________________________________________________________________
114 AliTOFQADataMakerRec::AliTOFQADataMakerRec(const AliTOFQADataMakerRec& qadm) :
116 fCalibData(qadm.fCalibData),
117 fEnableNoiseFiltering(qadm.fEnableNoiseFiltering),
118 fEnableDqmShifterOpt(qadm.fEnableDqmShifterOpt),
119 fProcessedRawEventN(qadm.fProcessedRawEventN),
120 fLineExpTimeMin(qadm.fLineExpTimeMin),
121 fLineExpTimeMax(qadm.fLineExpTimeMax),
122 fLineExpTotMin(qadm.fLineExpTotMin),
123 fLineExpTotMax(qadm.fLineExpTotMax),
124 fTOFRawStream(qadm.fTOFRawStream)
129 SetName((const char*)qadm.GetName()) ;
130 SetTitle((const char*)qadm.GetTitle());
132 for (Int_t sm=0;sm<10;sm++){
133 fLineSMid035[sm]=qadm.fLineSMid035[sm];
134 fLineSMid3671[sm]=qadm.fLineSMid3671[sm];
138 //__________________________________________________________________
139 AliTOFQADataMakerRec& AliTOFQADataMakerRec::operator = (const AliTOFQADataMakerRec& qadm )
142 // assignment operator.
144 this->~AliTOFQADataMakerRec();
145 new(this) AliTOFQADataMakerRec(qadm);
149 //----------------------------------------------------------------------------
150 AliTOFQADataMakerRec::~AliTOFQADataMakerRec()
153 fTOFRawStream.Clear();
155 delete fLineExpTimeMin;
156 delete fLineExpTimeMax;
157 delete fLineExpTotMin;
158 delete fLineExpTotMax;
159 for (Int_t sm=0;sm<10;sm++){
160 delete fLineSMid035[sm];
161 delete fLineSMid3671[sm];
165 //----------------------------------------------------------------------------
166 AliTOFChannelOnlineStatusArray* AliTOFQADataMakerRec::GetCalibData() const
169 // Retrive TOF calib objects from OCDB
171 AliCDBManager *man = AliCDBManager::Instance();
175 cdbe = man->Get("TOF/Calib/Status",fRun);
177 AliWarning("Load of calibration data from default storage failed!");
178 AliWarning("Calibration data will be loaded from local storage ($ALICE_ROOT)");
179 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
180 cdbe = man->Get("TOF/Calib/Status",fRun);
182 // Retrieval of data in directory TOF/Calib/Data:
184 AliTOFChannelOnlineStatusArray * array = 0;
185 if (cdbe) array = (AliTOFChannelOnlineStatusArray *)cdbe->GetObject();
186 if (!array) AliFatal("No calibration data from calibration database !");
194 //____________________________________________________________________________
195 void AliTOFQADataMakerRec::InitRaws()
198 // create Raws histograms in Raws subdir
200 const Bool_t expert = kTRUE ;
201 const Bool_t saveCorr = kTRUE ;
202 const Bool_t image = kTRUE ;
204 TH1I * h0 = new TH1I("hTOFRaws", "TOF raw hit multiplicity; TOF raw hits number;Counts ",200, 0, 200) ;
206 TH1I * h1 = new TH1I("hTOFRawsIA", "TOF raw hit multiplicity - I/A side; TOF raw hits number ;Counts ",200, 0, 200) ;
207 TH1I * h2 = new TH1I("hTOFRawsOA", "TOF raw hit multiplicity - O/A side; TOF raw hits number ;Counts ",200, 0, 200) ;
208 TH1I * h3 = new TH1I("hTOFRawsIC", "TOF raw hit multiplicity - I/C side; TOF raw hits number ;Counts ",200, 0, 200) ;
209 TH1I * h4 = new TH1I("hTOFRawsOC", "TOF raw hit multiplicity - O/C side; TOF raw hits number ;Counts ",200, 0, 200) ;
211 TH1F * h5 = new TH1F("hTOFRawsTime", "TOF Raws - Hit time (ns);Measured Hit time [ns];Counts", 25000,0. ,610.) ;
213 TH1F * h6 = new TH1F("hTOFRawsTimeIA", "TOF Raws - Hit time (ns) - I/A side;Measured Hit time [ns];Counts", 25000,0. ,610.) ;
214 TH1F * h7 = new TH1F("hTOFRawsTimeOA", "TOF Raws - Hit time (ns) - O/A side;Measured Hit time [ns];Counts", 25000,0. ,610.) ;
215 TH1F * h8 = new TH1F("hTOFRawsTimeIC", "TOF Raws - Hit time (ns) - I/C side;Measured Hit time [ns];Counts", 25000,0. ,610.) ;
216 TH1F * h9 = new TH1F("hTOFRawsTimeOC", "TOF Raws - Hit time (ns) - O/C side;Measured Hit time [ns];Counts", 25000,0. ,610.) ;
218 TH1F * h10 = new TH1F("hTOFRawsToT", "TOF Raws - Hit ToT (ns);Measured Hit ToT (ns);Counts", 1000, 0., 48.8) ;
220 TH1F * h11 = new TH1F("hTOFRawsToTIA", "TOF Raws - Hit ToT (ns) - I/A side;Measured Hit ToT (ns);Counts", 1000, 0., 48.8) ;
221 TH1F * h12 = new TH1F("hTOFRawsToTOA", "TOF Raws - Hit ToT (ns) - O/A side;Measured Hit ToT (ns);Counts", 1000, 0., 48.8) ;
222 TH1F * h13 = new TH1F("hTOFRawsToTIC", "TOF Raws - Hit ToT (ns) - I/C side;Measured Hit ToT (ns);Counts", 1000, 0., 48.8) ;
223 TH1F * h14 = new TH1F("hTOFRawsToTOC", "TOF Raws - Hit ToT (ns) - O/C side;Measured Hit ToT (ns);Counts", 1000, 0., 48.8) ;
225 TH1F * h15 = new TH1F("hTOFRawsLTMHits", "LTMs OR signals; Crate; Counts", 72, 0., 72.);
226 TH1F * h16 = new TH1F("hTOFRawsTRMHits035", "TRM hits - crates 0 to 35 ;TRM index = SMid(crate*10)+TRM(0-9);Hits", 361, 0., 361.) ;
227 TH1F * h17 = new TH1F("hTOFRawsTRMHits3671","TRM hits - crates 36 to 71 ;TRM index = SMid(crate*10)+TRM(0-9);Hits", 361, 360., 721.) ;
229 TH1F * h18 = new TH1F("hTOFRawChannelHits","TOF channel hits count; Channel ID; Hits", 158000, 0., 158000);
231 TH1F * h19 = new TH1F("hTOFOrphansTime", "TOF Raws - Orphans time (ns);Measured Hit time [ns];Counts", 25000, 0. ,610.) ;
232 TH2F * h20 = new TH2F("hTOFRawTimeVsTRM035", "TOF raws - Hit time vs TRM - crates 0 to 35; TRM index = DDL*10+TRM(0-9);TOF raw time [ns]", 361, 0., 361., 250, 0., 610.0) ;
233 TH2F * h21 = new TH2F("hTOFRawTimeVsTRM3671", "TOF raws - Hit time vs TRM - crates 36 to 72; TRM index = DDL**10+TRM(0-9);TOF raw time [ns]", 361, 360., 721., 250, 0., 610.0) ;
234 TH2F * h22 = new TH2F("hTOFRawToTVsTRM035", "TOF raws - Hit ToT vs TRM - crates 0 to 35; TRM index = DDL*10+TRM(0-9);TOF raw ToT [ns] ", 361, 0., 361., 100, 0., 48.8) ;
235 TH2F * h23 = new TH2F("hTOFRawToTVsTRM3671", "TOF raws - Hit ToT vs TRM - crates 36 to 72; TRM index = DDL*10+TRM(0-9);TOF raw ToT [ns] ", 361, 360., 721., 100, 0., 48.8) ;
236 TH2F * h24 = new TH2F("hTOFTimeVsStrip","TOF Raws - Hit time vs. strip (theta); Strip index;Raws TOF time (ns) ", 91,0.,91, 250, 0., 610.) ;
238 // TH2F * h25 = new TH2F("hTOFRawsClusMap","Raws vs TOF eta-phi;eta (2*strip+padz);phi (48*sector+padx)",183, -0.5, 182.5,865,-0.5,864.5) ;
266 //add lines for DQM shifter
267 //fLineExpTimeMin = new TLine(200., 0., 200., 0.);
268 fLineExpTimeMin->SetLineColor(kGreen);
269 fLineExpTimeMin->SetLineWidth(2);
271 //fLineExpTimeMax = new TLine(250., 0., 250., 0.);
272 fLineExpTimeMax->SetLineColor(kGreen);
273 fLineExpTimeMax->SetLineWidth(2);
275 //fLineExpTotMin = new TLine( 5., 0., 5., 0.);
276 fLineExpTotMin->SetLineColor(kGreen);
277 fLineExpTotMin->SetLineWidth(2);
279 //fLineExpTotMax = new TLine(20., 0., 20., 0.);
280 fLineExpTotMax->SetLineColor(kGreen);
281 fLineExpTotMax->SetLineWidth(2);
283 h5->GetListOfFunctions()->Add(fLineExpTimeMin);
284 h5->GetListOfFunctions()->Add(fLineExpTimeMax);
285 h10->GetListOfFunctions()->Add(fLineExpTotMin);
286 h10->GetListOfFunctions()->Add(fLineExpTotMax);
288 for (Int_t sm=0;sm<10;sm++){
289 //fLineSMid035[sm] = new TLine( 40*sm, 0., 40*sm, 0.);
290 fLineSMid035[sm]->SetLineColor(kMagenta);
291 fLineSMid035[sm]->SetLineWidth(2);
292 h16->GetListOfFunctions()->Add(fLineSMid035[sm]);
293 //GetRawsData(16)->GetListOfFunctions()->Add(fLineSMid035[sm]);
294 //fLineSMid3671[sm] = new TLine( 40*sm+360, 0., 40*sm+360, 0.);
295 fLineSMid3671[sm]->SetLineColor(kMagenta);
296 fLineSMid3671[sm]->SetLineWidth(2);
297 //GetRawsData(17)->GetListOfFunctions()->Add(fLineSMid3671[sm]);
298 h17->GetListOfFunctions()->Add(fLineSMid3671[sm]);
301 Add2RawsList(h0, 0, !expert, image, !saveCorr) ;
302 Add2RawsList(h1, 1, expert, !image, !saveCorr) ;
303 Add2RawsList(h2, 2, expert, !image, !saveCorr) ;
304 Add2RawsList(h3, 3, expert, !image, !saveCorr) ;
305 Add2RawsList(h4, 4, expert, !image, !saveCorr) ;
306 Add2RawsList(h5, 5, !expert, image, !saveCorr) ;
307 Add2RawsList(h6, 6, expert, !image, !saveCorr) ;
308 Add2RawsList(h7, 7, expert, !image, !saveCorr) ;
309 Add2RawsList(h8, 8, expert, !image, !saveCorr) ;
310 Add2RawsList(h9, 9, expert, !image, !saveCorr) ;
311 Add2RawsList(h10, 10, !expert, image, !saveCorr) ;
312 Add2RawsList(h11, 11, expert, !image, !saveCorr) ;
313 Add2RawsList(h12, 12, expert, !image, !saveCorr) ;
314 Add2RawsList(h13, 13, expert, !image, !saveCorr) ;
315 Add2RawsList(h14, 14, expert, !image, !saveCorr) ;
316 Add2RawsList(h15, 15, !expert, image, !saveCorr) ;
317 Add2RawsList(h16, 16, !expert, image, !saveCorr) ;
318 Add2RawsList(h17, 17, !expert, image, !saveCorr) ;
319 Add2RawsList(h18, 18, expert, !image, !saveCorr) ;
320 Add2RawsList(h19, 19, expert, !image, !saveCorr) ;
321 Add2RawsList(h20, 20, expert, !image, !saveCorr) ;
322 Add2RawsList(h21, 21, expert, !image, !saveCorr) ;
323 Add2RawsList(h22, 22, expert, !image, !saveCorr) ;
324 Add2RawsList(h23, 23, expert, !image, !saveCorr) ;
325 Add2RawsList(h24, 24, expert, !image, !saveCorr) ;
329 //____________________________________________________________________________
330 void AliTOFQADataMakerRec::InitRecPoints()
333 // create RecPoints histograms in RecPoints subdir
336 const Bool_t expert = kTRUE ;
337 const Bool_t image = kTRUE ;
339 TH1I * h0 = new TH1I("hTOFRecPoints", "TOF RecPoints multiplicity ; TOF RecPoints number;Counts",200, 0, 200) ;
341 TH1F * h1 = new TH1F("hTOFRecPointsTimeIA", "RecPoints Time Spectrum in TOF (ns)- I/A side; Calibrated TOF time [ns];Counts", 25000, 0., 610.) ;
342 TH1F * h2 = new TH1F("hTOFRecPointsTimeOA", "RecPoints Time Spectrum in TOF (ns)- O/A side; Calibrated TOF time [ns];Counts", 25000, 0., 610.) ;
343 TH1F * h3 = new TH1F("hTOFRecPointsTimeIC", "RecPoints Time Spectrum in TOF (ns)- I/C side; Calibrated TOF time [ns];Counts", 25000, 0., 610.) ;
344 TH1F * h4 = new TH1F("hTOFRecPointsTimeOC", "RecPoints Time Spectrum in TOF (ns)- O/C side; Calibrated TOF time [ns];Counts", 25000, 0., 610.) ;
346 TH1F * h5 = new TH1F("hTOFRecPointsRawTimeIA", "RecPoints raw Time Spectrum in TOF (ns)-I/A side; Measured TOF time [ns];Counts", 25000, 0., 610.) ;
347 TH1F * h6 = new TH1F("hTOFRecPointsRawTimeOA", "RecPoints raw Time Spectrum in TOF (ns)-O/A side; Measured TOF time [ns];Counts", 25000, 0., 610.) ;
348 TH1F * h7 = new TH1F("hTOFRecPointsRawTimeIC", "RecPoints raw Time Spectrum in TOF (ns)-I/C side; Measured TOF time [ns];Counts", 25000, 0., 610.) ;
349 TH1F * h8 = new TH1F("hTOFRecPointsRawTimeOC", "RecPoints raw Time Spectrum in TOF (ns)-O/C side; Measured TOF time [ns];Counts", 25000, 0., 610.) ;
351 TH1F * h9 = new TH1F("hTOFRecPointsToTIA", "RecPoints ToT Spectrum in TOF (ns)-I/A side; Measured TOT [ns];Counts", 1000, 0., 48.8 ) ;
352 TH1F * h10 = new TH1F("hTOFRecPointsToTOA", "RecPoints ToT Spectrum in TOF (ns)-O/A side; Measured TOT [ns];Counts", 1000, 0., 48.8 ) ;
353 TH1F * h11 = new TH1F("hTOFRecPointsToTIC", "RecPoints ToT Spectrum in TOF (ns)-I/C side; Measured TOT [ns];Counts", 1000, 0., 48.8 ) ;
354 TH1F * h12 = new TH1F("hTOFRecPointsToTOC", "RecPoints ToT Spectrum in TOF (ns)-O/C side; Measured TOT [ns];Counts", 1000, 0., 48.8 ) ;
355 TH1F * h13 = new TH1F("hTOFRawChannelHits","TOF channel hits count; Channel ID; Hits", 158000, 0., 158000);
357 TH2F * h14 = new TH2F("hTOFRecPointsClusMap","RecPoints vs TOF phi-eta; eta (2*strip+padz);phi (48*sector+padx)",183, -0.5, 182.5,865,-0.5,864.5) ;
358 TH2F * h15 = new TH2F("hTOFRecTimeVsStrip","RecPoints TOF time vs. strip (theta); Strip index; RecPoints TOF time (ns) ",92,-1.,91, 250, 0., 610.) ;
360 TH2F * h16 = new TH2F("hTOFRecPointsTimeVsTRM035","TOF RecPoints time vs TRM - crates 0 to 35; TRM index = DDL*10+TRM(0-9);TOF time [ns]", 361, 0., 361., 250, 0., 610.0) ;
361 TH2F * h17 = new TH2F("hTOFRecPointsTimeVsTRM3671","TOF RecPoints time vs TRM - crates 36 to 72; TRM index = DDL**10+TRM(0-9);TOF time [ns]", 361, 360., 721., 250, 0., 610.0) ;
362 TH2F * h18 = new TH2F("hTOFRecPointsToTVsTRM035","TOF RecPoints ToT vs TRM - crates 0 to 35; TRM index = DDL*10+TRM(0-9);TOF ToT [ns] ", 361, 0., 361., 100, 0., 48.8) ;
363 TH2F * h19 = new TH2F("hTOFRecPointsToTVsTRM3671","TOF RecPoints ToT vs TRM - crates 36 to 72; TRM index = DDL*10+TRM(0-9);TOF ToT [ns] ", 361, 360., 721., 100, 0., 48.8) ;
386 Add2RecPointsList(h0, 0, !expert, image) ;
387 Add2RecPointsList(h1, 1, !expert, image) ;
388 Add2RecPointsList(h2, 2, !expert, image) ;
389 Add2RecPointsList(h3, 3, !expert, image) ;
390 Add2RecPointsList(h4, 4, !expert, image) ;
391 Add2RecPointsList(h5, 5, expert, !image) ;
392 Add2RecPointsList(h6, 6, expert, !image) ;
393 Add2RecPointsList(h7, 7, expert, !image) ;
394 Add2RecPointsList(h8, 8, expert, !image) ;
395 Add2RecPointsList(h9, 9, !expert, image) ;
396 Add2RecPointsList(h10, 10, !expert, image) ;
397 Add2RecPointsList(h11, 11, !expert, image) ;
398 Add2RecPointsList(h12, 12, !expert, image) ;
399 Add2RecPointsList(h13, 13, expert, !image) ;
400 Add2RecPointsList(h14, 14, expert, !image) ;
401 Add2RecPointsList(h15, 15, expert, !image) ;
402 Add2RecPointsList(h16, 16, expert, !image) ;
403 Add2RecPointsList(h17, 17, expert, !image) ;
404 Add2RecPointsList(h18, 18, expert, !image) ;
405 Add2RecPointsList(h19, 19, expert, !image) ;
409 //____________________________________________________________________________
410 void AliTOFQADataMakerRec::InitESDs()
413 //create ESDs histograms in ESDs subdir
416 const Bool_t expert = kTRUE ;
417 const Bool_t image = kTRUE ;
419 TH1I * h0 = new TH1I("hTOFESDs", "Number of matched TOF tracks per event;Number of TOF matched ESD tracks;Counts", 200, 0, 200) ;
420 TH1F * h1 = new TH1F("hTOFESDsTime", "Matched ESDs tracks: TOF Time spectrum; Calibrated TOF time [ns];Counts", 25000, 0., 610. ) ;
421 TH1F * h2 = new TH1F("hTOFESDsRawTime", "Matched ESDs tracks: TOF raw Time spectrum;Measured TOF time [ns];Counts", 25000, 0., 610.) ;
422 TH1F * h3 = new TH1F("hTOFESDsToT", "Matched ESDs tracks: TOF ToT spectrum; ESDs ToT [ns];Counts",1000, 0., 48.8) ;
423 TH1F * h4 = new TH1F("hTOFESDsPIDoverMatched", "Fraction of TOF identified tracks over matched TOF tracks per event; identified by TOF / matched tracks [%];Counts", 101, -1., 100.) ;
424 TH1F * h5 = new TH1F("hTOFESDsPID", "Fraction of TOF identified tracks over ESD identified tracks per event; identified by TOF / ESD identified [%];Counts", 101, -1., 100.) ;
425 TH1F * h6 = new TH1F("hTOFESDsTPCmatched", "TPC-TOF matched tracks momentum distribution (GeV/c); p (GeV/c);Counts", 50, 0.20, 5.00) ;
426 TH1F * h7 = new TH1F("hTOFESDsMatchingProb", "TPC-TOF track-matching probability per event;TPC-TOF track-matching probability (%) ;Counts",101, -1.0, 100) ;
427 TH1F * h8 = new TH1F("hTOFESDsHitOverTracked", "Fraction of TOF matching tracks over propagated tracks per event; TOF matched / propagated to TOF [%];Counts",101, -1.0, 100.0) ;
428 TH1F * h9 = new TH1F("hTOFESDsDiffTime", "ESDs t_{TOF}-t_{exp} spectrum in TOF (ps); t_{TOF}-t_{exp} [ps];Counts", 200, -2440., 2440.) ;
429 TH1F * h10 = new TH1F("hTOFHitsLength", "Matched ESDs tracks: Length Spectrum; Track length [cm];Counts", 800, 0., 800) ;
442 Add2ESDsList(h0, 0, !expert, image) ;
443 Add2ESDsList(h1, 1, !expert, image) ;
444 Add2ESDsList(h2, 2, expert, image) ;
445 Add2ESDsList(h3, 3, !expert, image) ;
446 Add2ESDsList(h4, 4, expert, image) ;
447 Add2ESDsList(h5, 5, expert, image) ;
448 Add2ESDsList(h6, 6, expert, image) ;
449 Add2ESDsList(h7, 7, expert, image) ;
450 Add2ESDsList(h8, 8, expert, image) ;
451 Add2ESDsList(h9, 9, !expert, image) ;
452 Add2ESDsList(h10, 10, !expert, image) ;
457 //____________________________________________________________________________
458 void AliTOFQADataMakerRec::MakeRaws(AliRawReader* rawReader)
461 // makes data from Raws
463 if (rawReader->GetType()==7) {
465 Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;//in ns
466 Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
468 Int_t ntof[5]; /* 0=tot, 1=IA, 2=OA, 3=IC, 4=OC*/
469 for (Int_t j=0;j<5;j++){ ntof[j]=0;}
471 Int_t equipmentID[5]; //(ddl, trm, chain,tdc,channel)
472 Int_t volumeID[5]; //(sector,plate,strip,padX,padZ)
473 Int_t volumeID2[5]; //(sector,plate,strip,padZ,padX) to use AliTOFGeometry::GetIndex()
474 Int_t out[5]; // out=(indexZ,indexPhi)
477 TClonesArray * clonesRawData;
478 //AliTOFRawStream tofInput(rawReader);
479 fTOFRawStream.SetRawReader(rawReader);
481 //uncomment if needed to apply DeltaBC correction
482 //fTOFRawStream.ApplyBCCorrections(kTRUE);
484 for (Int_t iDDL = 0; iDDL < AliTOFGeometry::NDDL()*AliTOFGeometry::NSectors(); iDDL++){
487 fTOFRawStream.LoadRawDataBuffersV2(iDDL);
488 clonesRawData = (TClonesArray*)fTOFRawStream.GetRawData();
489 for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
490 AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
492 if (tofRawDatum->GetTOF()){
495 equipmentID[1]=tofRawDatum->GetTRM();
496 equipmentID[2]=tofRawDatum->GetTRMchain();
497 equipmentID[3]=tofRawDatum->GetTDC();
498 equipmentID[4]=tofRawDatum->GetTDCchannel();
500 if (CheckEquipID(equipmentID)){
501 fTOFRawStream.EquipmentId2VolumeId(iDDL,
502 tofRawDatum->GetTRM(),
503 tofRawDatum->GetTRMchain(),
504 tofRawDatum->GetTDC(),
505 tofRawDatum->GetTDCchannel(),
507 if (FilterSpare(equipmentID)) continue;
508 if (FilterLTMData(equipmentID)){ //counts LTM hits
509 if (tofRawDatum->GetTOT()) GetRawsData(15)->Fill(equipmentID[0]);
511 if (CheckVolumeID(volumeID)){
513 GetMapIndeces(volumeID,out);
514 volumeID2[0]=volumeID[0];
515 volumeID2[1]=volumeID[1];
516 volumeID2[2]=volumeID[2];
517 volumeID2[3]=volumeID[4];
518 volumeID2[4]=volumeID[3];
519 chIndex=AliTOFGeometry::GetIndex(volumeID2);
521 if (tofRawDatum->GetTOT()){
522 if (!(fCalibData->GetNoiseStatus(chIndex)==AliTOFChannelOnlineStatusArray::kTOFNoiseBad)
523 && (fCalibData->GetHWStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFHWOk)) {//noise and enabled filter
524 ntof[0]++; //counter for tof hits
526 //fill global spectra for DQM plots
527 GetRawsData(5)->Fill( tofRawDatum->GetTOF()*tdc2ns) ;//in ns
528 GetRawsData(10)->Fill( tofRawDatum->GetTOT()*tot2ns) ;//in ns
530 //fill side-related spectra for experts plots
531 if (volumeID2[0]>4 && volumeID2[0]<14){ //I side
532 if ((iDDL%4==0)|| (iDDL%4==1)){ //A side
534 GetRawsData(6)->Fill( tofRawDatum->GetTOF()*tdc2ns) ;
535 GetRawsData(11)->Fill( tofRawDatum->GetTOT()*tot2ns) ;
537 if ((iDDL%4==2)|| (iDDL%4==3)){//C side
539 GetRawsData(8)->Fill( tofRawDatum->GetTOF()*tdc2ns) ;
540 GetRawsData(13)->Fill( tofRawDatum->GetTOT()*tot2ns) ;
544 if (volumeID2[0]<5 || volumeID2[0]>13){ //O side
545 if ((iDDL%4==0)|| (iDDL%4==1)){ //A side
547 GetRawsData(7)->Fill( tofRawDatum->GetTOF()*tdc2ns) ;
548 GetRawsData(12)->Fill( tofRawDatum->GetTOT()*tot2ns) ;
550 if ((iDDL%4==2)|| (iDDL%4==3)){//C side
552 GetRawsData(9)->Fill( tofRawDatum->GetTOF()*tdc2ns) ;
553 GetRawsData(14)->Fill( tofRawDatum->GetTOT()*tot2ns) ;
558 GetRawsData(18)->Fill(chIndex);
560 Int_t trm= iDDL*10+(equipmentID[1]-3);
561 if (iDDL>=0 && iDDL<36) {
562 GetRawsData(16)->Fill(trm) ;
563 GetRawsData(20)->Fill(trm,tofRawDatum->GetTOF()*tdc2ns);
564 GetRawsData(22)->Fill(trm,tofRawDatum->GetTOT()*tot2ns);
566 if (iDDL>=36 && iDDL<72) {
567 GetRawsData(17)->Fill(trm) ;//in ns
568 GetRawsData(21)->Fill(trm,tofRawDatum->GetTOF()*tdc2ns);
569 GetRawsData(23)->Fill(trm,tofRawDatum->GetTOT()*tot2ns);
571 GetRawsData(24)->Fill(GetStripIndex(volumeID),tofRawDatum->GetTOF()*tdc2ns) ;
572 //GetRawsData(25)->Fill( out[0],out[1]) ;//raw map
576 if (!(fCalibData->GetNoiseStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFNoiseBad)
577 && (fCalibData->GetHWStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFHWOk))
578 GetRawsData(19)->Fill( tofRawDatum->GetTOF()*tdc2ns) ;//in ns
580 }//end volumeID check
585 clonesRawData->Clear();
588 for (Int_t j=0;j<5;j++){
589 GetRawsData(j)->Fill(ntof[j]);
591 fProcessedRawEventN++;
593 fTOFRawStream.Clear();
596 AliDebug(1,Form("Event of type %d found. Skipping non-physics event for QA.\n", rawReader->GetType()));
598 EnableDqmShifterOpt(kTRUE);
601 //____________________________________________________________________________
602 void AliTOFQADataMakerRec::MakeRecPoints(TTree * clustersTree)
605 // Make data from Clusters
608 Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;
609 Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
615 TBranch *branch=clustersTree->GetBranch("TOF");
617 AliError("can't get the branch with the TOF clusters !");
621 static TClonesArray dummy("AliTOFcluster",10000);
623 TClonesArray *clusters=&dummy;
624 branch->SetAddress(&clusters);
627 clustersTree->GetEvent(0);
629 GetRecPointsData(0)->Fill((Int_t)clusters->GetEntriesFast()) ;
631 TIter next(clusters) ;
633 while ( (c = dynamic_cast<AliTOFcluster *>(next())) ) {
635 volumeID[0] = c->GetDetInd(0);
636 volumeID[1] = c->GetDetInd(1);
637 volumeID[2] = c->GetDetInd(2);
638 volumeID[3] = c->GetDetInd(4); //X and Z indeces inverted in RecPoints
639 volumeID[4] = c->GetDetInd(3); //X and Z indeces inverted in RecPoints
641 for (Int_t i=0;i<5;i++){
642 volumeID2[i]=c->GetDetInd(i); //X and Z indeces inverted in RecPoints
645 GetMapIndeces(volumeID,out);
646 Int_t chIndex=AliTOFGeometry::GetIndex(volumeID2);
647 Int_t iDDL=AliTOFRawStream::Geant2DDL(volumeID2);
648 Int_t iTRM=AliTOFRawStream::Geant2TRM(volumeID2);
650 if (c->GetTDCRAW() && c->GetTDC() && c->GetToT()){
651 if (volumeID2[0]>4 && volumeID2[0]<14){ //I side
652 if ((iDDL%4==0)|| (iDDL%4==1)){ //A side
653 GetRecPointsData(1)->Fill( c->GetTDC()*tdc2ns) ;//in ns
654 GetRecPointsData(5)->Fill( c->GetTDCRAW()*tdc2ns) ;//in ns
655 GetRecPointsData(9)->Fill( c->GetToT()*tot2ns) ;//in ns
658 if ((iDDL%4==2)|| (iDDL%4==3)){//C side
659 GetRecPointsData(3)->Fill( c->GetTDC()*tdc2ns) ;//in ns
660 GetRecPointsData(7)->Fill( c->GetTDCRAW()*tdc2ns) ;//in ns
661 GetRecPointsData(11)->Fill( c->GetToT()*tot2ns) ;//in ns
665 if (volumeID2[0]<5 || volumeID2[0]>13){ //O side
666 if ((iDDL%4==0)|| (iDDL%4==1)){ //A side
667 GetRecPointsData(2)->Fill( c->GetTDC()*tdc2ns) ;//in ns
668 GetRecPointsData(6)->Fill( c->GetTDCRAW()*tdc2ns) ;//in ns
669 GetRecPointsData(10)->Fill( c->GetToT()*tot2ns) ;//in ns
671 if ((iDDL%4==2)|| (iDDL%4==3)){//C side
672 GetRecPointsData(4)->Fill( c->GetTDC()*tdc2ns) ;//in ns
673 GetRecPointsData(8)->Fill( c->GetTDCRAW()*tdc2ns) ;//in ns
674 GetRecPointsData(12)->Fill( c->GetToT()*tot2ns) ;//in ns
679 GetRecPointsData(14)->Fill(out[0],out[1]);
680 GetRecPointsData(15)->Fill(GetStripIndex(volumeID), c->GetTDC()*tdc2ns) ;
681 Int_t trm= iDDL*10+(iTRM-3);
682 if (iDDL>=0 && iDDL<36) {
683 GetRecPointsData(16)->Fill(trm,c->GetTDC()*tdc2ns);
684 GetRecPointsData(18)->Fill(trm,c->GetToT()*tot2ns);
686 if (iDDL>=36 && iDDL<72) {
687 GetRecPointsData(17)->Fill(trm,c->GetTDC()*tdc2ns);
688 GetRecPointsData(19)->Fill(trm,c->GetToT()*tot2ns);
690 GetRecPointsData(13)->Fill(chIndex) ;//in ns
694 EnableDqmShifterOpt(kFALSE);
697 //____________________________________________________________________________
698 void AliTOFQADataMakerRec::MakeESDs(AliESDEvent * esd)
701 // make QA data from ESDs
703 const Double_t speedOfLight = TMath::C()*1E2*1E-12; // cm/ps
704 const Double_t pionMass = 0.13957018; //GeV/c^2
706 Int_t ntrk = esd->GetNumberOfTracks() ;
715 AliESDtrack *track=esd->GetTrack(ntrk);
716 Double_t tofTime=track->GetTOFsignal();//in ps
717 Double_t tofTimeRaw=track->GetTOFsignalRaw();//in ps
718 Double_t tofToT=track->GetTOFsignalToT(); //in ps
720 UInt_t status=track->GetStatus();
721 if (track->IsOn(AliESDtrack::kTPCrefit)) {
723 Double_t y=track->Eta();
724 if ((status&AliESDtrack::kTOFout)!=0) {
729 if (TMath::Abs(y)<0.9) {
730 GetESDsData(6)->Fill(track->Pt());
733 GetESDsData(1)->Fill(tofTime*1E-3);
734 GetESDsData(2)->Fill(tofTimeRaw*1E-3);
735 GetESDsData(3)->Fill(tofToT*1E-3);
736 //check how many tracks where ESD PID is ok
737 if ((status&AliESDtrack::kESDpid)!=0) nesdpid++;
738 if (((status&AliESDtrack::kESDpid)&AliESDtrack::kTOFpid)!=0) ntofpid++;
740 Double_t length =track->GetIntegratedLength();
741 Double_t mom2=(track->Pt()*track->Pt())+(track->Pz()*track->Pz());
742 Double_t eTexp = TMath::Sqrt(1+(pionMass*pionMass/mom2))*length/speedOfLight; //in ps
743 GetESDsData(9)->Fill(tofTime-eTexp);
744 GetESDsData(10)->Fill(length);
745 } //end check on matched tracks
747 }//end check on TPCrefit
750 GetESDsData(0)->Fill(ntof) ;
754 Float_t ratio = (Int_t)ntofpid/(Int_t)ntof*100; //identified by TOF over matched
755 GetESDsData(4)->Fill(ratio) ;
759 Float_t ratio = (Float_t)ntofpid/(Float_t)nesdpid *100; //identified by TOF over identified
760 GetESDsData(5)->Fill(ratio) ;
764 Float_t ratio = (Float_t)ntof/(Float_t)ntpc*100.; //matching probability
765 GetESDsData(7)->Fill(ratio) ;
769 Float_t ratio = (Float_t)ntof/(Float_t)ntofout*100; //matched over propagated to TOF outer radius
770 GetESDsData(8)->Fill(ratio) ;
772 EnableDqmShifterOpt(kFALSE);
775 //____________________________________________________________________________
776 void AliTOFQADataMakerRec::StartOfDetectorCycle()
779 //Detector specific actions at start of cycle
781 fCalibData = GetCalibData();
785 //____________________________________________________________________________
786 void AliTOFQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
788 //Detector specific actions at end of cycle
789 // do the QA checking
791 TH1F hTrmChannels035("hTrmchannels035", "Active channels per TRM - crates 0 to 35;TRM index = SMid(crate*10)+TRM(0-9);Active channels", 361, 0., 361.) ;
792 TH1F hTrmChannels3671("hTrmChannels3671","Active channels per TRM - crates 36 to 71 ;TRM index = SMid(crate*10)+TRM(0-9);Active channels", 361, 360., 721.) ;
794 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
795 if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) )
798 if (fEnableDqmShifterOpt){
799 // Help make the raw qa histogram easier to interpret for the DQM shifter
800 if (!GetRawsData(0) || !GetRawsData(5) || !GetRawsData(10)
801 || !GetRawsData(15) || !GetRawsData(16) || !GetRawsData(17)) {
802 printf("No histogram for DQM found - Possible memory corruption ???. Please check\n") ;
805 AliInfo(Form("Processed %i physics raw events",fProcessedRawEventN));
809 //normalize TRM hits plots to the number of enabled channels from OCDB object
810 //TH1F * hTrmChannels035 = new TH1F("hTrmchannels035", "Active channels per TRM - crates 0 to 35;TRM index = SMid(crate*10)+TRM(0-9);Active channels", 361, 0., 361.) ;
811 //TH1F * hTrmChannels3671 = new TH1F("hTrmChannels3671","Active channels per TRM - crates 36 to 71 ;TRM index = SMid(crate*10)+TRM(0-9);Active channels", 361, 360., 721.) ;
812 hTrmChannels035.Clear();
813 hTrmChannels3671.Clear();
814 for (Int_t ch = 0; ch < fCalibData->GetSize(); ch++) {
815 if (!(fCalibData->GetNoiseStatus(ch)==AliTOFChannelOnlineStatusArray::kTOFNoiseBad)
816 && (fCalibData->GetHWStatus(ch) == AliTOFChannelOnlineStatusArray::kTOFHWOk)){
819 AliTOFGeometry::GetVolumeIndices(ch,geoId);
820 AliTOFRawStream::Geant2EquipmentId(geoId,detId); //detID=(ddl,trm,tdc, chain,channel)
821 if (detId[0]<36) hTrmChannels035.Fill((detId[1]-3)+detId[0]*10);
822 else hTrmChannels3671.Fill((detId[1]-3)+detId[0]*10);
825 GetRawsData(16)->Divide(&hTrmChannels035);
826 GetRawsData(16)->SetTitle("TRMs average hit number per active channel - crates 0-35");
827 GetRawsData(16)->GetYaxis()->SetTitle("hits/active channels");
828 GetRawsData(17)->Divide(&hTrmChannels3671);
829 GetRawsData(17)->SetTitle("TRMs average hit number per active channel - crates 36-71");
830 GetRawsData(17)->GetYaxis()->SetTitle("hits/active channels");
833 //set minima and maxima to allow log scale
834 Double_t yTimeMax = GetRawsData(5)->GetMaximum();
835 Double_t yTotMax = GetRawsData(10)->GetMaximum();
836 Double_t yTrmMax = TMath::Max(GetRawsData(16)->GetMaximum(),GetRawsData(17)->GetMaximum());
837 // Double_t yLtmMax = GetRawsData(15)->GetMaximum();
838 // Double_t yHitMax = GetRawsData(0)->GetMaximum();
840 // GetRawsData(0)->SetMinimum(0.1);
841 // GetRawsData(5)->SetMinimum(0.1);
842 // GetRawsData(10)->SetMinimum(0.1);
843 // GetRawsData(15)->SetMinimum(0.1);
844 GetRawsData(16)->SetMinimum(0.0001);
845 GetRawsData(17)->SetMinimum(0.0001);
847 // GetRawsData(0)->SetMaximum(yHitMax);
848 // GetRawsData(5)->SetMaximum(yTimeMax);
849 // GetRawsData(10)->SetMaximum(yTotMax);
850 // GetRawsData(15)->SetMaximum(yLtmMax);
851 GetRawsData(16)->SetMaximum(yTrmMax);
852 GetRawsData(17)->SetMaximum(yTrmMax);
854 fLineExpTimeMin->SetY2(yTimeMax);
855 fLineExpTimeMax->SetY2(yTimeMax);
856 fLineExpTotMin->SetY2(yTotMax);
857 fLineExpTotMax->SetY2(yTotMax);
858 for (Int_t sm=0;sm<10;sm++){
859 fLineSMid035[sm]->SetY2(yTrmMax);
860 fLineSMid3671[sm]->SetY2(yTrmMax);
864 //make up for all histos
865 for(Int_t j=0;j<20;j++){
867 GetRawsData(j)->SetMarkerColor(kRed);
868 GetRawsData(j)->SetMarkerStyle(7);
870 GetRawsData(j)->SetLineColor(kBlue+1);
871 GetRawsData(j)->SetLineWidth(1);
872 GetRawsData(j)->SetMarkerColor(kBlue+1);
876 for (Int_t j=15;j<19;j++){
877 GetRawsData(j)->SetFillColor(kGray+1);
878 GetRawsData(j)->SetOption("bar");
884 AliQAChecker::Instance()->Run(AliQAv1::kTOF, task, list) ;
886 //____________________________________________________________________________
887 void AliTOFQADataMakerRec::GetMapIndeces(const Int_t* const in , Int_t* out)
890 //return appropriate indeces for the theta-phi map
893 Int_t npadX = AliTOFGeometry::NpadX();
894 Int_t npadZ = AliTOFGeometry::NpadZ();
895 Int_t nStripA = AliTOFGeometry::NStripA();
896 Int_t nStripB = AliTOFGeometry::NStripB();
897 Int_t nStripC = AliTOFGeometry::NStripC();
899 Int_t isector = in[0];
900 Int_t iplate = in[1];
901 Int_t istrip = in[2];
905 Int_t stripOffset = 0;
911 stripOffset = nStripC;
914 stripOffset = nStripC+nStripB;
917 stripOffset = nStripC+nStripB+nStripA;
920 stripOffset = nStripC+nStripB+nStripA+nStripB;
923 AliDebug(1,Form("Wrong plate number in TOF (%d) !",iplate));
926 Int_t zindex=npadZ*(istrip+stripOffset)+(ipadZ+1);
927 Int_t phiindex=npadX*isector+ipadX+1;
933 //---------------------------------------------------------------
934 Int_t AliTOFQADataMakerRec::GetStripIndex(const Int_t * const in)
936 /* return tof strip index between 0 and 91 */
938 Int_t nStripA = AliTOFGeometry::NStripA();
939 Int_t nStripB = AliTOFGeometry::NStripB();
940 Int_t nStripC = AliTOFGeometry::NStripC();
942 // Int_t isector = in[0];
943 Int_t iplate = in[1];
944 Int_t istrip = in[2];
945 //Int_t ipadX = in[3];
946 //Int_t ipadZ = in[4];
948 Int_t stripOffset = 0;
954 stripOffset = nStripC;
957 stripOffset = nStripC+nStripB;
960 stripOffset = nStripC+nStripB+nStripA;
963 stripOffset = nStripC+nStripB+nStripA+nStripB;
966 AliDebug(1,Form("Wrong plate number in TOF (%d) !",iplate));
971 if (stripOffset<0 || stripOffset>92) return -1;
973 return (stripOffset+istrip);
976 //---------------------------------------------------------------
977 Bool_t AliTOFQADataMakerRec::CheckVolumeID(const Int_t * const volumeID)
980 //Checks volume ID validity
983 for (Int_t j=0;j<5;j++){
985 AliDebug(1,Form("Invalid detector volume index for volumeID[%i]",j));
993 //---------------------------------------------------------------
994 Bool_t AliTOFQADataMakerRec::CheckEquipID(const Int_t * const equipmentID)
997 //Checks equipment ID validity
999 for (Int_t j=0;j<5;j++){
1000 if (equipmentID[j]<0) {
1001 AliDebug(1,Form("Invalid equipment volume index for equipmentID[%i]",j));
1007 //---------------------------------------------------------------
1008 Bool_t AliTOFQADataMakerRec::FilterLTMData(const Int_t * const equipmentID) const
1010 /*It returns kTRUE if data come from LTM.
1011 It thus filters trigger-related signals */
1013 Int_t ddl, trm, tdc;
1014 //if (!CheckEquipID(equipmentID)) return kFALSE;
1015 ddl = equipmentID[0];
1016 trm = equipmentID[1];
1017 tdc = equipmentID[3];
1019 if ((ddl%2==1) && (trm==3) && (tdc>11 && tdc<15))
1025 //---------------------------------------------------------------
1026 Bool_t AliTOFQADataMakerRec::FilterSpare(const Int_t * const equipmentID) const
1028 /*It returns kTRUE if data come from spare
1030 So far only check on TRM 3 crate left is implemented */
1032 Int_t ddl, trm, tdc;
1033 //if (!CheckEquipID(equipmentID)) return kFALSE;
1034 ddl = equipmentID[0];
1035 trm = equipmentID[1];
1036 tdc = equipmentID[3];
1038 if ((ddl%2==1) && (trm==3) && (tdc>2 && tdc<12))