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