]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TOF/AliTOFQADataMakerRec.cxx
Test for Coverity
[u/mrichter/AliRoot.git] / TOF / AliTOFQADataMakerRec.cxx
CommitLineData
04236e67 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16///////////////////////////////////////////////////////////////////////
17// //
18// Produces the data needed to calculate the TOF quality assurance. //
19// QA objects are 1 & 2 Dimensional histograms. //
20// author: S.Arcelli //
21// //
22///////////////////////////////////////////////////////////////////////
23
fc71ba02 24/*
6caee44e 25Modified by fbellini on 01/11/2011
26- added histograms for LTM monitoring
27- fix for coverity
28
388c1205 29Modified by fbellini on 17/10/2011
30- fix for memory leak in constructor
31- added methods to read histos ranges from config file in DQM
32- added CTTM maps + relative methods to retrieve CTTM numbering
33- removed obslete comments
34
6f972712 35Modified by fbellini & rshanoian on 06/07/2011
36- changes for trigger classes implementation
37- fRunNumber added as private member
38- added time vs BCID plot
39
724eb92e 40Modified by fbellini on 18/01/2011
41- reduced histo binning to reduce size
42- added decoding errors plot
43- added channel maps and options for DQM shifters
44- new list of recPoints and ESDs plots
45- removed hTrmChannels035 and hTrmChannels3671
46
47 Modified by bvonhall on 03/11/2010
dce30a9d 48 - modified declaration of hTrmChannels035 and hTrmChannels3671 in EndOfDetectorCycle()
49 to prevent memory corruption
50
724eb92e 51 Modified by adecaro on 18/10/2010
e648d82d 52 - fTOFRawStream object set as private member
53
724eb92e 54Modified by fbellini on 13/09/2010
ea8ae424 55 - Set TLines as private members
56 - Set image flag for expert histos
57
724eb92e 58Modified by fbellini on 14/06/2010
5b4ed716 59 - Updated plots
60 - use LoadRawDataBuffersV2()
61
fc71ba02 62 Modified by fbellini on 10/05/2010
63 - Fixed EndOfDetectorCycle() memory corruption bug
64
65 Modified by fbellini on 22/04/2010
f63f6d7e 66 - Added filter for physics events
67
68 Modified by fbellini on 16/04/2010
5f144062 69 - Added EnableDqmShifterOpt()
70 - Modified EndOfDetectorCycle() with options for DQM
71 - Updated ESDs QA
72
73 Modified by fbellini on 30/03/2010
74 - Changed raws time histos range to 610ns
75 - Added FilterLTMData() and FilterSpare() methods
76 - Added check on enabled channels for raw data
77 - Updated RecPoints QA
78
79 Modified by fbellini on 02/03/2010
80 - Fixed raw data decoding methods (use AliTOFRawStream::LoadRawDataBuffer())
81 - Added filter for noisy channels and read map from OCDB
82 - Added GetCalibData() method
83 - Added CheckVolumeID() and CheckEquipID() methods
84 - Updated Raw QA
32bd8225 85*/
7a77a85a 86#include <iostream>
87#include <fstream>
32bd8225 88
04236e67 89#include <TClonesArray.h>
04236e67 90#include <TH1F.h>
91#include <TH2F.h>
5f144062 92#include <TLine.h>
724eb92e 93#include <TPaveText.h>
32bd8225 94
17f2cd01 95#include "AliCDBManager.h"
17f2cd01 96#include "AliCDBEntry.h"
04236e67 97#include "AliESDEvent.h"
98#include "AliESDtrack.h"
04236e67 99#include "AliQAChecker.h"
100#include "AliRawReader.h"
32bd8225 101#include "AliTOFRawStream.h"
5c7c93fa 102#include "AliTOFcluster.h"
103#include "AliTOFQADataMakerRec.h"
04236e67 104#include "AliTOFrawData.h"
5c7c93fa 105#include "AliTOFGeometry.h"
17f2cd01 106#include "AliTOFChannelOnlineStatusArray.h"
724eb92e 107#include "AliTOFDecoderSummaryData.h"
108#include "AliTOFDecoderV2.h"
dce30a9d 109
04236e67 110ClassImp(AliTOFQADataMakerRec)
388c1205 111
112Int_t AliTOFQADataMakerRec::fgNbinsMultiplicity=200; //number of bins in multiplicity plot
113Int_t AliTOFQADataMakerRec::fgRangeMinMultiplicity=0;//min range in multiplicity plot
114Int_t AliTOFQADataMakerRec::fgRangeMaxMultiplicity=200;//max range in multiplicity plot
115Int_t AliTOFQADataMakerRec::fgNbinsTime=250;//number of bins in time plot
116const Float_t AliTOFQADataMakerRec::fgkNbinsWidthTime=2.44;//width of bins in time plot
117Float_t AliTOFQADataMakerRec::fgRangeMinTime=0.0;//range min in time plot
118Float_t AliTOFQADataMakerRec::fgRangeMaxTime=620.0; //range max in time plot
119Int_t AliTOFQADataMakerRec::fgCutNmaxFiredMacropad=5;//cut on number of max fired macropad
120const Int_t AliTOFQADataMakerRec::fgkFiredMacropadLimit=50;//cut on number of max fired macropad
121
122
04236e67 123//____________________________________________________________________________
124 AliTOFQADataMakerRec::AliTOFQADataMakerRec() :
17f2cd01 125 AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kTOF), "TOF Quality Assurance Data Maker"),
126 fCalibData(0x0),
5f144062 127 fEnableNoiseFiltering(kFALSE),
e648d82d 128 fEnableDqmShifterOpt(kFALSE),
724eb92e 129 fIsSOC(kFALSE),
388c1205 130 fLineExpTimeMin(0x0),
131 fLineExpTimeMax(0x0),
132 fLineExpTotMin(0x0),
133 fLineExpTotMax(0x0),
724eb92e 134 fTOFRawStream(AliTOFRawStream()),
6f972712 135 fDecoderSummary(0),
388c1205 136 fRunNumber(-1),
137 fCalib(AliTOFcalib())
04236e67 138{
139 //
140 // ctor
724eb92e 141 //
388c1205 142 // fLineExpTimeMin = new TLine(200., 0., 200., 0.);
143 // fLineExpTimeMax = new TLine(250., 0., 250., 0.);
144 // fLineExpTotMin = new TLine(5., 0., 5., 0.);
145 // fLineExpTotMax = new TLine(20., 0., 20., 0.);
724eb92e 146 for (Int_t sm=0;sm<17;sm++){
147 fLineSMid[sm] = new TLine( sm+1, 0., sm+1, 91.);
ea8ae424 148 }
388c1205 149
150 for (Int_t sm=0;sm<71;sm++){
151 fLineLTMid[sm] = new TLine( sm+1, 0., sm+1, 23.);
152 }
153
154 for (Int_t sm=0;sm<22;sm++){
155 fLineLTMbitId[sm] = new TLine( 0., sm+1, 72. ,sm+1);
156 }
724eb92e 157
04236e67 158}
159
160//____________________________________________________________________________
161AliTOFQADataMakerRec::AliTOFQADataMakerRec(const AliTOFQADataMakerRec& qadm) :
17f2cd01 162 AliQADataMakerRec(),
163 fCalibData(qadm.fCalibData),
5f144062 164 fEnableNoiseFiltering(qadm.fEnableNoiseFiltering),
165 fEnableDqmShifterOpt(qadm.fEnableDqmShifterOpt),
724eb92e 166 fIsSOC(qadm.fIsSOC),
ea8ae424 167 fLineExpTimeMin(qadm.fLineExpTimeMin),
168 fLineExpTimeMax(qadm.fLineExpTimeMax),
169 fLineExpTotMin(qadm.fLineExpTotMin),
97430dfe 170 fLineExpTotMax(qadm.fLineExpTotMax),
724eb92e 171 fTOFRawStream(qadm.fTOFRawStream),
6f972712 172 fDecoderSummary(qadm.fDecoderSummary),
388c1205 173 fRunNumber(qadm.fRunNumber),
174 fCalib(qadm.fCalib)
04236e67 175{
176 //
177 //copy ctor
178 //
179 SetName((const char*)qadm.GetName()) ;
180 SetTitle((const char*)qadm.GetTitle());
ea8ae424 181
724eb92e 182 for (Int_t sm=0;sm<17;sm++){
183 fLineSMid[sm]=qadm.fLineSMid[sm];
ea8ae424 184 }
388c1205 185
186 for (Int_t sm=0;sm<71;sm++){
187 fLineLTMid[sm] = qadm.fLineLTMid[sm];
188 }
189
190 for (Int_t sm=0;sm<22;sm++){
191 fLineLTMbitId[sm] = qadm.fLineLTMbitId[sm];
192 }
04236e67 193}
194
195//__________________________________________________________________
196AliTOFQADataMakerRec& AliTOFQADataMakerRec::operator = (const AliTOFQADataMakerRec& qadm )
197{
198 //
199 // assignment operator.
200 //
201 this->~AliTOFQADataMakerRec();
202 new(this) AliTOFQADataMakerRec(qadm);
203 return *this;
204}
205
97430dfe 206//----------------------------------------------------------------------------
207AliTOFQADataMakerRec::~AliTOFQADataMakerRec()
208{
6f972712 209 //destructor
97430dfe 210 fTOFRawStream.Clear();
388c1205 211 fCalib.Clear();
6f972712 212 if (fLineExpTimeMin)
213 delete fLineExpTimeMin;
214 if (fLineExpTimeMax)
215 delete fLineExpTimeMax;
216 if (fLineExpTotMin)
217 delete fLineExpTotMin;
218 if (fLineExpTotMax)
219 delete fLineExpTotMax;
388c1205 220 for (Int_t sm=0;sm<17;sm++){
6f972712 221 if (fLineSMid[sm])
222 delete fLineSMid[sm];
724eb92e 223 }
388c1205 224 for (Int_t sm=0;sm<71;sm++){
225 if (fLineLTMid[sm])
226 delete fLineLTMid[sm];
227 }
228for (Int_t sm=0;sm<22;sm++){
229 if (fLineLTMbitId[sm])
230 delete fLineLTMbitId[sm];
231 }
97430dfe 232}
17f2cd01 233//----------------------------------------------------------------------------
6f972712 234AliTOFChannelOnlineStatusArray* AliTOFQADataMakerRec::GetCalibData()
17f2cd01 235{
32bd8225 236 //
237 // Retrive TOF calib objects from OCDB
238 //
724eb92e 239 AliCDBManager *man = AliCDBManager::Instance();
240 AliCDBEntry *cdbe=0;
6f972712 241
242 if (fRun<=0) fRunNumber=145288; //reference run from LHC11a
243 else fRunNumber=fRun;
244
245 if (man->GetRun()!=fRunNumber){
246 fRunNumber=man->GetRun();
247 AliWarning(Form("Run number mismatch found: setting it to value from current AliCDBManager instance = %i", fRunNumber));
248 }
249 cdbe = man->Get("TOF/Calib/Status",fRunNumber);
724eb92e 250
724eb92e 251 if(!cdbe){
6f972712 252 // for DQM online
253 AliWarning("Load of calibration data from default (alien://) storage failed!");
254 printf("Calibration data will be loaded from local storage - ok if on DQM station!");
255 man->SetDefaultStorage("local:///local/cdb/");
17f2cd01 256 cdbe = man->Get("TOF/Calib/Status",fRun);
6f972712 257
258 if(!cdbe){
259 AliWarning("Load of calibration data from local DQM machine storage failed!");
260 AliWarning("Calibration data will be loaded from local ($ALICE_ROOT) storage ");
261 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
262 cdbe = man->Get("TOF/Calib/Status",fRunNumber);
263 }
724eb92e 264 }
265 // Retrieval of data in directory TOF/Calib/Data:
724eb92e 266 AliTOFChannelOnlineStatusArray * array = 0;
8a9430fc 267 if (cdbe) {
268 printf("======= OCDB object for TOF retrieved from run %i in %s\n",fRunNumber,cdbe->GetName());
269 array = (AliTOFChannelOnlineStatusArray *)cdbe->GetObject();
270 }
724eb92e 271 if (!array) AliFatal("No calibration data from calibration database !");
272
388c1205 273 fCalib.Init(fRunNumber);
724eb92e 274 return array;
17f2cd01 275}
276
04236e67 277//____________________________________________________________________________
278void AliTOFQADataMakerRec::InitRaws()
279{
280 //
281 // create Raws histograms in Raws subdir
282 //
388c1205 283 ReadHistogramRangeFromFile(gSystem->Getenv("TOFDQMHISTO_CONFIGFILE"));
284
7d297381 285 const Bool_t expert = kTRUE ;
286 const Bool_t saveCorr = kTRUE ;
287 const Bool_t image = kTRUE ;
04236e67 288
388c1205 289 TH1I * h0 = new TH1I("hTOFRaws","TOF raw hit multiplicity; TOF raw hits number; Events ",fgNbinsMultiplicity, fgRangeMinMultiplicity, fgRangeMaxMultiplicity);
290 TH1I * h1 = new TH1I("hTOFRawsIA","TOF raw hit multiplicity - I/A side; TOF raw hits number;Events ",fgNbinsMultiplicity, fgRangeMinMultiplicity, fgRangeMaxMultiplicity);
291 TH1I * h2 = new TH1I("hTOFRawsOA","TOF raw hit multiplicity - O/A side; TOF raw hits number;Events ",fgNbinsMultiplicity, fgRangeMinMultiplicity, fgRangeMaxMultiplicity);
292 TH1I * h3 = new TH1I("hTOFRawsIC","TOF raw hit multiplicity - I/C side; TOF raw hits number;Events ",fgNbinsMultiplicity, fgRangeMinMultiplicity, fgRangeMaxMultiplicity);
293 TH1I * h4 = new TH1I("hTOFRawsOC","TOF raw hit multiplicity - O/C side; TOF raw hits number;Events ",fgNbinsMultiplicity, fgRangeMinMultiplicity, fgRangeMaxMultiplicity);
5f144062 294
388c1205 295 TH1F * h5 = new TH1F("hTOFRawsTime", "TOF Raws - Hit time (ns);Measured Hit time [ns];Hits", fgNbinsTime,fgRangeMinTime,fgRangeMaxTime);
296 TH1F * h6 = new TH1F("hTOFRawsTimeIA", "TOF Raws - Hit time (ns) - I/A side;Measured Hit time [ns];Hits", fgNbinsTime,fgRangeMinTime,fgRangeMaxTime);
297 TH1F * h7 = new TH1F("hTOFRawsTimeOA", "TOF Raws - Hit time (ns) - O/A side;Measured Hit time [ns];Hits", fgNbinsTime,fgRangeMinTime,fgRangeMaxTime);
298 TH1F * h8 = new TH1F("hTOFRawsTimeIC", "TOF Raws - Hit time (ns) - I/C side;Measured Hit time [ns];Hits", fgNbinsTime,fgRangeMinTime,fgRangeMaxTime);
299 TH1F * h9 = new TH1F("hTOFRawsTimeOC", "TOF Raws - Hit time (ns) - O/C side;Measured Hit time [ns];Hits", fgNbinsTime,fgRangeMinTime,fgRangeMaxTime);
724eb92e 300
388c1205 301 TH1F * h10 = new TH1F("hTOFRawsToT", "TOF Raws - Hit ToT (ns);Measured Hit ToT (ns);Hits", 100, 0., 48.8);
724eb92e 302
388c1205 303 TH1F * h11 = new TH1F("hTOFRawsToTIA", "TOF Raws - Hit ToT (ns) - I/A side;Measured Hit ToT (ns);Hits", 100, 0., 48.8);
304 TH1F * h12 = new TH1F("hTOFRawsToTOA", "TOF Raws - Hit ToT (ns) - O/A side;Measured Hit ToT (ns);Hits", 100, 0., 48.8);
305 TH1F * h13 = new TH1F("hTOFRawsToTIC", "TOF Raws - Hit ToT (ns) - I/C side;Measured Hit ToT (ns);Hits", 100, 0., 48.8);
306 TH1F * h14 = new TH1F("hTOFRawsToTOC", "TOF Raws - Hit ToT (ns) - O/C side;Measured Hit ToT (ns);Hits", 100, 0., 48.8);
724eb92e 307
5b4ed716 308 TH1F * h15 = new TH1F("hTOFRawsLTMHits", "LTMs OR signals; Crate; Counts", 72, 0., 72.);
724eb92e 309 TH2F * h16 = new TH2F("hTOFrefMap", "TOF enabled channel reference map;sector;strip", 72, 0., 18., 91, 0., 91.);
310 TH2F * h17 = new TH2F("hTOFRawHitMap","TOF raw hit map;sector;strip", 72, 0., 18., 91, 0., 91.);
311 TH2I * h18 = new TH2I("hTOFDecodingErrors","Decoding error monitoring; DDL; Error ", 72, 0, 72, 13,1,14);
32bd8225 312
724eb92e 313 h18->GetYaxis()->SetBinLabel(1,"DRM ");
314 h18->GetYaxis()->SetBinLabel(2,"LTM ");
315 h18->GetYaxis()->SetBinLabel(3,"TRM 3 ");
316 h18->GetYaxis()->SetBinLabel(4,"TRM 4");
317 h18->GetYaxis()->SetBinLabel(5,"TRM 5");
318 h18->GetYaxis()->SetBinLabel(6,"TRM 6");
319 h18->GetYaxis()->SetBinLabel(7,"TRM 7");
320 h18->GetYaxis()->SetBinLabel(8,"TRM 8");
321 h18->GetYaxis()->SetBinLabel(9,"TRM 9");
322 h18->GetYaxis()->SetBinLabel(10,"TRM 10");
323 h18->GetYaxis()->SetBinLabel(11,"TRM 11");
324 h18->GetYaxis()->SetBinLabel(12,"TRM 12");
325 h18->GetYaxis()->SetBinLabel(13,"recovered");
32bd8225 326
388c1205 327 TH1F * h19 = new TH1F("hTOFOrphansTime", "TOF Raws - Orphans time (ns);Measured Hit time [ns];Hits",fgNbinsTime,fgRangeMinTime,fgRangeMaxTime);
328 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);
329 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);
330 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);
331 TH2F * h23 = new TH2F("hTOFtimeVsBCID","TOF time vs BCID; BCID; time (ns) ", 3564, 0., 3564.,fgNbinsTime,fgRangeMinTime,fgRangeMaxTime);
332 TH2F * h24 = new TH2F("hTOFchannelEfficiencyMap","TOF channels (HWok && efficient && !noisy && !problematic);sector;strip", 72, 0., 18., 91, 0., 91.);
333 TH2F * h25 = new TH2F("hTOFhitsCTTM","Map of hit pads according to CTTM numbering;LTM index;bit index", 72, 0., 72., 23, 0., 23.);
334 TH2F * h26 = new TH2F("hTOFmacropadCTTM","Map of hit macropads according to CTTM numbering;LTM index; bit index", 72, 0., 72., 23, 0., 23.);
335 TH2F * h27 = new TH2F("hTOFmacropadDeltaPhiTime","#Deltat vs #Delta#Phi of hit macropads;#Delta#Phi (degrees);#DeltaBX", 18, 0., 180., 20, 0., 20.0);
7a77a85a 336 TH2I *h28 = new TH2I("hBXVsCttmBit","BX ID in TOF matching window vs trg channel; trg channel; BX", 1728, 0, 1728, 24, 0, 24);
337 TH2F *h29 = new TH2F("hTimeVsCttmBit","TOF raw time vs trg channel; trg channel; raw time (ns)", 1728, 0., 1728., fgNbinsTime, fgRangeMinTime, fgRangeMaxTime);
338
388c1205 339 h25->GetYaxis()->SetTickLength(-0.02);
340 h26->GetYaxis()->SetTickLength(-0.02);
341 h25->GetYaxis()->SetNdivisions(210);
342 h26->GetYaxis()->SetNdivisions(210);
343 h25->GetXaxis()->SetTickLength(-0.02);
344 h26->GetXaxis()->SetTickLength(-0.02);
345 h25->GetXaxis()->SetLabelOffset(0.015);
346 h26->GetXaxis()->SetLabelOffset(0.015);
347 h25->GetXaxis()->SetNdivisions(515);
348 h26->GetXaxis()->SetNdivisions(515);
6f972712 349
5f144062 350 h0->Sumw2() ;
351 h1->Sumw2() ;
352 h2->Sumw2() ;
353 h3->Sumw2() ;
354 h4->Sumw2() ;
724eb92e 355 // h5->Sumw2() ;
5f144062 356 h6->Sumw2() ;
357 h7->Sumw2() ;
358 h8->Sumw2() ;
359 h9->Sumw2() ;
724eb92e 360 // h10->Sumw2() ;
5f144062 361 h11->Sumw2() ;
362 h12->Sumw2() ;
363 h13->Sumw2() ;
364 h14->Sumw2() ;
365 h15->Sumw2() ;
366 h16->Sumw2() ;
367 h17->Sumw2() ;
368 h18->Sumw2() ;
369 h19->Sumw2() ;
370 h20->Sumw2() ;
371 h21->Sumw2() ;
372 h22->Sumw2() ;
6f972712 373 h23->Sumw2() ;
388c1205 374 h24->Sumw2() ;
375 h25->Sumw2() ;
376 h26->Sumw2() ;
377 h27->Sumw2() ;
7a77a85a 378 h28->Sumw2() ;
379 h29->Sumw2() ;
380
e648d82d 381 //add lines for DQM shifter
388c1205 382 fLineExpTimeMin = new TLine(200., 0., 200., 0.);
383 fLineExpTimeMax = new TLine(250., 0., 250., 0.);
384 fLineExpTotMin = new TLine(5., 0., 5., 0.);
385 fLineExpTotMax = new TLine(20., 0., 20., 0.);
386
e648d82d 387 fLineExpTimeMin->SetLineColor(kGreen);
388 fLineExpTimeMin->SetLineWidth(2);
389
e648d82d 390 fLineExpTimeMax->SetLineColor(kGreen);
391 fLineExpTimeMax->SetLineWidth(2);
392
e648d82d 393 fLineExpTotMin->SetLineColor(kGreen);
394 fLineExpTotMin->SetLineWidth(2);
395
e648d82d 396 fLineExpTotMax->SetLineColor(kGreen);
397 fLineExpTotMax->SetLineWidth(2);
398
724eb92e 399 for (Int_t sm=0;sm<17;sm++){
724eb92e 400 fLineSMid[sm]->SetLineColor(kMagenta);
401 fLineSMid[sm]->SetLineWidth(2);
e648d82d 402 }
724eb92e 403
a3286ffd 404 h5->GetListOfFunctions()->Add(fLineExpTimeMin);
405 h5->GetListOfFunctions()->Add(fLineExpTimeMax);
406 h10->GetListOfFunctions()->Add(fLineExpTotMin);
407 h10->GetListOfFunctions()->Add(fLineExpTotMax);
408
409 for (Int_t sm=0;sm<17;sm++){
410 h16->GetListOfFunctions()->Add(fLineSMid[sm]);
411 h17->GetListOfFunctions()->Add(fLineSMid[sm]);
412 }
413
388c1205 414 for (Int_t sm=0;sm<71;sm++){
415 fLineLTMid[sm]->SetLineColor(kBlack);
416 fLineLTMid[sm]->SetLineWidth(1);
417 h26->GetListOfFunctions()->Add(fLineLTMid[sm]);
418 h25->GetListOfFunctions()->Add(fLineLTMid[sm]);
419 }
420 for (Int_t sm=0;sm<22;sm++){
421 fLineLTMbitId[sm]->SetLineColor(kBlack);
422 fLineLTMbitId[sm]->SetLineWidth(1);
423 h26->GetListOfFunctions()->Add(fLineLTMbitId[sm]);
424 h25->GetListOfFunctions()->Add(fLineLTMbitId[sm]);
425 }
426
a3286ffd 427 TPaveText *phosHoleBox=new TPaveText(13,38,16,53,"b");
428 phosHoleBox->SetFillStyle(0);
429 phosHoleBox->SetFillColor(kWhite);
430 phosHoleBox->SetLineColor(kMagenta);
431 phosHoleBox->SetLineWidth(2);
432 phosHoleBox->AddText("PHOS");
433 h16->GetListOfFunctions()->Add(phosHoleBox);
434 h17->GetListOfFunctions()->Add(phosHoleBox);
435
436 // h0->SetDrawOption("logy");
437 // h5->SetDrawOption("logy");
438 // h10->SetDrawOption("logy");
439
17f2cd01 440 Add2RawsList(h0, 0, !expert, image, !saveCorr) ;
61740cee 441 Add2RawsList(h1, 1, expert, !image, !saveCorr) ;
442 Add2RawsList(h2, 2, expert, !image, !saveCorr) ;
443 Add2RawsList(h3, 3, expert, !image, !saveCorr) ;
444 Add2RawsList(h4, 4, expert, !image, !saveCorr) ;
17f2cd01 445 Add2RawsList(h5, 5, !expert, image, !saveCorr) ;
61740cee 446 Add2RawsList(h6, 6, expert, !image, !saveCorr) ;
447 Add2RawsList(h7, 7, expert, !image, !saveCorr) ;
448 Add2RawsList(h8, 8, expert, !image, !saveCorr) ;
449 Add2RawsList(h9, 9, expert, !image, !saveCorr) ;
17f2cd01 450 Add2RawsList(h10, 10, !expert, image, !saveCorr) ;
5f144062 451 Add2RawsList(h11, 11, expert, !image, !saveCorr) ;
452 Add2RawsList(h12, 12, expert, !image, !saveCorr) ;
17f2cd01 453 Add2RawsList(h13, 13, expert, !image, !saveCorr) ;
454 Add2RawsList(h14, 14, expert, !image, !saveCorr) ;
388c1205 455 Add2RawsList(h15, 15, expert, !image, !saveCorr) ;
456 Add2RawsList(h16, 16, !expert, image, !saveCorr) ;
457 Add2RawsList(h17, 17, !expert, image, !saveCorr) ;
458 Add2RawsList(h18, 18, expert, !image, !saveCorr) ;
459 Add2RawsList(h19, 19, expert, !image, !saveCorr) ;
460 Add2RawsList(h20, 20, expert, !image, !saveCorr) ;
461 Add2RawsList(h21, 21, expert, !image, !saveCorr) ;
462 Add2RawsList(h22, 22, !expert, image, !saveCorr) ;
463 Add2RawsList(h23, 23, !expert, !image, !saveCorr) ;
464 Add2RawsList(h24, 24, !expert, !image, !saveCorr) ;
465 Add2RawsList(h25, 25, !expert, !image, !saveCorr) ;
466 Add2RawsList(h26, 26, !expert, image, !saveCorr) ;
467 Add2RawsList(h27, 27, !expert, image, !saveCorr) ;
7a77a85a 468 Add2RawsList(h28, 28, !expert, !image, !saveCorr) ;
469 Add2RawsList(h29, 29, !expert, !image, !saveCorr) ;
470
388c1205 471//
92664bc8 472 ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line
44ed7a66 473}
474
04236e67 475//____________________________________________________________________________
476void AliTOFQADataMakerRec::InitRecPoints()
477{
478 //
479 // create RecPoints histograms in RecPoints subdir
480 //
724eb92e 481
32bd8225 482 const Bool_t expert = kTRUE ;
483 const Bool_t image = kTRUE ;
04236e67 484
724eb92e 485 TH1I * h0 = new TH1I("hTOFRecPoints", "TOF RecPoints multiplicity ; TOF RecPoints number;Events",200, 0, 200) ;
5f144062 486
724eb92e 487 TH1F * h1 = new TH1F("hTOFRecPointsTimeIA", "RecPoints Time Spectrum in TOF (ns)- I/A side; Calibrated TOF time [ns];Events", 250, 0., 610.) ;
488 TH1F * h2 = new TH1F("hTOFRecPointsTimeOA", "RecPoints Time Spectrum in TOF (ns)- O/A side; Calibrated TOF time [ns];Events", 250, 0., 610.) ;
489 TH1F * h3 = new TH1F("hTOFRecPointsTimeIC", "RecPoints Time Spectrum in TOF (ns)- I/C side; Calibrated TOF time [ns];Events", 250, 0., 610.) ;
490 TH1F * h4 = new TH1F("hTOFRecPointsTimeOC", "RecPoints Time Spectrum in TOF (ns)- O/C side; Calibrated TOF time [ns];Events", 250, 0., 610.) ;
32bd8225 491
724eb92e 492 TH1F * h5 = new TH1F("hTOFRecPointsRawTimeIA", "RecPoints raw Time Spectrum in TOF (ns)-I/A side; Measured TOF time [ns];Hits", 250, 0., 610.) ;
493 TH1F * h6 = new TH1F("hTOFRecPointsRawTimeOA", "RecPoints raw Time Spectrum in TOF (ns)-O/A side; Measured TOF time [ns];Hits", 250, 0., 610.) ;
494 TH1F * h7 = new TH1F("hTOFRecPointsRawTimeIC", "RecPoints raw Time Spectrum in TOF (ns)-I/C side; Measured TOF time [ns];Hits", 250, 0., 610.) ;
495 TH1F * h8 = new TH1F("hTOFRecPointsRawTimeOC", "RecPoints raw Time Spectrum in TOF (ns)-O/C side; Measured TOF time [ns];Hits", 250, 0., 610.) ;
32bd8225 496
724eb92e 497 TH1F * h9 = new TH1F("hTOFRecPointsToTIA", "RecPoints ToT Spectrum in TOF (ns)-I/A side; Measured TOT [ns];Hits", 100, 0., 48.8 ) ;
498 TH1F * h10 = new TH1F("hTOFRecPointsToTOA", "RecPoints ToT Spectrum in TOF (ns)-O/A side; Measured TOT [ns];Hits", 100, 0., 48.8 ) ;
499 TH1F * h11 = new TH1F("hTOFRecPointsToTIC", "RecPoints ToT Spectrum in TOF (ns)-I/C side; Measured TOT [ns];Hits", 100, 0., 48.8 ) ;
500 TH1F * h12 = new TH1F("hTOFRecPointsToTOC", "RecPoints ToT Spectrum in TOF (ns)-O/C side; Measured TOT [ns];Hits", 100, 0., 48.8 ) ;
501
502 TH2F * h13 = new TH2F("hTOFRecPointsClusMap","RecPoints map; sector ;strip", 72, 0., 18., 91, 0., 91.) ;
503 TH2F * h14 = new TH2F("hTOFRecPointsTimeVsStrip","RecPoints TOF time vs. strip (theta); Strip index; RecPoints TOF time (ns) ",91, 0., 91., 250, 0., 610.) ;
504 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) ;
505 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) ;
17f2cd01 506
724eb92e 507 h0->Sumw2() ;
508 h1->Sumw2() ;
509 h2->Sumw2() ;
510 h3->Sumw2() ;
511 h4->Sumw2() ;
512 h5->Sumw2() ;
513 h6->Sumw2() ;
514 h7->Sumw2() ;
515 h8->Sumw2() ;
516 h9->Sumw2() ;
517 h10->Sumw2() ;
518 h11->Sumw2() ;
519 h12->Sumw2() ;
520 h13->Sumw2() ;
521 h14->Sumw2() ;
522 h15->Sumw2() ;
523 h16->Sumw2() ;
524
5f144062 525 Add2RecPointsList(h0, 0, !expert, image) ;
526 Add2RecPointsList(h1, 1, !expert, image) ;
527 Add2RecPointsList(h2, 2, !expert, image) ;
528 Add2RecPointsList(h3, 3, !expert, image) ;
529 Add2RecPointsList(h4, 4, !expert, image) ;
724eb92e 530 Add2RecPointsList(h5, 5, expert, !image) ;
5f144062 531 Add2RecPointsList(h6, 6, expert, !image) ;
532 Add2RecPointsList(h7, 7, expert, !image) ;
533 Add2RecPointsList(h8, 8, expert, !image) ;
724eb92e 534 Add2RecPointsList(h9, 9, !expert, !image) ;
535 Add2RecPointsList(h10, 10, !expert, !image) ;
536 Add2RecPointsList(h11, 11, !expert, !image) ;
537 Add2RecPointsList(h12, 12, !expert, !image) ;
5f144062 538 Add2RecPointsList(h13, 13, expert, !image) ;
724eb92e 539 Add2RecPointsList(h14, 14, expert, image) ;
5f144062 540 Add2RecPointsList(h15, 15, expert, !image) ;
541 Add2RecPointsList(h16, 16, expert, !image) ;
92664bc8 542 //
543 ClonePerTrigClass(AliQAv1::kRECPOINTS); // this should be the last line
04236e67 544}
545
546//____________________________________________________________________________
547void AliTOFQADataMakerRec::InitESDs()
548{
549 //
550 //create ESDs histograms in ESDs subdir
551 //
135306ea 552
5f144062 553 const Bool_t expert = kTRUE ;
554 const Bool_t image = kTRUE ;
04236e67 555
7b81681b 556 TH1I * h0 = new TH1I("hTOFESDs", "Number of matched TOF tracks per event;Number of TOF matched ESD tracks;Counts", 200, 0, 200) ;
724eb92e 557 TH1F * h1 = new TH1F("hTOFESDsTime", "Matched ESDs tracks: TOF Time spectrum; Calibrated TOF time [ns];Counts", 250, 0., 610. ) ;
558 TH1F * h2 = new TH1F("hTOFESDsRawTime", "Matched ESDs tracks: TOF raw Time spectrum;Measured TOF time [ns];Counts", 250, 0., 610.) ;
559 TH1F * h3 = new TH1F("hTOFESDsToT", "Matched ESDs tracks: TOF ToT spectrum; ESDs ToT [ns];Counts",100, 0., 48.8) ;
560 TH1F * h4 = new TH1F("hTOFESDskTOFOUT", "p_{T} distribution of tracks with kTOFout; p_{T} (GeV/c);Counts", 50, 0.20, 5.00) ;
561 TH1F * h5 = new TH1F("hTOFESDskTIME", "p_{T} distribution of tracks with kTOFout && kTIME; p_{T} (GeV/c);Counts", 50, 0.20, 5.00) ;
562 TH1F * h6 = new TH1F("hTOFESDsMatched", "p_{T} distribution of tracks with kTOFout && TOFtime>0; p_{T} (GeV/c);Counts", 50, 0.20, 5.00) ;
563 TH1F * h7 = new TH1F("hTOFESDsMatchingProb", "TPC-TOF track-matching probability;TOF matching probability (%) ;Counts",101, -1.0, 100) ;
564 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.) ;
565 TH1F * h9 = new TH1F("hTOFHitsLength", "Matched ESDs tracks: Length Spectrum; Track length [cm];Counts", 800, 0., 800) ;
566
5f144062 567 h0->Sumw2() ;
04236e67 568 h1->Sumw2() ;
04236e67 569 h2->Sumw2() ;
04236e67 570 h3->Sumw2() ;
5f144062 571 h4->Sumw2() ;
572 h5->Sumw2() ;
573 h6->Sumw2() ;
574 h7->Sumw2() ;
575 h8->Sumw2() ;
576 h9->Sumw2() ;
5f144062 577
578 Add2ESDsList(h0, 0, !expert, image) ;
579 Add2ESDsList(h1, 1, !expert, image) ;
724eb92e 580 Add2ESDsList(h2, 2, expert, !image) ;
581 Add2ESDsList(h3, 3, !expert, !image) ;
5f144062 582 Add2ESDsList(h4, 4, expert, image) ;
583 Add2ESDsList(h5, 5, expert, image) ;
584 Add2ESDsList(h6, 6, expert, image) ;
585 Add2ESDsList(h7, 7, expert, image) ;
724eb92e 586 Add2ESDsList(h8, 8, expert, !image) ;
587 Add2ESDsList(h9, 9, !expert, !image) ;
92664bc8 588 //
589 ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line
04236e67 590}
591
5f144062 592
04236e67 593//____________________________________________________________________________
594void AliTOFQADataMakerRec::MakeRaws(AliRawReader* rawReader)
595{
596 //
597 // makes data from Raws
598 //
724eb92e 599 if (rawReader->GetType()==7) {
600
601 Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;//in ns
602 Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
603 Int_t ntof[5]; /* 0=tot, 1=IA, 2=OA, 3=IC, 4=OC*/
604 for (Int_t j=0;j<5;j++){ ntof[j]=0;}
605 Int_t equipmentID[5]; //(ddl, trm, chain,tdc,channel)
606 Int_t volumeID[5]; //(sector,plate,strip,padX,padZ)
607 Int_t volumeID2[5]; //(sector,plate,strip,padZ,padX) to use AliTOFGeometry::GetIndex()
608 Int_t chIndex=-1;
388c1205 609 Int_t indexCTTM[2]={-1,-1};
610 Int_t indexGeo2CTTM[2]={-1,-1};
611 Float_t macropadPhiTimeUPC[fgkFiredMacropadLimit][2];
612 for (Int_t ii=0;ii<2;ii++){
613 for (Int_t jj=0;jj<fgkFiredMacropadLimit;jj++){
614 macropadPhiTimeUPC[jj][ii]=-999.0;
615 }
616 }
617
724eb92e 618 TClonesArray * clonesRawData;
619 fTOFRawStream.SetRawReader(rawReader);
6f972712 620 Int_t BCID=rawReader->GetBCID();
724eb92e 621
388c1205 622 Int_t nFiredMacropad=0,
623 iFiredMacropad=-1;
624 nFiredMacropad=GetNumberOfFiredMacropad(rawReader);
625
724eb92e 626 //uncomment if needed to apply DeltaBC correction
627 //fTOFRawStream.ApplyBCCorrections(kTRUE);
388c1205 628
6f972712 629 if (fDecoderSummary){
630 fDecoderSummary->Reset();
631 }
724eb92e 632 for (Int_t iDDL = 0; iDDL < AliTOFGeometry::NDDL()*AliTOFGeometry::NSectors(); iDDL++){
633 rawReader->Reset();
634 fTOFRawStream.LoadRawDataBuffersV2(iDDL);
635
636 //* get decoding error counters
acfd6c93 637 fDecoderSummary = ( (AliTOFDecoderV2*) fTOFRawStream.GetDecoderV2() )->GetDecoderSummaryData();
724eb92e 638 if ( (fDecoderSummary) && (fDecoderSummary ->GetErrorDetected()) ) {
639 Int_t errorSlotID=(Int_t) fDecoderSummary->GetErrorSlotID();
92664bc8 640 FillRawsData(18,iDDL,errorSlotID);
724eb92e 641 if (fDecoderSummary -> GetRecoverError() )
92664bc8 642 FillRawsData(18,iDDL,13);
724eb92e 643 }
644
645 clonesRawData = (TClonesArray*)fTOFRawStream.GetRawData();
646 for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
647 AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
7a77a85a 648 Float_t tofRawTime=tofRawDatum->GetTOF()*tdc2ns;
f63f6d7e 649
724eb92e 650 if (tofRawDatum->GetTOF()){
651 equipmentID[0]=iDDL;
652 equipmentID[1]=tofRawDatum->GetTRM();
653 equipmentID[2]=tofRawDatum->GetTRMchain();
654 equipmentID[3]=tofRawDatum->GetTDC();
655 equipmentID[4]=tofRawDatum->GetTDCchannel();
656
657 if (CheckEquipID(equipmentID)){
658 fTOFRawStream.EquipmentId2VolumeId(iDDL,
659 tofRawDatum->GetTRM(),
660 tofRawDatum->GetTRMchain(),
661 tofRawDatum->GetTDC(),
662 tofRawDatum->GetTDCchannel(),
663 volumeID);
664 //LTM data
665 if (FilterLTMData(equipmentID)) { //counts LTM hits
6f972712 666 if (equipmentID[2]==1) //crate left, A-side or C-side
92664bc8 667 FillRawsData(15,equipmentID[0]);
6f972712 668 else
7a77a85a 669 FillRawsData(15,equipmentID[0]-1);
670
671 //retrieve CTTM index (Ltm, bit)
672 GetCTTMIndex(equipmentID, indexCTTM);
673
674 //get BX index within TOF-matching window
675 Int_t indexBC=-1;
676 indexBC= TMath::Nint(tofRawTime/24.4);
677
678 Int_t indexCttmChannel=indexCTTM[0]*24+indexCTTM[1];
679 FillRawsData(28,indexCttmChannel,indexBC);
680 FillRawsData(29,indexCttmChannel,tofRawTime);
388c1205 681
682 //fired macropad map (from LTM hits) - only for low multi evts (UPC)
683 if ((nFiredMacropad<=fgCutNmaxFiredMacropad)){
684 iFiredMacropad++;
685 AliInfo(Form("Event found with %i fired macropads in BCID = %i!",nFiredMacropad,BCID));
388c1205 686 FillRawsData(26,indexCTTM[0],indexCTTM[1]);
687 Float_t halfSMphi=-999.0;
388c1205 688 if (indexCTTM[0]<36)
689 halfSMphi=indexCTTM[0]*10.+5.;
690 else halfSMphi=(indexCTTM[0]-36)*10.+5.;
691 macropadPhiTimeUPC[iFiredMacropad][0]=halfSMphi;
388c1205 692 macropadPhiTimeUPC[iFiredMacropad][1]=indexBC;
693 }
724eb92e 694 }
17f2cd01 695
724eb92e 696 //TRM data
697 if (CheckVolumeID(volumeID)){
698 volumeID2[0]=volumeID[0];
699 volumeID2[1]=volumeID[1];
700 volumeID2[2]=volumeID[2];
701 volumeID2[3]=volumeID[4];
702 volumeID2[4]=volumeID[3];
703 chIndex=AliTOFGeometry::GetIndex(volumeID2);
704
388c1205 705 //fill hit map according to CTTM numbering
706 GetGeo2CTTMIndex(volumeID2, indexGeo2CTTM);
707 if ((nFiredMacropad<=fgCutNmaxFiredMacropad)){
708 FillRawsData(25,indexGeo2CTTM[0],indexGeo2CTTM[1]);
709 }
710 //hits selection
724eb92e 711 if (tofRawDatum->GetTOT()){
acfd6c93 712 if (!(fCalibData->GetNoiseStatus(chIndex)==AliTOFChannelOnlineStatusArray::kTOFNoiseBad)
724eb92e 713 && (fCalibData->GetHWStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFHWOk)) {//noise and enabled filter
714 ntof[0]++; //counter for tof hits
715
716 //fill global spectra for DQM plots
7a77a85a 717 FillRawsData(5, tofRawTime) ;//in ns
92664bc8 718 FillRawsData(10, tofRawDatum->GetTOT()*tot2ns) ;//in ns
7a77a85a 719 FillRawsData(23, BCID, tofRawTime) ;//in ns
724eb92e 720
721 //fill side-related spectra for experts plots
722 Int_t ddlACside=iDDL/36; // 0 or 1
723 Int_t ddlPerSm=iDDL%4;
724
acfd6c93 725 if (volumeID2[0]>4 && volumeID2[0]<14){ //O side
724eb92e 726 if (ddlPerSm<2){ //A side
727 ntof[1]++;
7a77a85a 728 FillRawsData(6, tofRawTime) ;
92664bc8 729 FillRawsData(11, tofRawDatum->GetTOT()*tot2ns) ;
724eb92e 730 } else { //C side
731 ntof[3]++;
7a77a85a 732 FillRawsData(8, tofRawTime) ;
92664bc8 733 FillRawsData(13, tofRawDatum->GetTOT()*tot2ns) ;
724eb92e 734 }
735 } else {
acfd6c93 736 if (volumeID2[0]<5 || volumeID2[0]>13){ //I side
724eb92e 737 if (ddlPerSm<2){ //A side
738 ntof[2]++;
7a77a85a 739 FillRawsData(7, tofRawTime) ;
92664bc8 740 FillRawsData(12, tofRawDatum->GetTOT()*tot2ns) ;
724eb92e 741 } else {//C side
742 ntof[4]++;
7a77a85a 743 FillRawsData(9, tofRawTime) ;
92664bc8 744 FillRawsData(14, tofRawDatum->GetTOT()*tot2ns) ;
724eb92e 745 }
746 }
747 }
748
749 //compute TRM offset
750 Int_t trm= iDDL*10+(equipmentID[1]-3);
7a77a85a 751 FillRawsData(20+ddlACside,trm,tofRawTime);
752 FillRawsData(22,GetStripIndex(volumeID),tofRawTime) ;
724eb92e 753 Short_t fea = volumeID2[4]/12;
754 Float_t hitmapx = volumeID2[0] + ((Double_t)(3 - fea) + 0.5) *0.25;
92664bc8 755 FillRawsData(17,hitmapx,GetStripIndex(volumeID2));
388c1205 756 if (fCalib.IsChannelEnabled(chIndex,kTRUE,kTRUE))//checks also if efficient and if problematic
757 FillRawsData(24,hitmapx,GetStripIndex(volumeID2));
724eb92e 758 }//noise filter
759 }//end hit selection
760 else { //orphans
761 if (!(fCalibData->GetNoiseStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFNoiseBad)
762 && (fCalibData->GetHWStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFHWOk))
7a77a85a 763 FillRawsData(19, tofRawTime) ;//in ns
724eb92e 764 }//end orphans
765 }//end volumeID check
766 }//end equipID check
767 }//end tof check
768 }//loop on raw data
769 clonesRawData->Clear();
770 } // DDL Loop
771
92664bc8 772 for (Int_t j=0;j<5;j++) FillRawsData(j,ntof[j]);
724eb92e 773 fTOFRawStream.Clear();
388c1205 774
775 if ((nFiredMacropad<=fgCutNmaxFiredMacropad)){
776 Float_t deltaPhiMacropad=-999.;
777 Float_t deltaTimeMacropad=-999.;
778 for (Int_t j=0;j<fgCutNmaxFiredMacropad+1; j++){
779 for (Int_t k=j+1;k<fgCutNmaxFiredMacropad+1; k++){
780 if ((macropadPhiTimeUPC[j][0]>0.0)&&(macropadPhiTimeUPC[k][0]>0.0)){
781 deltaPhiMacropad=TMath::Abs(macropadPhiTimeUPC[j][0]-macropadPhiTimeUPC[k][0]);
782 deltaTimeMacropad=TMath::Abs(macropadPhiTimeUPC[j][1]-macropadPhiTimeUPC[k][1]);
783 if (deltaPhiMacropad<=180.)
784 FillRawsData(27, deltaPhiMacropad,deltaTimeMacropad);
785 else
786 FillRawsData(27, TMath::Abs(360.0-deltaPhiMacropad),deltaTimeMacropad);
787 }
788 }
789 }
790 }//end cut on number of fired macropad
724eb92e 791 } else {
792 AliDebug(1,Form("Event of type %d found. Skipping non-physics event for QA.\n", rawReader->GetType()));
793 }
794
795 //fill reference map for DQM shifter only once in a detector cycle
796 if (fIsSOC) {
797 Int_t geoId[5]={-1,-1,-1,-1,-1};// pgeoId=(sm, mod, strip, padZ, padX)
798 Int_t detId[5]={-1,-1,-1,-1,-1};//detID=(ddl,trm,tdc, chain,channel)
799 Int_t trmIndex=-1;
800 for (Int_t ch = 0; ch < fCalibData->GetSize(); ch++) {
801 AliTOFGeometry::GetVolumeIndices(ch,geoId);
802 AliTOFRawStream::Geant2EquipmentId(geoId,detId);
803 if ((detId[1]<0)||(detId[0]<0)) continue;
804 trmIndex=(detId[1]-3)+detId[0]*10;
388c1205 805
724eb92e 806 if ( (!(fCalibData->GetNoiseStatus(ch)==AliTOFChannelOnlineStatusArray::kTOFNoiseBad))
807 && (fCalibData->GetHWStatus(ch) == AliTOFChannelOnlineStatusArray::kTOFHWOk) ){
724eb92e 808 //fill reference map with info from OCDB
809 Short_t fea = geoId[4]/12;
810 Float_t hitmapx = geoId[0] + ((Double_t)(3 - fea) + 0.5)*0.25;
92664bc8 811 FillRawsData(16,hitmapx, GetStripIndex(geoId));
724eb92e 812 }
f63f6d7e 813 }
724eb92e 814 fIsSOC=kFALSE;
815 }
388c1205 816
724eb92e 817 //enable options for DQM shifter
818 EnableDqmShifterOpt(kTRUE);
92664bc8 819 //
820 IncEvCountCycleRaws();
821 IncEvCountTotalRaws();
822 //
44ed7a66 823}
824
44ed7a66 825//____________________________________________________________________________
04236e67 826void AliTOFQADataMakerRec::MakeRecPoints(TTree * clustersTree)
827{
f63f6d7e 828 //
32bd8225 829 // Make data from Clusters
830 //
831
832 Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;
833 Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
724eb92e 834
835 Int_t volumeID2[5];//(sm, plate,strip, padZ,padX)
836 //Int_t volumeID[5];//(sm, plate,strip, padX,padZ)
837
32bd8225 838 TBranch *branch=clustersTree->GetBranch("TOF");
839 if (!branch) {
840 AliError("can't get the branch with the TOF clusters !");
841 return;
842 }
843
844 static TClonesArray dummy("AliTOFcluster",10000);
845 dummy.Clear();
846 TClonesArray *clusters=&dummy;
847 branch->SetAddress(&clusters);
724eb92e 848
32bd8225 849 // Import the tree
850 clustersTree->GetEvent(0);
851
92664bc8 852 FillRecPointsData(0,(Int_t)clusters->GetEntriesFast()) ;
32bd8225 853
854 TIter next(clusters) ;
855 AliTOFcluster * c ;
856 while ( (c = dynamic_cast<AliTOFcluster *>(next())) ) {
857
724eb92e 858 // volumeID2[0] = c->GetDetInd(0);
859 // volumeID2[1] = c->GetDetInd(1);
860 // volumeID2[2] = c->GetDetInd(2);
861 // volumeID2[3] = c->GetDetInd(4); //padX
862 // volumeID2[4] = c->GetDetInd(3); //padZ
32bd8225 863
864 for (Int_t i=0;i<5;i++){
724eb92e 865 volumeID2[i]=c->GetDetInd(i); //X and Z indeces inverted in RecPoints
32bd8225 866 }
724eb92e 867 //Int_t chIndex=AliTOFGeometry::GetIndex(volumeID2);
32bd8225 868 Int_t iDDL=AliTOFRawStream::Geant2DDL(volumeID2);
5f144062 869 Int_t iTRM=AliTOFRawStream::Geant2TRM(volumeID2);
724eb92e 870 Short_t fea = volumeID2[4]/12;
871 Float_t hitmapx = volumeID2[0] + ((Double_t)(3 - fea) + 0.5) *0.25;
872 Int_t ddlACside=iDDL/36; // 0 or 1
873 Int_t ddlPerSm=iDDL%4;
874
875 if ((c->GetTDCRAW()) && (c->GetTDC()) && (c->GetToT())){
876 if (volumeID2[0]>4 && volumeID2[0]<14){ //I side
877 if (ddlPerSm<2){ //A side
92664bc8 878 FillRecPointsData(1, c->GetTDC()*tdc2ns) ;//in ns
879 FillRecPointsData(5, c->GetTDCRAW()*tdc2ns) ;//in ns
880 FillRecPointsData(9, c->GetToT()*tot2ns) ;//in ns
724eb92e 881 } else {//C side
92664bc8 882 FillRecPointsData(3, c->GetTDC()*tdc2ns) ;//in ns
883 FillRecPointsData(7, c->GetTDCRAW()*tdc2ns) ;//in ns
884 FillRecPointsData(11, c->GetToT()*tot2ns) ;//in ns
5f144062 885 }
724eb92e 886 } else {
887 if (volumeID2[0]<5 || volumeID2[0]>13){ //O side
888 if (ddlPerSm<2){ //A side
92664bc8 889 FillRecPointsData(2, c->GetTDC()*tdc2ns) ;//in ns
890 FillRecPointsData(6, c->GetTDCRAW()*tdc2ns) ;//in ns
891 FillRecPointsData(10, c->GetToT()*tot2ns) ;//in ns
724eb92e 892 } else { //C side
92664bc8 893 FillRecPointsData(4, c->GetTDC()*tdc2ns) ;//in ns
894 FillRecPointsData(8, c->GetTDCRAW()*tdc2ns) ;//in ns
895 FillRecPointsData(12, c->GetToT()*tot2ns) ;//in ns
724eb92e 896 }
5f144062 897 }
724eb92e 898 }
92664bc8 899 FillRecPointsData(13,hitmapx,GetStripIndex(volumeID2));
900 FillRecPointsData(14,GetStripIndex(volumeID2), c->GetTDC()*tdc2ns) ;
724eb92e 901 Int_t trm= iDDL*10+(iTRM-3);
902 if (ddlACside==0) { //A side
92664bc8 903 FillRecPointsData(15,trm,c->GetTDC()*tdc2ns);
724eb92e 904 } else {//C side
92664bc8 905 FillRecPointsData(16,trm,c->GetTDC()*tdc2ns);
724eb92e 906 }
5f144062 907 }//hit selection
724eb92e 908 }//end while
5f144062 909 EnableDqmShifterOpt(kFALSE);
92664bc8 910 //
911 IncEvCountCycleRecPoints();
912 IncEvCountTotalRecPoints();
913 //
04236e67 914}
915
916//____________________________________________________________________________
5f144062 917void AliTOFQADataMakerRec::MakeESDs(AliESDEvent * esd)
04236e67 918{
919 //
920 // make QA data from ESDs
921 //
724eb92e 922 const Double_t speedOfLight = TMath::C()*1E2*1E-12; // cm/ps
923 const Double_t pionMass = 0.13957018; //GeV/c^2
5f144062 924
724eb92e 925 Int_t ntrk = esd->GetNumberOfTracks() ;
926 Int_t ntpc=0;
927 Int_t ntofout=0;
7b81681b 928
724eb92e 929 while (ntrk--) {
930 AliESDtrack *track=esd->GetTrack(ntrk);
931 Double_t tofTime=track->GetTOFsignal();//in ps
932 Double_t tofTimeRaw=track->GetTOFsignalRaw();//in ps
933 Double_t tofToT=track->GetTOFsignalToT(); //in ps
934
935 UInt_t status=track->GetStatus();
936 if (track->IsOn(AliESDtrack::kTPCrefit)) {
937 ntpc++;
938 Double_t y=track->Eta();
939 if (TMath::Abs(y)<0.9) { //select TOF acceptance
940 if ((status&AliESDtrack::kTOFout)!=0) { //define matching
941 ntofout++;
92664bc8 942 FillESDsData(1,tofTime*1E-3);
943 FillESDsData(2,tofTimeRaw*1E-3);
944 FillESDsData(3,tofToT*1E-3);
945 FillESDsData(4,track->Pt());
724eb92e 946
947 Double_t length =track->GetIntegratedLength();
948 Double_t mom2=(track->Pt()*track->Pt())+(track->Pz()*track->Pz());
949 Double_t piTexp = TMath::Sqrt(1+(pionMass*pionMass/mom2))*length/speedOfLight; //in ps
92664bc8 950 FillESDsData(8,tofTime-piTexp);
951 FillESDsData(9,length);
724eb92e 952
953 if ((status&AliESDtrack::kTIME)!=0)
92664bc8 954 FillESDsData(5,track->Pt());
724eb92e 955
956 if (tofTime>0)
92664bc8 957 FillESDsData(6,track->Pt());
724eb92e 958 } //end check on matched tracks
959 }
960 }//end check on TPCrefit
5f144062 961 }
962
92664bc8 963 FillESDsData(0,ntofout) ;
5f144062 964 if(ntpc>0){
724eb92e 965 Float_t ratio = (Float_t)ntofout/(Float_t)ntpc*100.; //matching probability
92664bc8 966 FillESDsData(7,ratio) ;
5f144062 967 }
968
969 if(ntofout>0) {
724eb92e 970 Float_t ratio = (Float_t)ntofout/(Float_t)ntpc*100; //matched over propagated to TOF outer radius
92664bc8 971 FillESDsData(8,ratio) ;
5f144062 972 }
973 EnableDqmShifterOpt(kFALSE);
92664bc8 974 //
975 IncEvCountCycleESDs();
976 IncEvCountTotalESDs();
977 //
04236e67 978}
5f144062 979
04236e67 980//____________________________________________________________________________
981void AliTOFQADataMakerRec::StartOfDetectorCycle()
982{
983 //
984 //Detector specific actions at start of cycle
17f2cd01 985 fCalibData = GetCalibData();
724eb92e 986 fIsSOC=kTRUE;
987 return;
988}
04236e67 989
990//____________________________________________________________________________
4e25ac79 991void AliTOFQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
04236e67 992{
993 //Detector specific actions at end of cycle
994 // do the QA checking
92664bc8 995 ResetEventTrigClasses();
996 //
724eb92e 997 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
6f972712 998 if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) continue ;
999 SetEventSpecie(AliRecoParam::ConvertIndex(specie));
1000
92664bc8 1001 for (int itc=-1;itc<GetNTrigClasses();itc++) { // RS: loop over eventual clones per trigger class
6f972712 1002
92664bc8 1003 if (fEnableDqmShifterOpt) {
92664bc8 1004 // RS: fetch the histograms for given trigger class
1005 TObjArray& arrRW = *GetRawsDataOfTrigClass(itc);
1006
1007 // Help make the raw qa histogram easier to interpret for the DQM shifter
1008 if (!arrRW[ 0] || !arrRW[ 5] || !arrRW[10] || !arrRW[15] || !arrRW[16] || !arrRW[17]) continue;
6f972712 1009
92664bc8 1010 printf("=========>Processed %i physics raw of specie %s with TrigGlass %d\n",
1011 GetEvCountCycleRaws(itc),AliRecoParam::GetEventSpecieName(specie), itc);
5f144062 1012
92664bc8 1013 //Double_t monitorPeriodLength=fProcessedRawEventN*600*1E-9;//in s
1014
1015 if (fCalibData){
1016 //set minima and maxima to allow log scale
1017 Double_t yTimeMax = ((TH1*)arrRW[5])->GetMaximum()*1.05;
1018 Double_t yTotMax = ((TH1*)arrRW[10])->GetMaximum()*1.05;
1019 fLineExpTimeMin->SetY2(yTimeMax);
1020 fLineExpTimeMax->SetY2(yTimeMax);
1021 fLineExpTotMin->SetY2(yTotMax);
1022 fLineExpTotMax->SetY2(yTotMax);
1023 //
1024 for (Int_t j=0;j<18;j++){
1025 if ((j==0)||(j==5)||(j==10)||(j==15)||(j==16)||(j==17)) {
1026 TH1* htmp = (TH1*)arrRW[j];
1027 htmp->GetXaxis()->SetLabelOffset(0.005);
1028 htmp->GetXaxis()->SetLabelSize(0.05);
1029 htmp->GetXaxis()->SetTitleOffset(0.8);
1030 htmp->GetXaxis()->SetTitleSize(0.05);
1031 htmp->GetYaxis()->SetLabelOffset(0.005);
1032 htmp->GetYaxis()->SetLabelSize(0.06);
1033 htmp->GetYaxis()->SetTitleOffset(0.8);
1034 htmp->GetYaxis()->SetTitleSize(0.06);
1035 }
724eb92e 1036 }
92664bc8 1037 //make up for all histos
1038 for(Int_t j=0;j<5;j++) {
1039 TH1* htmp = (TH1*)arrRW[j];
1040 if (!htmp) continue;
1041 htmp->SetMarkerColor(kBlue);
1042 htmp->SetMarkerStyle(8);
1043 htmp->SetMarkerSize(0.7);
1044 }
1045 for(Int_t j=5;j<15;j++) {
1046 TH1* htmp = (TH1*)arrRW[j];
1047 if (!htmp) continue;
1048 htmp->SetLineColor(kBlue);
1049 htmp->SetLineWidth(1);
1050 htmp->SetMarkerColor(kBlue);
92664bc8 1051 }
6f972712 1052
92664bc8 1053 TH1* htmp = (TH1*)arrRW[15];
1054 htmp->SetLineColor(kBlue);
1055 htmp->SetLineWidth(1);
1056 htmp->SetMarkerStyle(8);
1057 htmp->SetMarkerSize(0.7);
1058 htmp->SetMarkerColor(kBlue);//Option("bar");
1059 //
388c1205 1060 TString title25 = Form("Map of hit pads according to CTTM numbering (Max Fired Macropad = %i)",fgCutNmaxFiredMacropad);
1061 TString title26 = Form("Map of hit macropads according to CTTM numbering (Max Fired Macropad = %i)",fgCutNmaxFiredMacropad);
1062 TString title27 = Form("#Deltat vs #Delta#Phi of hit macropads (Max Fired Macropad = %i)",fgCutNmaxFiredMacropad);
1063
92664bc8 1064 if ( (htmp=(TH1*)arrRW[16]) ) htmp->SetOption("colz");
1065 if ( (htmp=(TH1*)arrRW[17]) ) htmp->SetOption("colz");
1066 if ( (htmp=(TH1*)arrRW[18]) ) htmp->SetOption("colz");
388c1205 1067 if ( (htmp=(TH1*)arrRW[22]) ) htmp->SetOption("colz");
1068 if ( (htmp=(TH1*)arrRW[23]) ) htmp->SetOption("colz");
1069 if ( (htmp=(TH1*)arrRW[24]) ) htmp->SetOption("colz");
7a77a85a 1070 if ( (htmp=(TH1*)arrRW[28]) ) htmp->SetOption("colz");
1071 if ( (htmp=(TH1*)arrRW[29]) ) htmp->SetOption("colz");
1072
388c1205 1073 if ( (htmp=(TH1*)arrRW[25]) ) {
1074 htmp->SetOption("colz");
1075 htmp->SetTitle(title25.Data());
1076 }
1077 if ( (htmp=(TH1*)arrRW[26]) ) {
1078 htmp->SetOption("colz");
1079 htmp->SetTitle(title26.Data());
1080 }
1081 if ( (htmp=(TH1*)arrRW[27]) ){
1082 htmp->SetOption("colz");
1083 htmp->SetTitle(title27.Data());
1084 }
ba5613e3 1085 }
92664bc8 1086 }//END ENABLE DQM SHIFTER OPT
1087 } // RS: loop over trigger classes
724eb92e 1088 } //end for
92664bc8 1089 //
724eb92e 1090 AliQAChecker::Instance()->Run(AliQAv1::kTOF, task, list) ;
92664bc8 1091 //
04236e67 1092}
1093//____________________________________________________________________________
32bd8225 1094void AliTOFQADataMakerRec::GetMapIndeces(const Int_t* const in , Int_t* out)
04236e67 1095{
1096 //
1097 //return appropriate indeces for the theta-phi map
1098 //
1099
1100 Int_t npadX = AliTOFGeometry::NpadX();
1101 Int_t npadZ = AliTOFGeometry::NpadZ();
1102 Int_t nStripA = AliTOFGeometry::NStripA();
1103 Int_t nStripB = AliTOFGeometry::NStripB();
1104 Int_t nStripC = AliTOFGeometry::NStripC();
1105
1106 Int_t isector = in[0];
1107 Int_t iplate = in[1];
1108 Int_t istrip = in[2];
1109 Int_t ipadX = in[3];
1110 Int_t ipadZ = in[4];
1111
1112 Int_t stripOffset = 0;
1113 switch (iplate) {
1114 case 0:
1115 stripOffset = 0;
1116 break;
1117 case 1:
1118 stripOffset = nStripC;
1119 break;
1120 case 2:
1121 stripOffset = nStripC+nStripB;
1122 break;
1123 case 3:
1124 stripOffset = nStripC+nStripB+nStripA;
1125 break;
1126 case 4:
1127 stripOffset = nStripC+nStripB+nStripA+nStripB;
1128 break;
1129 default:
17f2cd01 1130 AliDebug(1,Form("Wrong plate number in TOF (%d) !",iplate));
04236e67 1131 break;
1132 };
1133 Int_t zindex=npadZ*(istrip+stripOffset)+(ipadZ+1);
1134 Int_t phiindex=npadX*isector+ipadX+1;
1135 out[0]=zindex;
1136 out[1]=phiindex;
1137
5f144062 1138}
1139
1140//---------------------------------------------------------------
1141Int_t AliTOFQADataMakerRec::GetStripIndex(const Int_t * const in)
1142{
1143 /* return tof strip index between 0 and 91 */
1144
1145 Int_t nStripA = AliTOFGeometry::NStripA();
1146 Int_t nStripB = AliTOFGeometry::NStripB();
1147 Int_t nStripC = AliTOFGeometry::NStripC();
1148
1149 // Int_t isector = in[0];
1150 Int_t iplate = in[1];
1151 Int_t istrip = in[2];
1152 //Int_t ipadX = in[3];
1153 //Int_t ipadZ = in[4];
1154
1155 Int_t stripOffset = 0;
1156 switch (iplate) {
1157 case 0:
1158 stripOffset = 0;
1159 break;
1160 case 1:
1161 stripOffset = nStripC;
1162 break;
1163 case 2:
1164 stripOffset = nStripC+nStripB;
1165 break;
1166 case 3:
1167 stripOffset = nStripC+nStripB+nStripA;
1168 break;
1169 case 4:
1170 stripOffset = nStripC+nStripB+nStripA+nStripB;
1171 break;
1172 default:
1173 AliDebug(1,Form("Wrong plate number in TOF (%d) !",iplate));
1174 stripOffset=-1;
1175 break;
1176 };
1177
1178 if (stripOffset<0 || stripOffset>92) return -1;
1179 else
1180 return (stripOffset+istrip);
1181
04236e67 1182}
17f2cd01 1183//---------------------------------------------------------------
32bd8225 1184Bool_t AliTOFQADataMakerRec::CheckVolumeID(const Int_t * const volumeID)
17f2cd01 1185{
32bd8225 1186 //
1187 //Checks volume ID validity
388c1205 1188 //
17f2cd01 1189 for (Int_t j=0;j<5;j++){
1190 if (volumeID[j]<0) {
1191 AliDebug(1,Form("Invalid detector volume index for volumeID[%i]",j));
1192 return kFALSE;
1193 }
1194 }
388c1205 1195 return kTRUE;
17f2cd01 1196}
1197
1198//---------------------------------------------------------------
32bd8225 1199Bool_t AliTOFQADataMakerRec::CheckEquipID(const Int_t * const equipmentID)
17f2cd01 1200{
32bd8225 1201 //
388c1205 1202 //Checks equipment ID validity
17f2cd01 1203 for (Int_t j=0;j<5;j++){
1204 if (equipmentID[j]<0) {
17f2cd01 1205 AliDebug(1,Form("Invalid equipment volume index for equipmentID[%i]",j));
1206 return kFALSE;
1207 }
1208 }
1209 return kTRUE;
1210}
32bd8225 1211//---------------------------------------------------------------
1212Bool_t AliTOFQADataMakerRec::FilterLTMData(const Int_t * const equipmentID) const
1213{
1214 /*It returns kTRUE if data come from LTM.
5f144062 1215 It thus filters trigger-related signals */
32bd8225 1216
1217 Int_t ddl, trm, tdc;
1218 //if (!CheckEquipID(equipmentID)) return kFALSE;
1219 ddl = equipmentID[0];
1220 trm = equipmentID[1];
1221 tdc = equipmentID[3];
1222
1223 if ((ddl%2==1) && (trm==3) && (tdc>11 && tdc<15))
1224 return kTRUE;
1225 else
1226 return kFALSE;
1227
1228}
1229//---------------------------------------------------------------
1230Bool_t AliTOFQADataMakerRec::FilterSpare(const Int_t * const equipmentID) const
1231{
1232 /*It returns kTRUE if data come from spare
1233 equipment ID.
1234 So far only check on TRM 3 crate left is implemented */
1235
1236 Int_t ddl, trm, tdc;
1237 //if (!CheckEquipID(equipmentID)) return kFALSE;
1238 ddl = equipmentID[0];
1239 trm = equipmentID[1];
1240 tdc = equipmentID[3];
1241
1242 if ((ddl%2==1) && (trm==3) && (tdc>2 && tdc<12))
1243 return kTRUE;
1244 else
1245 return kFALSE;
32bd8225 1246}
388c1205 1247
1248//-----------------------------------------------------------------------------
1249void AliTOFQADataMakerRec::GetGeo2LTMIndex(const Int_t * const detind, Int_t *indexLTM) {
1250 //
1251 // getting LTMmatrix indexes for current digit
1252 //
1253 Int_t stripId=GetStripIndex(detind);
1254
1255 if (detind[1]==0 || detind[1]==1 || (detind[1]==2 && detind[2]<=7)) { //A side
1256 if (detind[4]<24){ //R
1257 indexLTM[0] = detind[0]*2;
1258 } else { //L
1259 indexLTM[0] = detind[0]*2+1;
1260 }
1261 indexLTM[1]=stripId;
1262
1263 } else { //C side
1264 if (detind[4]<24){
1265 indexLTM[0] = detind[0]*2+36;
1266 } else {
1267 indexLTM[0] = (detind[0]*2+1)+36;
1268 }
1269 indexLTM[1]=90-stripId;
1270 }
1271
1272 // if (indexLTM[0]<36) { //A side
1273 // if (detind[1] ==0){
1274 // indexLTM[1] = detind[2];
1275 // }
1276 // else if (detind[1] ==1){
1277 // indexLTM[1] = detind[2]+nStripB;
1278 // }
1279 // else if (detind[1] ==2){
1280 // indexLTM[1] = detind[2]+19*2;
1281 // }
1282 // else{
1283 // AliError("Smth Wrong!!!");
1284 // }
1285 // }
1286 // else { //C side
1287 // if (detind[1]==2){
1288 // if (detind[4]<24)
1289 // indexLTM[1] = (nStripAL-detind[2])+nStripC+nStripB;
1290 // else
1291 // indexLTM[1] = (nStripAR-detind[2])+nStripC+nStripB;
1292 // }
1293 // else if (detind[1] ==3){
1294 // indexLTM[1] = (nStripB-detind[2])+nStripC;
1295 // }
1296 // else if (detind[1] ==4){
1297 // indexLTM[1] = nStripC-detind[2];
1298 // }
1299 // else{
1300 // AliError("Smth Wrong!!!");
1301 // }
1302 // }
1303}
1304
1305//-----------------------------------------------------------------------------
1306void AliTOFQADataMakerRec::GetGeo2CTTMIndex(Int_t *detind, Int_t *indexCTTM) {
1307 //
1308 // Returns CTTM index corresponding to the detector element detind
1309 //
1310 GetGeo2LTMIndex(detind,indexCTTM);
1311 indexCTTM[1]/=2;
1312 return;
1313}
1314
1315//-------------------------------------------------------------------------
1316Int_t AliTOFQADataMakerRec::GetNumberOfFiredMacropad(AliRawReader * rawReader){
1317
1318 Int_t nFired=0;
1319 TClonesArray * clonesRawData;
1320 if (!rawReader) return 0;
1321 for (Int_t iDDL = 0; iDDL < AliTOFGeometry::NDDL()*AliTOFGeometry::NSectors(); iDDL++){
1322 rawReader->Reset();
1323 fTOFRawStream.LoadRawDataBuffersV2(iDDL);
1324 clonesRawData = (TClonesArray*)fTOFRawStream.GetRawData();
1325 for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
1326 AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
1327 if (tofRawDatum->GetTOF()){
1328 if ( (tofRawDatum->GetTRM()==3)&&
1329 (tofRawDatum->GetTDC()>11)&&
1330 (tofRawDatum->GetTDC()<15)) {
1331 nFired+=1;
1332 }
1333 }
1334 }
1335 }//loop over DDLs
1336 return nFired;
1337}
1338
724eb92e 1339//----------------------------------------------------------------
388c1205 1340void AliTOFQADataMakerRec::GetCTTMIndex(Int_t *equipid, Int_t *indexCTTM) {
1341 //
1342 // Returns CTTM index corresponding to the equipment id equipid, only for LTM hits
1343 // equipid = (crate, trm, chain, tdc, channel)
1344
1345 if ( (equipid[1]!=3)||(equipid[3]<12) ){
1346 indexCTTM[0]=-1;
1347 indexCTTM[1]=-1;
1348 return;
1349 }
1350 Int_t modStrip2LTM[3][8]={ { 0, 1, 2, 3, 4, 5, 6, 7},
1351 { 8, 9, 10, 11, 12, 13, 14, 15},
1352 {16, 17, 18, 19, 20, 21, 22, 23}
1353 };
1354
1355 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,
1356 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};
1357
1358 Int_t itdc=equipid[3]%12;
1359 Int_t crate=-1;
1360 if (equipid[2]==0)
1361 crate=equipid[0]-1;
1362 else crate=equipid[0];
1363
1364 indexCTTM[0]=DDL2LTMmatrix[crate];
1365 indexCTTM[1]=modStrip2LTM[itdc][equipid[4]];
1366 return;
1367}
1368
1369//_____________________________________________________________________________
1370void AliTOFQADataMakerRec::ReadHistogramRangeFromFile(const Char_t * filename)
724eb92e 1371{
388c1205 1372 //
1373 // read histogram ranges from configuration file
1374 //
1375 if (!filename) {
1376 AliInfo("Config file with histograms ranges not found or invalid -> use default values.");
1377 SetDefaultHistogramRange();
1378 SetDefaultCutNmaxFiredMacropad();
1379 return;
1380 }
1381
6caee44e 1382 std::fstream configFile;
1383 configFile.open(filename, std::fstream::in);
1384 if (!configFile.is_open()){
388c1205 1385 AliInfo("Cannot open config file with histograms ranges -> use default values.");
1386 SetDefaultHistogramRange();
1387 return;
1388 }
1389
6caee44e 1390 //check file size
1391 Int_t begin = configFile.tellg();
1392 configFile.seekg(0, std::fstream::end); /* end */
1393 Int_t end = configFile.tellg();
1394 Int_t size = end - begin;
1395 configFile.seekg(0, std::fstream::beg); /* rewind file */
1396 if (size <= 0){
1397 AliInfo(Form("Unexpected EOF of config file with histograms ranges. File size: %d -> use default values", size));
388c1205 1398 SetDefaultHistogramRange();
1399 return;
1400 }
1401
1402 Int_t minMulti=9999, maxMulti=-9999;
1403 Int_t nbinsMulti=0,nbinsTime=0;
1404 Float_t minTime=9999.0, maxTime=-9999.0;
1405 Int_t cutFiredMacropad=0;
6caee44e 1406 TString endoflist;
1407 while (!configFile.eof()) {
1408 configFile >> cutFiredMacropad >> minMulti >> maxMulti >> minTime >> maxTime;
1409 configFile >> endoflist;
1410 if (endoflist.Contains("end")) break;
1411 }
388c1205 1412
388c1205 1413 //set multiplicity histo ranges
1414 if (minMulti>maxMulti){
6caee44e 1415 AliInfo("Invalid range for multiplicity histogram set. Changing to default values.");
388c1205 1416 SetDefaultMultiHistogramRange();
1417 } else {
1418 nbinsMulti = maxMulti-minMulti;
1419 SetNbinsMultiplicityHisto(nbinsMulti);
1420 SetMultiplicityHistoRange(minMulti,maxMulti);
6caee44e 1421 //AliInfo(Form("Setting multiplicity histogram ranges to: multMin = %i - multMax = %i - nMultBins = %i", fgRangeMinMultiplicity, fgRangeMaxMultiplicity, fgNbinsMultiplicity));
388c1205 1422 }
1423
1424 //set time histo ranges
1425 if (minTime>maxTime){
6caee44e 1426 AliInfo("Invalid range for time histogram set. Changing to default values.");
388c1205 1427 SetDefaultTimeHistogramRange();
1428 } else {
484fd68b 1429 nbinsTime = TMath::Nint((maxTime - minTime)/fgkNbinsWidthTime);//ns
388c1205 1430 maxTime=minTime+nbinsTime*fgkNbinsWidthTime;//ns
1431 SetNbinsTimeHisto(nbinsTime);
1432 SetTimeHistoRange(minTime,maxTime);
6caee44e 1433 //AliInfo(Form("Setting time histogram ranges to: timeMin = %5.2f ns - timeMax = %5.2f ns - nTimeBins = %i", fgRangeMinTime, fgRangeMaxTime,fgNbinsTime));
388c1205 1434 }
1435
1436 if ((cutFiredMacropad>0)&&(cutFiredMacropad<fgkFiredMacropadLimit)){
1437 AliInfo("Invalid value for cut on fired macropad. Changing to default values.");
1438 SetDefaultCutNmaxFiredMacropad();
1439 } else {
1440 SetCutNmaxFiredMacropad(cutFiredMacropad);
6caee44e 1441 //AliInfo(Form("Setting cut on fired macropad to: = %i",cutFiredMacropad));
724eb92e 1442 }
6caee44e 1443 AliInfo(Form("Setting: multMin = %i - multMax = %i - nMultBins = %i, timeMin = %5.2f ns - timeMax = %5.2f ns - nTimeBins = %i, cutMaxFiredMacropad = %i",
1444 fgRangeMinMultiplicity, fgRangeMaxMultiplicity, fgNbinsMultiplicity, fgRangeMinTime, fgRangeMaxTime,fgNbinsTime, cutFiredMacropad));
1445 configFile.close();
388c1205 1446 return;
1447}
1448
1449//_____________________________________________________________________________
1450void AliTOFQADataMakerRec::SetDefaultHistogramRange()
1451{
1452 //
1453 // set default histogram ranges (tuned on 2011 pp collisions)
1454 //
1455 AliInfo("Setting all histogram ranges to default values.");
1456 SetDefaultMultiHistogramRange();
1457 SetDefaultTimeHistogramRange();
1458 SetDefaultCutNmaxFiredMacropad();
724eb92e 1459 return;
388c1205 1460}
1461
1462//_____________________________________________________________________________
1463void AliTOFQADataMakerRec::SetDefaultMultiHistogramRange()
1464{
1465 //
1466 // set default histogram ranges (tuned on 2011 pp collisions)
1467 //
1468 SetMultiplicityHistoRange (0, 200);
1469 SetNbinsMultiplicityHisto(200);
1470 AliInfo("Setting Multiplicity histogram ranges to default values.");
1471 AliInfo(Form("multMin = %i - multMax = %i - nMultBins = %i",
1472 fgRangeMinMultiplicity, fgRangeMaxMultiplicity, fgNbinsMultiplicity));
1473 return;
1474}
1475
1476//_____________________________________________________________________________
1477void AliTOFQADataMakerRec::SetDefaultTimeHistogramRange()
1478{
1479 //
1480 // set default histogram ranges (tuned on 2011 pp collisions)
1481 //
1482 SetNbinsTimeHisto(250);
1483 SetTimeHistoRange (0.0,610.);
724eb92e 1484
388c1205 1485 AliInfo("Setting Time histogram ranges to default values:");
1486 AliInfo(Form("timeMin = %5.2f ns - timeMax = %5.2f ns - nTimeBins = %i",
1487 fgRangeMinTime, fgRangeMaxTime,fgNbinsTime));
1488 return;
1489}
1490
1491//------------------------------------------------------------------
1492void AliTOFQADataMakerRec::SetDefaultCutNmaxFiredMacropad()
1493{
1494 //
1495 // set default cut on fired macropad
1496 //
1497 SetCutNmaxFiredMacropad(5);
1498 AliInfo(Form("Setting cut on fired macropad to default values: NfiredMacropad = %i", fgCutNmaxFiredMacropad));
1499 return;
724eb92e 1500}