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 18/01/2011
26 - reduced histo binning to reduce size
27 - added decoding errors plot
28 - added channel maps and options for DQM shifters
29 - new list of recPoints and ESDs plots
30 - removed hTrmChannels035 and hTrmChannels3671
32 Modified by bvonhall on 03/11/2010
33 - modified declaration of hTrmChannels035 and hTrmChannels3671 in EndOfDetectorCycle()
34 to prevent memory corruption
36 Modified by adecaro on 18/10/2010
37 - fTOFRawStream object set as private member
39 Modified by fbellini on 13/09/2010
40 - Set TLines as private members
41 - Set image flag for expert histos
43 Modified by fbellini on 14/06/2010
45 - use LoadRawDataBuffersV2()
47 Modified by fbellini on 10/05/2010
48 - Fixed EndOfDetectorCycle() memory corruption bug
50 Modified by fbellini on 22/04/2010
51 - Added filter for physics events
53 Modified by fbellini on 16/04/2010
54 - Added EnableDqmShifterOpt()
55 - Modified EndOfDetectorCycle() with options for DQM
58 Modified by fbellini on 30/03/2010
59 - Changed raws time histos range to 610ns
60 - Added FilterLTMData() and FilterSpare() methods
61 - Added check on enabled channels for raw data
62 - Updated RecPoints QA
64 Modified by fbellini on 02/03/2010
65 - Fixed raw data decoding methods (use AliTOFRawStream::LoadRawDataBuffer())
66 - Added filter for noisy channels and read map from OCDB
67 - Added GetCalibData() method
68 - Added CheckVolumeID() and CheckEquipID() methods
72 #include <TClonesArray.h>
76 #include <TPaveText.h>
78 #include "AliCDBManager.h"
79 #include "AliCDBEntry.h"
80 #include "AliESDEvent.h"
81 #include "AliESDtrack.h"
82 #include "AliQAChecker.h"
83 #include "AliRawReader.h"
84 #include "AliTOFRawStream.h"
85 #include "AliTOFcluster.h"
86 #include "AliTOFQADataMakerRec.h"
87 #include "AliTOFrawData.h"
88 #include "AliTOFGeometry.h"
89 #include "AliTOFChannelOnlineStatusArray.h"
90 #include "AliTOFDecoderSummaryData.h"
91 #include "AliTOFDecoderV2.h"
93 ClassImp(AliTOFQADataMakerRec)
95 //____________________________________________________________________________
96 AliTOFQADataMakerRec::AliTOFQADataMakerRec() :
97 AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kTOF), "TOF Quality Assurance Data Maker"),
99 fEnableNoiseFiltering(kFALSE),
100 fEnableDqmShifterOpt(kFALSE),
101 // fProcessedRawEventN(0),
103 fLineExpTimeMin(new TLine(200., 0., 200., 0.)),
104 fLineExpTimeMax(new TLine(250., 0., 250., 0.)),
105 fLineExpTotMin(new TLine(5., 0., 5., 0.)),
106 fLineExpTotMax(new TLine(20., 0., 20., 0.)),
107 fTOFRawStream(AliTOFRawStream()),
108 fDecoderSummary(new AliTOFDecoderSummaryData())
113 for (Int_t sm=0;sm<17;sm++){
114 fLineSMid[sm] = new TLine( sm+1, 0., sm+1, 91.);
116 //initialize all TRM counters to -1 i.e. invalid value
117 // for (Int_t trm=0;trm<720;trm++){
118 // fTRMNoisyArray[trm]=-1;
119 // fTRMHwOkArray[trm]=-1;
120 // fTRMEnabledArray[trm]=-1;
125 //____________________________________________________________________________
126 AliTOFQADataMakerRec::AliTOFQADataMakerRec(const AliTOFQADataMakerRec& qadm) :
128 fCalibData(qadm.fCalibData),
129 fEnableNoiseFiltering(qadm.fEnableNoiseFiltering),
130 fEnableDqmShifterOpt(qadm.fEnableDqmShifterOpt),
131 // fProcessedRawEventN(qadm.fProcessedRawEventN),
133 fLineExpTimeMin(qadm.fLineExpTimeMin),
134 fLineExpTimeMax(qadm.fLineExpTimeMax),
135 fLineExpTotMin(qadm.fLineExpTotMin),
136 fLineExpTotMax(qadm.fLineExpTotMax),
137 fTOFRawStream(qadm.fTOFRawStream),
138 fDecoderSummary(qadm.fDecoderSummary)
143 SetName((const char*)qadm.GetName()) ;
144 SetTitle((const char*)qadm.GetTitle());
146 for (Int_t sm=0;sm<17;sm++){
147 fLineSMid[sm]=qadm.fLineSMid[sm];
150 // for (Int_t trm=0;trm<10;trm++){
151 // fTRMNoisyArray[trm]=qadm.fTRMNoisyArray[trm];
152 // fTRMHwOkArray[trm]=qadm.fTRMHwOkArray[trm];
153 // fTRMEnabledArray[trm]=qadm.fTRMEnabledArray[trm];
158 //__________________________________________________________________
159 AliTOFQADataMakerRec& AliTOFQADataMakerRec::operator = (const AliTOFQADataMakerRec& qadm )
162 // assignment operator.
164 this->~AliTOFQADataMakerRec();
165 new(this) AliTOFQADataMakerRec(qadm);
169 //----------------------------------------------------------------------------
170 AliTOFQADataMakerRec::~AliTOFQADataMakerRec()
173 fTOFRawStream.Clear();
174 delete fLineExpTimeMin;
175 delete fLineExpTimeMax;
176 delete fLineExpTotMin;
177 delete fLineExpTotMax;
178 for (Int_t sm=0;sm<10;sm++){
179 delete fLineSMid[sm];
182 delete fDecoderSummary;
184 //----------------------------------------------------------------------------
185 AliTOFChannelOnlineStatusArray* AliTOFQADataMakerRec::GetCalibData() const
188 // Retrive TOF calib objects from OCDB
190 AliCDBManager *man = AliCDBManager::Instance();
193 cdbe = man->Get("TOF/Calib/Status",fRun);
195 AliWarning("Load of calibration data from default storage failed!");
196 AliWarning("Calibration data will be loaded from local storage ($ALICE_ROOT)");
197 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
198 cdbe = man->Get("TOF/Calib/Status",fRun);
200 // Retrieval of data in directory TOF/Calib/Data:
202 AliTOFChannelOnlineStatusArray * array = 0;
203 if (cdbe) array = (AliTOFChannelOnlineStatusArray *)cdbe->GetObject();
204 if (!array) AliFatal("No calibration data from calibration database !");
209 //____________________________________________________________________________
210 void AliTOFQADataMakerRec::InitRaws()
213 // create Raws histograms in Raws subdir
215 const Bool_t expert = kTRUE ;
216 const Bool_t saveCorr = kTRUE ;
217 const Bool_t image = kTRUE ;
219 TH1I * h0 = new TH1I("hTOFRaws", "TOF raw hit multiplicity; TOF raw hits number; Events ",200, 0, 200) ;
221 TH1I * h1 = new TH1I("hTOFRawsIA", "TOF raw hit multiplicity - I/A side; TOF raw hits number ;Events ",200, 0, 200) ;
222 TH1I * h2 = new TH1I("hTOFRawsOA", "TOF raw hit multiplicity - O/A side; TOF raw hits number ;Events ",200, 0, 200) ;
223 TH1I * h3 = new TH1I("hTOFRawsIC", "TOF raw hit multiplicity - I/C side; TOF raw hits number ;Events ",200, 0, 200) ;
224 TH1I * h4 = new TH1I("hTOFRawsOC", "TOF raw hit multiplicity - O/C side; TOF raw hits number ;Events ",200, 0, 200) ;
226 TH1F * h5 = new TH1F("hTOFRawsTime", "TOF Raws - Hit time (ns);Measured Hit time [ns];Hits", 250,0. ,610.) ;
227 TH1F * h6 = new TH1F("hTOFRawsTimeIA", "TOF Raws - Hit time (ns) - I/A side;Measured Hit time [ns];Hits", 250,0. ,610.) ;
228 TH1F * h7 = new TH1F("hTOFRawsTimeOA", "TOF Raws - Hit time (ns) - O/A side;Measured Hit time [ns];Hits", 250,0. ,610.) ;
229 TH1F * h8 = new TH1F("hTOFRawsTimeIC", "TOF Raws - Hit time (ns) - I/C side;Measured Hit time [ns];Hits", 250,0. ,610.) ;
230 TH1F * h9 = new TH1F("hTOFRawsTimeOC", "TOF Raws - Hit time (ns) - O/C side;Measured Hit time [ns];Hits", 250,0. ,610.) ;
232 TH1F * h10 = new TH1F("hTOFRawsToT", "TOF Raws - Hit ToT (ns);Measured Hit ToT (ns);Hits", 100, 0., 48.8) ;
234 TH1F * h11 = new TH1F("hTOFRawsToTIA", "TOF Raws - Hit ToT (ns) - I/A side;Measured Hit ToT (ns);Hits", 100, 0., 48.8) ;
235 TH1F * h12 = new TH1F("hTOFRawsToTOA", "TOF Raws - Hit ToT (ns) - O/A side;Measured Hit ToT (ns);Hits", 100, 0., 48.8) ;
236 TH1F * h13 = new TH1F("hTOFRawsToTIC", "TOF Raws - Hit ToT (ns) - I/C side;Measured Hit ToT (ns);Hits", 100, 0., 48.8) ;
237 TH1F * h14 = new TH1F("hTOFRawsToTOC", "TOF Raws - Hit ToT (ns) - O/C side;Measured Hit ToT (ns);Hits", 100, 0., 48.8) ;
239 TH1F * h15 = new TH1F("hTOFRawsLTMHits", "LTMs OR signals; Crate; Counts", 72, 0., 72.);
240 TH2F * h16 = new TH2F("hTOFrefMap", "TOF enabled channel reference map;sector;strip", 72, 0., 18., 91, 0., 91.);
241 TH2F * h17 = new TH2F("hTOFRawHitMap","TOF raw hit map;sector;strip", 72, 0., 18., 91, 0., 91.);
242 TH2I * h18 = new TH2I("hTOFDecodingErrors","Decoding error monitoring; DDL; Error ", 72, 0, 72, 13,1,14);
244 h18->GetYaxis()->SetBinLabel(1,"DRM ");
245 h18->GetYaxis()->SetBinLabel(2,"LTM ");
246 h18->GetYaxis()->SetBinLabel(3,"TRM 3 ");
247 h18->GetYaxis()->SetBinLabel(4,"TRM 4");
248 h18->GetYaxis()->SetBinLabel(5,"TRM 5");
249 h18->GetYaxis()->SetBinLabel(6,"TRM 6");
250 h18->GetYaxis()->SetBinLabel(7,"TRM 7");
251 h18->GetYaxis()->SetBinLabel(8,"TRM 8");
252 h18->GetYaxis()->SetBinLabel(9,"TRM 9");
253 h18->GetYaxis()->SetBinLabel(10,"TRM 10");
254 h18->GetYaxis()->SetBinLabel(11,"TRM 11");
255 h18->GetYaxis()->SetBinLabel(12,"TRM 12");
256 h18->GetYaxis()->SetBinLabel(13,"recovered");
258 TH1F * h19 = new TH1F("hTOFOrphansTime", "TOF Raws - Orphans time (ns);Measured Hit time [ns];Hits", 250, 0. ,610.) ;
259 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) ;
260 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) ;
261 TH2F * h22 = new TH2F("hTOFTimeVsStrip","TOF Raws - Hit time vs. strip (theta); Strip index;Raws TOF time (ns) ", 91,0.,91, 250, 0., 610.) ;
286 //add lines for DQM shifter
287 //fLineExpTimeMin = new TLine(200., 0., 200., 0.);
288 fLineExpTimeMin->SetLineColor(kGreen);
289 fLineExpTimeMin->SetLineWidth(2);
291 //fLineExpTimeMax = new TLine(250., 0., 250., 0.);
292 fLineExpTimeMax->SetLineColor(kGreen);
293 fLineExpTimeMax->SetLineWidth(2);
295 //fLineExpTotMin = new TLine( 5., 0., 5., 0.);
296 fLineExpTotMin->SetLineColor(kGreen);
297 fLineExpTotMin->SetLineWidth(2);
299 //fLineExpTotMax = new TLine(20., 0., 20., 0.);
300 fLineExpTotMax->SetLineColor(kGreen);
301 fLineExpTotMax->SetLineWidth(2);
303 for (Int_t sm=0;sm<17;sm++){
304 //fLineSMid[sm] = new TLine( 1+sm, 0., 1+sm, 91.);
305 fLineSMid[sm]->SetLineColor(kMagenta);
306 fLineSMid[sm]->SetLineWidth(2);
309 h5->GetListOfFunctions()->Add(fLineExpTimeMin);
310 h5->GetListOfFunctions()->Add(fLineExpTimeMax);
311 h10->GetListOfFunctions()->Add(fLineExpTotMin);
312 h10->GetListOfFunctions()->Add(fLineExpTotMax);
314 for (Int_t sm=0;sm<17;sm++){
315 h16->GetListOfFunctions()->Add(fLineSMid[sm]);
316 h17->GetListOfFunctions()->Add(fLineSMid[sm]);
320 TPaveText *phosHoleBox=new TPaveText(13,38,16,53,"b");
321 phosHoleBox->SetFillStyle(0);
322 phosHoleBox->SetFillColor(kWhite);
323 phosHoleBox->SetLineColor(kMagenta);
324 phosHoleBox->SetLineWidth(2);
325 phosHoleBox->AddText("PHOS");
326 h16->GetListOfFunctions()->Add(phosHoleBox);
327 h17->GetListOfFunctions()->Add(phosHoleBox);
329 // h0->SetDrawOption("logy");
330 // h5->SetDrawOption("logy");
331 // h10->SetDrawOption("logy");
333 Add2RawsList(h0, 0, !expert, image, !saveCorr) ;
334 Add2RawsList(h1, 1, expert, !image, !saveCorr) ;
335 Add2RawsList(h2, 2, expert, !image, !saveCorr) ;
336 Add2RawsList(h3, 3, expert, !image, !saveCorr) ;
337 Add2RawsList(h4, 4, expert, !image, !saveCorr) ;
338 Add2RawsList(h5, 5, !expert, image, !saveCorr) ;
339 Add2RawsList(h6, 6, expert, !image, !saveCorr) ;
340 Add2RawsList(h7, 7, expert, !image, !saveCorr) ;
341 Add2RawsList(h8, 8, expert, !image, !saveCorr) ;
342 Add2RawsList(h9, 9, expert, !image, !saveCorr) ;
343 Add2RawsList(h10, 10, !expert, image, !saveCorr) ;
344 Add2RawsList(h11, 11, expert, !image, !saveCorr) ;
345 Add2RawsList(h12, 12, expert, !image, !saveCorr) ;
346 Add2RawsList(h13, 13, expert, !image, !saveCorr) ;
347 Add2RawsList(h14, 14, expert, !image, !saveCorr) ;
348 Add2RawsList(h15, 15, !expert, image, !saveCorr) ;
349 Add2RawsList(h16, 16, !expert, image, !saveCorr) ;
350 Add2RawsList(h17, 17, !expert, image, !saveCorr) ;
351 Add2RawsList(h18, 18, expert, !image, !saveCorr) ;
352 Add2RawsList(h19, 19, expert, !image, !saveCorr) ;
353 Add2RawsList(h20, 20, expert, !image, !saveCorr) ;
354 Add2RawsList(h21, 21, expert, !image, !saveCorr) ;
355 Add2RawsList(h22, 22, expert, !image, !saveCorr) ;
357 ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line
360 //____________________________________________________________________________
361 void AliTOFQADataMakerRec::InitRecPoints()
364 // create RecPoints histograms in RecPoints subdir
367 const Bool_t expert = kTRUE ;
368 const Bool_t image = kTRUE ;
370 TH1I * h0 = new TH1I("hTOFRecPoints", "TOF RecPoints multiplicity ; TOF RecPoints number;Events",200, 0, 200) ;
372 TH1F * h1 = new TH1F("hTOFRecPointsTimeIA", "RecPoints Time Spectrum in TOF (ns)- I/A side; Calibrated TOF time [ns];Events", 250, 0., 610.) ;
373 TH1F * h2 = new TH1F("hTOFRecPointsTimeOA", "RecPoints Time Spectrum in TOF (ns)- O/A side; Calibrated TOF time [ns];Events", 250, 0., 610.) ;
374 TH1F * h3 = new TH1F("hTOFRecPointsTimeIC", "RecPoints Time Spectrum in TOF (ns)- I/C side; Calibrated TOF time [ns];Events", 250, 0., 610.) ;
375 TH1F * h4 = new TH1F("hTOFRecPointsTimeOC", "RecPoints Time Spectrum in TOF (ns)- O/C side; Calibrated TOF time [ns];Events", 250, 0., 610.) ;
377 TH1F * h5 = new TH1F("hTOFRecPointsRawTimeIA", "RecPoints raw Time Spectrum in TOF (ns)-I/A side; Measured TOF time [ns];Hits", 250, 0., 610.) ;
378 TH1F * h6 = new TH1F("hTOFRecPointsRawTimeOA", "RecPoints raw Time Spectrum in TOF (ns)-O/A side; Measured TOF time [ns];Hits", 250, 0., 610.) ;
379 TH1F * h7 = new TH1F("hTOFRecPointsRawTimeIC", "RecPoints raw Time Spectrum in TOF (ns)-I/C side; Measured TOF time [ns];Hits", 250, 0., 610.) ;
380 TH1F * h8 = new TH1F("hTOFRecPointsRawTimeOC", "RecPoints raw Time Spectrum in TOF (ns)-O/C side; Measured TOF time [ns];Hits", 250, 0., 610.) ;
382 TH1F * h9 = new TH1F("hTOFRecPointsToTIA", "RecPoints ToT Spectrum in TOF (ns)-I/A side; Measured TOT [ns];Hits", 100, 0., 48.8 ) ;
383 TH1F * h10 = new TH1F("hTOFRecPointsToTOA", "RecPoints ToT Spectrum in TOF (ns)-O/A side; Measured TOT [ns];Hits", 100, 0., 48.8 ) ;
384 TH1F * h11 = new TH1F("hTOFRecPointsToTIC", "RecPoints ToT Spectrum in TOF (ns)-I/C side; Measured TOT [ns];Hits", 100, 0., 48.8 ) ;
385 TH1F * h12 = new TH1F("hTOFRecPointsToTOC", "RecPoints ToT Spectrum in TOF (ns)-O/C side; Measured TOT [ns];Hits", 100, 0., 48.8 ) ;
387 TH2F * h13 = new TH2F("hTOFRecPointsClusMap","RecPoints map; sector ;strip", 72, 0., 18., 91, 0., 91.) ;
388 TH2F * h14 = new TH2F("hTOFRecPointsTimeVsStrip","RecPoints TOF time vs. strip (theta); Strip index; RecPoints TOF time (ns) ",91, 0., 91., 250, 0., 610.) ;
389 TH2F * h15 = 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) ;
390 TH2F * h16 = 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) ;
410 Add2RecPointsList(h0, 0, !expert, image) ;
411 Add2RecPointsList(h1, 1, !expert, image) ;
412 Add2RecPointsList(h2, 2, !expert, image) ;
413 Add2RecPointsList(h3, 3, !expert, image) ;
414 Add2RecPointsList(h4, 4, !expert, image) ;
415 Add2RecPointsList(h5, 5, expert, !image) ;
416 Add2RecPointsList(h6, 6, expert, !image) ;
417 Add2RecPointsList(h7, 7, expert, !image) ;
418 Add2RecPointsList(h8, 8, expert, !image) ;
419 Add2RecPointsList(h9, 9, !expert, !image) ;
420 Add2RecPointsList(h10, 10, !expert, !image) ;
421 Add2RecPointsList(h11, 11, !expert, !image) ;
422 Add2RecPointsList(h12, 12, !expert, !image) ;
423 Add2RecPointsList(h13, 13, expert, !image) ;
424 Add2RecPointsList(h14, 14, expert, image) ;
425 Add2RecPointsList(h15, 15, expert, !image) ;
426 Add2RecPointsList(h16, 16, expert, !image) ;
428 ClonePerTrigClass(AliQAv1::kRECPOINTS); // this should be the last line
431 //____________________________________________________________________________
432 void AliTOFQADataMakerRec::InitESDs()
435 //create ESDs histograms in ESDs subdir
438 const Bool_t expert = kTRUE ;
439 const Bool_t image = kTRUE ;
441 TH1I * h0 = new TH1I("hTOFESDs", "Number of matched TOF tracks per event;Number of TOF matched ESD tracks;Counts", 200, 0, 200) ;
442 TH1F * h1 = new TH1F("hTOFESDsTime", "Matched ESDs tracks: TOF Time spectrum; Calibrated TOF time [ns];Counts", 250, 0., 610. ) ;
443 TH1F * h2 = new TH1F("hTOFESDsRawTime", "Matched ESDs tracks: TOF raw Time spectrum;Measured TOF time [ns];Counts", 250, 0., 610.) ;
444 TH1F * h3 = new TH1F("hTOFESDsToT", "Matched ESDs tracks: TOF ToT spectrum; ESDs ToT [ns];Counts",100, 0., 48.8) ;
445 TH1F * h4 = new TH1F("hTOFESDskTOFOUT", "p_{T} distribution of tracks with kTOFout; p_{T} (GeV/c);Counts", 50, 0.20, 5.00) ;
446 TH1F * h5 = new TH1F("hTOFESDskTIME", "p_{T} distribution of tracks with kTOFout && kTIME; p_{T} (GeV/c);Counts", 50, 0.20, 5.00) ;
447 TH1F * h6 = new TH1F("hTOFESDsMatched", "p_{T} distribution of tracks with kTOFout && TOFtime>0; p_{T} (GeV/c);Counts", 50, 0.20, 5.00) ;
448 TH1F * h7 = new TH1F("hTOFESDsMatchingProb", "TPC-TOF track-matching probability;TOF matching probability (%) ;Counts",101, -1.0, 100) ;
449 TH1F * h8 = new TH1F("hTOFESDsDiffTime", "ESDs t_{TOF}-t_{exp,pi} spectrum in TOF (ps); t_{TOF}-t_{exp,pi} [ps];Counts", 200, -2440., 2440.) ;
450 TH1F * h9 = new TH1F("hTOFHitsLength", "Matched ESDs tracks: Length Spectrum; Track length [cm];Counts", 800, 0., 800) ;
463 Add2ESDsList(h0, 0, !expert, image) ;
464 Add2ESDsList(h1, 1, !expert, image) ;
465 Add2ESDsList(h2, 2, expert, !image) ;
466 Add2ESDsList(h3, 3, !expert, !image) ;
467 Add2ESDsList(h4, 4, expert, image) ;
468 Add2ESDsList(h5, 5, expert, image) ;
469 Add2ESDsList(h6, 6, expert, image) ;
470 Add2ESDsList(h7, 7, expert, image) ;
471 Add2ESDsList(h8, 8, expert, !image) ;
472 Add2ESDsList(h9, 9, !expert, !image) ;
474 ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line
478 //____________________________________________________________________________
479 void AliTOFQADataMakerRec::MakeRaws(AliRawReader* rawReader)
482 // makes data from Raws
484 if (rawReader->GetType()==7) {
486 Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;//in ns
487 Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
488 Int_t ntof[5]; /* 0=tot, 1=IA, 2=OA, 3=IC, 4=OC*/
489 for (Int_t j=0;j<5;j++){ ntof[j]=0;}
490 Int_t equipmentID[5]; //(ddl, trm, chain,tdc,channel)
491 Int_t volumeID[5]; //(sector,plate,strip,padX,padZ)
492 Int_t volumeID2[5]; //(sector,plate,strip,padZ,padX) to use AliTOFGeometry::GetIndex()
495 TClonesArray * clonesRawData;
496 fTOFRawStream.SetRawReader(rawReader);
498 //uncomment if needed to apply DeltaBC correction
499 //fTOFRawStream.ApplyBCCorrections(kTRUE);
501 fDecoderSummary->Reset();
502 for (Int_t iDDL = 0; iDDL < AliTOFGeometry::NDDL()*AliTOFGeometry::NSectors(); iDDL++){
504 fTOFRawStream.LoadRawDataBuffersV2(iDDL);
506 //* get decoding error counters
507 fDecoderSummary = ( (AliTOFDecoderV2*) fTOFRawStream.GetDecoderV2() )->GetDecoderSummaryData();
508 if ( (fDecoderSummary) && (fDecoderSummary ->GetErrorDetected()) ) {
509 Int_t errorSlotID=(Int_t) fDecoderSummary->GetErrorSlotID();
510 FillRawsData(18,iDDL,errorSlotID);
511 if (fDecoderSummary -> GetRecoverError() )
512 FillRawsData(18,iDDL,13);
515 clonesRawData = (TClonesArray*)fTOFRawStream.GetRawData();
516 for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
517 AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
519 if (tofRawDatum->GetTOF()){
521 equipmentID[1]=tofRawDatum->GetTRM();
522 equipmentID[2]=tofRawDatum->GetTRMchain();
523 equipmentID[3]=tofRawDatum->GetTDC();
524 equipmentID[4]=tofRawDatum->GetTDCchannel();
526 if (CheckEquipID(equipmentID)){
527 fTOFRawStream.EquipmentId2VolumeId(iDDL,
528 tofRawDatum->GetTRM(),
529 tofRawDatum->GetTRMchain(),
530 tofRawDatum->GetTDC(),
531 tofRawDatum->GetTDCchannel(),
534 if (FilterLTMData(equipmentID)) { //counts LTM hits
535 if (equipmentID[2]==1) { //crate left, A-side or C-side
536 FillRawsData(15,equipmentID[0]);
538 if (equipmentID[0]<36) { FillRawsData(15,equipmentID[0]-1); }
539 else { FillRawsData(15,equipmentID[0]+1); }
545 if (CheckVolumeID(volumeID)){
546 volumeID2[0]=volumeID[0];
547 volumeID2[1]=volumeID[1];
548 volumeID2[2]=volumeID[2];
549 volumeID2[3]=volumeID[4];
550 volumeID2[4]=volumeID[3];
551 chIndex=AliTOFGeometry::GetIndex(volumeID2);
553 if (tofRawDatum->GetTOT()){
554 if (!(fCalibData->GetNoiseStatus(chIndex)==AliTOFChannelOnlineStatusArray::kTOFNoiseBad)
555 && (fCalibData->GetHWStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFHWOk)) {//noise and enabled filter
556 ntof[0]++; //counter for tof hits
558 //fill global spectra for DQM plots
559 FillRawsData(5, tofRawDatum->GetTOF()*tdc2ns) ;//in ns
560 FillRawsData(10, tofRawDatum->GetTOT()*tot2ns) ;//in ns
562 //fill side-related spectra for experts plots
563 Int_t ddlACside=iDDL/36; // 0 or 1
564 Int_t ddlPerSm=iDDL%4;
566 if (volumeID2[0]>4 && volumeID2[0]<14){ //O side
567 if (ddlPerSm<2){ //A side
569 FillRawsData(6, tofRawDatum->GetTOF()*tdc2ns) ;
570 FillRawsData(11, tofRawDatum->GetTOT()*tot2ns) ;
573 FillRawsData(8, tofRawDatum->GetTOF()*tdc2ns) ;
574 FillRawsData(13, tofRawDatum->GetTOT()*tot2ns) ;
577 if (volumeID2[0]<5 || volumeID2[0]>13){ //I side
578 if (ddlPerSm<2){ //A side
580 FillRawsData(7, tofRawDatum->GetTOF()*tdc2ns) ;
581 FillRawsData(12, tofRawDatum->GetTOT()*tot2ns) ;
584 FillRawsData(9, tofRawDatum->GetTOF()*tdc2ns) ;
585 FillRawsData(14, tofRawDatum->GetTOT()*tot2ns) ;
591 Int_t trm= iDDL*10+(equipmentID[1]-3);
592 FillRawsData(20+ddlACside,trm,tofRawDatum->GetTOF()*tdc2ns);
593 FillRawsData(22,GetStripIndex(volumeID),tofRawDatum->GetTOF()*tdc2ns) ;
594 Short_t fea = volumeID2[4]/12;
595 Float_t hitmapx = volumeID2[0] + ((Double_t)(3 - fea) + 0.5) *0.25;
596 FillRawsData(17,hitmapx,GetStripIndex(volumeID2));
600 if (!(fCalibData->GetNoiseStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFNoiseBad)
601 && (fCalibData->GetHWStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFHWOk))
602 FillRawsData(19, tofRawDatum->GetTOF()*tdc2ns) ;//in ns
604 }//end volumeID check
608 clonesRawData->Clear();
611 for (Int_t j=0;j<5;j++) FillRawsData(j,ntof[j]);
612 // fProcessedRawEventN++; // RS Now the framework conters are use
613 fTOFRawStream.Clear();
615 AliDebug(1,Form("Event of type %d found. Skipping non-physics event for QA.\n", rawReader->GetType()));
618 //fill reference map for DQM shifter only once in a detector cycle
620 Int_t geoId[5]={-1,-1,-1,-1,-1};// pgeoId=(sm, mod, strip, padZ, padX)
621 Int_t detId[5]={-1,-1,-1,-1,-1};//detID=(ddl,trm,tdc, chain,channel)
623 for (Int_t ch = 0; ch < fCalibData->GetSize(); ch++) {
624 AliTOFGeometry::GetVolumeIndices(ch,geoId);
625 AliTOFRawStream::Geant2EquipmentId(geoId,detId);
626 if ((detId[1]<0)||(detId[0]<0)) continue;
627 trmIndex=(detId[1]-3)+detId[0]*10;
630 // if (fCalibData->GetNoiseStatus(ch)==AliTOFChannelOnlineStatusArray::kTOFNoiseBad)
631 // fTRMNoisyArray[trmIndex]+=1;
632 // if (fCalibData->GetHWStatus(ch) == AliTOFChannelOnlineStatusArray::kTOFHWOk)
633 // fTRMHwOkArray[trmIndex]+=1;
635 if ( (!(fCalibData->GetNoiseStatus(ch)==AliTOFChannelOnlineStatusArray::kTOFNoiseBad))
636 && (fCalibData->GetHWStatus(ch) == AliTOFChannelOnlineStatusArray::kTOFHWOk) ){
637 //fTRMEnabledArray[trmIndex]+=1;
638 //fill reference map with info from OCDB
639 Short_t fea = geoId[4]/12;
640 Float_t hitmapx = geoId[0] + ((Double_t)(3 - fea) + 0.5)*0.25;
641 FillRawsData(16,hitmapx, GetStripIndex(geoId));
644 //printf("Counters for noisy, enabled and good channels in TOF TRMs read from OCDB.\n");
648 //enable options for DQM shifter
649 EnableDqmShifterOpt(kTRUE);
651 IncEvCountCycleRaws();
652 IncEvCountTotalRaws();
656 //____________________________________________________________________________
657 void AliTOFQADataMakerRec::MakeRecPoints(TTree * clustersTree)
660 // Make data from Clusters
663 Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;
664 Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
666 Int_t volumeID2[5];//(sm, plate,strip, padZ,padX)
667 //Int_t volumeID[5];//(sm, plate,strip, padX,padZ)
669 TBranch *branch=clustersTree->GetBranch("TOF");
671 AliError("can't get the branch with the TOF clusters !");
675 static TClonesArray dummy("AliTOFcluster",10000);
677 TClonesArray *clusters=&dummy;
678 branch->SetAddress(&clusters);
681 clustersTree->GetEvent(0);
683 FillRecPointsData(0,(Int_t)clusters->GetEntriesFast()) ;
685 TIter next(clusters) ;
687 while ( (c = dynamic_cast<AliTOFcluster *>(next())) ) {
689 // volumeID2[0] = c->GetDetInd(0);
690 // volumeID2[1] = c->GetDetInd(1);
691 // volumeID2[2] = c->GetDetInd(2);
692 // volumeID2[3] = c->GetDetInd(4); //padX
693 // volumeID2[4] = c->GetDetInd(3); //padZ
695 for (Int_t i=0;i<5;i++){
696 volumeID2[i]=c->GetDetInd(i); //X and Z indeces inverted in RecPoints
698 //Int_t chIndex=AliTOFGeometry::GetIndex(volumeID2);
699 Int_t iDDL=AliTOFRawStream::Geant2DDL(volumeID2);
700 Int_t iTRM=AliTOFRawStream::Geant2TRM(volumeID2);
701 Short_t fea = volumeID2[4]/12;
702 Float_t hitmapx = volumeID2[0] + ((Double_t)(3 - fea) + 0.5) *0.25;
703 Int_t ddlACside=iDDL/36; // 0 or 1
704 Int_t ddlPerSm=iDDL%4;
706 if ((c->GetTDCRAW()) && (c->GetTDC()) && (c->GetToT())){
707 if (volumeID2[0]>4 && volumeID2[0]<14){ //I side
708 if (ddlPerSm<2){ //A side
709 FillRecPointsData(1, c->GetTDC()*tdc2ns) ;//in ns
710 FillRecPointsData(5, c->GetTDCRAW()*tdc2ns) ;//in ns
711 FillRecPointsData(9, c->GetToT()*tot2ns) ;//in ns
713 FillRecPointsData(3, c->GetTDC()*tdc2ns) ;//in ns
714 FillRecPointsData(7, c->GetTDCRAW()*tdc2ns) ;//in ns
715 FillRecPointsData(11, c->GetToT()*tot2ns) ;//in ns
718 if (volumeID2[0]<5 || volumeID2[0]>13){ //O side
719 if (ddlPerSm<2){ //A side
720 FillRecPointsData(2, c->GetTDC()*tdc2ns) ;//in ns
721 FillRecPointsData(6, c->GetTDCRAW()*tdc2ns) ;//in ns
722 FillRecPointsData(10, c->GetToT()*tot2ns) ;//in ns
724 FillRecPointsData(4, c->GetTDC()*tdc2ns) ;//in ns
725 FillRecPointsData(8, c->GetTDCRAW()*tdc2ns) ;//in ns
726 FillRecPointsData(12, c->GetToT()*tot2ns) ;//in ns
730 FillRecPointsData(13,hitmapx,GetStripIndex(volumeID2));
731 FillRecPointsData(14,GetStripIndex(volumeID2), c->GetTDC()*tdc2ns) ;
732 Int_t trm= iDDL*10+(iTRM-3);
733 if (ddlACside==0) { //A side
734 FillRecPointsData(15,trm,c->GetTDC()*tdc2ns);
736 FillRecPointsData(16,trm,c->GetTDC()*tdc2ns);
740 EnableDqmShifterOpt(kFALSE);
742 IncEvCountCycleRecPoints();
743 IncEvCountTotalRecPoints();
747 //____________________________________________________________________________
748 void AliTOFQADataMakerRec::MakeESDs(AliESDEvent * esd)
751 // make QA data from ESDs
753 const Double_t speedOfLight = TMath::C()*1E2*1E-12; // cm/ps
754 const Double_t pionMass = 0.13957018; //GeV/c^2
756 Int_t ntrk = esd->GetNumberOfTracks() ;
761 AliESDtrack *track=esd->GetTrack(ntrk);
762 Double_t tofTime=track->GetTOFsignal();//in ps
763 Double_t tofTimeRaw=track->GetTOFsignalRaw();//in ps
764 Double_t tofToT=track->GetTOFsignalToT(); //in ps
766 UInt_t status=track->GetStatus();
767 if (track->IsOn(AliESDtrack::kTPCrefit)) {
769 Double_t y=track->Eta();
770 if (TMath::Abs(y)<0.9) { //select TOF acceptance
771 if ((status&AliESDtrack::kTOFout)!=0) { //define matching
773 FillESDsData(1,tofTime*1E-3);
774 FillESDsData(2,tofTimeRaw*1E-3);
775 FillESDsData(3,tofToT*1E-3);
776 FillESDsData(4,track->Pt());
778 Double_t length =track->GetIntegratedLength();
779 Double_t mom2=(track->Pt()*track->Pt())+(track->Pz()*track->Pz());
780 Double_t piTexp = TMath::Sqrt(1+(pionMass*pionMass/mom2))*length/speedOfLight; //in ps
781 FillESDsData(8,tofTime-piTexp);
782 FillESDsData(9,length);
784 if ((status&AliESDtrack::kTIME)!=0)
785 FillESDsData(5,track->Pt());
788 FillESDsData(6,track->Pt());
789 } //end check on matched tracks
791 }//end check on TPCrefit
794 FillESDsData(0,ntofout) ;
796 Float_t ratio = (Float_t)ntofout/(Float_t)ntpc*100.; //matching probability
797 FillESDsData(7,ratio) ;
801 Float_t ratio = (Float_t)ntofout/(Float_t)ntpc*100; //matched over propagated to TOF outer radius
802 FillESDsData(8,ratio) ;
804 EnableDqmShifterOpt(kFALSE);
806 IncEvCountCycleESDs();
807 IncEvCountTotalESDs();
811 //____________________________________________________________________________
812 void AliTOFQADataMakerRec::StartOfDetectorCycle()
815 //Detector specific actions at start of cycle
816 // ResetAllTRMcounters();
817 fCalibData = GetCalibData();
822 //____________________________________________________________________________
823 void AliTOFQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
825 //Detector specific actions at end of cycle
826 // do the QA checking
827 ResetEventTrigClasses();
829 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
830 if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) continue ;
832 SetEventSpecie(AliRecoParam::ConvertIndex(specie)); // RS: the specie is not set, why?
834 for (int itc=-1;itc<GetNTrigClasses();itc++) { // RS: loop over eventual clones per trigger class
836 if (fEnableDqmShifterOpt) {
838 // RS: fetch the histograms for given trigger class
839 TObjArray& arrRW = *GetRawsDataOfTrigClass(itc);
841 // Help make the raw qa histogram easier to interpret for the DQM shifter
842 if (!arrRW[ 0] || !arrRW[ 5] || !arrRW[10] || !arrRW[15] || !arrRW[16] || !arrRW[17]) continue;
843 //printf("No histogram for DQM found - Possible memory corruption ???. Please check\n") ;
844 printf("=========>Processed %i physics raw of specie %s with TrigGlass %d\n",
845 GetEvCountCycleRaws(itc),AliRecoParam::GetEventSpecieName(specie), itc);
847 //Double_t monitorPeriodLength=fProcessedRawEventN*600*1E-9;//in s
850 //set minima and maxima to allow log scale
851 Double_t yTimeMax = ((TH1*)arrRW[5])->GetMaximum()*1.05;
852 Double_t yTotMax = ((TH1*)arrRW[10])->GetMaximum()*1.05;
853 fLineExpTimeMin->SetY2(yTimeMax);
854 fLineExpTimeMax->SetY2(yTimeMax);
855 fLineExpTotMin->SetY2(yTotMax);
856 fLineExpTotMax->SetY2(yTotMax);
858 for (Int_t j=0;j<18;j++){
859 if ((j==0)||(j==5)||(j==10)||(j==15)||(j==16)||(j==17)) {
860 TH1* htmp = (TH1*)arrRW[j];
861 htmp->GetXaxis()->SetLabelOffset(0.005);
862 htmp->GetXaxis()->SetLabelSize(0.05);
863 htmp->GetXaxis()->SetTitleOffset(0.8);
864 htmp->GetXaxis()->SetTitleSize(0.05);
865 htmp->GetYaxis()->SetLabelOffset(0.005);
866 htmp->GetYaxis()->SetLabelSize(0.06);
867 htmp->GetYaxis()->SetTitleOffset(0.8);
868 htmp->GetYaxis()->SetTitleSize(0.06);
871 //make up for all histos
872 for(Int_t j=0;j<5;j++) {
873 TH1* htmp = (TH1*)arrRW[j];
875 htmp->SetMarkerColor(kBlue);
876 htmp->SetMarkerStyle(8);
877 htmp->SetMarkerSize(0.7);
879 for(Int_t j=5;j<15;j++) {
880 TH1* htmp = (TH1*)arrRW[j];
882 htmp->SetLineColor(kBlue);
883 htmp->SetLineWidth(1);
884 htmp->SetMarkerColor(kBlue);
885 //htmp->SetFillColor(kWhite);
886 //htmp->SetDrawOption("bar");
889 TH1* htmp = (TH1*)arrRW[15];
890 htmp->SetLineColor(kBlue);
891 htmp->SetLineWidth(1);
892 htmp->SetMarkerStyle(8);
893 htmp->SetMarkerSize(0.7);
894 htmp->SetMarkerColor(kBlue);//Option("bar");
896 if ( (htmp=(TH1*)arrRW[16]) ) htmp->SetOption("colz");
897 if ( (htmp=(TH1*)arrRW[17]) ) htmp->SetOption("colz");
898 if ( (htmp=(TH1*)arrRW[18]) ) htmp->SetOption("colz");
900 }//END ENABLE DQM SHIFTER OPT
901 } // RS: loop over trigger classes
904 AliQAChecker::Instance()->Run(AliQAv1::kTOF, task, list) ;
907 //____________________________________________________________________________
908 void AliTOFQADataMakerRec::GetMapIndeces(const Int_t* const in , Int_t* out)
911 //return appropriate indeces for the theta-phi map
914 Int_t npadX = AliTOFGeometry::NpadX();
915 Int_t npadZ = AliTOFGeometry::NpadZ();
916 Int_t nStripA = AliTOFGeometry::NStripA();
917 Int_t nStripB = AliTOFGeometry::NStripB();
918 Int_t nStripC = AliTOFGeometry::NStripC();
920 Int_t isector = in[0];
921 Int_t iplate = in[1];
922 Int_t istrip = in[2];
926 Int_t stripOffset = 0;
932 stripOffset = nStripC;
935 stripOffset = nStripC+nStripB;
938 stripOffset = nStripC+nStripB+nStripA;
941 stripOffset = nStripC+nStripB+nStripA+nStripB;
944 AliDebug(1,Form("Wrong plate number in TOF (%d) !",iplate));
947 Int_t zindex=npadZ*(istrip+stripOffset)+(ipadZ+1);
948 Int_t phiindex=npadX*isector+ipadX+1;
954 //---------------------------------------------------------------
955 Int_t AliTOFQADataMakerRec::GetStripIndex(const Int_t * const in)
957 /* return tof strip index between 0 and 91 */
959 Int_t nStripA = AliTOFGeometry::NStripA();
960 Int_t nStripB = AliTOFGeometry::NStripB();
961 Int_t nStripC = AliTOFGeometry::NStripC();
963 // Int_t isector = in[0];
964 Int_t iplate = in[1];
965 Int_t istrip = in[2];
966 //Int_t ipadX = in[3];
967 //Int_t ipadZ = in[4];
969 Int_t stripOffset = 0;
975 stripOffset = nStripC;
978 stripOffset = nStripC+nStripB;
981 stripOffset = nStripC+nStripB+nStripA;
984 stripOffset = nStripC+nStripB+nStripA+nStripB;
987 AliDebug(1,Form("Wrong plate number in TOF (%d) !",iplate));
992 if (stripOffset<0 || stripOffset>92) return -1;
994 return (stripOffset+istrip);
997 //---------------------------------------------------------------
998 Bool_t AliTOFQADataMakerRec::CheckVolumeID(const Int_t * const volumeID)
1001 //Checks volume ID validity
1004 for (Int_t j=0;j<5;j++){
1005 if (volumeID[j]<0) {
1006 AliDebug(1,Form("Invalid detector volume index for volumeID[%i]",j));
1014 //---------------------------------------------------------------
1015 Bool_t AliTOFQADataMakerRec::CheckEquipID(const Int_t * const equipmentID)
1018 //Checks equipment ID validity
1020 for (Int_t j=0;j<5;j++){
1021 if (equipmentID[j]<0) {
1022 AliDebug(1,Form("Invalid equipment volume index for equipmentID[%i]",j));
1028 //---------------------------------------------------------------
1029 Bool_t AliTOFQADataMakerRec::FilterLTMData(const Int_t * const equipmentID) const
1031 /*It returns kTRUE if data come from LTM.
1032 It thus filters trigger-related signals */
1034 Int_t ddl, trm, tdc;
1035 //if (!CheckEquipID(equipmentID)) return kFALSE;
1036 ddl = equipmentID[0];
1037 trm = equipmentID[1];
1038 tdc = equipmentID[3];
1040 if ((ddl%2==1) && (trm==3) && (tdc>11 && tdc<15))
1046 //---------------------------------------------------------------
1047 Bool_t AliTOFQADataMakerRec::FilterSpare(const Int_t * const equipmentID) const
1049 /*It returns kTRUE if data come from spare
1051 So far only check on TRM 3 crate left is implemented */
1053 Int_t ddl, trm, tdc;
1054 //if (!CheckEquipID(equipmentID)) return kFALSE;
1055 ddl = equipmentID[0];
1056 trm = equipmentID[1];
1057 tdc = equipmentID[3];
1059 if ((ddl%2==1) && (trm==3) && (tdc>2 && tdc<12))
1065 //----------------------------------------------------------------
1066 /*void AliTOFQADataMakerRec::ResetAllTRMcounters()
1068 //resets all TRM counters to 0
1069 for (Int_t trm=0;trm<720;trm++){
1070 fTRMNoisyArray[trm]=-1;
1071 fTRMHwOkArray[trm]=-1;
1072 fTRMEnabledArray[trm]=-1;