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