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 17/10/2011
26 - fix for memory leak in constructor
27 - added methods to read histos ranges from config file in DQM
28 - added CTTM maps + relative methods to retrieve CTTM numbering
29 - removed obslete comments
31 Modified by fbellini & rshanoian on 06/07/2011
32 - changes for trigger classes implementation
33 - fRunNumber added as private member
34 - added time vs BCID plot
36 Modified by fbellini on 18/01/2011
37 - reduced histo binning to reduce size
38 - added decoding errors plot
39 - added channel maps and options for DQM shifters
40 - new list of recPoints and ESDs plots
41 - removed hTrmChannels035 and hTrmChannels3671
43 Modified by bvonhall on 03/11/2010
44 - modified declaration of hTrmChannels035 and hTrmChannels3671 in EndOfDetectorCycle()
45 to prevent memory corruption
47 Modified by adecaro on 18/10/2010
48 - fTOFRawStream object set as private member
50 Modified by fbellini on 13/09/2010
51 - Set TLines as private members
52 - Set image flag for expert histos
54 Modified by fbellini on 14/06/2010
56 - use LoadRawDataBuffersV2()
58 Modified by fbellini on 10/05/2010
59 - Fixed EndOfDetectorCycle() memory corruption bug
61 Modified by fbellini on 22/04/2010
62 - Added filter for physics events
64 Modified by fbellini on 16/04/2010
65 - Added EnableDqmShifterOpt()
66 - Modified EndOfDetectorCycle() with options for DQM
69 Modified by fbellini on 30/03/2010
70 - Changed raws time histos range to 610ns
71 - Added FilterLTMData() and FilterSpare() methods
72 - Added check on enabled channels for raw data
73 - Updated RecPoints QA
75 Modified by fbellini on 02/03/2010
76 - Fixed raw data decoding methods (use AliTOFRawStream::LoadRawDataBuffer())
77 - Added filter for noisy channels and read map from OCDB
78 - Added GetCalibData() method
79 - Added CheckVolumeID() and CheckEquipID() methods
85 #include <TClonesArray.h>
89 #include <TPaveText.h>
91 #include "AliCDBManager.h"
92 #include "AliCDBEntry.h"
93 #include "AliESDEvent.h"
94 #include "AliESDtrack.h"
95 #include "AliQAChecker.h"
96 #include "AliRawReader.h"
97 #include "AliTOFRawStream.h"
98 #include "AliTOFcluster.h"
99 #include "AliTOFQADataMakerRec.h"
100 #include "AliTOFrawData.h"
101 #include "AliTOFGeometry.h"
102 #include "AliTOFChannelOnlineStatusArray.h"
103 #include "AliTOFDecoderSummaryData.h"
104 #include "AliTOFDecoderV2.h"
106 ClassImp(AliTOFQADataMakerRec)
108 Int_t AliTOFQADataMakerRec::fgNbinsMultiplicity=200; //number of bins in multiplicity plot
109 Int_t AliTOFQADataMakerRec::fgRangeMinMultiplicity=0;//min range in multiplicity plot
110 Int_t AliTOFQADataMakerRec::fgRangeMaxMultiplicity=200;//max range in multiplicity plot
111 Int_t AliTOFQADataMakerRec::fgNbinsTime=250;//number of bins in time plot
112 const Float_t AliTOFQADataMakerRec::fgkNbinsWidthTime=2.44;//width of bins in time plot
113 Float_t AliTOFQADataMakerRec::fgRangeMinTime=0.0;//range min in time plot
114 Float_t AliTOFQADataMakerRec::fgRangeMaxTime=620.0; //range max in time plot
115 Int_t AliTOFQADataMakerRec::fgCutNmaxFiredMacropad=5;//cut on number of max fired macropad
116 const Int_t AliTOFQADataMakerRec::fgkFiredMacropadLimit=50;//cut on number of max fired macropad
119 //____________________________________________________________________________
120 AliTOFQADataMakerRec::AliTOFQADataMakerRec() :
121 AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kTOF), "TOF Quality Assurance Data Maker"),
123 fEnableNoiseFiltering(kFALSE),
124 fEnableDqmShifterOpt(kFALSE),
126 fLineExpTimeMin(0x0),
127 fLineExpTimeMax(0x0),
130 fTOFRawStream(AliTOFRawStream()),
133 fCalib(AliTOFcalib())
138 // fLineExpTimeMin = new TLine(200., 0., 200., 0.);
139 // fLineExpTimeMax = new TLine(250., 0., 250., 0.);
140 // fLineExpTotMin = new TLine(5., 0., 5., 0.);
141 // fLineExpTotMax = new TLine(20., 0., 20., 0.);
142 for (Int_t sm=0;sm<17;sm++){
143 fLineSMid[sm] = new TLine( sm+1, 0., sm+1, 91.);
146 for (Int_t sm=0;sm<71;sm++){
147 fLineLTMid[sm] = new TLine( sm+1, 0., sm+1, 23.);
150 for (Int_t sm=0;sm<22;sm++){
151 fLineLTMbitId[sm] = new TLine( 0., sm+1, 72. ,sm+1);
156 //____________________________________________________________________________
157 AliTOFQADataMakerRec::AliTOFQADataMakerRec(const AliTOFQADataMakerRec& qadm) :
159 fCalibData(qadm.fCalibData),
160 fEnableNoiseFiltering(qadm.fEnableNoiseFiltering),
161 fEnableDqmShifterOpt(qadm.fEnableDqmShifterOpt),
163 fLineExpTimeMin(qadm.fLineExpTimeMin),
164 fLineExpTimeMax(qadm.fLineExpTimeMax),
165 fLineExpTotMin(qadm.fLineExpTotMin),
166 fLineExpTotMax(qadm.fLineExpTotMax),
167 fTOFRawStream(qadm.fTOFRawStream),
168 fDecoderSummary(qadm.fDecoderSummary),
169 fRunNumber(qadm.fRunNumber),
175 SetName((const char*)qadm.GetName()) ;
176 SetTitle((const char*)qadm.GetTitle());
178 for (Int_t sm=0;sm<17;sm++){
179 fLineSMid[sm]=qadm.fLineSMid[sm];
182 for (Int_t sm=0;sm<71;sm++){
183 fLineLTMid[sm] = qadm.fLineLTMid[sm];
186 for (Int_t sm=0;sm<22;sm++){
187 fLineLTMbitId[sm] = qadm.fLineLTMbitId[sm];
191 //__________________________________________________________________
192 AliTOFQADataMakerRec& AliTOFQADataMakerRec::operator = (const AliTOFQADataMakerRec& qadm )
195 // assignment operator.
197 this->~AliTOFQADataMakerRec();
198 new(this) AliTOFQADataMakerRec(qadm);
202 //----------------------------------------------------------------------------
203 AliTOFQADataMakerRec::~AliTOFQADataMakerRec()
206 fTOFRawStream.Clear();
209 delete fLineExpTimeMin;
211 delete fLineExpTimeMax;
213 delete fLineExpTotMin;
215 delete fLineExpTotMax;
216 for (Int_t sm=0;sm<17;sm++){
218 delete fLineSMid[sm];
220 for (Int_t sm=0;sm<71;sm++){
222 delete fLineLTMid[sm];
224 for (Int_t sm=0;sm<22;sm++){
225 if (fLineLTMbitId[sm])
226 delete fLineLTMbitId[sm];
229 //----------------------------------------------------------------------------
230 AliTOFChannelOnlineStatusArray* AliTOFQADataMakerRec::GetCalibData()
233 // Retrive TOF calib objects from OCDB
235 AliCDBManager *man = AliCDBManager::Instance();
238 if (fRun<=0) fRunNumber=145288; //reference run from LHC11a
239 else fRunNumber=fRun;
241 if (man->GetRun()!=fRunNumber){
242 fRunNumber=man->GetRun();
243 AliWarning(Form("Run number mismatch found: setting it to value from current AliCDBManager instance = %i", fRunNumber));
245 cdbe = man->Get("TOF/Calib/Status",fRunNumber);
249 AliWarning("Load of calibration data from default (alien://) storage failed!");
250 printf("Calibration data will be loaded from local storage - ok if on DQM station!");
251 man->SetDefaultStorage("local:///local/cdb/");
252 cdbe = man->Get("TOF/Calib/Status",fRun);
255 AliWarning("Load of calibration data from local DQM machine storage failed!");
256 AliWarning("Calibration data will be loaded from local ($ALICE_ROOT) storage ");
257 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
258 cdbe = man->Get("TOF/Calib/Status",fRunNumber);
261 // Retrieval of data in directory TOF/Calib/Data:
262 AliTOFChannelOnlineStatusArray * array = 0;
264 printf("======= OCDB object for TOF retrieved from run %i in %s\n",fRunNumber,cdbe->GetName());
265 array = (AliTOFChannelOnlineStatusArray *)cdbe->GetObject();
267 if (!array) AliFatal("No calibration data from calibration database !");
269 fCalib.Init(fRunNumber);
273 //____________________________________________________________________________
274 void AliTOFQADataMakerRec::InitRaws()
277 // create Raws histograms in Raws subdir
279 ReadHistogramRangeFromFile(gSystem->Getenv("TOFDQMHISTO_CONFIGFILE"));
281 const Bool_t expert = kTRUE ;
282 const Bool_t saveCorr = kTRUE ;
283 const Bool_t image = kTRUE ;
285 TH1I * h0 = new TH1I("hTOFRaws","TOF raw hit multiplicity; TOF raw hits number; Events ",fgNbinsMultiplicity, fgRangeMinMultiplicity, fgRangeMaxMultiplicity);
286 TH1I * h1 = new TH1I("hTOFRawsIA","TOF raw hit multiplicity - I/A side; TOF raw hits number;Events ",fgNbinsMultiplicity, fgRangeMinMultiplicity, fgRangeMaxMultiplicity);
287 TH1I * h2 = new TH1I("hTOFRawsOA","TOF raw hit multiplicity - O/A side; TOF raw hits number;Events ",fgNbinsMultiplicity, fgRangeMinMultiplicity, fgRangeMaxMultiplicity);
288 TH1I * h3 = new TH1I("hTOFRawsIC","TOF raw hit multiplicity - I/C side; TOF raw hits number;Events ",fgNbinsMultiplicity, fgRangeMinMultiplicity, fgRangeMaxMultiplicity);
289 TH1I * h4 = new TH1I("hTOFRawsOC","TOF raw hit multiplicity - O/C side; TOF raw hits number;Events ",fgNbinsMultiplicity, fgRangeMinMultiplicity, fgRangeMaxMultiplicity);
291 TH1F * h5 = new TH1F("hTOFRawsTime", "TOF Raws - Hit time (ns);Measured Hit time [ns];Hits", fgNbinsTime,fgRangeMinTime,fgRangeMaxTime);
292 TH1F * h6 = new TH1F("hTOFRawsTimeIA", "TOF Raws - Hit time (ns) - I/A side;Measured Hit time [ns];Hits", fgNbinsTime,fgRangeMinTime,fgRangeMaxTime);
293 TH1F * h7 = new TH1F("hTOFRawsTimeOA", "TOF Raws - Hit time (ns) - O/A side;Measured Hit time [ns];Hits", fgNbinsTime,fgRangeMinTime,fgRangeMaxTime);
294 TH1F * h8 = new TH1F("hTOFRawsTimeIC", "TOF Raws - Hit time (ns) - I/C side;Measured Hit time [ns];Hits", fgNbinsTime,fgRangeMinTime,fgRangeMaxTime);
295 TH1F * h9 = new TH1F("hTOFRawsTimeOC", "TOF Raws - Hit time (ns) - O/C side;Measured Hit time [ns];Hits", fgNbinsTime,fgRangeMinTime,fgRangeMaxTime);
297 TH1F * h10 = new TH1F("hTOFRawsToT", "TOF Raws - Hit ToT (ns);Measured Hit ToT (ns);Hits", 100, 0., 48.8);
299 TH1F * h11 = new TH1F("hTOFRawsToTIA", "TOF Raws - Hit ToT (ns) - I/A side;Measured Hit ToT (ns);Hits", 100, 0., 48.8);
300 TH1F * h12 = new TH1F("hTOFRawsToTOA", "TOF Raws - Hit ToT (ns) - O/A side;Measured Hit ToT (ns);Hits", 100, 0., 48.8);
301 TH1F * h13 = new TH1F("hTOFRawsToTIC", "TOF Raws - Hit ToT (ns) - I/C side;Measured Hit ToT (ns);Hits", 100, 0., 48.8);
302 TH1F * h14 = new TH1F("hTOFRawsToTOC", "TOF Raws - Hit ToT (ns) - O/C side;Measured Hit ToT (ns);Hits", 100, 0., 48.8);
304 TH1F * h15 = new TH1F("hTOFRawsLTMHits", "LTMs OR signals; Crate; Counts", 72, 0., 72.);
305 TH2F * h16 = new TH2F("hTOFrefMap", "TOF enabled channel reference map;sector;strip", 72, 0., 18., 91, 0., 91.);
306 TH2F * h17 = new TH2F("hTOFRawHitMap","TOF raw hit map;sector;strip", 72, 0., 18., 91, 0., 91.);
307 TH2I * h18 = new TH2I("hTOFDecodingErrors","Decoding error monitoring; DDL; Error ", 72, 0, 72, 13,1,14);
309 h18->GetYaxis()->SetBinLabel(1,"DRM ");
310 h18->GetYaxis()->SetBinLabel(2,"LTM ");
311 h18->GetYaxis()->SetBinLabel(3,"TRM 3 ");
312 h18->GetYaxis()->SetBinLabel(4,"TRM 4");
313 h18->GetYaxis()->SetBinLabel(5,"TRM 5");
314 h18->GetYaxis()->SetBinLabel(6,"TRM 6");
315 h18->GetYaxis()->SetBinLabel(7,"TRM 7");
316 h18->GetYaxis()->SetBinLabel(8,"TRM 8");
317 h18->GetYaxis()->SetBinLabel(9,"TRM 9");
318 h18->GetYaxis()->SetBinLabel(10,"TRM 10");
319 h18->GetYaxis()->SetBinLabel(11,"TRM 11");
320 h18->GetYaxis()->SetBinLabel(12,"TRM 12");
321 h18->GetYaxis()->SetBinLabel(13,"recovered");
323 TH1F * h19 = new TH1F("hTOFOrphansTime", "TOF Raws - Orphans time (ns);Measured Hit time [ns];Hits",fgNbinsTime,fgRangeMinTime,fgRangeMaxTime);
324 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.,fgNbinsTime,fgRangeMinTime,fgRangeMaxTime);
325 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.,fgNbinsTime, fgRangeMinTime,fgRangeMaxTime);
326 TH2F * h22 = new TH2F("hTOFTimeVsStrip","TOF raw hit time vs. MRPC (along z axis); MRPC index along z axis; Raws TOF time (ns) ", 91,0.,91,fgNbinsTime,fgRangeMinTime,fgRangeMaxTime);
327 TH2F * h23 = new TH2F("hTOFtimeVsBCID","TOF time vs BCID; BCID; time (ns) ", 3564, 0., 3564.,fgNbinsTime,fgRangeMinTime,fgRangeMaxTime);
328 TH2F * h24 = new TH2F("hTOFchannelEfficiencyMap","TOF channels (HWok && efficient && !noisy && !problematic);sector;strip", 72, 0., 18., 91, 0., 91.);
329 TH2F * h25 = new TH2F("hTOFhitsCTTM","Map of hit pads according to CTTM numbering;LTM index;bit index", 72, 0., 72., 23, 0., 23.);
330 TH2F * h26 = new TH2F("hTOFmacropadCTTM","Map of hit macropads according to CTTM numbering;LTM index; bit index", 72, 0., 72., 23, 0., 23.);
331 TH2F * h27 = new TH2F("hTOFmacropadDeltaPhiTime","#Deltat vs #Delta#Phi of hit macropads;#Delta#Phi (degrees);#DeltaBX", 18, 0., 180., 20, 0., 20.0);
332 TH2I *h28 = new TH2I("hBXVsCttmBit","BX ID in TOF matching window vs trg channel; trg channel; BX", 1728, 0, 1728, 24, 0, 24);
333 TH2F *h29 = new TH2F("hTimeVsCttmBit","TOF raw time vs trg channel; trg channel; raw time (ns)", 1728, 0., 1728., fgNbinsTime, fgRangeMinTime, fgRangeMaxTime);
335 h25->GetYaxis()->SetTickLength(-0.02);
336 h26->GetYaxis()->SetTickLength(-0.02);
337 h25->GetYaxis()->SetNdivisions(210);
338 h26->GetYaxis()->SetNdivisions(210);
339 h25->GetXaxis()->SetTickLength(-0.02);
340 h26->GetXaxis()->SetTickLength(-0.02);
341 h25->GetXaxis()->SetLabelOffset(0.015);
342 h26->GetXaxis()->SetLabelOffset(0.015);
343 h25->GetXaxis()->SetNdivisions(515);
344 h26->GetXaxis()->SetNdivisions(515);
377 //add lines for DQM shifter
378 fLineExpTimeMin = new TLine(200., 0., 200., 0.);
379 fLineExpTimeMax = new TLine(250., 0., 250., 0.);
380 fLineExpTotMin = new TLine(5., 0., 5., 0.);
381 fLineExpTotMax = new TLine(20., 0., 20., 0.);
383 fLineExpTimeMin->SetLineColor(kGreen);
384 fLineExpTimeMin->SetLineWidth(2);
386 fLineExpTimeMax->SetLineColor(kGreen);
387 fLineExpTimeMax->SetLineWidth(2);
389 fLineExpTotMin->SetLineColor(kGreen);
390 fLineExpTotMin->SetLineWidth(2);
392 fLineExpTotMax->SetLineColor(kGreen);
393 fLineExpTotMax->SetLineWidth(2);
395 for (Int_t sm=0;sm<17;sm++){
396 fLineSMid[sm]->SetLineColor(kMagenta);
397 fLineSMid[sm]->SetLineWidth(2);
400 h5->GetListOfFunctions()->Add(fLineExpTimeMin);
401 h5->GetListOfFunctions()->Add(fLineExpTimeMax);
402 h10->GetListOfFunctions()->Add(fLineExpTotMin);
403 h10->GetListOfFunctions()->Add(fLineExpTotMax);
405 for (Int_t sm=0;sm<17;sm++){
406 h16->GetListOfFunctions()->Add(fLineSMid[sm]);
407 h17->GetListOfFunctions()->Add(fLineSMid[sm]);
410 for (Int_t sm=0;sm<71;sm++){
411 fLineLTMid[sm]->SetLineColor(kBlack);
412 fLineLTMid[sm]->SetLineWidth(1);
413 h26->GetListOfFunctions()->Add(fLineLTMid[sm]);
414 h25->GetListOfFunctions()->Add(fLineLTMid[sm]);
416 for (Int_t sm=0;sm<22;sm++){
417 fLineLTMbitId[sm]->SetLineColor(kBlack);
418 fLineLTMbitId[sm]->SetLineWidth(1);
419 h26->GetListOfFunctions()->Add(fLineLTMbitId[sm]);
420 h25->GetListOfFunctions()->Add(fLineLTMbitId[sm]);
423 TPaveText *phosHoleBox=new TPaveText(13,38,16,53,"b");
424 phosHoleBox->SetFillStyle(0);
425 phosHoleBox->SetFillColor(kWhite);
426 phosHoleBox->SetLineColor(kMagenta);
427 phosHoleBox->SetLineWidth(2);
428 phosHoleBox->AddText("PHOS");
429 h16->GetListOfFunctions()->Add(phosHoleBox);
430 h17->GetListOfFunctions()->Add(phosHoleBox);
432 // h0->SetDrawOption("logy");
433 // h5->SetDrawOption("logy");
434 // h10->SetDrawOption("logy");
436 Add2RawsList(h0, 0, !expert, image, !saveCorr) ;
437 Add2RawsList(h1, 1, expert, !image, !saveCorr) ;
438 Add2RawsList(h2, 2, expert, !image, !saveCorr) ;
439 Add2RawsList(h3, 3, expert, !image, !saveCorr) ;
440 Add2RawsList(h4, 4, expert, !image, !saveCorr) ;
441 Add2RawsList(h5, 5, !expert, image, !saveCorr) ;
442 Add2RawsList(h6, 6, expert, !image, !saveCorr) ;
443 Add2RawsList(h7, 7, expert, !image, !saveCorr) ;
444 Add2RawsList(h8, 8, expert, !image, !saveCorr) ;
445 Add2RawsList(h9, 9, expert, !image, !saveCorr) ;
446 Add2RawsList(h10, 10, !expert, image, !saveCorr) ;
447 Add2RawsList(h11, 11, expert, !image, !saveCorr) ;
448 Add2RawsList(h12, 12, expert, !image, !saveCorr) ;
449 Add2RawsList(h13, 13, expert, !image, !saveCorr) ;
450 Add2RawsList(h14, 14, expert, !image, !saveCorr) ;
451 Add2RawsList(h15, 15, expert, !image, !saveCorr) ;
452 Add2RawsList(h16, 16, !expert, image, !saveCorr) ;
453 Add2RawsList(h17, 17, !expert, image, !saveCorr) ;
454 Add2RawsList(h18, 18, expert, !image, !saveCorr) ;
455 Add2RawsList(h19, 19, expert, !image, !saveCorr) ;
456 Add2RawsList(h20, 20, expert, !image, !saveCorr) ;
457 Add2RawsList(h21, 21, expert, !image, !saveCorr) ;
458 Add2RawsList(h22, 22, !expert, image, !saveCorr) ;
459 Add2RawsList(h23, 23, !expert, !image, !saveCorr) ;
460 Add2RawsList(h24, 24, !expert, !image, !saveCorr) ;
461 Add2RawsList(h25, 25, !expert, !image, !saveCorr) ;
462 Add2RawsList(h26, 26, !expert, image, !saveCorr) ;
463 Add2RawsList(h27, 27, !expert, image, !saveCorr) ;
464 Add2RawsList(h28, 28, !expert, !image, !saveCorr) ;
465 Add2RawsList(h29, 29, !expert, !image, !saveCorr) ;
468 ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line
471 //____________________________________________________________________________
472 void AliTOFQADataMakerRec::InitRecPoints()
475 // create RecPoints histograms in RecPoints subdir
478 const Bool_t expert = kTRUE ;
479 const Bool_t image = kTRUE ;
481 TH1I * h0 = new TH1I("hTOFRecPoints", "TOF RecPoints multiplicity ; TOF RecPoints number;Events",200, 0, 200) ;
483 TH1F * h1 = new TH1F("hTOFRecPointsTimeIA", "RecPoints Time Spectrum in TOF (ns)- I/A side; Calibrated TOF time [ns];Events", 250, 0., 610.) ;
484 TH1F * h2 = new TH1F("hTOFRecPointsTimeOA", "RecPoints Time Spectrum in TOF (ns)- O/A side; Calibrated TOF time [ns];Events", 250, 0., 610.) ;
485 TH1F * h3 = new TH1F("hTOFRecPointsTimeIC", "RecPoints Time Spectrum in TOF (ns)- I/C side; Calibrated TOF time [ns];Events", 250, 0., 610.) ;
486 TH1F * h4 = new TH1F("hTOFRecPointsTimeOC", "RecPoints Time Spectrum in TOF (ns)- O/C side; Calibrated TOF time [ns];Events", 250, 0., 610.) ;
488 TH1F * h5 = new TH1F("hTOFRecPointsRawTimeIA", "RecPoints raw Time Spectrum in TOF (ns)-I/A side; Measured TOF time [ns];Hits", 250, 0., 610.) ;
489 TH1F * h6 = new TH1F("hTOFRecPointsRawTimeOA", "RecPoints raw Time Spectrum in TOF (ns)-O/A side; Measured TOF time [ns];Hits", 250, 0., 610.) ;
490 TH1F * h7 = new TH1F("hTOFRecPointsRawTimeIC", "RecPoints raw Time Spectrum in TOF (ns)-I/C side; Measured TOF time [ns];Hits", 250, 0., 610.) ;
491 TH1F * h8 = new TH1F("hTOFRecPointsRawTimeOC", "RecPoints raw Time Spectrum in TOF (ns)-O/C side; Measured TOF time [ns];Hits", 250, 0., 610.) ;
493 TH1F * h9 = new TH1F("hTOFRecPointsToTIA", "RecPoints ToT Spectrum in TOF (ns)-I/A side; Measured TOT [ns];Hits", 100, 0., 48.8 ) ;
494 TH1F * h10 = new TH1F("hTOFRecPointsToTOA", "RecPoints ToT Spectrum in TOF (ns)-O/A side; Measured TOT [ns];Hits", 100, 0., 48.8 ) ;
495 TH1F * h11 = new TH1F("hTOFRecPointsToTIC", "RecPoints ToT Spectrum in TOF (ns)-I/C side; Measured TOT [ns];Hits", 100, 0., 48.8 ) ;
496 TH1F * h12 = new TH1F("hTOFRecPointsToTOC", "RecPoints ToT Spectrum in TOF (ns)-O/C side; Measured TOT [ns];Hits", 100, 0., 48.8 ) ;
498 TH2F * h13 = new TH2F("hTOFRecPointsClusMap","RecPoints map; sector ;strip", 72, 0., 18., 91, 0., 91.) ;
499 TH2F * h14 = new TH2F("hTOFRecPointsTimeVsStrip","RecPoints TOF time vs. strip (theta); Strip index; RecPoints TOF time (ns) ",91, 0., 91., 250, 0., 610.) ;
500 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) ;
501 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) ;
521 Add2RecPointsList(h0, 0, !expert, image) ;
522 Add2RecPointsList(h1, 1, !expert, image) ;
523 Add2RecPointsList(h2, 2, !expert, image) ;
524 Add2RecPointsList(h3, 3, !expert, image) ;
525 Add2RecPointsList(h4, 4, !expert, image) ;
526 Add2RecPointsList(h5, 5, expert, !image) ;
527 Add2RecPointsList(h6, 6, expert, !image) ;
528 Add2RecPointsList(h7, 7, expert, !image) ;
529 Add2RecPointsList(h8, 8, expert, !image) ;
530 Add2RecPointsList(h9, 9, !expert, !image) ;
531 Add2RecPointsList(h10, 10, !expert, !image) ;
532 Add2RecPointsList(h11, 11, !expert, !image) ;
533 Add2RecPointsList(h12, 12, !expert, !image) ;
534 Add2RecPointsList(h13, 13, expert, !image) ;
535 Add2RecPointsList(h14, 14, expert, image) ;
536 Add2RecPointsList(h15, 15, expert, !image) ;
537 Add2RecPointsList(h16, 16, expert, !image) ;
539 ClonePerTrigClass(AliQAv1::kRECPOINTS); // this should be the last line
542 //____________________________________________________________________________
543 void AliTOFQADataMakerRec::InitESDs()
546 //create ESDs histograms in ESDs subdir
549 const Bool_t expert = kTRUE ;
550 const Bool_t image = kTRUE ;
552 TH1I * h0 = new TH1I("hTOFESDs", "Number of matched TOF tracks per event;Number of TOF matched ESD tracks;Counts", 200, 0, 200) ;
553 TH1F * h1 = new TH1F("hTOFESDsTime", "Matched ESDs tracks: TOF Time spectrum; Calibrated TOF time [ns];Counts", 250, 0., 610. ) ;
554 TH1F * h2 = new TH1F("hTOFESDsRawTime", "Matched ESDs tracks: TOF raw Time spectrum;Measured TOF time [ns];Counts", 250, 0., 610.) ;
555 TH1F * h3 = new TH1F("hTOFESDsToT", "Matched ESDs tracks: TOF ToT spectrum; ESDs ToT [ns];Counts",100, 0., 48.8) ;
556 TH1F * h4 = new TH1F("hTOFESDskTOFOUT", "p_{T} distribution of tracks with kTOFout; p_{T} (GeV/c);Counts", 50, 0.20, 5.00) ;
557 TH1F * h5 = new TH1F("hTOFESDskTIME", "p_{T} distribution of tracks with kTOFout && kTIME; p_{T} (GeV/c);Counts", 50, 0.20, 5.00) ;
558 TH1F * h6 = new TH1F("hTOFESDsMatched", "p_{T} distribution of tracks with kTOFout && TOFtime>0; p_{T} (GeV/c);Counts", 50, 0.20, 5.00) ;
559 TH1F * h7 = new TH1F("hTOFESDsMatchingProb", "TPC-TOF track-matching probability;TOF matching probability (%) ;Counts",101, -1.0, 100) ;
560 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.) ;
561 TH1F * h9 = new TH1F("hTOFHitsLength", "Matched ESDs tracks: Length Spectrum; Track length [cm];Counts", 800, 0., 800) ;
574 Add2ESDsList(h0, 0, !expert, image) ;
575 Add2ESDsList(h1, 1, !expert, image) ;
576 Add2ESDsList(h2, 2, expert, !image) ;
577 Add2ESDsList(h3, 3, !expert, !image) ;
578 Add2ESDsList(h4, 4, expert, image) ;
579 Add2ESDsList(h5, 5, expert, image) ;
580 Add2ESDsList(h6, 6, expert, image) ;
581 Add2ESDsList(h7, 7, expert, image) ;
582 Add2ESDsList(h8, 8, expert, !image) ;
583 Add2ESDsList(h9, 9, !expert, !image) ;
585 ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line
589 //____________________________________________________________________________
590 void AliTOFQADataMakerRec::MakeRaws(AliRawReader* rawReader)
593 // makes data from Raws
595 if (rawReader->GetType()==7) {
597 Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;//in ns
598 Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
599 Int_t ntof[5]; /* 0=tot, 1=IA, 2=OA, 3=IC, 4=OC*/
600 for (Int_t j=0;j<5;j++){ ntof[j]=0;}
601 Int_t equipmentID[5]; //(ddl, trm, chain,tdc,channel)
602 Int_t volumeID[5]; //(sector,plate,strip,padX,padZ)
603 Int_t volumeID2[5]; //(sector,plate,strip,padZ,padX) to use AliTOFGeometry::GetIndex()
605 Int_t indexCTTM[2]={-1,-1};
606 Int_t indexGeo2CTTM[2]={-1,-1};
607 Float_t macropadPhiTimeUPC[fgkFiredMacropadLimit][2];
608 for (Int_t ii=0;ii<2;ii++){
609 for (Int_t jj=0;jj<fgkFiredMacropadLimit;jj++){
610 macropadPhiTimeUPC[jj][ii]=-999.0;
614 TClonesArray * clonesRawData;
615 fTOFRawStream.SetRawReader(rawReader);
616 Int_t BCID=rawReader->GetBCID();
618 Int_t nFiredMacropad=0,
620 nFiredMacropad=GetNumberOfFiredMacropad(rawReader);
622 //uncomment if needed to apply DeltaBC correction
623 //fTOFRawStream.ApplyBCCorrections(kTRUE);
625 if (fDecoderSummary){
626 fDecoderSummary->Reset();
628 for (Int_t iDDL = 0; iDDL < AliTOFGeometry::NDDL()*AliTOFGeometry::NSectors(); iDDL++){
630 fTOFRawStream.LoadRawDataBuffersV2(iDDL);
632 //* get decoding error counters
633 fDecoderSummary = ( (AliTOFDecoderV2*) fTOFRawStream.GetDecoderV2() )->GetDecoderSummaryData();
634 if ( (fDecoderSummary) && (fDecoderSummary ->GetErrorDetected()) ) {
635 Int_t errorSlotID=(Int_t) fDecoderSummary->GetErrorSlotID();
636 FillRawsData(18,iDDL,errorSlotID);
637 if (fDecoderSummary -> GetRecoverError() )
638 FillRawsData(18,iDDL,13);
641 clonesRawData = (TClonesArray*)fTOFRawStream.GetRawData();
642 for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
643 AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
644 Float_t tofRawTime=tofRawDatum->GetTOF()*tdc2ns;
646 if (tofRawDatum->GetTOF()){
648 equipmentID[1]=tofRawDatum->GetTRM();
649 equipmentID[2]=tofRawDatum->GetTRMchain();
650 equipmentID[3]=tofRawDatum->GetTDC();
651 equipmentID[4]=tofRawDatum->GetTDCchannel();
653 if (CheckEquipID(equipmentID)){
654 fTOFRawStream.EquipmentId2VolumeId(iDDL,
655 tofRawDatum->GetTRM(),
656 tofRawDatum->GetTRMchain(),
657 tofRawDatum->GetTDC(),
658 tofRawDatum->GetTDCchannel(),
661 if (FilterLTMData(equipmentID)) { //counts LTM hits
662 if (equipmentID[2]==1) //crate left, A-side or C-side
663 FillRawsData(15,equipmentID[0]);
665 FillRawsData(15,equipmentID[0]-1);
667 //retrieve CTTM index (Ltm, bit)
668 GetCTTMIndex(equipmentID, indexCTTM);
670 //get BX index within TOF-matching window
672 indexBC= TMath::Nint(tofRawTime/24.4);
674 Int_t indexCttmChannel=indexCTTM[0]*24+indexCTTM[1];
675 FillRawsData(28,indexCttmChannel,indexBC);
676 FillRawsData(29,indexCttmChannel,tofRawTime);
678 //fired macropad map (from LTM hits) - only for low multi evts (UPC)
679 if ((nFiredMacropad<=fgCutNmaxFiredMacropad)){
681 AliInfo(Form("Event found with %i fired macropads in BCID = %i!",nFiredMacropad,BCID));
682 FillRawsData(26,indexCTTM[0],indexCTTM[1]);
683 Float_t halfSMphi=-999.0;
685 halfSMphi=indexCTTM[0]*10.+5.;
686 else halfSMphi=(indexCTTM[0]-36)*10.+5.;
687 macropadPhiTimeUPC[iFiredMacropad][0]=halfSMphi;
688 macropadPhiTimeUPC[iFiredMacropad][1]=indexBC;
693 if (CheckVolumeID(volumeID)){
694 volumeID2[0]=volumeID[0];
695 volumeID2[1]=volumeID[1];
696 volumeID2[2]=volumeID[2];
697 volumeID2[3]=volumeID[4];
698 volumeID2[4]=volumeID[3];
699 chIndex=AliTOFGeometry::GetIndex(volumeID2);
701 //fill hit map according to CTTM numbering
702 GetGeo2CTTMIndex(volumeID2, indexGeo2CTTM);
703 if ((nFiredMacropad<=fgCutNmaxFiredMacropad)){
704 FillRawsData(25,indexGeo2CTTM[0],indexGeo2CTTM[1]);
707 if (tofRawDatum->GetTOT()){
708 if (!(fCalibData->GetNoiseStatus(chIndex)==AliTOFChannelOnlineStatusArray::kTOFNoiseBad)
709 && (fCalibData->GetHWStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFHWOk)) {//noise and enabled filter
710 ntof[0]++; //counter for tof hits
712 //fill global spectra for DQM plots
713 FillRawsData(5, tofRawTime) ;//in ns
714 FillRawsData(10, tofRawDatum->GetTOT()*tot2ns) ;//in ns
715 FillRawsData(23, BCID, tofRawTime) ;//in ns
717 //fill side-related spectra for experts plots
718 Int_t ddlACside=iDDL/36; // 0 or 1
719 Int_t ddlPerSm=iDDL%4;
721 if (volumeID2[0]>4 && volumeID2[0]<14){ //O side
722 if (ddlPerSm<2){ //A side
724 FillRawsData(6, tofRawTime) ;
725 FillRawsData(11, tofRawDatum->GetTOT()*tot2ns) ;
728 FillRawsData(8, tofRawTime) ;
729 FillRawsData(13, tofRawDatum->GetTOT()*tot2ns) ;
732 if (volumeID2[0]<5 || volumeID2[0]>13){ //I side
733 if (ddlPerSm<2){ //A side
735 FillRawsData(7, tofRawTime) ;
736 FillRawsData(12, tofRawDatum->GetTOT()*tot2ns) ;
739 FillRawsData(9, tofRawTime) ;
740 FillRawsData(14, tofRawDatum->GetTOT()*tot2ns) ;
746 Int_t trm= iDDL*10+(equipmentID[1]-3);
747 FillRawsData(20+ddlACside,trm,tofRawTime);
748 FillRawsData(22,GetStripIndex(volumeID),tofRawTime) ;
749 Short_t fea = volumeID2[4]/12;
750 Float_t hitmapx = volumeID2[0] + ((Double_t)(3 - fea) + 0.5) *0.25;
751 FillRawsData(17,hitmapx,GetStripIndex(volumeID2));
752 if (fCalib.IsChannelEnabled(chIndex,kTRUE,kTRUE))//checks also if efficient and if problematic
753 FillRawsData(24,hitmapx,GetStripIndex(volumeID2));
757 if (!(fCalibData->GetNoiseStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFNoiseBad)
758 && (fCalibData->GetHWStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFHWOk))
759 FillRawsData(19, tofRawTime) ;//in ns
761 }//end volumeID check
765 clonesRawData->Clear();
768 for (Int_t j=0;j<5;j++) FillRawsData(j,ntof[j]);
769 fTOFRawStream.Clear();
771 if ((nFiredMacropad<=fgCutNmaxFiredMacropad)){
772 Float_t deltaPhiMacropad=-999.;
773 Float_t deltaTimeMacropad=-999.;
774 for (Int_t j=0;j<fgCutNmaxFiredMacropad+1; j++){
775 for (Int_t k=j+1;k<fgCutNmaxFiredMacropad+1; k++){
776 if ((macropadPhiTimeUPC[j][0]>0.0)&&(macropadPhiTimeUPC[k][0]>0.0)){
777 deltaPhiMacropad=TMath::Abs(macropadPhiTimeUPC[j][0]-macropadPhiTimeUPC[k][0]);
778 deltaTimeMacropad=TMath::Abs(macropadPhiTimeUPC[j][1]-macropadPhiTimeUPC[k][1]);
779 if (deltaPhiMacropad<=180.)
780 FillRawsData(27, deltaPhiMacropad,deltaTimeMacropad);
782 FillRawsData(27, TMath::Abs(360.0-deltaPhiMacropad),deltaTimeMacropad);
786 }//end cut on number of fired macropad
788 AliDebug(1,Form("Event of type %d found. Skipping non-physics event for QA.\n", rawReader->GetType()));
791 //fill reference map for DQM shifter only once in a detector cycle
793 Int_t geoId[5]={-1,-1,-1,-1,-1};// pgeoId=(sm, mod, strip, padZ, padX)
794 Int_t detId[5]={-1,-1,-1,-1,-1};//detID=(ddl,trm,tdc, chain,channel)
796 for (Int_t ch = 0; ch < fCalibData->GetSize(); ch++) {
797 AliTOFGeometry::GetVolumeIndices(ch,geoId);
798 AliTOFRawStream::Geant2EquipmentId(geoId,detId);
799 if ((detId[1]<0)||(detId[0]<0)) continue;
800 trmIndex=(detId[1]-3)+detId[0]*10;
802 if ( (!(fCalibData->GetNoiseStatus(ch)==AliTOFChannelOnlineStatusArray::kTOFNoiseBad))
803 && (fCalibData->GetHWStatus(ch) == AliTOFChannelOnlineStatusArray::kTOFHWOk) ){
804 //fill reference map with info from OCDB
805 Short_t fea = geoId[4]/12;
806 Float_t hitmapx = geoId[0] + ((Double_t)(3 - fea) + 0.5)*0.25;
807 FillRawsData(16,hitmapx, GetStripIndex(geoId));
813 //enable options for DQM shifter
814 EnableDqmShifterOpt(kTRUE);
816 IncEvCountCycleRaws();
817 IncEvCountTotalRaws();
821 //____________________________________________________________________________
822 void AliTOFQADataMakerRec::MakeRecPoints(TTree * clustersTree)
825 // Make data from Clusters
828 Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;
829 Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
831 Int_t volumeID2[5];//(sm, plate,strip, padZ,padX)
832 //Int_t volumeID[5];//(sm, plate,strip, padX,padZ)
834 TBranch *branch=clustersTree->GetBranch("TOF");
836 AliError("can't get the branch with the TOF clusters !");
840 static TClonesArray dummy("AliTOFcluster",10000);
842 TClonesArray *clusters=&dummy;
843 branch->SetAddress(&clusters);
846 clustersTree->GetEvent(0);
848 FillRecPointsData(0,(Int_t)clusters->GetEntriesFast()) ;
850 TIter next(clusters) ;
852 while ( (c = dynamic_cast<AliTOFcluster *>(next())) ) {
854 // volumeID2[0] = c->GetDetInd(0);
855 // volumeID2[1] = c->GetDetInd(1);
856 // volumeID2[2] = c->GetDetInd(2);
857 // volumeID2[3] = c->GetDetInd(4); //padX
858 // volumeID2[4] = c->GetDetInd(3); //padZ
860 for (Int_t i=0;i<5;i++){
861 volumeID2[i]=c->GetDetInd(i); //X and Z indeces inverted in RecPoints
863 //Int_t chIndex=AliTOFGeometry::GetIndex(volumeID2);
864 Int_t iDDL=AliTOFRawStream::Geant2DDL(volumeID2);
865 Int_t iTRM=AliTOFRawStream::Geant2TRM(volumeID2);
866 Short_t fea = volumeID2[4]/12;
867 Float_t hitmapx = volumeID2[0] + ((Double_t)(3 - fea) + 0.5) *0.25;
868 Int_t ddlACside=iDDL/36; // 0 or 1
869 Int_t ddlPerSm=iDDL%4;
871 if ((c->GetTDCRAW()) && (c->GetTDC()) && (c->GetToT())){
872 if (volumeID2[0]>4 && volumeID2[0]<14){ //I side
873 if (ddlPerSm<2){ //A side
874 FillRecPointsData(1, c->GetTDC()*tdc2ns) ;//in ns
875 FillRecPointsData(5, c->GetTDCRAW()*tdc2ns) ;//in ns
876 FillRecPointsData(9, c->GetToT()*tot2ns) ;//in ns
878 FillRecPointsData(3, c->GetTDC()*tdc2ns) ;//in ns
879 FillRecPointsData(7, c->GetTDCRAW()*tdc2ns) ;//in ns
880 FillRecPointsData(11, c->GetToT()*tot2ns) ;//in ns
883 if (volumeID2[0]<5 || volumeID2[0]>13){ //O side
884 if (ddlPerSm<2){ //A side
885 FillRecPointsData(2, c->GetTDC()*tdc2ns) ;//in ns
886 FillRecPointsData(6, c->GetTDCRAW()*tdc2ns) ;//in ns
887 FillRecPointsData(10, c->GetToT()*tot2ns) ;//in ns
889 FillRecPointsData(4, c->GetTDC()*tdc2ns) ;//in ns
890 FillRecPointsData(8, c->GetTDCRAW()*tdc2ns) ;//in ns
891 FillRecPointsData(12, c->GetToT()*tot2ns) ;//in ns
895 FillRecPointsData(13,hitmapx,GetStripIndex(volumeID2));
896 FillRecPointsData(14,GetStripIndex(volumeID2), c->GetTDC()*tdc2ns) ;
897 Int_t trm= iDDL*10+(iTRM-3);
898 if (ddlACside==0) { //A side
899 FillRecPointsData(15,trm,c->GetTDC()*tdc2ns);
901 FillRecPointsData(16,trm,c->GetTDC()*tdc2ns);
905 EnableDqmShifterOpt(kFALSE);
907 IncEvCountCycleRecPoints();
908 IncEvCountTotalRecPoints();
912 //____________________________________________________________________________
913 void AliTOFQADataMakerRec::MakeESDs(AliESDEvent * esd)
916 // make QA data from ESDs
918 const Double_t speedOfLight = TMath::C()*1E2*1E-12; // cm/ps
919 const Double_t pionMass = 0.13957018; //GeV/c^2
921 Int_t ntrk = esd->GetNumberOfTracks() ;
926 AliESDtrack *track=esd->GetTrack(ntrk);
927 Double_t tofTime=track->GetTOFsignal();//in ps
928 Double_t tofTimeRaw=track->GetTOFsignalRaw();//in ps
929 Double_t tofToT=track->GetTOFsignalToT(); //in ps
931 UInt_t status=track->GetStatus();
932 if (track->IsOn(AliESDtrack::kTPCrefit)) {
934 Double_t y=track->Eta();
935 if (TMath::Abs(y)<0.9) { //select TOF acceptance
936 if ((status&AliESDtrack::kTOFout)!=0) { //define matching
938 FillESDsData(1,tofTime*1E-3);
939 FillESDsData(2,tofTimeRaw*1E-3);
940 FillESDsData(3,tofToT*1E-3);
941 FillESDsData(4,track->Pt());
943 Double_t length =track->GetIntegratedLength();
944 Double_t mom2=(track->Pt()*track->Pt())+(track->Pz()*track->Pz());
945 Double_t piTexp = TMath::Sqrt(1+(pionMass*pionMass/mom2))*length/speedOfLight; //in ps
946 FillESDsData(8,tofTime-piTexp);
947 FillESDsData(9,length);
949 if ((status&AliESDtrack::kTIME)!=0)
950 FillESDsData(5,track->Pt());
953 FillESDsData(6,track->Pt());
954 } //end check on matched tracks
956 }//end check on TPCrefit
959 FillESDsData(0,ntofout) ;
961 Float_t ratio = (Float_t)ntofout/(Float_t)ntpc*100.; //matching probability
962 FillESDsData(7,ratio) ;
966 Float_t ratio = (Float_t)ntofout/(Float_t)ntpc*100; //matched over propagated to TOF outer radius
967 FillESDsData(8,ratio) ;
969 EnableDqmShifterOpt(kFALSE);
971 IncEvCountCycleESDs();
972 IncEvCountTotalESDs();
976 //____________________________________________________________________________
977 void AliTOFQADataMakerRec::StartOfDetectorCycle()
980 //Detector specific actions at start of cycle
981 fCalibData = GetCalibData();
986 //____________________________________________________________________________
987 void AliTOFQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
989 //Detector specific actions at end of cycle
990 // do the QA checking
991 ResetEventTrigClasses();
993 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
994 if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) continue ;
995 SetEventSpecie(AliRecoParam::ConvertIndex(specie));
997 for (int itc=-1;itc<GetNTrigClasses();itc++) { // RS: loop over eventual clones per trigger class
999 if (fEnableDqmShifterOpt) {
1000 // RS: fetch the histograms for given trigger class
1001 TObjArray& arrRW = *GetRawsDataOfTrigClass(itc);
1003 // Help make the raw qa histogram easier to interpret for the DQM shifter
1004 if (!arrRW[ 0] || !arrRW[ 5] || !arrRW[10] || !arrRW[15] || !arrRW[16] || !arrRW[17]) continue;
1006 printf("=========>Processed %i physics raw of specie %s with TrigGlass %d\n",
1007 GetEvCountCycleRaws(itc),AliRecoParam::GetEventSpecieName(specie), itc);
1009 //Double_t monitorPeriodLength=fProcessedRawEventN*600*1E-9;//in s
1012 //set minima and maxima to allow log scale
1013 Double_t yTimeMax = ((TH1*)arrRW[5])->GetMaximum()*1.05;
1014 Double_t yTotMax = ((TH1*)arrRW[10])->GetMaximum()*1.05;
1015 fLineExpTimeMin->SetY2(yTimeMax);
1016 fLineExpTimeMax->SetY2(yTimeMax);
1017 fLineExpTotMin->SetY2(yTotMax);
1018 fLineExpTotMax->SetY2(yTotMax);
1020 for (Int_t j=0;j<18;j++){
1021 if ((j==0)||(j==5)||(j==10)||(j==15)||(j==16)||(j==17)) {
1022 TH1* htmp = (TH1*)arrRW[j];
1023 htmp->GetXaxis()->SetLabelOffset(0.005);
1024 htmp->GetXaxis()->SetLabelSize(0.05);
1025 htmp->GetXaxis()->SetTitleOffset(0.8);
1026 htmp->GetXaxis()->SetTitleSize(0.05);
1027 htmp->GetYaxis()->SetLabelOffset(0.005);
1028 htmp->GetYaxis()->SetLabelSize(0.06);
1029 htmp->GetYaxis()->SetTitleOffset(0.8);
1030 htmp->GetYaxis()->SetTitleSize(0.06);
1033 //make up for all histos
1034 for(Int_t j=0;j<5;j++) {
1035 TH1* htmp = (TH1*)arrRW[j];
1036 if (!htmp) continue;
1037 htmp->SetMarkerColor(kBlue);
1038 htmp->SetMarkerStyle(8);
1039 htmp->SetMarkerSize(0.7);
1041 for(Int_t j=5;j<15;j++) {
1042 TH1* htmp = (TH1*)arrRW[j];
1043 if (!htmp) continue;
1044 htmp->SetLineColor(kBlue);
1045 htmp->SetLineWidth(1);
1046 htmp->SetMarkerColor(kBlue);
1049 TH1* htmp = (TH1*)arrRW[15];
1050 htmp->SetLineColor(kBlue);
1051 htmp->SetLineWidth(1);
1052 htmp->SetMarkerStyle(8);
1053 htmp->SetMarkerSize(0.7);
1054 htmp->SetMarkerColor(kBlue);//Option("bar");
1056 TString title25 = Form("Map of hit pads according to CTTM numbering (Max Fired Macropad = %i)",fgCutNmaxFiredMacropad);
1057 TString title26 = Form("Map of hit macropads according to CTTM numbering (Max Fired Macropad = %i)",fgCutNmaxFiredMacropad);
1058 TString title27 = Form("#Deltat vs #Delta#Phi of hit macropads (Max Fired Macropad = %i)",fgCutNmaxFiredMacropad);
1060 if ( (htmp=(TH1*)arrRW[16]) ) htmp->SetOption("colz");
1061 if ( (htmp=(TH1*)arrRW[17]) ) htmp->SetOption("colz");
1062 if ( (htmp=(TH1*)arrRW[18]) ) htmp->SetOption("colz");
1063 if ( (htmp=(TH1*)arrRW[22]) ) htmp->SetOption("colz");
1064 if ( (htmp=(TH1*)arrRW[23]) ) htmp->SetOption("colz");
1065 if ( (htmp=(TH1*)arrRW[24]) ) htmp->SetOption("colz");
1066 if ( (htmp=(TH1*)arrRW[28]) ) htmp->SetOption("colz");
1067 if ( (htmp=(TH1*)arrRW[29]) ) htmp->SetOption("colz");
1069 if ( (htmp=(TH1*)arrRW[25]) ) {
1070 htmp->SetOption("colz");
1071 htmp->SetTitle(title25.Data());
1073 if ( (htmp=(TH1*)arrRW[26]) ) {
1074 htmp->SetOption("colz");
1075 htmp->SetTitle(title26.Data());
1077 if ( (htmp=(TH1*)arrRW[27]) ){
1078 htmp->SetOption("colz");
1079 htmp->SetTitle(title27.Data());
1082 }//END ENABLE DQM SHIFTER OPT
1083 } // RS: loop over trigger classes
1086 AliQAChecker::Instance()->Run(AliQAv1::kTOF, task, list) ;
1089 //____________________________________________________________________________
1090 void AliTOFQADataMakerRec::GetMapIndeces(const Int_t* const in , Int_t* out)
1093 //return appropriate indeces for the theta-phi map
1096 Int_t npadX = AliTOFGeometry::NpadX();
1097 Int_t npadZ = AliTOFGeometry::NpadZ();
1098 Int_t nStripA = AliTOFGeometry::NStripA();
1099 Int_t nStripB = AliTOFGeometry::NStripB();
1100 Int_t nStripC = AliTOFGeometry::NStripC();
1102 Int_t isector = in[0];
1103 Int_t iplate = in[1];
1104 Int_t istrip = in[2];
1105 Int_t ipadX = in[3];
1106 Int_t ipadZ = in[4];
1108 Int_t stripOffset = 0;
1114 stripOffset = nStripC;
1117 stripOffset = nStripC+nStripB;
1120 stripOffset = nStripC+nStripB+nStripA;
1123 stripOffset = nStripC+nStripB+nStripA+nStripB;
1126 AliDebug(1,Form("Wrong plate number in TOF (%d) !",iplate));
1129 Int_t zindex=npadZ*(istrip+stripOffset)+(ipadZ+1);
1130 Int_t phiindex=npadX*isector+ipadX+1;
1136 //---------------------------------------------------------------
1137 Int_t AliTOFQADataMakerRec::GetStripIndex(const Int_t * const in)
1139 /* return tof strip index between 0 and 91 */
1141 Int_t nStripA = AliTOFGeometry::NStripA();
1142 Int_t nStripB = AliTOFGeometry::NStripB();
1143 Int_t nStripC = AliTOFGeometry::NStripC();
1145 // Int_t isector = in[0];
1146 Int_t iplate = in[1];
1147 Int_t istrip = in[2];
1148 //Int_t ipadX = in[3];
1149 //Int_t ipadZ = in[4];
1151 Int_t stripOffset = 0;
1157 stripOffset = nStripC;
1160 stripOffset = nStripC+nStripB;
1163 stripOffset = nStripC+nStripB+nStripA;
1166 stripOffset = nStripC+nStripB+nStripA+nStripB;
1169 AliDebug(1,Form("Wrong plate number in TOF (%d) !",iplate));
1174 if (stripOffset<0 || stripOffset>92) return -1;
1176 return (stripOffset+istrip);
1179 //---------------------------------------------------------------
1180 Bool_t AliTOFQADataMakerRec::CheckVolumeID(const Int_t * const volumeID)
1183 //Checks volume ID validity
1185 for (Int_t j=0;j<5;j++){
1186 if (volumeID[j]<0) {
1187 AliDebug(1,Form("Invalid detector volume index for volumeID[%i]",j));
1194 //---------------------------------------------------------------
1195 Bool_t AliTOFQADataMakerRec::CheckEquipID(const Int_t * const equipmentID)
1198 //Checks equipment ID validity
1199 for (Int_t j=0;j<5;j++){
1200 if (equipmentID[j]<0) {
1201 AliDebug(1,Form("Invalid equipment volume index for equipmentID[%i]",j));
1207 //---------------------------------------------------------------
1208 Bool_t AliTOFQADataMakerRec::FilterLTMData(const Int_t * const equipmentID) const
1210 /*It returns kTRUE if data come from LTM.
1211 It thus filters trigger-related signals */
1213 Int_t ddl, trm, tdc;
1214 //if (!CheckEquipID(equipmentID)) return kFALSE;
1215 ddl = equipmentID[0];
1216 trm = equipmentID[1];
1217 tdc = equipmentID[3];
1219 if ((ddl%2==1) && (trm==3) && (tdc>11 && tdc<15))
1225 //---------------------------------------------------------------
1226 Bool_t AliTOFQADataMakerRec::FilterSpare(const Int_t * const equipmentID) const
1228 /*It returns kTRUE if data come from spare
1230 So far only check on TRM 3 crate left is implemented */
1232 Int_t ddl, trm, tdc;
1233 //if (!CheckEquipID(equipmentID)) return kFALSE;
1234 ddl = equipmentID[0];
1235 trm = equipmentID[1];
1236 tdc = equipmentID[3];
1238 if ((ddl%2==1) && (trm==3) && (tdc>2 && tdc<12))
1244 //-----------------------------------------------------------------------------
1245 void AliTOFQADataMakerRec::GetGeo2LTMIndex(const Int_t * const detind, Int_t *indexLTM) {
1247 // getting LTMmatrix indexes for current digit
1249 Int_t stripId=GetStripIndex(detind);
1251 if (detind[1]==0 || detind[1]==1 || (detind[1]==2 && detind[2]<=7)) { //A side
1252 if (detind[4]<24){ //R
1253 indexLTM[0] = detind[0]*2;
1255 indexLTM[0] = detind[0]*2+1;
1257 indexLTM[1]=stripId;
1261 indexLTM[0] = detind[0]*2+36;
1263 indexLTM[0] = (detind[0]*2+1)+36;
1265 indexLTM[1]=90-stripId;
1268 // if (indexLTM[0]<36) { //A side
1269 // if (detind[1] ==0){
1270 // indexLTM[1] = detind[2];
1272 // else if (detind[1] ==1){
1273 // indexLTM[1] = detind[2]+nStripB;
1275 // else if (detind[1] ==2){
1276 // indexLTM[1] = detind[2]+19*2;
1279 // AliError("Smth Wrong!!!");
1283 // if (detind[1]==2){
1284 // if (detind[4]<24)
1285 // indexLTM[1] = (nStripAL-detind[2])+nStripC+nStripB;
1287 // indexLTM[1] = (nStripAR-detind[2])+nStripC+nStripB;
1289 // else if (detind[1] ==3){
1290 // indexLTM[1] = (nStripB-detind[2])+nStripC;
1292 // else if (detind[1] ==4){
1293 // indexLTM[1] = nStripC-detind[2];
1296 // AliError("Smth Wrong!!!");
1301 //-----------------------------------------------------------------------------
1302 void AliTOFQADataMakerRec::GetGeo2CTTMIndex(Int_t *detind, Int_t *indexCTTM) {
1304 // Returns CTTM index corresponding to the detector element detind
1306 GetGeo2LTMIndex(detind,indexCTTM);
1311 //-------------------------------------------------------------------------
1312 Int_t AliTOFQADataMakerRec::GetNumberOfFiredMacropad(AliRawReader * rawReader){
1315 TClonesArray * clonesRawData;
1316 if (!rawReader) return 0;
1317 for (Int_t iDDL = 0; iDDL < AliTOFGeometry::NDDL()*AliTOFGeometry::NSectors(); iDDL++){
1319 fTOFRawStream.LoadRawDataBuffersV2(iDDL);
1320 clonesRawData = (TClonesArray*)fTOFRawStream.GetRawData();
1321 for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
1322 AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
1323 if (tofRawDatum->GetTOF()){
1324 if ( (tofRawDatum->GetTRM()==3)&&
1325 (tofRawDatum->GetTDC()>11)&&
1326 (tofRawDatum->GetTDC()<15)) {
1335 //----------------------------------------------------------------
1336 void AliTOFQADataMakerRec::GetCTTMIndex(Int_t *equipid, Int_t *indexCTTM) {
1338 // Returns CTTM index corresponding to the equipment id equipid, only for LTM hits
1339 // equipid = (crate, trm, chain, tdc, channel)
1341 if ( (equipid[1]!=3)||(equipid[3]<12) ){
1346 Int_t modStrip2LTM[3][8]={ { 0, 1, 2, 3, 4, 5, 6, 7},
1347 { 8, 9, 10, 11, 12, 13, 14, 15},
1348 {16, 17, 18, 19, 20, 21, 22, 23}
1351 Int_t DDL2LTMmatrix[72]={0,1,37,36,2,3,39,38,4,5,41,40,6,7,43,42,8,9,45,44,10,11,47,46,12,13,49,48,14,15,51,50,16,17,53,52,18,19,
1352 55,54,20,21,57,56,22,23,59,58,24,25,61,60,26,27,63,62,28,29,65,64,30,31,67,66,32,33,69,68,34,35,71,70};
1354 Int_t itdc=equipid[3]%12;
1358 else crate=equipid[0];
1360 indexCTTM[0]=DDL2LTMmatrix[crate];
1361 indexCTTM[1]=modStrip2LTM[itdc][equipid[4]];
1365 //_____________________________________________________________________________
1366 void AliTOFQADataMakerRec::ReadHistogramRangeFromFile(const Char_t * filename)
1369 // read histogram ranges from configuration file
1372 AliInfo("Config file with histograms ranges not found or invalid -> use default values.");
1373 SetDefaultHistogramRange();
1374 SetDefaultCutNmaxFiredMacropad();
1378 FILE * configFile = fopen(filename,"r");
1380 AliInfo("Cannot open config file with histograms ranges -> use default values.");
1381 SetDefaultHistogramRange();
1385 if (feof(configFile)){
1386 AliInfo("Unexpected EOF of config file with histograms ranges -> use default values.");
1387 SetDefaultHistogramRange();
1391 Int_t minMulti=9999, maxMulti=-9999;
1392 Int_t nbinsMulti=0,nbinsTime=0;
1393 Float_t minTime=9999.0, maxTime=-9999.0;
1394 Int_t cutFiredMacropad=0;
1396 fscanf(configFile,"%10i %10i %10i %10f %10f", &cutFiredMacropad,&minMulti,&maxMulti,&minTime,&maxTime);
1398 //set multiplicity histo ranges
1399 if (minMulti>maxMulti){
1400 AliInfo("Invalid range for multiplicity histogram set. Changing to defualt values.");
1401 SetDefaultMultiHistogramRange();
1403 nbinsMulti = maxMulti-minMulti;
1404 SetNbinsMultiplicityHisto(nbinsMulti);
1405 SetMultiplicityHistoRange(minMulti,maxMulti);
1406 AliInfo(Form("Setting multiplicity histogram ranges to: multMin = %i - multMax = %i - nMultBins = %i",
1407 fgRangeMinMultiplicity, fgRangeMaxMultiplicity, fgNbinsMultiplicity));
1410 //set time histo ranges
1411 if (minTime>maxTime){
1412 AliInfo("Invalid range for time histogram set. Changing to defualt values.");
1413 SetDefaultTimeHistogramRange();
1415 nbinsTime = TMath::Nint((maxTime - minTime)/fgkNbinsWidthTime);//ns
1416 maxTime=minTime+nbinsTime*fgkNbinsWidthTime;//ns
1417 SetNbinsTimeHisto(nbinsTime);
1418 SetTimeHistoRange(minTime,maxTime);
1419 AliInfo(Form("Setting time histogram ranges to: timeMin = %5.2f ns - timeMax = %5.2f ns - nTimeBins = %i",
1420 fgRangeMinTime, fgRangeMaxTime,fgNbinsTime));
1423 if ((cutFiredMacropad>0)&&(cutFiredMacropad<fgkFiredMacropadLimit)){
1424 AliInfo("Invalid value for cut on fired macropad. Changing to default values.");
1425 SetDefaultCutNmaxFiredMacropad();
1427 SetCutNmaxFiredMacropad(cutFiredMacropad);
1428 AliInfo(Form("Setting cut on fired macropad to: = %i",cutFiredMacropad));
1435 //_____________________________________________________________________________
1436 void AliTOFQADataMakerRec::SetDefaultHistogramRange()
1439 // set default histogram ranges (tuned on 2011 pp collisions)
1441 AliInfo("Setting all histogram ranges to default values.");
1442 SetDefaultMultiHistogramRange();
1443 SetDefaultTimeHistogramRange();
1444 SetDefaultCutNmaxFiredMacropad();
1448 //_____________________________________________________________________________
1449 void AliTOFQADataMakerRec::SetDefaultMultiHistogramRange()
1452 // set default histogram ranges (tuned on 2011 pp collisions)
1454 SetMultiplicityHistoRange (0, 200);
1455 SetNbinsMultiplicityHisto(200);
1456 AliInfo("Setting Multiplicity histogram ranges to default values.");
1457 AliInfo(Form("multMin = %i - multMax = %i - nMultBins = %i",
1458 fgRangeMinMultiplicity, fgRangeMaxMultiplicity, fgNbinsMultiplicity));
1462 //_____________________________________________________________________________
1463 void AliTOFQADataMakerRec::SetDefaultTimeHistogramRange()
1466 // set default histogram ranges (tuned on 2011 pp collisions)
1468 SetNbinsTimeHisto(250);
1469 SetTimeHistoRange (0.0,610.);
1471 AliInfo("Setting Time histogram ranges to default values:");
1472 AliInfo(Form("timeMin = %5.2f ns - timeMax = %5.2f ns - nTimeBins = %i",
1473 fgRangeMinTime, fgRangeMaxTime,fgNbinsTime));
1477 //------------------------------------------------------------------
1478 void AliTOFQADataMakerRec::SetDefaultCutNmaxFiredMacropad()
1481 // set default cut on fired macropad
1483 SetCutNmaxFiredMacropad(5);
1484 AliInfo(Form("Setting cut on fired macropad to default values: NfiredMacropad = %i", fgCutNmaxFiredMacropad));