]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TOF/AliTOFQADataMaker.cxx
Fixing putward propagation parameters to make the track loose energy.
[u/mrichter/AliRoot.git] / TOF / AliTOFQADataMaker.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 #include <TClonesArray.h>
25 #include <TFile.h> 
26 #include <TH1I.h> 
27 #include <TH1F.h> 
28 #include <TH2F.h> 
29 #include "AliESDEvent.h"
30 #include "AliESDtrack.h"
31 #include "AliTOFcluster.h"
32 #include "AliTOFdigit.h"
33 #include "AliTOFSDigit.h"
34 #include "AliTOFhitT0.h"
35 #include "AliTOFQADataMaker.h"
36 #include "AliQAChecker.h"
37 #include "AliRawReader.h"
38 #include "AliTOFRawStream.h"
39 #include "AliTOFrawData.h"
40 #include "AliLog.h"
41
42 ClassImp(AliTOFQADataMaker)
43            
44 //____________________________________________________________________________ 
45   AliTOFQADataMaker::AliTOFQADataMaker() : 
46   AliQADataMaker(AliQAv1::GetDetName(AliQAv1::kTOF), "TOF Quality Assurance Data Maker"),
47     fTOFRawStream(AliTOFRawStream())
48 {
49   //
50   // ctor
51   //
52 }
53
54 //____________________________________________________________________________ 
55 AliTOFQADataMaker::AliTOFQADataMaker(const AliTOFQADataMaker& qadm) :
56   AliQADataMaker(),
57   fTOFRawStream(AliTOFRawStream(qadm.fTOFRawStream))
58 {
59   //
60   //copy ctor 
61   //
62   SetName((const char*)qadm.GetName()) ; 
63   SetTitle((const char*)qadm.GetTitle()); 
64 }
65
66 //__________________________________________________________________
67 AliTOFQADataMaker& AliTOFQADataMaker::operator = (const AliTOFQADataMaker& qadm )
68 {
69   //
70   // assignment operator.
71   //
72   this->~AliTOFQADataMaker();
73   new(this) AliTOFQADataMaker(qadm);
74   return *this;
75 }
76  
77 //____________________________________________________________________________ 
78 void AliTOFQADataMaker::InitHits()
79 {
80   //
81   // create Hits histograms in Hits subdir
82   //
83
84   Bool_t expert = kFALSE;
85
86   TH1F * h0 = new TH1F("hTOFHits",    "Number of TOF Hits ",301, -1.02, 5.) ;
87   h0->Sumw2() ;
88   h0->GetXaxis()->SetTitle("TOF hit number [10 power]");
89   Add2HitsList(h0, 0, expert) ;
90
91   TH1F * h1  = new TH1F("hTOFHitsTime", "Hits Time Spectrum in TOF (ns)", 2000, 0., 200) ;
92   h1->Sumw2() ;
93   h1->GetXaxis()->SetTitle("Simulated TOF time [ns]");
94   Add2HitsList(h1, 1, expert) ;
95
96   TH1F * h2  = new TH1F("hTOFHitsLength", "Length Spectrum in TOF (cm)", 500, 0., 500) ;
97   h2->Sumw2() ;
98   h2->GetXaxis()->SetTitle("Track length from primary vertex till hit TOF pad [cm]");
99   Add2HitsList(h2, 2, expert) ;
100
101   TH2F * h3  = new TH2F("hTOFHitsClusMap","Hits vs TOF eta-phi",183, -0.5, 182.5,865,-0.5,864.5) ;
102   h3->Sumw2() ;
103   h3->GetXaxis()->SetTitle("2*strip+padz (eta)");
104   h3->GetYaxis()->SetTitle("48*sector+padx (phi)");
105   h3->GetYaxis()->SetTitleOffset(1.15);
106   Add2HitsList(h3, 3, expert) ;
107 }
108
109 //____________________________________________________________________________ 
110 void AliTOFQADataMaker::InitDigits()
111 {
112   //
113   // create Digits histograms in Digits subdir
114   //
115
116   Bool_t expert = kFALSE;
117
118   TH1F * h0 = new TH1F("hTOFDigits",    "Number of TOF Digits ",301, -1.02, 5.) ;
119   h0->Sumw2() ;
120   h0->GetXaxis()->SetTitle("TOF digit number [10 power]");
121   Add2DigitsList(h0, 0, expert) ;
122
123   TH1F * h1  = new TH1F("hTOFDigitsTime", "Digits Time Spectrum in TOF (ns)", 2000, 0., 200) ;
124   h1->Sumw2() ;
125   h1->GetXaxis()->SetTitle("Digitized TOF time [ns]");
126   Add2DigitsList(h1, 1, expert) ;
127
128   TH1F * h2  = new TH1F("hTOFDigitsToT", "Digits ToT Spectrum in TOF (ns)", 500, 0., 50) ;
129   h2->Sumw2() ;
130   h2->GetXaxis()->SetTitle("Digitized TOT [ns]");
131   h2->GetYaxis()->SetTitle("Digitized TOF time [ns]");
132   Add2DigitsList(h2, 2, expert) ;
133
134   TH2F * h3  = new TH2F("hTOFDigitsClusMap","Digits vs TOF eta-phi",183, -0.5, 182.5,865,-0.5,864.5) ;
135   h3->Sumw2() ;
136   h3->GetXaxis()->SetTitle("2*strip+padz (eta)");
137   h3->GetYaxis()->SetTitle("48*sector+padx (phi)");
138   h3->GetYaxis()->SetTitleOffset(1.15);
139   Add2DigitsList(h3, 3, expert) ;
140
141 }
142
143 //____________________________________________________________________________ 
144 void AliTOFQADataMaker::InitSDigits()
145 {
146   //
147   // create SDigits histograms in SDigits subdir
148   //
149
150   Bool_t expert = kFALSE;
151
152   TH1F * h0 = new TH1F("hTOFSDigits",    "Number of TOF SDigits ",301, -1.02, 5.) ;
153   h0->Sumw2() ;
154   h0->GetXaxis()->SetTitle("TOF sdigit number [10 power]");
155   Add2SDigitsList(h0, 0, expert) ;
156
157   TH1F * h1  = new TH1F("hTOFSDigitsTime", "SDigits Time Spectrum in TOF (ns)", 2000, 0., 200) ;
158   h1->Sumw2() ;
159   h1->GetXaxis()->SetTitle("SDigitized TOF time [ns]");
160   Add2SDigitsList(h1, 1, expert) ;
161
162   TH2F * h2  = new TH2F("hTOFSDigitsClusMap","SDigits vs TOF eta-phi",183, -0.5, 182.5,865,-0.5,864.5) ;
163   h2->Sumw2() ;
164   h2->GetXaxis()->SetTitle("2*strip+padz (eta)");
165   h2->GetYaxis()->SetTitle("48*sector+padx (phi)");
166   h2->GetYaxis()->SetTitleOffset(1.15);
167   Add2SDigitsList(h2, 2, expert) ;
168
169 }
170
171 //____________________________________________________________________________ 
172 void AliTOFQADataMaker::InitRaws()
173 {
174   //
175   // create Raws histograms in Raws subdir
176   //
177
178   Bool_t expert = kFALSE;
179
180   TH1F * h0 = new TH1F("hTOFRaws",    "Number of TOF Raws ",301, -1.02, 5.) ;
181   h0->Sumw2() ;
182   h0->GetXaxis()->SetTitle("TOF raw number [10 power]");
183   Add2RawsList(h0, 0, expert) ;
184
185   TH1F * h1  = new TH1F("hTOFRawsTime", "Raws Time Spectrum in TOF (ns)", 20000, 0., 2000) ;
186   h1->Sumw2() ;
187   h1->GetXaxis()->SetTitle("Measured TOF time [ns]");
188   Add2RawsList(h1, 1, expert) ;
189
190   TH1F * h2  = new TH1F("hTOFRawsToT", "Raws ToT Spectrum in TOF (ns)", 500, 0., 50) ;
191   h2->Sumw2() ;
192   h2->GetXaxis()->SetTitle("Measured TOT [ns]");
193   h2->GetYaxis()->SetTitle("Measured TOF time [ns]");
194   Add2RawsList(h2, 2, expert) ;
195
196   TH2F * h3  = new TH2F("hTOFRawsClusMap","Raws vs TOF eta-phi",183, -0.5, 182.5,865,-0.5,864.5) ;
197   h3->Sumw2() ;
198   h3->GetXaxis()->SetTitle("2*strip+padz (eta)");
199   h3->GetYaxis()->SetTitle("48*sector+padx (phi)");
200   h3->GetYaxis()->SetTitleOffset(1.15);
201   Add2RawsList(h3, 3, expert) ;
202
203 }
204
205 //____________________________________________________________________________ 
206 void AliTOFQADataMaker::InitRecPoints()
207 {
208   //
209   // create RecPoints histograms in RecPoints subdir
210   //
211
212   Bool_t expert = kFALSE;
213
214   TH1F * h0 = new TH1F("hTOFRecPoints",    "Number of TOF RecPoints ",301, -1.02, 5.) ;
215   h0->Sumw2() ;
216   h0->GetXaxis()->SetTitle("TOF recPoint number [10 power]");
217   Add2RecPointsList(h0, 0, expert) ;
218
219   TH1F * h1  = new TH1F("hTOFRecPointsTime", "RecPoints Time Spectrum in TOF (ns)", 20000, 0., 2000) ;
220   h1->Sumw2() ;
221   h1->GetXaxis()->SetTitle("Calibrated TOF time [ns]");
222   Add2RecPointsList(h1, 1, expert) ;
223
224   TH1F * h2  = new TH1F("hTOFRecPointsRawTime", "RecPoints raw Time Spectrum in TOF (ns)", 20000, 0., 2000) ;
225   h2->Sumw2() ;
226   h2->GetXaxis()->SetTitle("Measured TOT [ns]");
227   h2->GetYaxis()->SetTitle("Measured TOF time [ns]");
228   Add2RecPointsList(h2, 2, expert) ;
229
230   TH1F * h3  = new TH1F("hTOFRecPointsToT", "RecPoints ToT Spectrum in TOF (ns)", 500, 0., 50) ;
231   h3->Sumw2() ;
232   h3->GetXaxis()->SetTitle("Measured TOT [ns]");
233   Add2RecPointsList(h3, 3, expert) ;
234
235   TH2F * h4  = new TH2F("hTOFRecPointsClusMap","RecPoints vs TOF phi-eta",183, -0.5, 182.5,865,-0.5,864.5) ;
236   h4->Sumw2() ;
237   h4->GetXaxis()->SetTitle("2*strip+padz (eta)");
238   h4->GetYaxis()->SetTitle("48*sector+padx (phi)");
239   h4->GetYaxis()->SetTitleOffset(1.15);
240   Add2RecPointsList(h4, 4, expert) ;
241
242 }
243
244 //____________________________________________________________________________ 
245 void AliTOFQADataMaker::InitESDs()
246 {
247   //
248   //create ESDs histograms in ESDs subdir
249   //
250
251   Bool_t expert = kFALSE;
252
253   TH1F * h0 = new TH1F("hTOFESDs",    "Number of matched TOF tracks over ESDs",       250, -1., 4.) ;
254   h0->Sumw2() ; 
255   h0->GetXaxis()->SetTitle("Number of TOF matched ESD tracks [10 power]");
256   Add2ESDsList(h0, 0, expert) ;
257
258   TH1F * h1  = new TH1F("hTOFESDsTime", "Time Spectrum in TOF (ns)", 20000, 0., 2000) ;
259   h1->Sumw2() ;
260   h1->GetXaxis()->SetTitle("Calibrated TOF time [ns]");
261   Add2ESDsList(h1, 1, expert) ;
262
263   TH1F * h2  = new TH1F("hTOFESDsRawTime", "raw Time Spectrum in TOF (ns)", 20000, 0., 2000) ;
264   h2->Sumw2() ;
265   h2->GetXaxis()->SetTitle("Measured TOF time [ns]");
266   Add2ESDsList(h2, 2, expert) ;
267
268   TH1F * h3  = new TH1F("hTOFESDsToT", "ToT Spectrum in TOF (ns)", 500, 0., 50) ;
269   h3->Sumw2() ;
270   h3->GetXaxis()->SetTitle("Measured TOT [ns]");
271   Add2ESDsList(h3, 3, expert) ;
272
273   TH1F * h4 = new TH1F("hTOFESDsPID",    "Fraction of matched TOF tracks with good PID flag", 101, 0., 101.) ;
274   h4->Sumw2() ;
275   h4->GetXaxis()->SetTitle("Fraction of TOF matched ESD tracks with good flag [%]");
276   Add2ESDsList(h4, 4, expert) ;
277 }
278
279
280 //____________________________________________________________________________
281 void AliTOFQADataMaker::MakeHits(TClonesArray * hits)
282 {
283   //
284   //make QA data from Hits
285   //
286
287   Int_t in[5];
288   Int_t out[5];
289
290   Int_t nentries=hits->GetEntriesFast();
291   if(nentries<=0) {
292     GetHitsData(0)->Fill(-1.) ; 
293   } else{
294     GetHitsData(0)->Fill(TMath::Log10(nentries)) ; 
295   }
296   TIter next(hits) ; 
297   AliTOFhitT0 * hit ; 
298   while ( (hit = dynamic_cast<AliTOFhitT0 *>(next())) ) {
299
300     GetHitsData(1)->Fill( hit->GetTof()*1.E9) ;//in ns
301     GetHitsData(2)->Fill( hit->GetLen()) ;//in cm
302   
303     in[0] = hit->GetSector();
304     in[1] = hit->GetPlate();
305     in[2]= hit->GetStrip();
306     in[3]= hit->GetPadx();
307     in[4]= hit->GetPadz();
308     GetMapIndeces(in,out);
309     GetHitsData(3)->Fill( out[0],out[1]) ;//hit map
310   }
311
312 }
313
314
315 //____________________________________________________________________________
316 void AliTOFQADataMaker::MakeHits(TTree * hitTree)
317 {
318   //
319   // make QA data from Hit Tree
320   //
321   if(!hitTree){
322     AliError("can't get the tree with TOF hits !");
323     return;
324   }     
325
326   TBranch * branch = hitTree->GetBranch("TOF") ;
327
328   if (!branch ) {
329     AliError("TOF branch in Hit Tree not found") ; 
330     return;
331   }
332
333   TClonesArray * hits = new TClonesArray("AliTOFhitT0", 1000);
334   TClonesArray * dummy = new TClonesArray("AliTOFhitT0", 1000);
335   branch->SetAddress(&dummy);
336   Int_t index = 0 ;  
337   for (Int_t ientry = 0 ; ientry < branch->GetEntries() ; ientry++) {
338     branch->GetEntry(ientry) ; 
339     for (Int_t ihit = 0 ; ihit < dummy->GetEntries() ; ihit++) {
340       AliTOFhitT0 * hit = dynamic_cast<AliTOFhitT0 *> (dummy->At(ihit)) ; 
341       new((*hits)[index]) AliTOFhitT0(*hit) ; 
342       index++ ;
343     } 
344   }     
345
346   dummy->Delete();
347   delete dummy;
348   MakeHits(hits) ; 
349
350 }
351
352 //____________________________________________________________________________
353 void AliTOFQADataMaker::MakeDigits(TClonesArray * digits)
354 {
355   //
356   // makes data from Digits
357   //
358   Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;
359   Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
360   Int_t in[5];
361   Int_t out[5];
362
363   Int_t nentries=digits->GetEntriesFast();
364   if(nentries<=0){
365     GetDigitsData(0)->Fill(-1.) ; 
366   }else{
367     GetDigitsData(0)->Fill(TMath::Log10(nentries)) ; 
368   } 
369
370   TIter next(digits) ; 
371   AliTOFdigit * digit ; 
372   while ( (digit = dynamic_cast<AliTOFdigit *>(next())) ) {
373     
374     GetDigitsData(1)->Fill( digit->GetTdc()*tdc2ns) ;//in ns
375     GetDigitsData(2)->Fill( digit->GetToT()*tot2ns) ;//in ns
376
377     in[0] = digit->GetSector();
378     in[1] = digit->GetPlate();
379     in[2] = digit->GetStrip();
380     in[3] = digit->GetPadx();
381     in[4]= digit->GetPadz();
382     GetMapIndeces(in,out);
383     GetDigitsData(3)->Fill( out[0],out[1]) ;//digit map
384   }
385
386 }
387
388
389 //____________________________________________________________________________
390 void AliTOFQADataMaker::MakeDigits(TTree * digitTree)
391 {
392   //
393   // makes data from Digit Tree
394   //
395   TClonesArray * digits = new TClonesArray("AliTOFdigit", 1000) ; 
396   
397   TBranch * branch = digitTree->GetBranch("TOF") ;
398   if ( ! branch ) {
399     AliError("TOF branch in Digit Tree not found") ; 
400     return;
401   }
402   branch->SetAddress(&digits) ;
403   branch->GetEntry(0) ; 
404   MakeDigits(digits) ; 
405 }
406
407 //____________________________________________________________________________
408 void AliTOFQADataMaker::MakeSDigits(TClonesArray * sdigits)
409 {
410   //
411   // makes data from SDigits
412   //
413
414   Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;
415   Int_t in[5];
416   Int_t out[5];
417
418   Int_t nentries=sdigits->GetEntriesFast();
419   if(nentries<=0){
420     GetSDigitsData(0)->Fill(-1.) ; 
421   }else{
422     GetSDigitsData(0)->Fill(TMath::Log10(nentries)) ; 
423   } 
424
425   TIter next(sdigits) ; 
426   AliTOFSDigit * sdigit ; 
427   while ( (sdigit = dynamic_cast<AliTOFSDigit *>(next())) ) {
428     
429     for(Int_t i=0;i<sdigit->GetNDigits();i++){
430       GetSDigitsData(1)->Fill( sdigit->GetTdc(i)*tdc2ns) ;//in ns
431     }
432
433     in[0] = sdigit->GetSector();
434     in[1] = sdigit->GetPlate();
435     in[2] = sdigit->GetStrip();
436     in[3] = sdigit->GetPadx();
437     in[4]= sdigit->GetPadz();
438     GetMapIndeces(in,out);
439     GetSDigitsData(2)->Fill( out[0],out[1]) ;//sdigit map
440   }
441 }
442
443 //____________________________________________________________________________
444 void AliTOFQADataMaker::MakeSDigits(TTree * sdigitTree)
445 {
446   //
447   // makes data from SDigit Tree
448   //
449   TClonesArray * sdigits = new TClonesArray("AliTOFSDigit", 1000) ; 
450   
451   TBranch * branch = sdigitTree->GetBranch("TOF") ;
452   if ( ! branch ) {
453     AliError("TOF branch in SDigit Tree not found") ; 
454     return;
455   }
456   branch->SetAddress(&sdigits) ;
457   branch->GetEntry(0) ; 
458   MakeSDigits(sdigits) ; 
459 }
460
461 //____________________________________________________________________________
462 void AliTOFQADataMaker::MakeRaws(AliRawReader* rawReader)
463 {
464   //
465   // makes data from Raws
466   //
467
468   Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;
469   Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
470
471
472   Int_t ntof = 0 ; 
473   Int_t in[5];
474   Int_t out[5];
475
476   TClonesArray * clonesRawData;
477   //AliTOFRawStream tofInput(rawReader);
478   fTOFRawStream.SetRawReader(rawReader);
479   for (Int_t iDDL = 0; iDDL < AliTOFGeometry::NDDL()*AliTOFGeometry::NSectors(); iDDL++){
480     rawReader->Reset();
481     fTOFRawStream.LoadRawData(iDDL);
482     clonesRawData = (TClonesArray*)fTOFRawStream.GetRawData();
483     for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
484       AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
485       //if (!tofRawDatum->GetTOT() || !tofRawDatum->GetTOF()) continue;
486       if (!tofRawDatum->GetTOF()) continue;
487       ntof++;
488       GetRawsData(1)->Fill( tofRawDatum->GetTOF()*tdc2ns) ;//in ns
489       GetRawsData(2)->Fill( tofRawDatum->GetTOT()*tot2ns) ;//in ns
490
491       fTOFRawStream.EquipmentId2VolumeId(iDDL, 
492                                          tofRawDatum->GetTRM(), 
493                                          tofRawDatum->GetTRMchain(),
494                                          tofRawDatum->GetTDC(), 
495                                          tofRawDatum->GetTDCchannel(), 
496                                          in);
497     
498       GetMapIndeces(in,out);
499       GetRawsData(3)->Fill( out[0],out[1]) ;//raw map
500       
501     } // while loop
502     
503     clonesRawData->Clear();
504     
505   } // DDL Loop
506   
507   fTOFRawStream.Clear();
508
509   Int_t nentries=ntof;
510   if(nentries<=0){
511     GetRawsData(0)->Fill(-1.) ; 
512   }else{
513     GetRawsData(0)->Fill(TMath::Log10(nentries)) ; 
514   }
515 }
516
517 //____________________________________________________________________________
518 void AliTOFQADataMaker::MakeRecPoints(TTree * clustersTree)
519 {
520   //
521   // Make data from Clusters
522   //
523
524   Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;
525   Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
526
527   Int_t in[5];
528   Int_t out[5];
529
530   TBranch *branch=clustersTree->GetBranch("TOF");
531   if (!branch) { 
532     AliError("can't get the branch with the TOF clusters !");
533     return;
534   }
535
536   TClonesArray dummy("AliTOFcluster",10000), *clusters=&dummy;
537   branch->SetAddress(&clusters);
538
539   // Import the tree
540   clustersTree->GetEvent(0);  
541   
542   Int_t nentries=clusters->GetEntriesFast();
543   if(nentries<=0){
544     GetRecPointsData(0)->Fill(-1.) ; 
545   }else{
546     GetRecPointsData(0)->Fill(TMath::Log10(nentries)) ; 
547   } 
548  
549   TIter next(clusters) ; 
550   AliTOFcluster * c ; 
551   while ( (c = dynamic_cast<AliTOFcluster *>(next())) ) {
552     GetRecPointsData(1)->Fill(c->GetTDC()*tdc2ns);
553     GetRecPointsData(2)->Fill(c->GetTDCRAW()*tdc2ns);
554     GetRecPointsData(3)->Fill(c->GetToT()*tot2ns);
555     
556     in[0] = c->GetDetInd(0);
557     in[1] = c->GetDetInd(1);
558     in[2] = c->GetDetInd(2);
559     in[3] = c->GetDetInd(4); //X and Z indeces inverted in RecPoints
560     in[4] = c->GetDetInd(3); //X and Z indeces inverted in RecPoints
561     
562     GetMapIndeces(in,out);
563     GetRecPointsData(4)->Fill(out[0],out[1]);
564     
565   }
566 }
567
568 //____________________________________________________________________________
569 void AliTOFQADataMaker::MakeESDs(AliESDEvent * esd)
570 {
571   //
572   // make QA data from ESDs
573   //  
574   Int_t ntrk = esd->GetNumberOfTracks() ; 
575   Int_t ntof=0;
576   Int_t ntofpid=0;
577   while (ntrk--) {
578     AliESDtrack *track=esd->GetTrack(ntrk);
579     Double_t tofTime=track->GetTOFsignal()*1E-3;//in ns
580     Double_t tofTimeRaw=track->GetTOFsignalRaw()*1E-3;//in ns
581     Double_t tofToT=track->GetTOFsignalToT(); //in ns
582     if(!(tofTime>0))continue;
583     ntof++;
584     GetESDsData(1)->Fill(tofTime);
585     GetESDsData(2)->Fill(tofTimeRaw); 
586     GetESDsData(3)->Fill(tofToT);
587     //check how many tracks where ESD PID is ok 
588     UInt_t status=track->GetStatus();
589     if (((status&AliESDtrack::kESDpid)==0) || 
590         ((status&AliESDtrack::kTOFpid)==0)) continue;
591     ntofpid++;
592   }
593   
594   Int_t nentries=ntof;
595   if(nentries<=0){
596     GetESDsData(0)->Fill(-1.) ;
597   }else{
598     GetESDsData(0)->Fill(TMath::Log10(nentries)) ;
599   }
600
601   Float_t ratio = 0.;
602   if(ntof>0) ratio=(Float_t)ntofpid/(Float_t)ntof*100.;
603   GetESDsData(4)->Fill(ratio) ;
604
605 }
606
607 //____________________________________________________________________________ 
608 void AliTOFQADataMaker::StartOfDetectorCycle()
609 {
610   //
611   //Detector specific actions at start of cycle
612   //to be implemented  
613 }
614
615 //____________________________________________________________________________ 
616 void AliTOFQADataMaker::EndOfDetectorCycle(AliQAv1::TASKINDEX task, TObjArray * list)
617 {
618   //Detector specific actions at end of cycle
619   // do the QA checking
620
621   AliQAChecker::Instance()->Run(AliQAv1::kTOF, task, list) ;  
622 }
623 //____________________________________________________________________________
624 void AliTOFQADataMaker::GetMapIndeces(Int_t* in , Int_t* out)
625 {
626   //
627   //return appropriate indeces for the theta-phi map
628   //
629
630   Int_t npadX = AliTOFGeometry::NpadX();
631   Int_t npadZ = AliTOFGeometry::NpadZ();
632   Int_t nStripA = AliTOFGeometry::NStripA();
633   Int_t nStripB = AliTOFGeometry::NStripB();
634   Int_t nStripC = AliTOFGeometry::NStripC();
635
636   Int_t isector = in[0];
637   Int_t iplate = in[1];
638   Int_t istrip = in[2];
639   Int_t ipadX = in[3]; 
640   Int_t ipadZ = in[4]; 
641   
642   Int_t stripOffset = 0;
643   switch (iplate) {
644   case 0:
645     stripOffset = 0;
646       break;
647   case 1:
648     stripOffset = nStripC;
649     break;
650   case 2:
651     stripOffset = nStripC+nStripB;
652     break;
653   case 3:
654     stripOffset = nStripC+nStripB+nStripA;
655     break;
656   case 4:
657     stripOffset = nStripC+nStripB+nStripA+nStripB;
658     break;
659   default:
660     AliError(Form("Wrong plate number in TOF (%d) !",iplate));
661     break;
662   };
663   Int_t zindex=npadZ*(istrip+stripOffset)+(ipadZ+1);
664   Int_t phiindex=npadX*isector+ipadX+1;
665   out[0]=zindex;  
666   out[1]=phiindex;  
667   
668 }