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 & rshanoian on 06/07/2011
26 - changes for trigger classes implementation
27 - fRunNumber added as private member
28 - added time vs BCID plot
30 Modified by fbellini on 18/01/2011
31 - reduced histo binning to reduce size
32 - added decoding errors plot
33 - added channel maps and options for DQM shifters
34 - new list of recPoints and ESDs plots
35 - removed hTrmChannels035 and hTrmChannels3671
37 Modified by bvonhall on 03/11/2010
38 - modified declaration of hTrmChannels035 and hTrmChannels3671 in EndOfDetectorCycle()
39 to prevent memory corruption
41 Modified by adecaro on 18/10/2010
42 - fTOFRawStream object set as private member
44 Modified by fbellini on 13/09/2010
45 - Set TLines as private members
46 - Set image flag for expert histos
48 Modified by fbellini on 14/06/2010
50 - use LoadRawDataBuffersV2()
52 Modified by fbellini on 10/05/2010
53 - Fixed EndOfDetectorCycle() memory corruption bug
55 Modified by fbellini on 22/04/2010
56 - Added filter for physics events
58 Modified by fbellini on 16/04/2010
59 - Added EnableDqmShifterOpt()
60 - Modified EndOfDetectorCycle() with options for DQM
63 Modified by fbellini on 30/03/2010
64 - Changed raws time histos range to 610ns
65 - Added FilterLTMData() and FilterSpare() methods
66 - Added check on enabled channels for raw data
67 - Updated RecPoints QA
69 Modified by fbellini on 02/03/2010
70 - Fixed raw data decoding methods (use AliTOFRawStream::LoadRawDataBuffer())
71 - Added filter for noisy channels and read map from OCDB
72 - Added GetCalibData() method
73 - Added CheckVolumeID() and CheckEquipID() methods
77 #include <TClonesArray.h>
81 #include <TPaveText.h>
83 #include "AliCDBManager.h"
84 #include "AliCDBEntry.h"
85 #include "AliESDEvent.h"
86 #include "AliESDtrack.h"
87 #include "AliQAChecker.h"
88 #include "AliRawReader.h"
89 #include "AliTOFRawStream.h"
90 #include "AliTOFcluster.h"
91 #include "AliTOFQADataMakerRec.h"
92 #include "AliTOFrawData.h"
93 #include "AliTOFGeometry.h"
94 #include "AliTOFChannelOnlineStatusArray.h"
95 #include "AliTOFDecoderSummaryData.h"
96 #include "AliTOFDecoderV2.h"
98 ClassImp(AliTOFQADataMakerRec)
100 //____________________________________________________________________________
101 AliTOFQADataMakerRec::AliTOFQADataMakerRec() :
102 AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kTOF), "TOF Quality Assurance Data Maker"),
104 fEnableNoiseFiltering(kFALSE),
105 fEnableDqmShifterOpt(kFALSE),
106 // fProcessedRawEventN(0),
108 fLineExpTimeMin(new TLine(200., 0., 200., 0.)),
109 fLineExpTimeMax(new TLine(250., 0., 250., 0.)),
110 fLineExpTotMin(new TLine(5., 0., 5., 0.)),
111 fLineExpTotMax(new TLine(20., 0., 20., 0.)),
112 fTOFRawStream(AliTOFRawStream()),
119 for (Int_t sm=0;sm<17;sm++){
120 fLineSMid[sm] = new TLine( sm+1, 0., sm+1, 91.);
122 //initialize all TRM counters to -1 i.e. invalid value
123 // for (Int_t trm=0;trm<720;trm++){
124 // fTRMNoisyArray[trm]=-1;
125 // fTRMHwOkArray[trm]=-1;
126 // fTRMEnabledArray[trm]=-1;
131 //____________________________________________________________________________
132 AliTOFQADataMakerRec::AliTOFQADataMakerRec(const AliTOFQADataMakerRec& qadm) :
134 fCalibData(qadm.fCalibData),
135 fEnableNoiseFiltering(qadm.fEnableNoiseFiltering),
136 fEnableDqmShifterOpt(qadm.fEnableDqmShifterOpt),
137 // fProcessedRawEventN(qadm.fProcessedRawEventN),
139 fLineExpTimeMin(qadm.fLineExpTimeMin),
140 fLineExpTimeMax(qadm.fLineExpTimeMax),
141 fLineExpTotMin(qadm.fLineExpTotMin),
142 fLineExpTotMax(qadm.fLineExpTotMax),
143 fTOFRawStream(qadm.fTOFRawStream),
144 fDecoderSummary(qadm.fDecoderSummary),
145 fRunNumber(qadm.fRunNumber)
150 SetName((const char*)qadm.GetName()) ;
151 SetTitle((const char*)qadm.GetTitle());
153 for (Int_t sm=0;sm<17;sm++){
154 fLineSMid[sm]=qadm.fLineSMid[sm];
157 // for (Int_t trm=0;trm<10;trm++){
158 // fTRMNoisyArray[trm]=qadm.fTRMNoisyArray[trm];
159 // fTRMHwOkArray[trm]=qadm.fTRMHwOkArray[trm];
160 // fTRMEnabledArray[trm]=qadm.fTRMEnabledArray[trm];
165 //__________________________________________________________________
166 AliTOFQADataMakerRec& AliTOFQADataMakerRec::operator = (const AliTOFQADataMakerRec& qadm )
169 // assignment operator.
171 this->~AliTOFQADataMakerRec();
172 new(this) AliTOFQADataMakerRec(qadm);
176 //----------------------------------------------------------------------------
177 AliTOFQADataMakerRec::~AliTOFQADataMakerRec()
180 fTOFRawStream.Clear();
182 delete fLineExpTimeMin;
184 delete fLineExpTimeMax;
186 delete fLineExpTotMin;
188 delete fLineExpTotMax;
189 for (Int_t sm=0;sm<10;sm++){
191 delete fLineSMid[sm];
194 //----------------------------------------------------------------------------
195 AliTOFChannelOnlineStatusArray* AliTOFQADataMakerRec::GetCalibData()
198 // Retrive TOF calib objects from OCDB
200 AliCDBManager *man = AliCDBManager::Instance();
203 if (fRun<=0) fRunNumber=145288; //reference run from LHC11a
204 else fRunNumber=fRun;
206 if (man->GetRun()!=fRunNumber){
207 fRunNumber=man->GetRun();
208 AliWarning(Form("Run number mismatch found: setting it to value from current AliCDBManager instance = %i", fRunNumber));
210 cdbe = man->Get("TOF/Calib/Status",fRunNumber);
214 AliWarning("Load of calibration data from default (alien://) storage failed!");
215 printf("Calibration data will be loaded from local storage - ok if on DQM station!");
216 man->SetDefaultStorage("local:///local/cdb/");
217 cdbe = man->Get("TOF/Calib/Status",fRun);
220 AliWarning("Load of calibration data from local DQM machine storage failed!");
221 AliWarning("Calibration data will be loaded from local ($ALICE_ROOT) storage ");
222 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
223 cdbe = man->Get("TOF/Calib/Status",fRunNumber);
226 // Retrieval of data in directory TOF/Calib/Data:
227 AliTOFChannelOnlineStatusArray * array = 0;
229 printf("======= OCDB object for TOF retrieved from run %i in %s\n",fRunNumber,cdbe->GetName());
230 array = (AliTOFChannelOnlineStatusArray *)cdbe->GetObject();
232 if (!array) AliFatal("No calibration data from calibration database !");
237 //____________________________________________________________________________
238 void AliTOFQADataMakerRec::InitRaws()
241 // create Raws histograms in Raws subdir
243 const Bool_t expert = kTRUE ;
244 const Bool_t saveCorr = kTRUE ;
245 const Bool_t image = kTRUE ;
247 TH1I * h0 = new TH1I("hTOFRaws", "TOF raw hit multiplicity; TOF raw hits number; Events ",200, 0, 200) ;
249 TH1I * h1 = new TH1I("hTOFRawsIA", "TOF raw hit multiplicity - I/A side; TOF raw hits number ;Events ",200, 0, 200) ;
250 TH1I * h2 = new TH1I("hTOFRawsOA", "TOF raw hit multiplicity - O/A side; TOF raw hits number ;Events ",200, 0, 200) ;
251 TH1I * h3 = new TH1I("hTOFRawsIC", "TOF raw hit multiplicity - I/C side; TOF raw hits number ;Events ",200, 0, 200) ;
252 TH1I * h4 = new TH1I("hTOFRawsOC", "TOF raw hit multiplicity - O/C side; TOF raw hits number ;Events ",200, 0, 200) ;
254 TH1F * h5 = new TH1F("hTOFRawsTime", "TOF Raws - Hit time (ns);Measured Hit time [ns];Hits", 250,0. ,610.) ;
255 TH1F * h6 = new TH1F("hTOFRawsTimeIA", "TOF Raws - Hit time (ns) - I/A side;Measured Hit time [ns];Hits", 250,0. ,610.) ;
256 TH1F * h7 = new TH1F("hTOFRawsTimeOA", "TOF Raws - Hit time (ns) - O/A side;Measured Hit time [ns];Hits", 250,0. ,610.) ;
257 TH1F * h8 = new TH1F("hTOFRawsTimeIC", "TOF Raws - Hit time (ns) - I/C side;Measured Hit time [ns];Hits", 250,0. ,610.) ;
258 TH1F * h9 = new TH1F("hTOFRawsTimeOC", "TOF Raws - Hit time (ns) - O/C side;Measured Hit time [ns];Hits", 250,0. ,610.) ;
260 TH1F * h10 = new TH1F("hTOFRawsToT", "TOF Raws - Hit ToT (ns);Measured Hit ToT (ns);Hits", 100, 0., 48.8) ;
262 TH1F * h11 = new TH1F("hTOFRawsToTIA", "TOF Raws - Hit ToT (ns) - I/A side;Measured Hit ToT (ns);Hits", 100, 0., 48.8) ;
263 TH1F * h12 = new TH1F("hTOFRawsToTOA", "TOF Raws - Hit ToT (ns) - O/A side;Measured Hit ToT (ns);Hits", 100, 0., 48.8) ;
264 TH1F * h13 = new TH1F("hTOFRawsToTIC", "TOF Raws - Hit ToT (ns) - I/C side;Measured Hit ToT (ns);Hits", 100, 0., 48.8) ;
265 TH1F * h14 = new TH1F("hTOFRawsToTOC", "TOF Raws - Hit ToT (ns) - O/C side;Measured Hit ToT (ns);Hits", 100, 0., 48.8) ;
267 TH1F * h15 = new TH1F("hTOFRawsLTMHits", "LTMs OR signals; Crate; Counts", 72, 0., 72.);
268 TH2F * h16 = new TH2F("hTOFrefMap", "TOF enabled channel reference map;sector;strip", 72, 0., 18., 91, 0., 91.);
269 TH2F * h17 = new TH2F("hTOFRawHitMap","TOF raw hit map;sector;strip", 72, 0., 18., 91, 0., 91.);
270 TH2I * h18 = new TH2I("hTOFDecodingErrors","Decoding error monitoring; DDL; Error ", 72, 0, 72, 13,1,14);
272 h18->GetYaxis()->SetBinLabel(1,"DRM ");
273 h18->GetYaxis()->SetBinLabel(2,"LTM ");
274 h18->GetYaxis()->SetBinLabel(3,"TRM 3 ");
275 h18->GetYaxis()->SetBinLabel(4,"TRM 4");
276 h18->GetYaxis()->SetBinLabel(5,"TRM 5");
277 h18->GetYaxis()->SetBinLabel(6,"TRM 6");
278 h18->GetYaxis()->SetBinLabel(7,"TRM 7");
279 h18->GetYaxis()->SetBinLabel(8,"TRM 8");
280 h18->GetYaxis()->SetBinLabel(9,"TRM 9");
281 h18->GetYaxis()->SetBinLabel(10,"TRM 10");
282 h18->GetYaxis()->SetBinLabel(11,"TRM 11");
283 h18->GetYaxis()->SetBinLabel(12,"TRM 12");
284 h18->GetYaxis()->SetBinLabel(13,"recovered");
286 TH1F * h19 = new TH1F("hTOFOrphansTime", "TOF Raws - Orphans time (ns);Measured Hit time [ns];Hits", 250, 0. ,610.) ;
287 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) ;
288 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) ;
289 TH2F * h22 = new TH2F("hTOFTimeVsStrip","TOF Raws - Hit time vs. strip (theta); Strip index;Raws TOF time (ns) ", 91,0.,91, 250, 0., 610.) ;
290 TH2F * h23 = new TH2F("hTOFtimeVsBCID","TOF time vs BCID; BCID; time (ns) ", 3564, 0., 3564., 250,0.,610);
317 //add lines for DQM shifter
318 //fLineExpTimeMin = new TLine(200., 0., 200., 0.);
319 fLineExpTimeMin->SetLineColor(kGreen);
320 fLineExpTimeMin->SetLineWidth(2);
322 //fLineExpTimeMax = new TLine(250., 0., 250., 0.);
323 fLineExpTimeMax->SetLineColor(kGreen);
324 fLineExpTimeMax->SetLineWidth(2);
326 //fLineExpTotMin = new TLine( 5., 0., 5., 0.);
327 fLineExpTotMin->SetLineColor(kGreen);
328 fLineExpTotMin->SetLineWidth(2);
330 //fLineExpTotMax = new TLine(20., 0., 20., 0.);
331 fLineExpTotMax->SetLineColor(kGreen);
332 fLineExpTotMax->SetLineWidth(2);
334 for (Int_t sm=0;sm<17;sm++){
335 //fLineSMid[sm] = new TLine( 1+sm, 0., 1+sm, 91.);
336 fLineSMid[sm]->SetLineColor(kMagenta);
337 fLineSMid[sm]->SetLineWidth(2);
340 h5->GetListOfFunctions()->Add(fLineExpTimeMin);
341 h5->GetListOfFunctions()->Add(fLineExpTimeMax);
342 h10->GetListOfFunctions()->Add(fLineExpTotMin);
343 h10->GetListOfFunctions()->Add(fLineExpTotMax);
345 for (Int_t sm=0;sm<17;sm++){
346 h16->GetListOfFunctions()->Add(fLineSMid[sm]);
347 h17->GetListOfFunctions()->Add(fLineSMid[sm]);
351 TPaveText *phosHoleBox=new TPaveText(13,38,16,53,"b");
352 phosHoleBox->SetFillStyle(0);
353 phosHoleBox->SetFillColor(kWhite);
354 phosHoleBox->SetLineColor(kMagenta);
355 phosHoleBox->SetLineWidth(2);
356 phosHoleBox->AddText("PHOS");
357 h16->GetListOfFunctions()->Add(phosHoleBox);
358 h17->GetListOfFunctions()->Add(phosHoleBox);
360 // h0->SetDrawOption("logy");
361 // h5->SetDrawOption("logy");
362 // h10->SetDrawOption("logy");
364 Add2RawsList(h0, 0, !expert, image, !saveCorr) ;
365 Add2RawsList(h1, 1, expert, !image, !saveCorr) ;
366 Add2RawsList(h2, 2, expert, !image, !saveCorr) ;
367 Add2RawsList(h3, 3, expert, !image, !saveCorr) ;
368 Add2RawsList(h4, 4, expert, !image, !saveCorr) ;
369 Add2RawsList(h5, 5, !expert, image, !saveCorr) ;
370 Add2RawsList(h6, 6, expert, !image, !saveCorr) ;
371 Add2RawsList(h7, 7, expert, !image, !saveCorr) ;
372 Add2RawsList(h8, 8, expert, !image, !saveCorr) ;
373 Add2RawsList(h9, 9, expert, !image, !saveCorr) ;
374 Add2RawsList(h10, 10, !expert, image, !saveCorr) ;
375 Add2RawsList(h11, 11, expert, !image, !saveCorr) ;
376 Add2RawsList(h12, 12, expert, !image, !saveCorr) ;
377 Add2RawsList(h13, 13, expert, !image, !saveCorr) ;
378 Add2RawsList(h14, 14, expert, !image, !saveCorr) ;
379 Add2RawsList(h15, 15, !expert, image, !saveCorr) ;
380 Add2RawsList(h16, 16, !expert, image, !saveCorr) ;
381 Add2RawsList(h17, 17, !expert, image, !saveCorr) ;
382 Add2RawsList(h18, 18, expert, !image, !saveCorr) ;
383 Add2RawsList(h19, 19, expert, !image, !saveCorr) ;
384 Add2RawsList(h20, 20, expert, !image, !saveCorr) ;
385 Add2RawsList(h21, 21, expert, !image, !saveCorr) ;
386 Add2RawsList(h22, 22, expert, !image, !saveCorr) ;
387 Add2RawsList(h23, 23, expert, !image, !saveCorr) ;
389 ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line
392 //____________________________________________________________________________
393 void AliTOFQADataMakerRec::InitRecPoints()
396 // create RecPoints histograms in RecPoints subdir
399 const Bool_t expert = kTRUE ;
400 const Bool_t image = kTRUE ;
402 TH1I * h0 = new TH1I("hTOFRecPoints", "TOF RecPoints multiplicity ; TOF RecPoints number;Events",200, 0, 200) ;
404 TH1F * h1 = new TH1F("hTOFRecPointsTimeIA", "RecPoints Time Spectrum in TOF (ns)- I/A side; Calibrated TOF time [ns];Events", 250, 0., 610.) ;
405 TH1F * h2 = new TH1F("hTOFRecPointsTimeOA", "RecPoints Time Spectrum in TOF (ns)- O/A side; Calibrated TOF time [ns];Events", 250, 0., 610.) ;
406 TH1F * h3 = new TH1F("hTOFRecPointsTimeIC", "RecPoints Time Spectrum in TOF (ns)- I/C side; Calibrated TOF time [ns];Events", 250, 0., 610.) ;
407 TH1F * h4 = new TH1F("hTOFRecPointsTimeOC", "RecPoints Time Spectrum in TOF (ns)- O/C side; Calibrated TOF time [ns];Events", 250, 0., 610.) ;
409 TH1F * h5 = new TH1F("hTOFRecPointsRawTimeIA", "RecPoints raw Time Spectrum in TOF (ns)-I/A side; Measured TOF time [ns];Hits", 250, 0., 610.) ;
410 TH1F * h6 = new TH1F("hTOFRecPointsRawTimeOA", "RecPoints raw Time Spectrum in TOF (ns)-O/A side; Measured TOF time [ns];Hits", 250, 0., 610.) ;
411 TH1F * h7 = new TH1F("hTOFRecPointsRawTimeIC", "RecPoints raw Time Spectrum in TOF (ns)-I/C side; Measured TOF time [ns];Hits", 250, 0., 610.) ;
412 TH1F * h8 = new TH1F("hTOFRecPointsRawTimeOC", "RecPoints raw Time Spectrum in TOF (ns)-O/C side; Measured TOF time [ns];Hits", 250, 0., 610.) ;
414 TH1F * h9 = new TH1F("hTOFRecPointsToTIA", "RecPoints ToT Spectrum in TOF (ns)-I/A side; Measured TOT [ns];Hits", 100, 0., 48.8 ) ;
415 TH1F * h10 = new TH1F("hTOFRecPointsToTOA", "RecPoints ToT Spectrum in TOF (ns)-O/A side; Measured TOT [ns];Hits", 100, 0., 48.8 ) ;
416 TH1F * h11 = new TH1F("hTOFRecPointsToTIC", "RecPoints ToT Spectrum in TOF (ns)-I/C side; Measured TOT [ns];Hits", 100, 0., 48.8 ) ;
417 TH1F * h12 = new TH1F("hTOFRecPointsToTOC", "RecPoints ToT Spectrum in TOF (ns)-O/C side; Measured TOT [ns];Hits", 100, 0., 48.8 ) ;
419 TH2F * h13 = new TH2F("hTOFRecPointsClusMap","RecPoints map; sector ;strip", 72, 0., 18., 91, 0., 91.) ;
420 TH2F * h14 = new TH2F("hTOFRecPointsTimeVsStrip","RecPoints TOF time vs. strip (theta); Strip index; RecPoints TOF time (ns) ",91, 0., 91., 250, 0., 610.) ;
421 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) ;
422 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) ;
442 Add2RecPointsList(h0, 0, !expert, image) ;
443 Add2RecPointsList(h1, 1, !expert, image) ;
444 Add2RecPointsList(h2, 2, !expert, image) ;
445 Add2RecPointsList(h3, 3, !expert, image) ;
446 Add2RecPointsList(h4, 4, !expert, image) ;
447 Add2RecPointsList(h5, 5, expert, !image) ;
448 Add2RecPointsList(h6, 6, expert, !image) ;
449 Add2RecPointsList(h7, 7, expert, !image) ;
450 Add2RecPointsList(h8, 8, expert, !image) ;
451 Add2RecPointsList(h9, 9, !expert, !image) ;
452 Add2RecPointsList(h10, 10, !expert, !image) ;
453 Add2RecPointsList(h11, 11, !expert, !image) ;
454 Add2RecPointsList(h12, 12, !expert, !image) ;
455 Add2RecPointsList(h13, 13, expert, !image) ;
456 Add2RecPointsList(h14, 14, expert, image) ;
457 Add2RecPointsList(h15, 15, expert, !image) ;
458 Add2RecPointsList(h16, 16, expert, !image) ;
460 ClonePerTrigClass(AliQAv1::kRECPOINTS); // this should be the last line
463 //____________________________________________________________________________
464 void AliTOFQADataMakerRec::InitESDs()
467 //create ESDs histograms in ESDs subdir
470 const Bool_t expert = kTRUE ;
471 const Bool_t image = kTRUE ;
473 TH1I * h0 = new TH1I("hTOFESDs", "Number of matched TOF tracks per event;Number of TOF matched ESD tracks;Counts", 200, 0, 200) ;
474 TH1F * h1 = new TH1F("hTOFESDsTime", "Matched ESDs tracks: TOF Time spectrum; Calibrated TOF time [ns];Counts", 250, 0., 610. ) ;
475 TH1F * h2 = new TH1F("hTOFESDsRawTime", "Matched ESDs tracks: TOF raw Time spectrum;Measured TOF time [ns];Counts", 250, 0., 610.) ;
476 TH1F * h3 = new TH1F("hTOFESDsToT", "Matched ESDs tracks: TOF ToT spectrum; ESDs ToT [ns];Counts",100, 0., 48.8) ;
477 TH1F * h4 = new TH1F("hTOFESDskTOFOUT", "p_{T} distribution of tracks with kTOFout; p_{T} (GeV/c);Counts", 50, 0.20, 5.00) ;
478 TH1F * h5 = new TH1F("hTOFESDskTIME", "p_{T} distribution of tracks with kTOFout && kTIME; p_{T} (GeV/c);Counts", 50, 0.20, 5.00) ;
479 TH1F * h6 = new TH1F("hTOFESDsMatched", "p_{T} distribution of tracks with kTOFout && TOFtime>0; p_{T} (GeV/c);Counts", 50, 0.20, 5.00) ;
480 TH1F * h7 = new TH1F("hTOFESDsMatchingProb", "TPC-TOF track-matching probability;TOF matching probability (%) ;Counts",101, -1.0, 100) ;
481 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.) ;
482 TH1F * h9 = new TH1F("hTOFHitsLength", "Matched ESDs tracks: Length Spectrum; Track length [cm];Counts", 800, 0., 800) ;
495 Add2ESDsList(h0, 0, !expert, image) ;
496 Add2ESDsList(h1, 1, !expert, image) ;
497 Add2ESDsList(h2, 2, expert, !image) ;
498 Add2ESDsList(h3, 3, !expert, !image) ;
499 Add2ESDsList(h4, 4, expert, image) ;
500 Add2ESDsList(h5, 5, expert, image) ;
501 Add2ESDsList(h6, 6, expert, image) ;
502 Add2ESDsList(h7, 7, expert, image) ;
503 Add2ESDsList(h8, 8, expert, !image) ;
504 Add2ESDsList(h9, 9, !expert, !image) ;
506 ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line
510 //____________________________________________________________________________
511 void AliTOFQADataMakerRec::MakeRaws(AliRawReader* rawReader)
514 // makes data from Raws
516 if (rawReader->GetType()==7) {
518 Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;//in ns
519 Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
520 Int_t ntof[5]; /* 0=tot, 1=IA, 2=OA, 3=IC, 4=OC*/
521 for (Int_t j=0;j<5;j++){ ntof[j]=0;}
522 Int_t equipmentID[5]; //(ddl, trm, chain,tdc,channel)
523 Int_t volumeID[5]; //(sector,plate,strip,padX,padZ)
524 Int_t volumeID2[5]; //(sector,plate,strip,padZ,padX) to use AliTOFGeometry::GetIndex()
527 TClonesArray * clonesRawData;
528 fTOFRawStream.SetRawReader(rawReader);
529 Int_t BCID=rawReader->GetBCID();
531 //uncomment if needed to apply DeltaBC correction
532 //fTOFRawStream.ApplyBCCorrections(kTRUE);
533 if (fDecoderSummary){
534 fDecoderSummary->Reset();
536 for (Int_t iDDL = 0; iDDL < AliTOFGeometry::NDDL()*AliTOFGeometry::NSectors(); iDDL++){
538 fTOFRawStream.LoadRawDataBuffersV2(iDDL);
540 //* get decoding error counters
541 fDecoderSummary = ( (AliTOFDecoderV2*) fTOFRawStream.GetDecoderV2() )->GetDecoderSummaryData();
542 if ( (fDecoderSummary) && (fDecoderSummary ->GetErrorDetected()) ) {
543 Int_t errorSlotID=(Int_t) fDecoderSummary->GetErrorSlotID();
544 FillRawsData(18,iDDL,errorSlotID);
545 if (fDecoderSummary -> GetRecoverError() )
546 FillRawsData(18,iDDL,13);
549 clonesRawData = (TClonesArray*)fTOFRawStream.GetRawData();
550 for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
551 AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
553 if (tofRawDatum->GetTOF()){
555 equipmentID[1]=tofRawDatum->GetTRM();
556 equipmentID[2]=tofRawDatum->GetTRMchain();
557 equipmentID[3]=tofRawDatum->GetTDC();
558 equipmentID[4]=tofRawDatum->GetTDCchannel();
560 if (CheckEquipID(equipmentID)){
561 fTOFRawStream.EquipmentId2VolumeId(iDDL,
562 tofRawDatum->GetTRM(),
563 tofRawDatum->GetTRMchain(),
564 tofRawDatum->GetTDC(),
565 tofRawDatum->GetTDCchannel(),
568 if (FilterLTMData(equipmentID)) { //counts LTM hits
569 if (equipmentID[2]==1) //crate left, A-side or C-side
570 FillRawsData(15,equipmentID[0]);
572 FillRawsData(15,equipmentID[0]-1);
577 if (CheckVolumeID(volumeID)){
578 volumeID2[0]=volumeID[0];
579 volumeID2[1]=volumeID[1];
580 volumeID2[2]=volumeID[2];
581 volumeID2[3]=volumeID[4];
582 volumeID2[4]=volumeID[3];
583 chIndex=AliTOFGeometry::GetIndex(volumeID2);
585 if (tofRawDatum->GetTOT()){
586 if (!(fCalibData->GetNoiseStatus(chIndex)==AliTOFChannelOnlineStatusArray::kTOFNoiseBad)
587 && (fCalibData->GetHWStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFHWOk)) {//noise and enabled filter
588 ntof[0]++; //counter for tof hits
590 //fill global spectra for DQM plots
591 FillRawsData(5, tofRawDatum->GetTOF()*tdc2ns) ;//in ns
592 FillRawsData(10, tofRawDatum->GetTOT()*tot2ns) ;//in ns
593 FillRawsData(23, BCID, tofRawDatum->GetTOF()*tdc2ns) ;//in ns
595 //fill side-related spectra for experts plots
596 Int_t ddlACside=iDDL/36; // 0 or 1
597 Int_t ddlPerSm=iDDL%4;
599 if (volumeID2[0]>4 && volumeID2[0]<14){ //O side
600 if (ddlPerSm<2){ //A side
602 FillRawsData(6, tofRawDatum->GetTOF()*tdc2ns) ;
603 FillRawsData(11, tofRawDatum->GetTOT()*tot2ns) ;
606 FillRawsData(8, tofRawDatum->GetTOF()*tdc2ns) ;
607 FillRawsData(13, tofRawDatum->GetTOT()*tot2ns) ;
610 if (volumeID2[0]<5 || volumeID2[0]>13){ //I side
611 if (ddlPerSm<2){ //A side
613 FillRawsData(7, tofRawDatum->GetTOF()*tdc2ns) ;
614 FillRawsData(12, tofRawDatum->GetTOT()*tot2ns) ;
617 FillRawsData(9, tofRawDatum->GetTOF()*tdc2ns) ;
618 FillRawsData(14, tofRawDatum->GetTOT()*tot2ns) ;
624 Int_t trm= iDDL*10+(equipmentID[1]-3);
625 FillRawsData(20+ddlACside,trm,tofRawDatum->GetTOF()*tdc2ns);
626 FillRawsData(22,GetStripIndex(volumeID),tofRawDatum->GetTOF()*tdc2ns) ;
627 Short_t fea = volumeID2[4]/12;
628 Float_t hitmapx = volumeID2[0] + ((Double_t)(3 - fea) + 0.5) *0.25;
629 FillRawsData(17,hitmapx,GetStripIndex(volumeID2));
633 if (!(fCalibData->GetNoiseStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFNoiseBad)
634 && (fCalibData->GetHWStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFHWOk))
635 FillRawsData(19, tofRawDatum->GetTOF()*tdc2ns) ;//in ns
637 }//end volumeID check
641 clonesRawData->Clear();
644 for (Int_t j=0;j<5;j++) FillRawsData(j,ntof[j]);
645 // fProcessedRawEventN++; // RS Now the framework conters are use
646 fTOFRawStream.Clear();
648 AliDebug(1,Form("Event of type %d found. Skipping non-physics event for QA.\n", rawReader->GetType()));
651 //fill reference map for DQM shifter only once in a detector cycle
653 Int_t geoId[5]={-1,-1,-1,-1,-1};// pgeoId=(sm, mod, strip, padZ, padX)
654 Int_t detId[5]={-1,-1,-1,-1,-1};//detID=(ddl,trm,tdc, chain,channel)
656 for (Int_t ch = 0; ch < fCalibData->GetSize(); ch++) {
657 AliTOFGeometry::GetVolumeIndices(ch,geoId);
658 AliTOFRawStream::Geant2EquipmentId(geoId,detId);
659 if ((detId[1]<0)||(detId[0]<0)) continue;
660 trmIndex=(detId[1]-3)+detId[0]*10;
663 // if (fCalibData->GetNoiseStatus(ch)==AliTOFChannelOnlineStatusArray::kTOFNoiseBad)
664 // fTRMNoisyArray[trmIndex]+=1;
665 // if (fCalibData->GetHWStatus(ch) == AliTOFChannelOnlineStatusArray::kTOFHWOk)
666 // fTRMHwOkArray[trmIndex]+=1;
668 if ( (!(fCalibData->GetNoiseStatus(ch)==AliTOFChannelOnlineStatusArray::kTOFNoiseBad))
669 && (fCalibData->GetHWStatus(ch) == AliTOFChannelOnlineStatusArray::kTOFHWOk) ){
670 //fTRMEnabledArray[trmIndex]+=1;
671 //fill reference map with info from OCDB
672 Short_t fea = geoId[4]/12;
673 Float_t hitmapx = geoId[0] + ((Double_t)(3 - fea) + 0.5)*0.25;
674 FillRawsData(16,hitmapx, GetStripIndex(geoId));
677 //printf("Counters for noisy, enabled and good channels in TOF TRMs read from OCDB.\n");
681 //enable options for DQM shifter
682 EnableDqmShifterOpt(kTRUE);
684 IncEvCountCycleRaws();
685 IncEvCountTotalRaws();
689 //____________________________________________________________________________
690 void AliTOFQADataMakerRec::MakeRecPoints(TTree * clustersTree)
693 // Make data from Clusters
696 Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;
697 Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
699 Int_t volumeID2[5];//(sm, plate,strip, padZ,padX)
700 //Int_t volumeID[5];//(sm, plate,strip, padX,padZ)
702 TBranch *branch=clustersTree->GetBranch("TOF");
704 AliError("can't get the branch with the TOF clusters !");
708 static TClonesArray dummy("AliTOFcluster",10000);
710 TClonesArray *clusters=&dummy;
711 branch->SetAddress(&clusters);
714 clustersTree->GetEvent(0);
716 FillRecPointsData(0,(Int_t)clusters->GetEntriesFast()) ;
718 TIter next(clusters) ;
720 while ( (c = dynamic_cast<AliTOFcluster *>(next())) ) {
722 // volumeID2[0] = c->GetDetInd(0);
723 // volumeID2[1] = c->GetDetInd(1);
724 // volumeID2[2] = c->GetDetInd(2);
725 // volumeID2[3] = c->GetDetInd(4); //padX
726 // volumeID2[4] = c->GetDetInd(3); //padZ
728 for (Int_t i=0;i<5;i++){
729 volumeID2[i]=c->GetDetInd(i); //X and Z indeces inverted in RecPoints
731 //Int_t chIndex=AliTOFGeometry::GetIndex(volumeID2);
732 Int_t iDDL=AliTOFRawStream::Geant2DDL(volumeID2);
733 Int_t iTRM=AliTOFRawStream::Geant2TRM(volumeID2);
734 Short_t fea = volumeID2[4]/12;
735 Float_t hitmapx = volumeID2[0] + ((Double_t)(3 - fea) + 0.5) *0.25;
736 Int_t ddlACside=iDDL/36; // 0 or 1
737 Int_t ddlPerSm=iDDL%4;
739 if ((c->GetTDCRAW()) && (c->GetTDC()) && (c->GetToT())){
740 if (volumeID2[0]>4 && volumeID2[0]<14){ //I side
741 if (ddlPerSm<2){ //A side
742 FillRecPointsData(1, c->GetTDC()*tdc2ns) ;//in ns
743 FillRecPointsData(5, c->GetTDCRAW()*tdc2ns) ;//in ns
744 FillRecPointsData(9, c->GetToT()*tot2ns) ;//in ns
746 FillRecPointsData(3, c->GetTDC()*tdc2ns) ;//in ns
747 FillRecPointsData(7, c->GetTDCRAW()*tdc2ns) ;//in ns
748 FillRecPointsData(11, c->GetToT()*tot2ns) ;//in ns
751 if (volumeID2[0]<5 || volumeID2[0]>13){ //O side
752 if (ddlPerSm<2){ //A side
753 FillRecPointsData(2, c->GetTDC()*tdc2ns) ;//in ns
754 FillRecPointsData(6, c->GetTDCRAW()*tdc2ns) ;//in ns
755 FillRecPointsData(10, c->GetToT()*tot2ns) ;//in ns
757 FillRecPointsData(4, c->GetTDC()*tdc2ns) ;//in ns
758 FillRecPointsData(8, c->GetTDCRAW()*tdc2ns) ;//in ns
759 FillRecPointsData(12, c->GetToT()*tot2ns) ;//in ns
763 FillRecPointsData(13,hitmapx,GetStripIndex(volumeID2));
764 FillRecPointsData(14,GetStripIndex(volumeID2), c->GetTDC()*tdc2ns) ;
765 Int_t trm= iDDL*10+(iTRM-3);
766 if (ddlACside==0) { //A side
767 FillRecPointsData(15,trm,c->GetTDC()*tdc2ns);
769 FillRecPointsData(16,trm,c->GetTDC()*tdc2ns);
773 EnableDqmShifterOpt(kFALSE);
775 IncEvCountCycleRecPoints();
776 IncEvCountTotalRecPoints();
780 //____________________________________________________________________________
781 void AliTOFQADataMakerRec::MakeESDs(AliESDEvent * esd)
784 // make QA data from ESDs
786 const Double_t speedOfLight = TMath::C()*1E2*1E-12; // cm/ps
787 const Double_t pionMass = 0.13957018; //GeV/c^2
789 Int_t ntrk = esd->GetNumberOfTracks() ;
794 AliESDtrack *track=esd->GetTrack(ntrk);
795 Double_t tofTime=track->GetTOFsignal();//in ps
796 Double_t tofTimeRaw=track->GetTOFsignalRaw();//in ps
797 Double_t tofToT=track->GetTOFsignalToT(); //in ps
799 UInt_t status=track->GetStatus();
800 if (track->IsOn(AliESDtrack::kTPCrefit)) {
802 Double_t y=track->Eta();
803 if (TMath::Abs(y)<0.9) { //select TOF acceptance
804 if ((status&AliESDtrack::kTOFout)!=0) { //define matching
806 FillESDsData(1,tofTime*1E-3);
807 FillESDsData(2,tofTimeRaw*1E-3);
808 FillESDsData(3,tofToT*1E-3);
809 FillESDsData(4,track->Pt());
811 Double_t length =track->GetIntegratedLength();
812 Double_t mom2=(track->Pt()*track->Pt())+(track->Pz()*track->Pz());
813 Double_t piTexp = TMath::Sqrt(1+(pionMass*pionMass/mom2))*length/speedOfLight; //in ps
814 FillESDsData(8,tofTime-piTexp);
815 FillESDsData(9,length);
817 if ((status&AliESDtrack::kTIME)!=0)
818 FillESDsData(5,track->Pt());
821 FillESDsData(6,track->Pt());
822 } //end check on matched tracks
824 }//end check on TPCrefit
827 FillESDsData(0,ntofout) ;
829 Float_t ratio = (Float_t)ntofout/(Float_t)ntpc*100.; //matching probability
830 FillESDsData(7,ratio) ;
834 Float_t ratio = (Float_t)ntofout/(Float_t)ntpc*100; //matched over propagated to TOF outer radius
835 FillESDsData(8,ratio) ;
837 EnableDqmShifterOpt(kFALSE);
839 IncEvCountCycleESDs();
840 IncEvCountTotalESDs();
844 //____________________________________________________________________________
845 void AliTOFQADataMakerRec::StartOfDetectorCycle()
848 //Detector specific actions at start of cycle
849 // ResetAllTRMcounters();
850 fCalibData = GetCalibData();
855 //____________________________________________________________________________
856 void AliTOFQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
858 //Detector specific actions at end of cycle
859 // do the QA checking
860 ResetEventTrigClasses();
862 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
863 if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) continue ;
864 SetEventSpecie(AliRecoParam::ConvertIndex(specie));
866 for (int itc=-1;itc<GetNTrigClasses();itc++) { // RS: loop over eventual clones per trigger class
868 if (fEnableDqmShifterOpt) {
869 // RS: fetch the histograms for given trigger class
870 TObjArray& arrRW = *GetRawsDataOfTrigClass(itc);
872 // Help make the raw qa histogram easier to interpret for the DQM shifter
873 if (!arrRW[ 0] || !arrRW[ 5] || !arrRW[10] || !arrRW[15] || !arrRW[16] || !arrRW[17]) continue;
875 printf("=========>Processed %i physics raw of specie %s with TrigGlass %d\n",
876 GetEvCountCycleRaws(itc),AliRecoParam::GetEventSpecieName(specie), itc);
878 //Double_t monitorPeriodLength=fProcessedRawEventN*600*1E-9;//in s
881 //set minima and maxima to allow log scale
882 Double_t yTimeMax = ((TH1*)arrRW[5])->GetMaximum()*1.05;
883 Double_t yTotMax = ((TH1*)arrRW[10])->GetMaximum()*1.05;
884 fLineExpTimeMin->SetY2(yTimeMax);
885 fLineExpTimeMax->SetY2(yTimeMax);
886 fLineExpTotMin->SetY2(yTotMax);
887 fLineExpTotMax->SetY2(yTotMax);
889 for (Int_t j=0;j<18;j++){
890 if ((j==0)||(j==5)||(j==10)||(j==15)||(j==16)||(j==17)) {
891 TH1* htmp = (TH1*)arrRW[j];
892 htmp->GetXaxis()->SetLabelOffset(0.005);
893 htmp->GetXaxis()->SetLabelSize(0.05);
894 htmp->GetXaxis()->SetTitleOffset(0.8);
895 htmp->GetXaxis()->SetTitleSize(0.05);
896 htmp->GetYaxis()->SetLabelOffset(0.005);
897 htmp->GetYaxis()->SetLabelSize(0.06);
898 htmp->GetYaxis()->SetTitleOffset(0.8);
899 htmp->GetYaxis()->SetTitleSize(0.06);
902 //make up for all histos
903 for(Int_t j=0;j<5;j++) {
904 TH1* htmp = (TH1*)arrRW[j];
906 htmp->SetMarkerColor(kBlue);
907 htmp->SetMarkerStyle(8);
908 htmp->SetMarkerSize(0.7);
910 for(Int_t j=5;j<15;j++) {
911 TH1* htmp = (TH1*)arrRW[j];
913 htmp->SetLineColor(kBlue);
914 htmp->SetLineWidth(1);
915 htmp->SetMarkerColor(kBlue);
918 TH1* htmp = (TH1*)arrRW[15];
919 htmp->SetLineColor(kBlue);
920 htmp->SetLineWidth(1);
921 htmp->SetMarkerStyle(8);
922 htmp->SetMarkerSize(0.7);
923 htmp->SetMarkerColor(kBlue);//Option("bar");
925 if ( (htmp=(TH1*)arrRW[16]) ) htmp->SetOption("colz");
926 if ( (htmp=(TH1*)arrRW[17]) ) htmp->SetOption("colz");
927 if ( (htmp=(TH1*)arrRW[18]) ) htmp->SetOption("colz");
929 }//END ENABLE DQM SHIFTER OPT
930 } // RS: loop over trigger classes
933 AliQAChecker::Instance()->Run(AliQAv1::kTOF, task, list) ;
936 //____________________________________________________________________________
937 void AliTOFQADataMakerRec::GetMapIndeces(const Int_t* const in , Int_t* out)
940 //return appropriate indeces for the theta-phi map
943 Int_t npadX = AliTOFGeometry::NpadX();
944 Int_t npadZ = AliTOFGeometry::NpadZ();
945 Int_t nStripA = AliTOFGeometry::NStripA();
946 Int_t nStripB = AliTOFGeometry::NStripB();
947 Int_t nStripC = AliTOFGeometry::NStripC();
949 Int_t isector = in[0];
950 Int_t iplate = in[1];
951 Int_t istrip = in[2];
955 Int_t stripOffset = 0;
961 stripOffset = nStripC;
964 stripOffset = nStripC+nStripB;
967 stripOffset = nStripC+nStripB+nStripA;
970 stripOffset = nStripC+nStripB+nStripA+nStripB;
973 AliDebug(1,Form("Wrong plate number in TOF (%d) !",iplate));
976 Int_t zindex=npadZ*(istrip+stripOffset)+(ipadZ+1);
977 Int_t phiindex=npadX*isector+ipadX+1;
983 //---------------------------------------------------------------
984 Int_t AliTOFQADataMakerRec::GetStripIndex(const Int_t * const in)
986 /* return tof strip index between 0 and 91 */
988 Int_t nStripA = AliTOFGeometry::NStripA();
989 Int_t nStripB = AliTOFGeometry::NStripB();
990 Int_t nStripC = AliTOFGeometry::NStripC();
992 // Int_t isector = in[0];
993 Int_t iplate = in[1];
994 Int_t istrip = in[2];
995 //Int_t ipadX = in[3];
996 //Int_t ipadZ = in[4];
998 Int_t stripOffset = 0;
1004 stripOffset = nStripC;
1007 stripOffset = nStripC+nStripB;
1010 stripOffset = nStripC+nStripB+nStripA;
1013 stripOffset = nStripC+nStripB+nStripA+nStripB;
1016 AliDebug(1,Form("Wrong plate number in TOF (%d) !",iplate));
1021 if (stripOffset<0 || stripOffset>92) return -1;
1023 return (stripOffset+istrip);
1026 //---------------------------------------------------------------
1027 Bool_t AliTOFQADataMakerRec::CheckVolumeID(const Int_t * const volumeID)
1030 //Checks volume ID validity
1033 for (Int_t j=0;j<5;j++){
1034 if (volumeID[j]<0) {
1035 AliDebug(1,Form("Invalid detector volume index for volumeID[%i]",j));
1043 //---------------------------------------------------------------
1044 Bool_t AliTOFQADataMakerRec::CheckEquipID(const Int_t * const equipmentID)
1047 //Checks equipment ID validity
1049 for (Int_t j=0;j<5;j++){
1050 if (equipmentID[j]<0) {
1051 AliDebug(1,Form("Invalid equipment volume index for equipmentID[%i]",j));
1057 //---------------------------------------------------------------
1058 Bool_t AliTOFQADataMakerRec::FilterLTMData(const Int_t * const equipmentID) const
1060 /*It returns kTRUE if data come from LTM.
1061 It thus filters trigger-related signals */
1063 Int_t ddl, trm, tdc;
1064 //if (!CheckEquipID(equipmentID)) return kFALSE;
1065 ddl = equipmentID[0];
1066 trm = equipmentID[1];
1067 tdc = equipmentID[3];
1069 if ((ddl%2==1) && (trm==3) && (tdc>11 && tdc<15))
1075 //---------------------------------------------------------------
1076 Bool_t AliTOFQADataMakerRec::FilterSpare(const Int_t * const equipmentID) const
1078 /*It returns kTRUE if data come from spare
1080 So far only check on TRM 3 crate left is implemented */
1082 Int_t ddl, trm, tdc;
1083 //if (!CheckEquipID(equipmentID)) return kFALSE;
1084 ddl = equipmentID[0];
1085 trm = equipmentID[1];
1086 tdc = equipmentID[3];
1088 if ((ddl%2==1) && (trm==3) && (tdc>2 && tdc<12))
1094 //----------------------------------------------------------------
1095 /*void AliTOFQADataMakerRec::ResetAllTRMcounters()
1097 //resets all TRM counters to 0
1098 for (Int_t trm=0;trm<720;trm++){
1099 fTRMNoisyArray[trm]=-1;
1100 fTRMHwOkArray[trm]=-1;
1101 fTRMEnabledArray[trm]=-1;