First implementation of EMCAL trigger QA from Nicola Arbor
[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/*
6f972712 25Modified by fbellini & rshanoian on 06/07/2011
26- changes for trigger classes implementation
27- fRunNumber added as private member
28- added time vs BCID plot
29
724eb92e 30Modified by fbellini on 18/01/2011
31- reduced histo binning to reduce size
32- added decoding errors plot
33- added channel maps and options for DQM shifters
34- new list of recPoints and ESDs plots
35- removed hTrmChannels035 and hTrmChannels3671
36
37 Modified by bvonhall on 03/11/2010
dce30a9d 38 - modified declaration of hTrmChannels035 and hTrmChannels3671 in EndOfDetectorCycle()
39 to prevent memory corruption
40
724eb92e 41 Modified by adecaro on 18/10/2010
e648d82d 42 - fTOFRawStream object set as private member
43
724eb92e 44Modified by fbellini on 13/09/2010
ea8ae424 45 - Set TLines as private members
46 - Set image flag for expert histos
47
724eb92e 48Modified by fbellini on 14/06/2010
5b4ed716 49 - Updated plots
50 - use LoadRawDataBuffersV2()
51
fc71ba02 52 Modified by fbellini on 10/05/2010
53 - Fixed EndOfDetectorCycle() memory corruption bug
54
55 Modified by fbellini on 22/04/2010
f63f6d7e 56 - Added filter for physics events
57
58 Modified by fbellini on 16/04/2010
5f144062 59 - Added EnableDqmShifterOpt()
60 - Modified EndOfDetectorCycle() with options for DQM
61 - Updated ESDs QA
62
63 Modified by fbellini on 30/03/2010
64 - Changed raws time histos range to 610ns
65 - Added FilterLTMData() and FilterSpare() methods
66 - Added check on enabled channels for raw data
67 - Updated RecPoints QA
68
69 Modified by fbellini on 02/03/2010
70 - Fixed raw data decoding methods (use AliTOFRawStream::LoadRawDataBuffer())
71 - Added filter for noisy channels and read map from OCDB
72 - Added GetCalibData() method
73 - Added CheckVolumeID() and CheckEquipID() methods
74 - Updated Raw QA
32bd8225 75*/
76
04236e67 77#include <TClonesArray.h>
04236e67 78#include <TH1F.h>
79#include <TH2F.h>
5f144062 80#include <TLine.h>
724eb92e 81#include <TPaveText.h>
32bd8225 82
17f2cd01 83#include "AliCDBManager.h"
17f2cd01 84#include "AliCDBEntry.h"
04236e67 85#include "AliESDEvent.h"
86#include "AliESDtrack.h"
04236e67 87#include "AliQAChecker.h"
88#include "AliRawReader.h"
32bd8225 89#include "AliTOFRawStream.h"
5c7c93fa 90#include "AliTOFcluster.h"
91#include "AliTOFQADataMakerRec.h"
04236e67 92#include "AliTOFrawData.h"
5c7c93fa 93#include "AliTOFGeometry.h"
17f2cd01 94#include "AliTOFChannelOnlineStatusArray.h"
724eb92e 95#include "AliTOFDecoderSummaryData.h"
96#include "AliTOFDecoderV2.h"
dce30a9d 97
04236e67 98ClassImp(AliTOFQADataMakerRec)
99
100//____________________________________________________________________________
101 AliTOFQADataMakerRec::AliTOFQADataMakerRec() :
17f2cd01 102 AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kTOF), "TOF Quality Assurance Data Maker"),
103 fCalibData(0x0),
5f144062 104 fEnableNoiseFiltering(kFALSE),
e648d82d 105 fEnableDqmShifterOpt(kFALSE),
92664bc8 106// fProcessedRawEventN(0),
724eb92e 107 fIsSOC(kFALSE),
e648d82d 108 fLineExpTimeMin(new TLine(200., 0., 200., 0.)),
109 fLineExpTimeMax(new TLine(250., 0., 250., 0.)),
110 fLineExpTotMin(new TLine(5., 0., 5., 0.)),
111 fLineExpTotMax(new TLine(20., 0., 20., 0.)),
724eb92e 112 fTOFRawStream(AliTOFRawStream()),
6f972712 113 fDecoderSummary(0),
114 fRunNumber(-1)
04236e67 115{
116 //
117 // ctor
724eb92e 118 //
119 for (Int_t sm=0;sm<17;sm++){
120 fLineSMid[sm] = new TLine( sm+1, 0., sm+1, 91.);
ea8ae424 121 }
724eb92e 122 //initialize all TRM counters to -1 i.e. invalid value
123 // for (Int_t trm=0;trm<720;trm++){
124 // fTRMNoisyArray[trm]=-1;
125 // fTRMHwOkArray[trm]=-1;
126 // fTRMEnabledArray[trm]=-1;
127 // }
128
04236e67 129}
130
131//____________________________________________________________________________
132AliTOFQADataMakerRec::AliTOFQADataMakerRec(const AliTOFQADataMakerRec& qadm) :
17f2cd01 133 AliQADataMakerRec(),
134 fCalibData(qadm.fCalibData),
5f144062 135 fEnableNoiseFiltering(qadm.fEnableNoiseFiltering),
136 fEnableDqmShifterOpt(qadm.fEnableDqmShifterOpt),
92664bc8 137 // fProcessedRawEventN(qadm.fProcessedRawEventN),
724eb92e 138 fIsSOC(qadm.fIsSOC),
ea8ae424 139 fLineExpTimeMin(qadm.fLineExpTimeMin),
140 fLineExpTimeMax(qadm.fLineExpTimeMax),
141 fLineExpTotMin(qadm.fLineExpTotMin),
97430dfe 142 fLineExpTotMax(qadm.fLineExpTotMax),
724eb92e 143 fTOFRawStream(qadm.fTOFRawStream),
6f972712 144 fDecoderSummary(qadm.fDecoderSummary),
145 fRunNumber(qadm.fRunNumber)
04236e67 146{
147 //
148 //copy ctor
149 //
150 SetName((const char*)qadm.GetName()) ;
151 SetTitle((const char*)qadm.GetTitle());
ea8ae424 152
724eb92e 153 for (Int_t sm=0;sm<17;sm++){
154 fLineSMid[sm]=qadm.fLineSMid[sm];
ea8ae424 155 }
724eb92e 156
157 // for (Int_t trm=0;trm<10;trm++){
158 // fTRMNoisyArray[trm]=qadm.fTRMNoisyArray[trm];
159 // fTRMHwOkArray[trm]=qadm.fTRMHwOkArray[trm];
160 // fTRMEnabledArray[trm]=qadm.fTRMEnabledArray[trm];
161 // }
162
04236e67 163}
164
165//__________________________________________________________________
166AliTOFQADataMakerRec& AliTOFQADataMakerRec::operator = (const AliTOFQADataMakerRec& qadm )
167{
168 //
169 // assignment operator.
170 //
171 this->~AliTOFQADataMakerRec();
172 new(this) AliTOFQADataMakerRec(qadm);
173 return *this;
174}
175
17f2cd01 176//----------------------------------------------------------------------------
97430dfe 177AliTOFQADataMakerRec::~AliTOFQADataMakerRec()
178{
6f972712 179 //destructor
97430dfe 180 fTOFRawStream.Clear();
6f972712 181 if (fLineExpTimeMin)
182 delete fLineExpTimeMin;
183 if (fLineExpTimeMax)
184 delete fLineExpTimeMax;
185 if (fLineExpTotMin)
186 delete fLineExpTotMin;
187 if (fLineExpTotMax)
188 delete fLineExpTotMax;
e648d82d 189 for (Int_t sm=0;sm<10;sm++){
6f972712 190 if (fLineSMid[sm])
191 delete fLineSMid[sm];
724eb92e 192 }
97430dfe 193}
194//----------------------------------------------------------------------------
6f972712 195AliTOFChannelOnlineStatusArray* AliTOFQADataMakerRec::GetCalibData()
17f2cd01 196{
32bd8225 197 //
198 // Retrive TOF calib objects from OCDB
199 //
724eb92e 200 AliCDBManager *man = AliCDBManager::Instance();
201 AliCDBEntry *cdbe=0;
6f972712 202
203 if (fRun<=0) fRunNumber=145288; //reference run from LHC11a
204 else fRunNumber=fRun;
205
206 if (man->GetRun()!=fRunNumber){
207 fRunNumber=man->GetRun();
208 AliWarning(Form("Run number mismatch found: setting it to value from current AliCDBManager instance = %i", fRunNumber));
209 }
210 cdbe = man->Get("TOF/Calib/Status",fRunNumber);
724eb92e 211
724eb92e 212 if(!cdbe){
6f972712 213 // for DQM online
214 AliWarning("Load of calibration data from default (alien://) storage failed!");
215 printf("Calibration data will be loaded from local storage - ok if on DQM station!");
216 man->SetDefaultStorage("local:///local/cdb/");
17f2cd01 217 cdbe = man->Get("TOF/Calib/Status",fRun);
6f972712 218
219 if(!cdbe){
220 AliWarning("Load of calibration data from local DQM machine storage failed!");
221 AliWarning("Calibration data will be loaded from local ($ALICE_ROOT) storage ");
222 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
223 cdbe = man->Get("TOF/Calib/Status",fRunNumber);
224 }
724eb92e 225 }
226 // Retrieval of data in directory TOF/Calib/Data:
724eb92e 227 AliTOFChannelOnlineStatusArray * array = 0;
8a9430fc 228 if (cdbe) {
229 printf("======= OCDB object for TOF retrieved from run %i in %s\n",fRunNumber,cdbe->GetName());
230 array = (AliTOFChannelOnlineStatusArray *)cdbe->GetObject();
231 }
724eb92e 232 if (!array) AliFatal("No calibration data from calibration database !");
233
234 return array;
17f2cd01 235}
236
04236e67 237//____________________________________________________________________________
238void AliTOFQADataMakerRec::InitRaws()
239{
240 //
241 // create Raws histograms in Raws subdir
242 //
7d297381 243 const Bool_t expert = kTRUE ;
244 const Bool_t saveCorr = kTRUE ;
245 const Bool_t image = kTRUE ;
04236e67 246
724eb92e 247 TH1I * h0 = new TH1I("hTOFRaws", "TOF raw hit multiplicity; TOF raw hits number; Events ",200, 0, 200) ;
5f144062 248
724eb92e 249 TH1I * h1 = new TH1I("hTOFRawsIA", "TOF raw hit multiplicity - I/A side; TOF raw hits number ;Events ",200, 0, 200) ;
250 TH1I * h2 = new TH1I("hTOFRawsOA", "TOF raw hit multiplicity - O/A side; TOF raw hits number ;Events ",200, 0, 200) ;
251 TH1I * h3 = new TH1I("hTOFRawsIC", "TOF raw hit multiplicity - I/C side; TOF raw hits number ;Events ",200, 0, 200) ;
252 TH1I * h4 = new TH1I("hTOFRawsOC", "TOF raw hit multiplicity - O/C side; TOF raw hits number ;Events ",200, 0, 200) ;
5f144062 253
724eb92e 254 TH1F * h5 = new TH1F("hTOFRawsTime", "TOF Raws - Hit time (ns);Measured Hit time [ns];Hits", 250,0. ,610.) ;
255 TH1F * h6 = new TH1F("hTOFRawsTimeIA", "TOF Raws - Hit time (ns) - I/A side;Measured Hit time [ns];Hits", 250,0. ,610.) ;
256 TH1F * h7 = new TH1F("hTOFRawsTimeOA", "TOF Raws - Hit time (ns) - O/A side;Measured Hit time [ns];Hits", 250,0. ,610.) ;
257 TH1F * h8 = new TH1F("hTOFRawsTimeIC", "TOF Raws - Hit time (ns) - I/C side;Measured Hit time [ns];Hits", 250,0. ,610.) ;
258 TH1F * h9 = new TH1F("hTOFRawsTimeOC", "TOF Raws - Hit time (ns) - O/C side;Measured Hit time [ns];Hits", 250,0. ,610.) ;
259
260 TH1F * h10 = new TH1F("hTOFRawsToT", "TOF Raws - Hit ToT (ns);Measured Hit ToT (ns);Hits", 100, 0., 48.8) ;
261
262 TH1F * h11 = new TH1F("hTOFRawsToTIA", "TOF Raws - Hit ToT (ns) - I/A side;Measured Hit ToT (ns);Hits", 100, 0., 48.8) ;
263 TH1F * h12 = new TH1F("hTOFRawsToTOA", "TOF Raws - Hit ToT (ns) - O/A side;Measured Hit ToT (ns);Hits", 100, 0., 48.8) ;
264 TH1F * h13 = new TH1F("hTOFRawsToTIC", "TOF Raws - Hit ToT (ns) - I/C side;Measured Hit ToT (ns);Hits", 100, 0., 48.8) ;
265 TH1F * h14 = new TH1F("hTOFRawsToTOC", "TOF Raws - Hit ToT (ns) - O/C side;Measured Hit ToT (ns);Hits", 100, 0., 48.8) ;
266
5b4ed716 267 TH1F * h15 = new TH1F("hTOFRawsLTMHits", "LTMs OR signals; Crate; Counts", 72, 0., 72.);
724eb92e 268 TH2F * h16 = new TH2F("hTOFrefMap", "TOF enabled channel reference map;sector;strip", 72, 0., 18., 91, 0., 91.);
269 TH2F * h17 = new TH2F("hTOFRawHitMap","TOF raw hit map;sector;strip", 72, 0., 18., 91, 0., 91.);
270 TH2I * h18 = new TH2I("hTOFDecodingErrors","Decoding error monitoring; DDL; Error ", 72, 0, 72, 13,1,14);
32bd8225 271
724eb92e 272 h18->GetYaxis()->SetBinLabel(1,"DRM ");
273 h18->GetYaxis()->SetBinLabel(2,"LTM ");
274 h18->GetYaxis()->SetBinLabel(3,"TRM 3 ");
275 h18->GetYaxis()->SetBinLabel(4,"TRM 4");
276 h18->GetYaxis()->SetBinLabel(5,"TRM 5");
277 h18->GetYaxis()->SetBinLabel(6,"TRM 6");
278 h18->GetYaxis()->SetBinLabel(7,"TRM 7");
279 h18->GetYaxis()->SetBinLabel(8,"TRM 8");
280 h18->GetYaxis()->SetBinLabel(9,"TRM 9");
281 h18->GetYaxis()->SetBinLabel(10,"TRM 10");
282 h18->GetYaxis()->SetBinLabel(11,"TRM 11");
283 h18->GetYaxis()->SetBinLabel(12,"TRM 12");
284 h18->GetYaxis()->SetBinLabel(13,"recovered");
32bd8225 285
724eb92e 286 TH1F * h19 = new TH1F("hTOFOrphansTime", "TOF Raws - Orphans time (ns);Measured Hit time [ns];Hits", 250, 0. ,610.) ;
5f144062 287 TH2F * h20 = new TH2F("hTOFRawTimeVsTRM035", "TOF raws - Hit time vs TRM - crates 0 to 35; TRM index = DDL*10+TRM(0-9);TOF raw time [ns]", 361, 0., 361., 250, 0., 610.0) ;
ba5613e3 288 TH2F * h21 = new TH2F("hTOFRawTimeVsTRM3671", "TOF raws - Hit time vs TRM - crates 36 to 72; TRM index = DDL**10+TRM(0-9);TOF raw time [ns]", 361, 360., 721., 250, 0., 610.0) ;
724eb92e 289 TH2F * h22 = new TH2F("hTOFTimeVsStrip","TOF Raws - Hit time vs. strip (theta); Strip index;Raws TOF time (ns) ", 91,0.,91, 250, 0., 610.) ;
6f972712 290 TH2F * h23 = new TH2F("hTOFtimeVsBCID","TOF time vs BCID; BCID; time (ns) ", 3564, 0., 3564., 250,0.,610);
291
5f144062 292 h0->Sumw2() ;
293 h1->Sumw2() ;
294 h2->Sumw2() ;
295 h3->Sumw2() ;
296 h4->Sumw2() ;
724eb92e 297 // h5->Sumw2() ;
5f144062 298 h6->Sumw2() ;
299 h7->Sumw2() ;
300 h8->Sumw2() ;
301 h9->Sumw2() ;
724eb92e 302 // h10->Sumw2() ;
5f144062 303 h11->Sumw2() ;
304 h12->Sumw2() ;
305 h13->Sumw2() ;
306 h14->Sumw2() ;
307 h15->Sumw2() ;
308 h16->Sumw2() ;
309 h17->Sumw2() ;
310 h18->Sumw2() ;
311 h19->Sumw2() ;
312 h20->Sumw2() ;
313 h21->Sumw2() ;
314 h22->Sumw2() ;
6f972712 315 h23->Sumw2() ;
724eb92e 316
e648d82d 317 //add lines for DQM shifter
318 //fLineExpTimeMin = new TLine(200., 0., 200., 0.);
319 fLineExpTimeMin->SetLineColor(kGreen);
320 fLineExpTimeMin->SetLineWidth(2);
321
322 //fLineExpTimeMax = new TLine(250., 0., 250., 0.);
323 fLineExpTimeMax->SetLineColor(kGreen);
324 fLineExpTimeMax->SetLineWidth(2);
325
326 //fLineExpTotMin = new TLine( 5., 0., 5., 0.);
327 fLineExpTotMin->SetLineColor(kGreen);
328 fLineExpTotMin->SetLineWidth(2);
329
330 //fLineExpTotMax = new TLine(20., 0., 20., 0.);
331 fLineExpTotMax->SetLineColor(kGreen);
332 fLineExpTotMax->SetLineWidth(2);
333
724eb92e 334 for (Int_t sm=0;sm<17;sm++){
335 //fLineSMid[sm] = new TLine( 1+sm, 0., 1+sm, 91.);
336 fLineSMid[sm]->SetLineColor(kMagenta);
337 fLineSMid[sm]->SetLineWidth(2);
e648d82d 338 }
724eb92e 339
a3286ffd 340 h5->GetListOfFunctions()->Add(fLineExpTimeMin);
341 h5->GetListOfFunctions()->Add(fLineExpTimeMax);
342 h10->GetListOfFunctions()->Add(fLineExpTotMin);
343 h10->GetListOfFunctions()->Add(fLineExpTotMax);
344
345 for (Int_t sm=0;sm<17;sm++){
346 h16->GetListOfFunctions()->Add(fLineSMid[sm]);
347 h17->GetListOfFunctions()->Add(fLineSMid[sm]);
348 }
349
350
351 TPaveText *phosHoleBox=new TPaveText(13,38,16,53,"b");
352 phosHoleBox->SetFillStyle(0);
353 phosHoleBox->SetFillColor(kWhite);
354 phosHoleBox->SetLineColor(kMagenta);
355 phosHoleBox->SetLineWidth(2);
356 phosHoleBox->AddText("PHOS");
357 h16->GetListOfFunctions()->Add(phosHoleBox);
358 h17->GetListOfFunctions()->Add(phosHoleBox);
359
360 // h0->SetDrawOption("logy");
361 // h5->SetDrawOption("logy");
362 // h10->SetDrawOption("logy");
363
17f2cd01 364 Add2RawsList(h0, 0, !expert, image, !saveCorr) ;
61740cee 365 Add2RawsList(h1, 1, expert, !image, !saveCorr) ;
366 Add2RawsList(h2, 2, expert, !image, !saveCorr) ;
367 Add2RawsList(h3, 3, expert, !image, !saveCorr) ;
368 Add2RawsList(h4, 4, expert, !image, !saveCorr) ;
17f2cd01 369 Add2RawsList(h5, 5, !expert, image, !saveCorr) ;
61740cee 370 Add2RawsList(h6, 6, expert, !image, !saveCorr) ;
371 Add2RawsList(h7, 7, expert, !image, !saveCorr) ;
372 Add2RawsList(h8, 8, expert, !image, !saveCorr) ;
373 Add2RawsList(h9, 9, expert, !image, !saveCorr) ;
17f2cd01 374 Add2RawsList(h10, 10, !expert, image, !saveCorr) ;
5f144062 375 Add2RawsList(h11, 11, expert, !image, !saveCorr) ;
376 Add2RawsList(h12, 12, expert, !image, !saveCorr) ;
17f2cd01 377 Add2RawsList(h13, 13, expert, !image, !saveCorr) ;
378 Add2RawsList(h14, 14, expert, !image, !saveCorr) ;
5f144062 379 Add2RawsList(h15, 15, !expert, image, !saveCorr) ;
380 Add2RawsList(h16, 16, !expert, image, !saveCorr) ;
381 Add2RawsList(h17, 17, !expert, image, !saveCorr) ;
17f2cd01 382 Add2RawsList(h18, 18, expert, !image, !saveCorr) ;
383 Add2RawsList(h19, 19, expert, !image, !saveCorr) ;
384 Add2RawsList(h20, 20, expert, !image, !saveCorr) ;
385 Add2RawsList(h21, 21, expert, !image, !saveCorr) ;
5f144062 386 Add2RawsList(h22, 22, expert, !image, !saveCorr) ;
6f972712 387 Add2RawsList(h23, 23, expert, !image, !saveCorr) ;
92664bc8 388 //
389 ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line
44ed7a66 390}
391
392//____________________________________________________________________________
04236e67 393void AliTOFQADataMakerRec::InitRecPoints()
394{
395 //
396 // create RecPoints histograms in RecPoints subdir
397 //
724eb92e 398
32bd8225 399 const Bool_t expert = kTRUE ;
400 const Bool_t image = kTRUE ;
04236e67 401
724eb92e 402 TH1I * h0 = new TH1I("hTOFRecPoints", "TOF RecPoints multiplicity ; TOF RecPoints number;Events",200, 0, 200) ;
5f144062 403
724eb92e 404 TH1F * h1 = new TH1F("hTOFRecPointsTimeIA", "RecPoints Time Spectrum in TOF (ns)- I/A side; Calibrated TOF time [ns];Events", 250, 0., 610.) ;
405 TH1F * h2 = new TH1F("hTOFRecPointsTimeOA", "RecPoints Time Spectrum in TOF (ns)- O/A side; Calibrated TOF time [ns];Events", 250, 0., 610.) ;
406 TH1F * h3 = new TH1F("hTOFRecPointsTimeIC", "RecPoints Time Spectrum in TOF (ns)- I/C side; Calibrated TOF time [ns];Events", 250, 0., 610.) ;
407 TH1F * h4 = new TH1F("hTOFRecPointsTimeOC", "RecPoints Time Spectrum in TOF (ns)- O/C side; Calibrated TOF time [ns];Events", 250, 0., 610.) ;
32bd8225 408
724eb92e 409 TH1F * h5 = new TH1F("hTOFRecPointsRawTimeIA", "RecPoints raw Time Spectrum in TOF (ns)-I/A side; Measured TOF time [ns];Hits", 250, 0., 610.) ;
410 TH1F * h6 = new TH1F("hTOFRecPointsRawTimeOA", "RecPoints raw Time Spectrum in TOF (ns)-O/A side; Measured TOF time [ns];Hits", 250, 0., 610.) ;
411 TH1F * h7 = new TH1F("hTOFRecPointsRawTimeIC", "RecPoints raw Time Spectrum in TOF (ns)-I/C side; Measured TOF time [ns];Hits", 250, 0., 610.) ;
412 TH1F * h8 = new TH1F("hTOFRecPointsRawTimeOC", "RecPoints raw Time Spectrum in TOF (ns)-O/C side; Measured TOF time [ns];Hits", 250, 0., 610.) ;
32bd8225 413
724eb92e 414 TH1F * h9 = new TH1F("hTOFRecPointsToTIA", "RecPoints ToT Spectrum in TOF (ns)-I/A side; Measured TOT [ns];Hits", 100, 0., 48.8 ) ;
415 TH1F * h10 = new TH1F("hTOFRecPointsToTOA", "RecPoints ToT Spectrum in TOF (ns)-O/A side; Measured TOT [ns];Hits", 100, 0., 48.8 ) ;
416 TH1F * h11 = new TH1F("hTOFRecPointsToTIC", "RecPoints ToT Spectrum in TOF (ns)-I/C side; Measured TOT [ns];Hits", 100, 0., 48.8 ) ;
417 TH1F * h12 = new TH1F("hTOFRecPointsToTOC", "RecPoints ToT Spectrum in TOF (ns)-O/C side; Measured TOT [ns];Hits", 100, 0., 48.8 ) ;
418
419 TH2F * h13 = new TH2F("hTOFRecPointsClusMap","RecPoints map; sector ;strip", 72, 0., 18., 91, 0., 91.) ;
420 TH2F * h14 = new TH2F("hTOFRecPointsTimeVsStrip","RecPoints TOF time vs. strip (theta); Strip index; RecPoints TOF time (ns) ",91, 0., 91., 250, 0., 610.) ;
421 TH2F * h15 = new TH2F("hTOFRecPointsTimeVsTRM035","TOF RecPoints time vs TRM - crates 0 to 35; TRM index = DDL*10+TRM(0-9);TOF time [ns]", 361, 0., 361., 250, 0., 610.0) ;
422 TH2F * h16 = new TH2F("hTOFRecPointsTimeVsTRM3671","TOF RecPoints time vs TRM - crates 36 to 72; TRM index = DDL**10+TRM(0-9);TOF time [ns]", 361, 360., 721., 250, 0., 610.0) ;
17f2cd01 423
724eb92e 424 h0->Sumw2() ;
425 h1->Sumw2() ;
426 h2->Sumw2() ;
427 h3->Sumw2() ;
428 h4->Sumw2() ;
429 h5->Sumw2() ;
430 h6->Sumw2() ;
431 h7->Sumw2() ;
432 h8->Sumw2() ;
433 h9->Sumw2() ;
434 h10->Sumw2() ;
435 h11->Sumw2() ;
436 h12->Sumw2() ;
437 h13->Sumw2() ;
438 h14->Sumw2() ;
439 h15->Sumw2() ;
440 h16->Sumw2() ;
441
5f144062 442 Add2RecPointsList(h0, 0, !expert, image) ;
443 Add2RecPointsList(h1, 1, !expert, image) ;
444 Add2RecPointsList(h2, 2, !expert, image) ;
445 Add2RecPointsList(h3, 3, !expert, image) ;
446 Add2RecPointsList(h4, 4, !expert, image) ;
724eb92e 447 Add2RecPointsList(h5, 5, expert, !image) ;
5f144062 448 Add2RecPointsList(h6, 6, expert, !image) ;
449 Add2RecPointsList(h7, 7, expert, !image) ;
450 Add2RecPointsList(h8, 8, expert, !image) ;
724eb92e 451 Add2RecPointsList(h9, 9, !expert, !image) ;
452 Add2RecPointsList(h10, 10, !expert, !image) ;
453 Add2RecPointsList(h11, 11, !expert, !image) ;
454 Add2RecPointsList(h12, 12, !expert, !image) ;
5f144062 455 Add2RecPointsList(h13, 13, expert, !image) ;
724eb92e 456 Add2RecPointsList(h14, 14, expert, image) ;
5f144062 457 Add2RecPointsList(h15, 15, expert, !image) ;
458 Add2RecPointsList(h16, 16, expert, !image) ;
92664bc8 459 //
460 ClonePerTrigClass(AliQAv1::kRECPOINTS); // this should be the last line
04236e67 461}
462
463//____________________________________________________________________________
464void AliTOFQADataMakerRec::InitESDs()
465{
466 //
467 //create ESDs histograms in ESDs subdir
468 //
135306ea 469
5f144062 470 const Bool_t expert = kTRUE ;
471 const Bool_t image = kTRUE ;
04236e67 472
7b81681b 473 TH1I * h0 = new TH1I("hTOFESDs", "Number of matched TOF tracks per event;Number of TOF matched ESD tracks;Counts", 200, 0, 200) ;
724eb92e 474 TH1F * h1 = new TH1F("hTOFESDsTime", "Matched ESDs tracks: TOF Time spectrum; Calibrated TOF time [ns];Counts", 250, 0., 610. ) ;
475 TH1F * h2 = new TH1F("hTOFESDsRawTime", "Matched ESDs tracks: TOF raw Time spectrum;Measured TOF time [ns];Counts", 250, 0., 610.) ;
476 TH1F * h3 = new TH1F("hTOFESDsToT", "Matched ESDs tracks: TOF ToT spectrum; ESDs ToT [ns];Counts",100, 0., 48.8) ;
477 TH1F * h4 = new TH1F("hTOFESDskTOFOUT", "p_{T} distribution of tracks with kTOFout; p_{T} (GeV/c);Counts", 50, 0.20, 5.00) ;
478 TH1F * h5 = new TH1F("hTOFESDskTIME", "p_{T} distribution of tracks with kTOFout && kTIME; p_{T} (GeV/c);Counts", 50, 0.20, 5.00) ;
479 TH1F * h6 = new TH1F("hTOFESDsMatched", "p_{T} distribution of tracks with kTOFout && TOFtime>0; p_{T} (GeV/c);Counts", 50, 0.20, 5.00) ;
480 TH1F * h7 = new TH1F("hTOFESDsMatchingProb", "TPC-TOF track-matching probability;TOF matching probability (%) ;Counts",101, -1.0, 100) ;
481 TH1F * h8 = new TH1F("hTOFESDsDiffTime", "ESDs t_{TOF}-t_{exp,pi} spectrum in TOF (ps); t_{TOF}-t_{exp,pi} [ps];Counts", 200, -2440., 2440.) ;
482 TH1F * h9 = new TH1F("hTOFHitsLength", "Matched ESDs tracks: Length Spectrum; Track length [cm];Counts", 800, 0., 800) ;
483
5f144062 484 h0->Sumw2() ;
04236e67 485 h1->Sumw2() ;
04236e67 486 h2->Sumw2() ;
04236e67 487 h3->Sumw2() ;
5f144062 488 h4->Sumw2() ;
489 h5->Sumw2() ;
490 h6->Sumw2() ;
491 h7->Sumw2() ;
492 h8->Sumw2() ;
493 h9->Sumw2() ;
5f144062 494
495 Add2ESDsList(h0, 0, !expert, image) ;
496 Add2ESDsList(h1, 1, !expert, image) ;
724eb92e 497 Add2ESDsList(h2, 2, expert, !image) ;
498 Add2ESDsList(h3, 3, !expert, !image) ;
5f144062 499 Add2ESDsList(h4, 4, expert, image) ;
500 Add2ESDsList(h5, 5, expert, image) ;
501 Add2ESDsList(h6, 6, expert, image) ;
502 Add2ESDsList(h7, 7, expert, image) ;
724eb92e 503 Add2ESDsList(h8, 8, expert, !image) ;
504 Add2ESDsList(h9, 9, !expert, !image) ;
92664bc8 505 //
506 ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line
04236e67 507}
508
5f144062 509
04236e67 510//____________________________________________________________________________
511void AliTOFQADataMakerRec::MakeRaws(AliRawReader* rawReader)
512{
513 //
514 // makes data from Raws
515 //
724eb92e 516 if (rawReader->GetType()==7) {
517
518 Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;//in ns
519 Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
520 Int_t ntof[5]; /* 0=tot, 1=IA, 2=OA, 3=IC, 4=OC*/
521 for (Int_t j=0;j<5;j++){ ntof[j]=0;}
522 Int_t equipmentID[5]; //(ddl, trm, chain,tdc,channel)
523 Int_t volumeID[5]; //(sector,plate,strip,padX,padZ)
524 Int_t volumeID2[5]; //(sector,plate,strip,padZ,padX) to use AliTOFGeometry::GetIndex()
525 Int_t chIndex=-1;
526
527 TClonesArray * clonesRawData;
528 fTOFRawStream.SetRawReader(rawReader);
6f972712 529 Int_t BCID=rawReader->GetBCID();
724eb92e 530
531 //uncomment if needed to apply DeltaBC correction
532 //fTOFRawStream.ApplyBCCorrections(kTRUE);
6f972712 533 if (fDecoderSummary){
534 fDecoderSummary->Reset();
535 }
724eb92e 536 for (Int_t iDDL = 0; iDDL < AliTOFGeometry::NDDL()*AliTOFGeometry::NSectors(); iDDL++){
537 rawReader->Reset();
538 fTOFRawStream.LoadRawDataBuffersV2(iDDL);
539
540 //* get decoding error counters
acfd6c93 541 fDecoderSummary = ( (AliTOFDecoderV2*) fTOFRawStream.GetDecoderV2() )->GetDecoderSummaryData();
724eb92e 542 if ( (fDecoderSummary) && (fDecoderSummary ->GetErrorDetected()) ) {
543 Int_t errorSlotID=(Int_t) fDecoderSummary->GetErrorSlotID();
92664bc8 544 FillRawsData(18,iDDL,errorSlotID);
724eb92e 545 if (fDecoderSummary -> GetRecoverError() )
92664bc8 546 FillRawsData(18,iDDL,13);
724eb92e 547 }
548
549 clonesRawData = (TClonesArray*)fTOFRawStream.GetRawData();
550 for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
551 AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
f63f6d7e 552
724eb92e 553 if (tofRawDatum->GetTOF()){
554 equipmentID[0]=iDDL;
555 equipmentID[1]=tofRawDatum->GetTRM();
556 equipmentID[2]=tofRawDatum->GetTRMchain();
557 equipmentID[3]=tofRawDatum->GetTDC();
558 equipmentID[4]=tofRawDatum->GetTDCchannel();
559
560 if (CheckEquipID(equipmentID)){
561 fTOFRawStream.EquipmentId2VolumeId(iDDL,
562 tofRawDatum->GetTRM(),
563 tofRawDatum->GetTRMchain(),
564 tofRawDatum->GetTDC(),
565 tofRawDatum->GetTDCchannel(),
566 volumeID);
567 //LTM data
568 if (FilterLTMData(equipmentID)) { //counts LTM hits
6f972712 569 if (equipmentID[2]==1) //crate left, A-side or C-side
92664bc8 570 FillRawsData(15,equipmentID[0]);
6f972712 571 else
572 FillRawsData(15,equipmentID[0]-1);
724eb92e 573 continue;
574 }
17f2cd01 575
724eb92e 576 //TRM data
577 if (CheckVolumeID(volumeID)){
578 volumeID2[0]=volumeID[0];
579 volumeID2[1]=volumeID[1];
580 volumeID2[2]=volumeID[2];
581 volumeID2[3]=volumeID[4];
582 volumeID2[4]=volumeID[3];
583 chIndex=AliTOFGeometry::GetIndex(volumeID2);
584
585 if (tofRawDatum->GetTOT()){
acfd6c93 586 if (!(fCalibData->GetNoiseStatus(chIndex)==AliTOFChannelOnlineStatusArray::kTOFNoiseBad)
724eb92e 587 && (fCalibData->GetHWStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFHWOk)) {//noise and enabled filter
588 ntof[0]++; //counter for tof hits
589
590 //fill global spectra for DQM plots
92664bc8 591 FillRawsData(5, tofRawDatum->GetTOF()*tdc2ns) ;//in ns
592 FillRawsData(10, tofRawDatum->GetTOT()*tot2ns) ;//in ns
6f972712 593 FillRawsData(23, BCID, tofRawDatum->GetTOF()*tdc2ns) ;//in ns
724eb92e 594
595 //fill side-related spectra for experts plots
596 Int_t ddlACside=iDDL/36; // 0 or 1
597 Int_t ddlPerSm=iDDL%4;
598
acfd6c93 599 if (volumeID2[0]>4 && volumeID2[0]<14){ //O side
724eb92e 600 if (ddlPerSm<2){ //A side
601 ntof[1]++;
92664bc8 602 FillRawsData(6, tofRawDatum->GetTOF()*tdc2ns) ;
603 FillRawsData(11, tofRawDatum->GetTOT()*tot2ns) ;
724eb92e 604 } else { //C side
605 ntof[3]++;
92664bc8 606 FillRawsData(8, tofRawDatum->GetTOF()*tdc2ns) ;
607 FillRawsData(13, tofRawDatum->GetTOT()*tot2ns) ;
724eb92e 608 }
609 } else {
acfd6c93 610 if (volumeID2[0]<5 || volumeID2[0]>13){ //I side
724eb92e 611 if (ddlPerSm<2){ //A side
612 ntof[2]++;
92664bc8 613 FillRawsData(7, tofRawDatum->GetTOF()*tdc2ns) ;
614 FillRawsData(12, tofRawDatum->GetTOT()*tot2ns) ;
724eb92e 615 } else {//C side
616 ntof[4]++;
92664bc8 617 FillRawsData(9, tofRawDatum->GetTOF()*tdc2ns) ;
618 FillRawsData(14, tofRawDatum->GetTOT()*tot2ns) ;
724eb92e 619 }
620 }
621 }
622
623 //compute TRM offset
624 Int_t trm= iDDL*10+(equipmentID[1]-3);
92664bc8 625 FillRawsData(20+ddlACside,trm,tofRawDatum->GetTOF()*tdc2ns);
626 FillRawsData(22,GetStripIndex(volumeID),tofRawDatum->GetTOF()*tdc2ns) ;
724eb92e 627 Short_t fea = volumeID2[4]/12;
628 Float_t hitmapx = volumeID2[0] + ((Double_t)(3 - fea) + 0.5) *0.25;
92664bc8 629 FillRawsData(17,hitmapx,GetStripIndex(volumeID2));
724eb92e 630 }//noise filter
631 }//end hit selection
632 else { //orphans
633 if (!(fCalibData->GetNoiseStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFNoiseBad)
634 && (fCalibData->GetHWStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFHWOk))
92664bc8 635 FillRawsData(19, tofRawDatum->GetTOF()*tdc2ns) ;//in ns
724eb92e 636 }//end orphans
637 }//end volumeID check
638 }//end equipID check
639 }//end tof check
640 }//loop on raw data
641 clonesRawData->Clear();
642 } // DDL Loop
643
92664bc8 644 for (Int_t j=0;j<5;j++) FillRawsData(j,ntof[j]);
645 // fProcessedRawEventN++; // RS Now the framework conters are use
724eb92e 646 fTOFRawStream.Clear();
647 } else {
648 AliDebug(1,Form("Event of type %d found. Skipping non-physics event for QA.\n", rawReader->GetType()));
649 }
650
651 //fill reference map for DQM shifter only once in a detector cycle
652 if (fIsSOC) {
653 Int_t geoId[5]={-1,-1,-1,-1,-1};// pgeoId=(sm, mod, strip, padZ, padX)
654 Int_t detId[5]={-1,-1,-1,-1,-1};//detID=(ddl,trm,tdc, chain,channel)
655 Int_t trmIndex=-1;
656 for (Int_t ch = 0; ch < fCalibData->GetSize(); ch++) {
657 AliTOFGeometry::GetVolumeIndices(ch,geoId);
658 AliTOFRawStream::Geant2EquipmentId(geoId,detId);
659 if ((detId[1]<0)||(detId[0]<0)) continue;
660 trmIndex=(detId[1]-3)+detId[0]*10;
661
662 //set TRM counters
663 // if (fCalibData->GetNoiseStatus(ch)==AliTOFChannelOnlineStatusArray::kTOFNoiseBad)
664 // fTRMNoisyArray[trmIndex]+=1;
665 // if (fCalibData->GetHWStatus(ch) == AliTOFChannelOnlineStatusArray::kTOFHWOk)
666 // fTRMHwOkArray[trmIndex]+=1;
667
668 if ( (!(fCalibData->GetNoiseStatus(ch)==AliTOFChannelOnlineStatusArray::kTOFNoiseBad))
669 && (fCalibData->GetHWStatus(ch) == AliTOFChannelOnlineStatusArray::kTOFHWOk) ){
670 //fTRMEnabledArray[trmIndex]+=1;
671 //fill reference map with info from OCDB
672 Short_t fea = geoId[4]/12;
673 Float_t hitmapx = geoId[0] + ((Double_t)(3 - fea) + 0.5)*0.25;
92664bc8 674 FillRawsData(16,hitmapx, GetStripIndex(geoId));
724eb92e 675 }
f63f6d7e 676 }
724eb92e 677 //printf("Counters for noisy, enabled and good channels in TOF TRMs read from OCDB.\n");
678 fIsSOC=kFALSE;
679 }
a3286ffd 680
724eb92e 681 //enable options for DQM shifter
682 EnableDqmShifterOpt(kTRUE);
92664bc8 683 //
684 IncEvCountCycleRaws();
685 IncEvCountTotalRaws();
686 //
44ed7a66 687}
688
44ed7a66 689//____________________________________________________________________________
04236e67 690void AliTOFQADataMakerRec::MakeRecPoints(TTree * clustersTree)
691{
f63f6d7e 692 //
32bd8225 693 // Make data from Clusters
694 //
695
696 Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;
697 Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
724eb92e 698
699 Int_t volumeID2[5];//(sm, plate,strip, padZ,padX)
700 //Int_t volumeID[5];//(sm, plate,strip, padX,padZ)
701
32bd8225 702 TBranch *branch=clustersTree->GetBranch("TOF");
703 if (!branch) {
704 AliError("can't get the branch with the TOF clusters !");
705 return;
706 }
707
708 static TClonesArray dummy("AliTOFcluster",10000);
709 dummy.Clear();
710 TClonesArray *clusters=&dummy;
711 branch->SetAddress(&clusters);
724eb92e 712
32bd8225 713 // Import the tree
714 clustersTree->GetEvent(0);
715
92664bc8 716 FillRecPointsData(0,(Int_t)clusters->GetEntriesFast()) ;
32bd8225 717
718 TIter next(clusters) ;
719 AliTOFcluster * c ;
720 while ( (c = dynamic_cast<AliTOFcluster *>(next())) ) {
721
724eb92e 722 // volumeID2[0] = c->GetDetInd(0);
723 // volumeID2[1] = c->GetDetInd(1);
724 // volumeID2[2] = c->GetDetInd(2);
725 // volumeID2[3] = c->GetDetInd(4); //padX
726 // volumeID2[4] = c->GetDetInd(3); //padZ
32bd8225 727
728 for (Int_t i=0;i<5;i++){
724eb92e 729 volumeID2[i]=c->GetDetInd(i); //X and Z indeces inverted in RecPoints
32bd8225 730 }
724eb92e 731 //Int_t chIndex=AliTOFGeometry::GetIndex(volumeID2);
32bd8225 732 Int_t iDDL=AliTOFRawStream::Geant2DDL(volumeID2);
5f144062 733 Int_t iTRM=AliTOFRawStream::Geant2TRM(volumeID2);
724eb92e 734 Short_t fea = volumeID2[4]/12;
735 Float_t hitmapx = volumeID2[0] + ((Double_t)(3 - fea) + 0.5) *0.25;
736 Int_t ddlACside=iDDL/36; // 0 or 1
737 Int_t ddlPerSm=iDDL%4;
738
739 if ((c->GetTDCRAW()) && (c->GetTDC()) && (c->GetToT())){
740 if (volumeID2[0]>4 && volumeID2[0]<14){ //I side
741 if (ddlPerSm<2){ //A side
92664bc8 742 FillRecPointsData(1, c->GetTDC()*tdc2ns) ;//in ns
743 FillRecPointsData(5, c->GetTDCRAW()*tdc2ns) ;//in ns
744 FillRecPointsData(9, c->GetToT()*tot2ns) ;//in ns
724eb92e 745 } else {//C side
92664bc8 746 FillRecPointsData(3, c->GetTDC()*tdc2ns) ;//in ns
747 FillRecPointsData(7, c->GetTDCRAW()*tdc2ns) ;//in ns
748 FillRecPointsData(11, c->GetToT()*tot2ns) ;//in ns
5f144062 749 }
724eb92e 750 } else {
751 if (volumeID2[0]<5 || volumeID2[0]>13){ //O side
752 if (ddlPerSm<2){ //A side
92664bc8 753 FillRecPointsData(2, c->GetTDC()*tdc2ns) ;//in ns
754 FillRecPointsData(6, c->GetTDCRAW()*tdc2ns) ;//in ns
755 FillRecPointsData(10, c->GetToT()*tot2ns) ;//in ns
724eb92e 756 } else { //C side
92664bc8 757 FillRecPointsData(4, c->GetTDC()*tdc2ns) ;//in ns
758 FillRecPointsData(8, c->GetTDCRAW()*tdc2ns) ;//in ns
759 FillRecPointsData(12, c->GetToT()*tot2ns) ;//in ns
724eb92e 760 }
5f144062 761 }
724eb92e 762 }
92664bc8 763 FillRecPointsData(13,hitmapx,GetStripIndex(volumeID2));
764 FillRecPointsData(14,GetStripIndex(volumeID2), c->GetTDC()*tdc2ns) ;
724eb92e 765 Int_t trm= iDDL*10+(iTRM-3);
766 if (ddlACside==0) { //A side
92664bc8 767 FillRecPointsData(15,trm,c->GetTDC()*tdc2ns);
724eb92e 768 } else {//C side
92664bc8 769 FillRecPointsData(16,trm,c->GetTDC()*tdc2ns);
724eb92e 770 }
5f144062 771 }//hit selection
724eb92e 772 }//end while
5f144062 773 EnableDqmShifterOpt(kFALSE);
92664bc8 774 //
775 IncEvCountCycleRecPoints();
776 IncEvCountTotalRecPoints();
777 //
04236e67 778}
779
780//____________________________________________________________________________
5f144062 781void AliTOFQADataMakerRec::MakeESDs(AliESDEvent * esd)
04236e67 782{
783 //
784 // make QA data from ESDs
785 //
724eb92e 786 const Double_t speedOfLight = TMath::C()*1E2*1E-12; // cm/ps
787 const Double_t pionMass = 0.13957018; //GeV/c^2
5f144062 788
724eb92e 789 Int_t ntrk = esd->GetNumberOfTracks() ;
790 Int_t ntpc=0;
791 Int_t ntofout=0;
7b81681b 792
724eb92e 793 while (ntrk--) {
794 AliESDtrack *track=esd->GetTrack(ntrk);
795 Double_t tofTime=track->GetTOFsignal();//in ps
796 Double_t tofTimeRaw=track->GetTOFsignalRaw();//in ps
797 Double_t tofToT=track->GetTOFsignalToT(); //in ps
798
799 UInt_t status=track->GetStatus();
800 if (track->IsOn(AliESDtrack::kTPCrefit)) {
801 ntpc++;
802 Double_t y=track->Eta();
803 if (TMath::Abs(y)<0.9) { //select TOF acceptance
804 if ((status&AliESDtrack::kTOFout)!=0) { //define matching
805 ntofout++;
92664bc8 806 FillESDsData(1,tofTime*1E-3);
807 FillESDsData(2,tofTimeRaw*1E-3);
808 FillESDsData(3,tofToT*1E-3);
809 FillESDsData(4,track->Pt());
724eb92e 810
811 Double_t length =track->GetIntegratedLength();
812 Double_t mom2=(track->Pt()*track->Pt())+(track->Pz()*track->Pz());
813 Double_t piTexp = TMath::Sqrt(1+(pionMass*pionMass/mom2))*length/speedOfLight; //in ps
92664bc8 814 FillESDsData(8,tofTime-piTexp);
815 FillESDsData(9,length);
724eb92e 816
817 if ((status&AliESDtrack::kTIME)!=0)
92664bc8 818 FillESDsData(5,track->Pt());
724eb92e 819
820 if (tofTime>0)
92664bc8 821 FillESDsData(6,track->Pt());
724eb92e 822 } //end check on matched tracks
823 }
824 }//end check on TPCrefit
5f144062 825 }
826
92664bc8 827 FillESDsData(0,ntofout) ;
5f144062 828 if(ntpc>0){
724eb92e 829 Float_t ratio = (Float_t)ntofout/(Float_t)ntpc*100.; //matching probability
92664bc8 830 FillESDsData(7,ratio) ;
5f144062 831 }
832
833 if(ntofout>0) {
724eb92e 834 Float_t ratio = (Float_t)ntofout/(Float_t)ntpc*100; //matched over propagated to TOF outer radius
92664bc8 835 FillESDsData(8,ratio) ;
5f144062 836 }
837 EnableDqmShifterOpt(kFALSE);
92664bc8 838 //
839 IncEvCountCycleESDs();
840 IncEvCountTotalESDs();
841 //
04236e67 842}
5f144062 843
04236e67 844//____________________________________________________________________________
845void AliTOFQADataMakerRec::StartOfDetectorCycle()
846{
847 //
848 //Detector specific actions at start of cycle
724eb92e 849 // ResetAllTRMcounters();
17f2cd01 850 fCalibData = GetCalibData();
724eb92e 851 fIsSOC=kTRUE;
852 return;
853}
04236e67 854
855//____________________________________________________________________________
4e25ac79 856void AliTOFQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
04236e67 857{
858 //Detector specific actions at end of cycle
859 // do the QA checking
92664bc8 860 ResetEventTrigClasses();
861 //
724eb92e 862 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
6f972712 863 if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) continue ;
864 SetEventSpecie(AliRecoParam::ConvertIndex(specie));
865
92664bc8 866 for (int itc=-1;itc<GetNTrigClasses();itc++) { // RS: loop over eventual clones per trigger class
6f972712 867
92664bc8 868 if (fEnableDqmShifterOpt) {
92664bc8 869 // RS: fetch the histograms for given trigger class
870 TObjArray& arrRW = *GetRawsDataOfTrigClass(itc);
871
872 // Help make the raw qa histogram easier to interpret for the DQM shifter
873 if (!arrRW[ 0] || !arrRW[ 5] || !arrRW[10] || !arrRW[15] || !arrRW[16] || !arrRW[17]) continue;
6f972712 874
92664bc8 875 printf("=========>Processed %i physics raw of specie %s with TrigGlass %d\n",
876 GetEvCountCycleRaws(itc),AliRecoParam::GetEventSpecieName(specie), itc);
5f144062 877
92664bc8 878 //Double_t monitorPeriodLength=fProcessedRawEventN*600*1E-9;//in s
879
880 if (fCalibData){
881 //set minima and maxima to allow log scale
882 Double_t yTimeMax = ((TH1*)arrRW[5])->GetMaximum()*1.05;
883 Double_t yTotMax = ((TH1*)arrRW[10])->GetMaximum()*1.05;
884 fLineExpTimeMin->SetY2(yTimeMax);
885 fLineExpTimeMax->SetY2(yTimeMax);
886 fLineExpTotMin->SetY2(yTotMax);
887 fLineExpTotMax->SetY2(yTotMax);
888 //
889 for (Int_t j=0;j<18;j++){
890 if ((j==0)||(j==5)||(j==10)||(j==15)||(j==16)||(j==17)) {
891 TH1* htmp = (TH1*)arrRW[j];
892 htmp->GetXaxis()->SetLabelOffset(0.005);
893 htmp->GetXaxis()->SetLabelSize(0.05);
894 htmp->GetXaxis()->SetTitleOffset(0.8);
895 htmp->GetXaxis()->SetTitleSize(0.05);
896 htmp->GetYaxis()->SetLabelOffset(0.005);
897 htmp->GetYaxis()->SetLabelSize(0.06);
898 htmp->GetYaxis()->SetTitleOffset(0.8);
899 htmp->GetYaxis()->SetTitleSize(0.06);
900 }
724eb92e 901 }
92664bc8 902 //make up for all histos
903 for(Int_t j=0;j<5;j++) {
904 TH1* htmp = (TH1*)arrRW[j];
905 if (!htmp) continue;
906 htmp->SetMarkerColor(kBlue);
907 htmp->SetMarkerStyle(8);
908 htmp->SetMarkerSize(0.7);
909 }
910 for(Int_t j=5;j<15;j++) {
911 TH1* htmp = (TH1*)arrRW[j];
912 if (!htmp) continue;
913 htmp->SetLineColor(kBlue);
914 htmp->SetLineWidth(1);
915 htmp->SetMarkerColor(kBlue);
92664bc8 916 }
6f972712 917
92664bc8 918 TH1* htmp = (TH1*)arrRW[15];
919 htmp->SetLineColor(kBlue);
920 htmp->SetLineWidth(1);
921 htmp->SetMarkerStyle(8);
922 htmp->SetMarkerSize(0.7);
923 htmp->SetMarkerColor(kBlue);//Option("bar");
924 //
925 if ( (htmp=(TH1*)arrRW[16]) ) htmp->SetOption("colz");
926 if ( (htmp=(TH1*)arrRW[17]) ) htmp->SetOption("colz");
927 if ( (htmp=(TH1*)arrRW[18]) ) htmp->SetOption("colz");
ba5613e3 928 }
92664bc8 929 }//END ENABLE DQM SHIFTER OPT
930 } // RS: loop over trigger classes
724eb92e 931 } //end for
92664bc8 932 //
724eb92e 933 AliQAChecker::Instance()->Run(AliQAv1::kTOF, task, list) ;
92664bc8 934 //
04236e67 935}
936//____________________________________________________________________________
32bd8225 937void AliTOFQADataMakerRec::GetMapIndeces(const Int_t* const in , Int_t* out)
04236e67 938{
939 //
940 //return appropriate indeces for the theta-phi map
941 //
942
943 Int_t npadX = AliTOFGeometry::NpadX();
944 Int_t npadZ = AliTOFGeometry::NpadZ();
945 Int_t nStripA = AliTOFGeometry::NStripA();
946 Int_t nStripB = AliTOFGeometry::NStripB();
947 Int_t nStripC = AliTOFGeometry::NStripC();
948
949 Int_t isector = in[0];
950 Int_t iplate = in[1];
951 Int_t istrip = in[2];
952 Int_t ipadX = in[3];
953 Int_t ipadZ = in[4];
954
955 Int_t stripOffset = 0;
956 switch (iplate) {
957 case 0:
958 stripOffset = 0;
959 break;
960 case 1:
961 stripOffset = nStripC;
962 break;
963 case 2:
964 stripOffset = nStripC+nStripB;
965 break;
966 case 3:
967 stripOffset = nStripC+nStripB+nStripA;
968 break;
969 case 4:
970 stripOffset = nStripC+nStripB+nStripA+nStripB;
971 break;
972 default:
17f2cd01 973 AliDebug(1,Form("Wrong plate number in TOF (%d) !",iplate));
04236e67 974 break;
975 };
976 Int_t zindex=npadZ*(istrip+stripOffset)+(ipadZ+1);
977 Int_t phiindex=npadX*isector+ipadX+1;
978 out[0]=zindex;
979 out[1]=phiindex;
980
981}
5f144062 982
983//---------------------------------------------------------------
984Int_t AliTOFQADataMakerRec::GetStripIndex(const Int_t * const in)
985{
986 /* return tof strip index between 0 and 91 */
987
988 Int_t nStripA = AliTOFGeometry::NStripA();
989 Int_t nStripB = AliTOFGeometry::NStripB();
990 Int_t nStripC = AliTOFGeometry::NStripC();
991
992 // Int_t isector = in[0];
993 Int_t iplate = in[1];
994 Int_t istrip = in[2];
995 //Int_t ipadX = in[3];
996 //Int_t ipadZ = in[4];
997
998 Int_t stripOffset = 0;
999 switch (iplate) {
1000 case 0:
1001 stripOffset = 0;
1002 break;
1003 case 1:
1004 stripOffset = nStripC;
1005 break;
1006 case 2:
1007 stripOffset = nStripC+nStripB;
1008 break;
1009 case 3:
1010 stripOffset = nStripC+nStripB+nStripA;
1011 break;
1012 case 4:
1013 stripOffset = nStripC+nStripB+nStripA+nStripB;
1014 break;
1015 default:
1016 AliDebug(1,Form("Wrong plate number in TOF (%d) !",iplate));
1017 stripOffset=-1;
1018 break;
1019 };
1020
1021 if (stripOffset<0 || stripOffset>92) return -1;
1022 else
1023 return (stripOffset+istrip);
1024
1025}
17f2cd01 1026//---------------------------------------------------------------
32bd8225 1027Bool_t AliTOFQADataMakerRec::CheckVolumeID(const Int_t * const volumeID)
17f2cd01 1028{
32bd8225 1029 //
1030 //Checks volume ID validity
1031 //
17f2cd01 1032
1033 for (Int_t j=0;j<5;j++){
1034 if (volumeID[j]<0) {
1035 AliDebug(1,Form("Invalid detector volume index for volumeID[%i]",j));
1036 return kFALSE;
1037 }
1038 }
1039 return kTRUE;
1040
1041}
1042
1043//---------------------------------------------------------------
32bd8225 1044Bool_t AliTOFQADataMakerRec::CheckEquipID(const Int_t * const equipmentID)
17f2cd01 1045{
32bd8225 1046 //
1047 //Checks equipment ID validity
1048
17f2cd01 1049 for (Int_t j=0;j<5;j++){
1050 if (equipmentID[j]<0) {
17f2cd01 1051 AliDebug(1,Form("Invalid equipment volume index for equipmentID[%i]",j));
1052 return kFALSE;
1053 }
1054 }
1055 return kTRUE;
1056}
32bd8225 1057//---------------------------------------------------------------
1058Bool_t AliTOFQADataMakerRec::FilterLTMData(const Int_t * const equipmentID) const
1059{
1060 /*It returns kTRUE if data come from LTM.
5f144062 1061 It thus filters trigger-related signals */
32bd8225 1062
1063 Int_t ddl, trm, tdc;
1064 //if (!CheckEquipID(equipmentID)) return kFALSE;
1065 ddl = equipmentID[0];
1066 trm = equipmentID[1];
1067 tdc = equipmentID[3];
1068
1069 if ((ddl%2==1) && (trm==3) && (tdc>11 && tdc<15))
1070 return kTRUE;
1071 else
1072 return kFALSE;
1073
1074}
1075//---------------------------------------------------------------
1076Bool_t AliTOFQADataMakerRec::FilterSpare(const Int_t * const equipmentID) const
1077{
1078 /*It returns kTRUE if data come from spare
1079 equipment ID.
1080 So far only check on TRM 3 crate left is implemented */
1081
1082 Int_t ddl, trm, tdc;
1083 //if (!CheckEquipID(equipmentID)) return kFALSE;
1084 ddl = equipmentID[0];
1085 trm = equipmentID[1];
1086 tdc = equipmentID[3];
1087
1088 if ((ddl%2==1) && (trm==3) && (tdc>2 && tdc<12))
1089 return kTRUE;
1090 else
1091 return kFALSE;
1092
1093}
724eb92e 1094//----------------------------------------------------------------
1095/*void AliTOFQADataMakerRec::ResetAllTRMcounters()
1096{
1097 //resets all TRM counters to 0
1098 for (Int_t trm=0;trm<720;trm++){
1099 fTRMNoisyArray[trm]=-1;
1100 fTRMHwOkArray[trm]=-1;
1101 fTRMEnabledArray[trm]=-1;
1102 }
1103 return;
1104
1105}
1106*/