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 fbellini on 14/06/2010
27 - use LoadRawDataBuffersV2()
29 Modified by fbellini on 10/05/2010
30 - Fixed EndOfDetectorCycle() memory corruption bug
32 Modified by fbellini on 22/04/2010
33 - Added filter for physics events
35 Modified by fbellini on 16/04/2010
36 - Added EnableDqmShifterOpt()
37 - Modified EndOfDetectorCycle() with options for DQM
40 Modified by fbellini on 30/03/2010
41 - Changed raws time histos range to 610ns
42 - Added FilterLTMData() and FilterSpare() methods
43 - Added check on enabled channels for raw data
44 - Updated RecPoints QA
46 Modified by fbellini on 02/03/2010
47 - Fixed raw data decoding methods (use AliTOFRawStream::LoadRawDataBuffer())
48 - Added filter for noisy channels and read map from OCDB
49 - Added GetCalibData() method
50 - Added CheckVolumeID() and CheckEquipID() methods
54 #include <TClonesArray.h>
59 #include "AliCDBManager.h"
60 #include "AliCDBEntry.h"
61 #include "AliESDEvent.h"
62 #include "AliESDtrack.h"
63 #include "AliQAChecker.h"
64 #include "AliRawReader.h"
65 #include "AliTOFRawStream.h"
66 #include "AliTOFcluster.h"
67 #include "AliTOFQADataMakerRec.h"
68 #include "AliTOFrawData.h"
69 #include "AliTOFGeometry.h"
70 #include "AliTOFChannelOnlineStatusArray.h"
73 ClassImp(AliTOFQADataMakerRec)
75 //____________________________________________________________________________
76 AliTOFQADataMakerRec::AliTOFQADataMakerRec() :
77 AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kTOF), "TOF Quality Assurance Data Maker"),
79 fEnableNoiseFiltering(kFALSE),
80 fEnableDqmShifterOpt(kFALSE),
81 fProcessedRawEventN(0)
89 //____________________________________________________________________________
90 AliTOFQADataMakerRec::AliTOFQADataMakerRec(const AliTOFQADataMakerRec& qadm) :
92 fCalibData(qadm.fCalibData),
93 fEnableNoiseFiltering(qadm.fEnableNoiseFiltering),
94 fEnableDqmShifterOpt(qadm.fEnableDqmShifterOpt),
95 fProcessedRawEventN(qadm.fProcessedRawEventN)
100 SetName((const char*)qadm.GetName()) ;
101 SetTitle((const char*)qadm.GetTitle());
106 //__________________________________________________________________
107 AliTOFQADataMakerRec& AliTOFQADataMakerRec::operator = (const AliTOFQADataMakerRec& qadm )
110 // assignment operator.
112 this->~AliTOFQADataMakerRec();
113 new(this) AliTOFQADataMakerRec(qadm);
117 //----------------------------------------------------------------------------
118 AliTOFChannelOnlineStatusArray* AliTOFQADataMakerRec::GetCalibData() const
121 // Retrive TOF calib objects from OCDB
123 AliCDBManager *man = AliCDBManager::Instance();
127 cdbe = man->Get("TOF/Calib/Status",fRun);
129 AliWarning("Load of calibration data from default storage failed!");
130 AliWarning("Calibration data will be loaded from local storage ($ALICE_ROOT)");
131 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
132 cdbe = man->Get("TOF/Calib/Status",fRun);
134 // Retrieval of data in directory TOF/Calib/Data:
136 AliTOFChannelOnlineStatusArray * array = 0;
137 if (cdbe) array = (AliTOFChannelOnlineStatusArray *)cdbe->GetObject();
138 if (!array) AliFatal("No calibration data from calibration database !");
146 //____________________________________________________________________________
147 void AliTOFQADataMakerRec::InitRaws()
150 // create Raws histograms in Raws subdir
152 const Bool_t expert = kTRUE ;
153 const Bool_t saveCorr = kTRUE ;
154 const Bool_t image = kTRUE ;
156 TH1I * h0 = new TH1I("hTOFRaws", "TOF raw hit multiplicity; TOF raw hits number;Counts ",200, 0, 200) ;
158 TH1I * h1 = new TH1I("hTOFRawsIA", "TOF raw hit multiplicity - I/A side; TOF raw hits number ;Counts ",200, 0, 200) ;
159 TH1I * h2 = new TH1I("hTOFRawsOA", "TOF raw hit multiplicity - O/A side; TOF raw hits number ;Counts ",200, 0, 200) ;
160 TH1I * h3 = new TH1I("hTOFRawsIC", "TOF raw hit multiplicity - I/C side; TOF raw hits number ;Counts ",200, 0, 200) ;
161 TH1I * h4 = new TH1I("hTOFRawsOC", "TOF raw hit multiplicity - O/C side; TOF raw hits number ;Counts ",200, 0, 200) ;
163 TH1F * h5 = new TH1F("hTOFRawsTime", "TOF Raws - Hit time (ns);Measured Hit time [ns];Counts", 25000,0. ,610.) ;
165 TH1F * h6 = new TH1F("hTOFRawsTimeIA", "TOF Raws - Hit time (ns) - I/A side;Measured Hit time [ns];Counts", 25000,0. ,610.) ;
166 TH1F * h7 = new TH1F("hTOFRawsTimeOA", "TOF Raws - Hit time (ns) - O/A side;Measured Hit time [ns];Counts", 25000,0. ,610.) ;
167 TH1F * h8 = new TH1F("hTOFRawsTimeIC", "TOF Raws - Hit time (ns) - I/C side;Measured Hit time [ns];Counts", 25000,0. ,610.) ;
168 TH1F * h9 = new TH1F("hTOFRawsTimeOC", "TOF Raws - Hit time (ns) - O/C side;Measured Hit time [ns];Counts", 25000,0. ,610.) ;
170 TH1F * h10 = new TH1F("hTOFRawsToT", "TOF Raws - Hit ToT (ns);Measured Hit ToT (ns);Counts", 1000, 0., 48.8) ;
172 TH1F * h11 = new TH1F("hTOFRawsToTIA", "TOF Raws - Hit ToT (ns) - I/A side;Measured Hit ToT (ns);Counts", 1000, 0., 48.8) ;
173 TH1F * h12 = new TH1F("hTOFRawsToTOA", "TOF Raws - Hit ToT (ns) - O/A side;Measured Hit ToT (ns);Counts", 1000, 0., 48.8) ;
174 TH1F * h13 = new TH1F("hTOFRawsToTIC", "TOF Raws - Hit ToT (ns) - I/C side;Measured Hit ToT (ns);Counts", 1000, 0., 48.8) ;
175 TH1F * h14 = new TH1F("hTOFRawsToTOC", "TOF Raws - Hit ToT (ns) - O/C side;Measured Hit ToT (ns);Counts", 1000, 0., 48.8) ;
177 TH1F * h15 = new TH1F("hTOFRawsLTMHits", "LTMs OR signals; Crate; Counts", 72, 0., 72.);
178 TH1F * h16 = new TH1F("hTOFRawsTRMHits035", "TRM hits - crates 0 to 35 ;TRM index = SMid(crate*10)+TRM(0-9);Hits", 361, 0., 361.) ;
179 TH1F * h17 = new TH1F("hTOFRawsTRMHits3671","TRM hits - crates 36 to 71 ;TRM index = SMid(crate*10)+TRM(0-9);Hits", 361, 360., 721.) ;
181 TH1F * h18 = new TH1F("hTOFRawChannelHits","TOF channel hits count; Channel ID; Hits", 158000, 0., 158000);
183 TH1F * h19 = new TH1F("hTOFOrphansTime", "TOF Raws - Orphans time (ns);Measured Hit time [ns];Counts", 25000, 0. ,610.) ;
184 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) ;
185 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) ;
186 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) ;
187 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) ;
188 TH2F * h24 = new TH2F("hTOFTimeVsStrip","TOF Raws - Hit time vs. strip (theta); Strip index;Raws TOF time (ns) ", 91,0.,91, 250, 0., 610.) ;
190 // 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) ;
218 Add2RawsList(h0, 0, !expert, image, !saveCorr) ;
219 Add2RawsList(h1, 1, expert, !image, !saveCorr) ;
220 Add2RawsList(h2, 2, expert, !image, !saveCorr) ;
221 Add2RawsList(h3, 3, expert, !image, !saveCorr) ;
222 Add2RawsList(h4, 4, expert, !image, !saveCorr) ;
223 Add2RawsList(h5, 5, !expert, image, !saveCorr) ;
224 Add2RawsList(h6, 6, expert, !image, !saveCorr) ;
225 Add2RawsList(h7, 7, expert, !image, !saveCorr) ;
226 Add2RawsList(h8, 8, expert, !image, !saveCorr) ;
227 Add2RawsList(h9, 9, expert, !image, !saveCorr) ;
228 Add2RawsList(h10, 10, !expert, image, !saveCorr) ;
229 Add2RawsList(h11, 11, expert, !image, !saveCorr) ;
230 Add2RawsList(h12, 12, expert, !image, !saveCorr) ;
231 Add2RawsList(h13, 13, expert, !image, !saveCorr) ;
232 Add2RawsList(h14, 14, expert, !image, !saveCorr) ;
233 Add2RawsList(h15, 15, !expert, image, !saveCorr) ;
234 Add2RawsList(h16, 16, !expert, image, !saveCorr) ;
235 Add2RawsList(h17, 17, !expert, image, !saveCorr) ;
236 Add2RawsList(h18, 18, expert, !image, !saveCorr) ;
237 Add2RawsList(h19, 19, expert, !image, !saveCorr) ;
238 Add2RawsList(h20, 20, expert, !image, !saveCorr) ;
239 Add2RawsList(h21, 21, expert, !image, !saveCorr) ;
240 Add2RawsList(h22, 22, expert, !image, !saveCorr) ;
241 Add2RawsList(h23, 23, expert, !image, !saveCorr) ;
242 Add2RawsList(h24, 24, expert, !image, !saveCorr) ;
246 //____________________________________________________________________________
247 void AliTOFQADataMakerRec::InitRecPoints()
250 // create RecPoints histograms in RecPoints subdir
253 const Bool_t expert = kTRUE ;
254 const Bool_t image = kTRUE ;
256 TH1I * h0 = new TH1I("hTOFRecPoints", "TOF RecPoints multiplicity ; TOF RecPoints number;Counts",200, 0, 200) ;
258 TH1F * h1 = new TH1F("hTOFRecPointsTimeIA", "RecPoints Time Spectrum in TOF (ns)- I/A side; Calibrated TOF time [ns];Counts", 25000, 0., 610.) ;
259 TH1F * h2 = new TH1F("hTOFRecPointsTimeOA", "RecPoints Time Spectrum in TOF (ns)- O/A side; Calibrated TOF time [ns];Counts", 25000, 0., 610.) ;
260 TH1F * h3 = new TH1F("hTOFRecPointsTimeIC", "RecPoints Time Spectrum in TOF (ns)- I/C side; Calibrated TOF time [ns];Counts", 25000, 0., 610.) ;
261 TH1F * h4 = new TH1F("hTOFRecPointsTimeOC", "RecPoints Time Spectrum in TOF (ns)- O/C side; Calibrated TOF time [ns];Counts", 25000, 0., 610.) ;
263 TH1F * h5 = new TH1F("hTOFRecPointsRawTimeIA", "RecPoints raw Time Spectrum in TOF (ns)-I/A side; Measured TOF time [ns];Counts", 25000, 0., 610.) ;
264 TH1F * h6 = new TH1F("hTOFRecPointsRawTimeOA", "RecPoints raw Time Spectrum in TOF (ns)-O/A side; Measured TOF time [ns];Counts", 25000, 0., 610.) ;
265 TH1F * h7 = new TH1F("hTOFRecPointsRawTimeIC", "RecPoints raw Time Spectrum in TOF (ns)-I/C side; Measured TOF time [ns];Counts", 25000, 0., 610.) ;
266 TH1F * h8 = new TH1F("hTOFRecPointsRawTimeOC", "RecPoints raw Time Spectrum in TOF (ns)-O/C side; Measured TOF time [ns];Counts", 25000, 0., 610.) ;
268 TH1F * h9 = new TH1F("hTOFRecPointsToTIA", "RecPoints ToT Spectrum in TOF (ns)-I/A side; Measured TOT [ns];Counts", 1000, 0., 48.8 ) ;
269 TH1F * h10 = new TH1F("hTOFRecPointsToTOA", "RecPoints ToT Spectrum in TOF (ns)-O/A side; Measured TOT [ns];Counts", 1000, 0., 48.8 ) ;
270 TH1F * h11 = new TH1F("hTOFRecPointsToTIC", "RecPoints ToT Spectrum in TOF (ns)-I/C side; Measured TOT [ns];Counts", 1000, 0., 48.8 ) ;
271 TH1F * h12 = new TH1F("hTOFRecPointsToTOC", "RecPoints ToT Spectrum in TOF (ns)-O/C side; Measured TOT [ns];Counts", 1000, 0., 48.8 ) ;
272 TH1F * h13 = new TH1F("hTOFRawChannelHits","TOF channel hits count; Channel ID; Hits", 158000, 0., 158000);
274 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) ;
275 TH2F * h15 = new TH2F("hTOFRecTimeVsStrip","RecPoints TOF time vs. strip (theta); Strip index; RecPoints TOF time (ns) ",92,-1.,91, 250, 0., 610.) ;
277 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) ;
278 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) ;
279 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) ;
280 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) ;
303 Add2RecPointsList(h0, 0, !expert, image) ;
304 Add2RecPointsList(h1, 1, !expert, image) ;
305 Add2RecPointsList(h2, 2, !expert, image) ;
306 Add2RecPointsList(h3, 3, !expert, image) ;
307 Add2RecPointsList(h4, 4, !expert, image) ;
308 Add2RecPointsList(h5, 5, expert, !image) ;
309 Add2RecPointsList(h6, 6, expert, !image) ;
310 Add2RecPointsList(h7, 7, expert, !image) ;
311 Add2RecPointsList(h8, 8, expert, !image) ;
312 Add2RecPointsList(h9, 9, !expert, image) ;
313 Add2RecPointsList(h10, 10, !expert, image) ;
314 Add2RecPointsList(h11, 11, !expert, image) ;
315 Add2RecPointsList(h12, 12, !expert, image) ;
316 Add2RecPointsList(h13, 13, expert, !image) ;
317 Add2RecPointsList(h14, 14, expert, !image) ;
318 Add2RecPointsList(h15, 15, expert, !image) ;
319 Add2RecPointsList(h16, 16, expert, !image) ;
320 Add2RecPointsList(h17, 17, expert, !image) ;
321 Add2RecPointsList(h18, 18, expert, !image) ;
322 Add2RecPointsList(h19, 19, expert, !image) ;
325 //____________________________________________________________________________
326 void AliTOFQADataMakerRec::InitESDs()
329 //create ESDs histograms in ESDs subdir
332 const Bool_t expert = kTRUE ;
333 const Bool_t image = kTRUE ;
335 TH1I * h0 = new TH1I("hTOFESDs", "Number of matched TOF tracks per event;Number of TOF matched ESD tracks;Counts", 200, 0, 200) ;
336 TH1F * h1 = new TH1F("hTOFESDsTime", "Matched ESDs tracks: TOF Time spectrum; Calibrated TOF time [ns];Counts", 25000, 0., 610. ) ;
337 TH1F * h2 = new TH1F("hTOFESDsRawTime", "Matched ESDs tracks: TOF raw Time spectrum;Measured TOF time [ns];Counts", 25000, 0., 610.) ;
338 TH1F * h3 = new TH1F("hTOFESDsToT", "Matched ESDs tracks: TOF ToT spectrum; ESDs ToT [ns];Counts",1000, 0., 48.8) ;
339 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.) ;
340 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.) ;
341 TH1F * h6 = new TH1F("hTOFESDsTPCmatched", "TPC-TOF matched tracks momentum distribution (GeV/c); p (GeV/c);Counts", 50, 0.20, 5.00) ;
342 TH1F * h7 = new TH1F("hTOFESDsMatchingProb", "TPC-TOF track-matching probability per event;TPC-TOF track-matching probability (%) ;Counts",101, -1.0, 100) ;
343 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) ;
344 TH1F * h9 = new TH1F("hTOFESDsDiffTime", "ESDs t_{TOF}-t_{exp} spectrum in TOF (ps); t_{TOF}-t_{exp} [ps];Counts", 200, -2440., 2440.) ;
345 TH1F * h10 = new TH1F("hTOFHitsLength", "Matched ESDs tracks: Length Spectrum; Track length [cm];Counts", 800, 0., 800) ;
358 Add2ESDsList(h0, 0, !expert, image) ;
359 Add2ESDsList(h1, 1, !expert, image) ;
360 Add2ESDsList(h2, 2, expert, image) ;
361 Add2ESDsList(h3, 3, !expert, image) ;
362 Add2ESDsList(h4, 4, expert, image) ;
363 Add2ESDsList(h5, 5, expert, image) ;
364 Add2ESDsList(h6, 6, expert, image) ;
365 Add2ESDsList(h7, 7, expert, image) ;
366 Add2ESDsList(h8, 8, expert, image) ;
367 Add2ESDsList(h9, 9, !expert, image) ;
368 Add2ESDsList(h10, 10, !expert, image) ;
372 //____________________________________________________________________________
373 void AliTOFQADataMakerRec::MakeRaws(AliRawReader* rawReader)
376 // makes data from Raws
378 if (rawReader->GetType()==7) {
380 Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;//in ns
381 Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
383 Int_t ntof[5]; /* 0=tot, 1=IA, 2=OA, 3=IC, 4=OC*/
384 for (Int_t j=0;j<5;j++){ ntof[j]=0;}
386 Int_t equipmentID[5]; //(ddl, trm, chain,tdc,channel)
387 Int_t volumeID[5]; //(sector,plate,strip,padX,padZ)
388 Int_t volumeID2[5]; //(sector,plate,strip,padZ,padX) to use AliTOFGeometry::GetIndex()
389 Int_t out[5]; // out=(indexZ,indexPhi)
392 TClonesArray * clonesRawData;
393 AliTOFRawStream tofInput(rawReader);
395 //uncomment if needed to apply DeltaBC correction
396 //tofInput.ApplyBCCorrections(kTRUE);
398 for (Int_t iDDL = 0; iDDL < AliTOFGeometry::NDDL()*AliTOFGeometry::NSectors(); iDDL++){
401 tofInput.LoadRawDataBuffersV2(iDDL);
402 clonesRawData = (TClonesArray*)tofInput.GetRawData();
403 for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
404 AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
406 if (tofRawDatum->GetTOF()){
409 equipmentID[1]=tofRawDatum->GetTRM();
410 equipmentID[2]=tofRawDatum->GetTRMchain();
411 equipmentID[3]=tofRawDatum->GetTDC();
412 equipmentID[4]=tofRawDatum->GetTDCchannel();
414 if (CheckEquipID(equipmentID)){
415 tofInput.EquipmentId2VolumeId(iDDL,
416 tofRawDatum->GetTRM(),
417 tofRawDatum->GetTRMchain(),
418 tofRawDatum->GetTDC(),
419 tofRawDatum->GetTDCchannel(),
421 if (FilterSpare(equipmentID)) continue;
422 if (FilterLTMData(equipmentID)){ //counts LTM hits
423 if (tofRawDatum->GetTOT()) GetRawsData(15)->Fill(equipmentID[0]);
425 if (CheckVolumeID(volumeID)){
427 GetMapIndeces(volumeID,out);
428 volumeID2[0]=volumeID[0];
429 volumeID2[1]=volumeID[1];
430 volumeID2[2]=volumeID[2];
431 volumeID2[3]=volumeID[4];
432 volumeID2[4]=volumeID[3];
433 chIndex=AliTOFGeometry::GetIndex(volumeID2);
435 if (tofRawDatum->GetTOT()){
436 if (!(fCalibData->GetNoiseStatus(chIndex)==AliTOFChannelOnlineStatusArray::kTOFNoiseBad)
437 && (fCalibData->GetHWStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFHWOk)) {//noise and enabled filter
438 ntof[0]++; //counter for tof hits
440 //fill global spectra for DQM plots
441 GetRawsData(5)->Fill( tofRawDatum->GetTOF()*tdc2ns) ;//in ns
442 GetRawsData(10)->Fill( tofRawDatum->GetTOT()*tot2ns) ;//in ns
444 //fill side-related spectra for experts plots
445 if (volumeID2[0]>4 && volumeID2[0]<14){ //I side
446 if ((iDDL%4==0)|| (iDDL%4==1)){ //A side
448 GetRawsData(6)->Fill( tofRawDatum->GetTOF()*tdc2ns) ;
449 GetRawsData(11)->Fill( tofRawDatum->GetTOT()*tot2ns) ;
451 if ((iDDL%4==2)|| (iDDL%4==3)){//C side
453 GetRawsData(8)->Fill( tofRawDatum->GetTOF()*tdc2ns) ;
454 GetRawsData(13)->Fill( tofRawDatum->GetTOT()*tot2ns) ;
458 if (volumeID2[0]<5 || volumeID2[0]>13){ //O side
459 if ((iDDL%4==0)|| (iDDL%4==1)){ //A side
461 GetRawsData(7)->Fill( tofRawDatum->GetTOF()*tdc2ns) ;
462 GetRawsData(12)->Fill( tofRawDatum->GetTOT()*tot2ns) ;
464 if ((iDDL%4==2)|| (iDDL%4==3)){//C side
466 GetRawsData(9)->Fill( tofRawDatum->GetTOF()*tdc2ns) ;
467 GetRawsData(14)->Fill( tofRawDatum->GetTOT()*tot2ns) ;
472 GetRawsData(18)->Fill(chIndex);
474 Int_t trm= iDDL*10+(equipmentID[1]-3);
475 if (iDDL>=0 && iDDL<36) {
476 GetRawsData(16)->Fill(trm) ;
477 GetRawsData(20)->Fill(trm,tofRawDatum->GetTOF()*tdc2ns);
478 GetRawsData(22)->Fill(trm,tofRawDatum->GetTOT()*tot2ns);
480 if (iDDL>=36 && iDDL<72) {
481 GetRawsData(17)->Fill(trm) ;//in ns
482 GetRawsData(21)->Fill(trm,tofRawDatum->GetTOF()*tdc2ns);
483 GetRawsData(23)->Fill(trm,tofRawDatum->GetTOT()*tot2ns);
485 GetRawsData(24)->Fill(GetStripIndex(volumeID),tofRawDatum->GetTOF()*tdc2ns) ;
486 //GetRawsData(25)->Fill( out[0],out[1]) ;//raw map
490 if (!(fCalibData->GetNoiseStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFNoiseBad)
491 && (fCalibData->GetHWStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFHWOk))
492 GetRawsData(19)->Fill( tofRawDatum->GetTOF()*tdc2ns) ;//in ns
494 }//end volumeID check
499 clonesRawData->Clear();
502 for (Int_t j=0;j<5;j++){
503 GetRawsData(j)->Fill(ntof[j]);
505 fProcessedRawEventN++;
508 AliDebug(1,Form("Event of type %d found. Skipping non-physics event for QA.\n", rawReader->GetType()));
510 EnableDqmShifterOpt(kTRUE);
513 //____________________________________________________________________________
514 void AliTOFQADataMakerRec::MakeRecPoints(TTree * clustersTree)
517 // Make data from Clusters
520 Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;
521 Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
527 TBranch *branch=clustersTree->GetBranch("TOF");
529 AliError("can't get the branch with the TOF clusters !");
533 static TClonesArray dummy("AliTOFcluster",10000);
535 TClonesArray *clusters=&dummy;
536 branch->SetAddress(&clusters);
539 clustersTree->GetEvent(0);
541 GetRecPointsData(0)->Fill((Int_t)clusters->GetEntriesFast()) ;
543 TIter next(clusters) ;
545 while ( (c = dynamic_cast<AliTOFcluster *>(next())) ) {
547 volumeID[0] = c->GetDetInd(0);
548 volumeID[1] = c->GetDetInd(1);
549 volumeID[2] = c->GetDetInd(2);
550 volumeID[3] = c->GetDetInd(4); //X and Z indeces inverted in RecPoints
551 volumeID[4] = c->GetDetInd(3); //X and Z indeces inverted in RecPoints
553 for (Int_t i=0;i<5;i++){
554 volumeID2[i]=c->GetDetInd(i); //X and Z indeces inverted in RecPoints
557 GetMapIndeces(volumeID,out);
558 Int_t chIndex=AliTOFGeometry::GetIndex(volumeID2);
559 Int_t iDDL=AliTOFRawStream::Geant2DDL(volumeID2);
560 Int_t iTRM=AliTOFRawStream::Geant2TRM(volumeID2);
562 if (c->GetTDCRAW() && c->GetTDC() && c->GetToT()){
563 if (volumeID2[0]>4 && volumeID2[0]<14){ //I side
564 if ((iDDL%4==0)|| (iDDL%4==1)){ //A side
565 GetRecPointsData(1)->Fill( c->GetTDC()*tdc2ns) ;//in ns
566 GetRecPointsData(5)->Fill( c->GetTDCRAW()*tdc2ns) ;//in ns
567 GetRecPointsData(9)->Fill( c->GetToT()*tot2ns) ;//in ns
570 if ((iDDL%4==2)|| (iDDL%4==3)){//C side
571 GetRecPointsData(3)->Fill( c->GetTDC()*tdc2ns) ;//in ns
572 GetRecPointsData(7)->Fill( c->GetTDCRAW()*tdc2ns) ;//in ns
573 GetRecPointsData(11)->Fill( c->GetToT()*tot2ns) ;//in ns
577 if (volumeID2[0]<5 || volumeID2[0]>13){ //O side
578 if ((iDDL%4==0)|| (iDDL%4==1)){ //A side
579 GetRecPointsData(2)->Fill( c->GetTDC()*tdc2ns) ;//in ns
580 GetRecPointsData(6)->Fill( c->GetTDCRAW()*tdc2ns) ;//in ns
581 GetRecPointsData(10)->Fill( c->GetToT()*tot2ns) ;//in ns
583 if ((iDDL%4==2)|| (iDDL%4==3)){//C side
584 GetRecPointsData(4)->Fill( c->GetTDC()*tdc2ns) ;//in ns
585 GetRecPointsData(8)->Fill( c->GetTDCRAW()*tdc2ns) ;//in ns
586 GetRecPointsData(12)->Fill( c->GetToT()*tot2ns) ;//in ns
591 GetRecPointsData(14)->Fill(out[0],out[1]);
592 GetRecPointsData(15)->Fill(GetStripIndex(volumeID), c->GetTDC()*tdc2ns) ;
593 Int_t trm= iDDL*10+(iTRM-3);
594 if (iDDL>=0 && iDDL<36) {
595 GetRecPointsData(16)->Fill(trm,c->GetTDC()*tdc2ns);
596 GetRecPointsData(18)->Fill(trm,c->GetToT()*tot2ns);
598 if (iDDL>=36 && iDDL<72) {
599 GetRecPointsData(17)->Fill(trm,c->GetTDC()*tdc2ns);
600 GetRecPointsData(19)->Fill(trm,c->GetToT()*tot2ns);
602 GetRecPointsData(13)->Fill(chIndex) ;//in ns
606 EnableDqmShifterOpt(kFALSE);
609 //____________________________________________________________________________
610 void AliTOFQADataMakerRec::MakeESDs(AliESDEvent * esd)
613 // make QA data from ESDs
615 const Double_t speedOfLight = TMath::C()*1E2*1E-12; // cm/ps
616 const Double_t pionMass = 0.13957018; //GeV/c^2
618 Int_t ntrk = esd->GetNumberOfTracks() ;
627 AliESDtrack *track=esd->GetTrack(ntrk);
628 Double_t tofTime=track->GetTOFsignal();//in ps
629 Double_t tofTimeRaw=track->GetTOFsignalRaw();//in ps
630 Double_t tofToT=track->GetTOFsignalToT(); //in ps
632 UInt_t status=track->GetStatus();
633 if (track->IsOn(AliESDtrack::kTPCrefit)) {
635 Double_t y=track->Eta();
636 if ((status&AliESDtrack::kTOFout)!=0) {
641 if (TMath::Abs(y)<0.9) {
642 GetESDsData(6)->Fill(track->Pt());
645 GetESDsData(1)->Fill(tofTime*1E-3);
646 GetESDsData(2)->Fill(tofTimeRaw*1E-3);
647 GetESDsData(3)->Fill(tofToT*1E-3);
648 //check how many tracks where ESD PID is ok
649 if ((status&AliESDtrack::kESDpid)!=0) nesdpid++;
650 if (((status&AliESDtrack::kESDpid)&AliESDtrack::kTOFpid)!=0) ntofpid++;
652 Double_t length =track->GetIntegratedLength();
653 Double_t mom2=(track->Pt()*track->Pt())+(track->Pz()*track->Pz());
654 Double_t eTexp = TMath::Sqrt(1+(pionMass*pionMass/mom2))*length/speedOfLight; //in ps
655 GetESDsData(9)->Fill(tofTime-eTexp);
656 GetESDsData(10)->Fill(length);
657 } //end check on matched tracks
659 }//end check on TPCrefit
662 GetESDsData(0)->Fill(ntof) ;
666 Float_t ratio = (Int_t)ntofpid/(Int_t)ntof*100; //identified by TOF over matched
667 GetESDsData(4)->Fill(ratio) ;
671 Float_t ratio = (Float_t)ntofpid/(Float_t)nesdpid *100; //identified by TOF over identified
672 GetESDsData(5)->Fill(ratio) ;
676 Float_t ratio = (Float_t)ntof/(Float_t)ntpc*100.; //matching probability
677 GetESDsData(7)->Fill(ratio) ;
681 Float_t ratio = (Float_t)ntof/(Float_t)ntofout*100; //matched over propagated to TOF outer radius
682 GetESDsData(8)->Fill(ratio) ;
684 EnableDqmShifterOpt(kFALSE);
687 //____________________________________________________________________________
688 void AliTOFQADataMakerRec::StartOfDetectorCycle()
691 //Detector specific actions at start of cycle
693 fCalibData = GetCalibData();
697 //____________________________________________________________________________
698 void AliTOFQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
700 //Detector specific actions at end of cycle
701 // do the QA checking
702 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
703 if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) )
706 if (fEnableDqmShifterOpt){
707 // Help make the raw qa histogram easier to interpret for the DQM shifter
708 // This is still to be optimized...
710 if (!GetRawsData(0) || !GetRawsData(5) || !GetRawsData(10)
711 || !GetRawsData(15) || !GetRawsData(16) || !GetRawsData(17)) {
712 printf("No histogram for DQM found - Possible memory corruption ???. Please check\n") ;
715 AliInfo(Form("Processed %i physics raw events",fProcessedRawEventN));
719 //normalize TRM hits plots to the number of enabled channels from OCDB object
720 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.) ;
721 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.) ;
723 for (Int_t ch = 0; ch < fCalibData->GetSize(); ch++) {
724 if (!(fCalibData->GetNoiseStatus(ch)==AliTOFChannelOnlineStatusArray::kTOFNoiseBad)
725 && (fCalibData->GetHWStatus(ch) == AliTOFChannelOnlineStatusArray::kTOFHWOk)){
728 AliTOFGeometry::GetVolumeIndices(ch,geoId);
729 AliTOFRawStream::Geant2EquipmentId(geoId,detId); //detID=(ddl,trm,tdc, chain,channel)
730 if (detId[0]<36) hTrmChannels035->Fill((detId[1]-3)+detId[0]*10);
731 else hTrmChannels3671->Fill((detId[1]-3)+detId[0]*10);
734 GetRawsData(16)->Divide(hTrmChannels035);
735 GetRawsData(16)->SetTitle("TRMs average hit number per active channel - crates 0-35");
736 GetRawsData(16)->GetYaxis()->SetTitle("hits/active channels");
737 GetRawsData(17)->Divide(hTrmChannels3671);
738 GetRawsData(17)->SetTitle("TRMs average hit number per active channel - crates 36-71");
739 GetRawsData(17)->GetYaxis()->SetTitle("hits/active channels");
743 Double_t yTimeMin = GetRawsData(5)->GetMinimum();
744 Double_t yTimeMax = GetRawsData(5)->GetMaximum();
745 Double_t yTotMin = GetRawsData(10)->GetMinimum();
746 Double_t yTotMax = GetRawsData(10)->GetMaximum();
748 TLine* lineExpTimeMin = new TLine(200., yTimeMin, 200., yTimeMax);
749 lineExpTimeMin->SetLineColor(kGreen);
750 lineExpTimeMin->SetLineWidth(2);
752 TLine* lineExpTimeMax = new TLine(250., yTimeMin, 250., yTimeMax);
753 lineExpTimeMax->SetLineColor(kGreen);
754 lineExpTimeMax->SetLineWidth(2);
756 TLine* lineExpTotMin = new TLine( 5., yTotMin, 5., yTotMax);
757 lineExpTotMin->SetLineColor(kGreen);
758 lineExpTotMin->SetLineWidth(2);
760 TLine* lineExpTotMax = new TLine(20., yTotMin, 20., yTotMax);
761 lineExpTotMax->SetLineColor(kGreen);
762 lineExpTotMax->SetLineWidth(2);
764 ((TH1F*)GetRawsData(5))->GetListOfFunctions()->Add(lineExpTimeMin);
765 ((TH1F*)GetRawsData(5))->GetListOfFunctions()->Add(lineExpTimeMax);
766 ((TH1F*)GetRawsData(10))->GetListOfFunctions()->Add(lineExpTotMin);
767 ((TH1F*)GetRawsData(10))->GetListOfFunctions()->Add(lineExpTotMax);
769 //make up for all bistos
770 for(Int_t j=0;j<20;j++){
772 GetRawsData(j)->SetMarkerColor(kRed);
773 GetRawsData(j)->SetMarkerStyle(7);
775 GetRawsData(j)->SetLineColor(kBlue+1);
776 GetRawsData(j)->SetLineWidth(1);
777 GetRawsData(j)->SetMarkerColor(kBlue+1);
780 Float_t ySMmax035=GetRawsData(16)->GetMaximum();
781 TLine* lineSMid035[10];
782 Float_t ySMmax3671=GetRawsData(17)->GetMaximum();
783 TLine* lineSMid3671[10];
785 for (Int_t sm=0;sm<10;sm++){
786 lineSMid035[sm] = new TLine( 40*sm, 0, 40*sm, ySMmax035);
787 lineSMid035[sm]->SetLineColor(kMagenta);
788 lineSMid035[sm]->SetLineWidth(2);
789 GetRawsData(16)->GetListOfFunctions()->Add(lineSMid035[sm]);
791 lineSMid3671[sm] = new TLine( 40*sm+360, 0, 40*sm+360, ySMmax3671);
792 lineSMid3671[sm]->SetLineColor(kMagenta);
793 lineSMid3671[sm]->SetLineWidth(2);
794 GetRawsData(17)->GetListOfFunctions()->Add(lineSMid3671[sm]);
797 for (Int_t j=15;j<19;j++){
798 GetRawsData(j)->SetFillColor(kGray+1);
799 GetRawsData(j)->SetOption("bar");
804 AliQAChecker::Instance()->Run(AliQAv1::kTOF, task, list) ;
806 //____________________________________________________________________________
807 void AliTOFQADataMakerRec::GetMapIndeces(const Int_t* const in , Int_t* out)
810 //return appropriate indeces for the theta-phi map
813 Int_t npadX = AliTOFGeometry::NpadX();
814 Int_t npadZ = AliTOFGeometry::NpadZ();
815 Int_t nStripA = AliTOFGeometry::NStripA();
816 Int_t nStripB = AliTOFGeometry::NStripB();
817 Int_t nStripC = AliTOFGeometry::NStripC();
819 Int_t isector = in[0];
820 Int_t iplate = in[1];
821 Int_t istrip = in[2];
825 Int_t stripOffset = 0;
831 stripOffset = nStripC;
834 stripOffset = nStripC+nStripB;
837 stripOffset = nStripC+nStripB+nStripA;
840 stripOffset = nStripC+nStripB+nStripA+nStripB;
843 AliDebug(1,Form("Wrong plate number in TOF (%d) !",iplate));
846 Int_t zindex=npadZ*(istrip+stripOffset)+(ipadZ+1);
847 Int_t phiindex=npadX*isector+ipadX+1;
853 //---------------------------------------------------------------
854 Int_t AliTOFQADataMakerRec::GetStripIndex(const Int_t * const in)
856 /* return tof strip index between 0 and 91 */
858 Int_t nStripA = AliTOFGeometry::NStripA();
859 Int_t nStripB = AliTOFGeometry::NStripB();
860 Int_t nStripC = AliTOFGeometry::NStripC();
862 // Int_t isector = in[0];
863 Int_t iplate = in[1];
864 Int_t istrip = in[2];
865 //Int_t ipadX = in[3];
866 //Int_t ipadZ = in[4];
868 Int_t stripOffset = 0;
874 stripOffset = nStripC;
877 stripOffset = nStripC+nStripB;
880 stripOffset = nStripC+nStripB+nStripA;
883 stripOffset = nStripC+nStripB+nStripA+nStripB;
886 AliDebug(1,Form("Wrong plate number in TOF (%d) !",iplate));
891 if (stripOffset<0 || stripOffset>92) return -1;
893 return (stripOffset+istrip);
896 //---------------------------------------------------------------
897 Bool_t AliTOFQADataMakerRec::CheckVolumeID(const Int_t * const volumeID)
900 //Checks volume ID validity
903 for (Int_t j=0;j<5;j++){
905 AliDebug(1,Form("Invalid detector volume index for volumeID[%i]",j));
913 //---------------------------------------------------------------
914 Bool_t AliTOFQADataMakerRec::CheckEquipID(const Int_t * const equipmentID)
917 //Checks equipment ID validity
919 for (Int_t j=0;j<5;j++){
920 if (equipmentID[j]<0) {
921 AliDebug(1,Form("Invalid equipment volume index for equipmentID[%i]",j));
927 //---------------------------------------------------------------
928 Bool_t AliTOFQADataMakerRec::FilterLTMData(const Int_t * const equipmentID) const
930 /*It returns kTRUE if data come from LTM.
931 It thus filters trigger-related signals */
934 //if (!CheckEquipID(equipmentID)) return kFALSE;
935 ddl = equipmentID[0];
936 trm = equipmentID[1];
937 tdc = equipmentID[3];
939 if ((ddl%2==1) && (trm==3) && (tdc>11 && tdc<15))
945 //---------------------------------------------------------------
946 Bool_t AliTOFQADataMakerRec::FilterSpare(const Int_t * const equipmentID) const
948 /*It returns kTRUE if data come from spare
950 So far only check on TRM 3 crate left is implemented */
953 //if (!CheckEquipID(equipmentID)) return kFALSE;
954 ddl = equipmentID[0];
955 trm = equipmentID[1];
956 tdc = equipmentID[3];
958 if ((ddl%2==1) && (trm==3) && (tdc>2 && tdc<12))