576fcc6c8ae1809500004bc641d44d6b8319dc38
[u/mrichter/AliRoot.git] / T0 / AliT0QADataMakerRec.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 /* $Id$ */
18
19 //---
20 //  Produces the data needed to calculate the quality assurance. 
21 //  Alla.Maevskaya@cern.ch
22 //---
23
24 // --- ROOT system ---
25 #include <TClonesArray.h>
26 #include <TFile.h> 
27 #include <TH1F.h> 
28 #include <TH2F.h> 
29 #include <TDirectory.h>
30 // --- Standard library ---
31
32 // --- AliRoot header files ---
33 #include "AliESDEvent.h"
34 #include "AliLog.h"
35 #include "AliT0digit.h" 
36 #include "AliT0hit.h"
37 #include "AliT0RecPoint.h"
38 #include "AliT0QADataMakerRec.h"
39 #include "AliQAChecker.h"
40 #include "AliT0RawReader.h"
41 #include "AliT0RecoParam.h"
42
43 #include "Riostream.h"
44 ClassImp(AliT0QADataMakerRec)
45            
46 //____________________________________________________________________________ 
47   AliT0QADataMakerRec::AliT0QADataMakerRec() : 
48 AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kT0), 
49                   "T0 Quality Assurance Data Maker"),
50   fnEventCal(0),
51   fnEventPhys(0)
52
53 {
54   // ctor
55   for (Int_t i=0; i<6; i++) {
56     fNumTriggers[i]=0;
57     fNumTriggersCal[i]=0;
58     fTrEffCal[i] = 0;
59     fTrEffPhys[i] = 0;
60
61   }
62   for (Int_t i=0; i<24; i++)
63     {
64       feffC[i]=0;
65       feffA[i]=0;
66       feffqtc[i]=0;
67    }
68 }
69
70 //____________________________________________________________________________ 
71 AliT0QADataMakerRec::AliT0QADataMakerRec(const AliT0QADataMakerRec& qadm) :
72   AliQADataMakerRec(),
73   fnEventCal(0),
74   fnEventPhys(0)
75
76   
77 {
78   //copy ctor 
79  SetName((const char*)qadm.GetName()) ; 
80   SetTitle((const char*)qadm.GetTitle()); 
81 }
82
83 //__________________________________________________________________
84 AliT0QADataMakerRec& AliT0QADataMakerRec::operator = (const AliT0QADataMakerRec& qadm )
85 {
86   // Equal operator.
87   this->~AliT0QADataMakerRec();
88   new(this) AliT0QADataMakerRec(qadm);
89   return *this;
90 }
91 //____________________________________________________________________________
92 void AliT0QADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
93 {
94   //Detector specific actions at end of cycle
95   // do the QA checking
96   AliQAChecker::Instance()->Run(AliQAv1::kT0, task, list) ;
97   
98   for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
99     if (! IsValidEventSpecie(specie, list)) 
100       continue ;
101     SetEventSpecie(AliRecoParam::ConvertIndex(specie)) ; 
102     if ( task == AliQAv1::kRAWS ) {
103       GetRawsData(0)->SetLabelSize(0.02);
104       const Char_t *triggers[6] = {"mean", "vertex","ORA","ORC","central","semi-central"};
105       for (Int_t itr=0; itr<6; itr++) {
106         if ( fnEventCal>0) 
107           fTrEffCal[itr] = Float_t (fNumTriggersCal[itr])/Float_t (fnEventCal);
108         if ( fnEventPhys>0) 
109           fTrEffPhys[itr] = Float_t (fNumTriggers[itr])/Float_t (fnEventPhys);
110
111         GetRawsData(420)->Fill(triggers[itr], fTrEffCal[itr]);
112         GetRawsData(420)->SetBinContent(itr+1, fTrEffCal[itr]);
113         GetRawsData(97)->Fill(triggers[itr], fTrEffPhys[itr]);
114         GetRawsData(97)->SetBinContent(itr+1, fTrEffPhys[itr]);
115       } 
116       Float_t effic=0;
117       for(Int_t ik=0; ik<24; ik++)
118         {  
119           effic=0;
120           if ( fnEventCal>0) effic = Float_t(feffC[ik])/Float_t(fnEventCal);
121           GetRawsData(205)->SetBinContent(ik+1,effic) ;
122           effic=0;
123           if ( fnEventCal>0) effic = Float_t(feffA[ik])/Float_t(fnEventCal);
124           GetRawsData(206)->SetBinContent(ik+1,effic );
125           effic=0;
126           if ( fnEventCal>0) effic = Float_t(feffqtc[ik])/Float_t(fnEventCal);
127           GetRawsData(207)->SetBinContent(ik+1, effic);
128         }
129       
130       
131     }
132     
133   }
134
135 }
136 //____________________________________________________________________________
137 void AliT0QADataMakerRec::StartOfDetectorCycle()
138 {
139   //Detector specific actions at start of cycle
140
141
142 }
143  
144 //____________________________________________________________________________ 
145 void AliT0QADataMakerRec::InitRaws()
146 {
147   // create Raw histograms in Raw subdir
148   const Bool_t expert   = kTRUE ; 
149   const Bool_t saveCorr = kTRUE ; 
150   const Bool_t image    = kTRUE ; 
151   Float_t low[500];
152   Float_t high[500];
153
154   
155   for (Int_t i=0; i<500; i++){
156     low[i]  = GetRecoParam()->GetLow(i);
157     high[i]  = GetRecoParam()->GetHigh(i);
158
159   }
160
161   TString timename, ampname, qtcname, ledname;
162   TString timeCalname, ampCalname, ledCalname, qtcCalname;
163   TString qt1name, qt0name, qt1Calname, qt0Calname;
164
165   TH1F* fhRefPoint = new TH1F("hRefPoint","Ref Point", 20000,1230000, 1250000);
166   Add2RawsList( fhRefPoint,0, expert, !image, !saveCorr);
167    
168   TH1F *fhRawCFD[24]; TH1F * fhRawLEDamp[24];
169   TH1F *fhRawQTC[24]; TH1F * fhRawLED[24];
170   TH1F *fhRawCFDcal[24]; TH1F * fhRawLEDampcal[24]; 
171   TH1F *fhRawCFDcalpmt[24]; TH1F * fhRawLEDcalpmt[24]; 
172   TH1F *fhRawCFDpmt[24]; TH1F * fhRawLEDpmt[24]; 
173   TH1F *fhRawQTCcal[24];  TH1F * fhRawLEDcal[24];
174   TH1F *fhRawQT0cal[24]; TH1F *fhRawQT1cal[24];
175   TH1F *fhRawQT1[24]; TH1F *fhRawQT0[24];
176   
177   for (Int_t i=0; i<24; i++)
178     {
179       timename ="hRawCFD";
180       ledname = "hRawLED";
181       qtcname = "hRawQTC";
182       qt0name = "hRawQT0_";
183       qt1name = "hRawQT1_";
184       ampname = "hRawLEDminCFD";
185       timename += i+1;
186       ampname += i+1;
187       qtcname += i+1;
188       qt0name += i+1;
189       qt1name += i+1;
190       ledname += i+1;
191       fhRawCFD[i] = new TH1F(timename.Data(), Form("%s;CFD [#channels];Counts", timename.Data()),high[i+1]-low[i+1],low[i+1],high[i+1]);
192         Add2RawsList( fhRawCFD[i],i+1, expert, !image, !saveCorr);
193       fhRawLED[i] = new TH1F(ledname.Data(),  Form("%s;LED[#channels];Counts", ledname.Data()),high[i+24+1]-low[i+24+1],low[i+24+1],high[i]);
194       Add2RawsList( fhRawLED[i],i+24+1, expert, !image, !saveCorr);
195       fhRawLEDamp[i] = new TH1F(ampname.Data(),  Form("%s;LED-CFD [#channels];Counts", ampname.Data()),1000,0,1000);
196      Add2RawsList( fhRawLEDamp[i],i+48+1, expert, !image, !saveCorr);
197       fhRawQTC[i] = new TH1F(qtcname.Data(),  Form("%s;QTC[#channels];Counts", qtcname.Data()),10000,0,10000);
198       Add2RawsList( fhRawQTC[i],i+72+1, expert, !image, !saveCorr);
199       fhRawQT1[i] = new TH1F(qt1name.Data(),  Form("%s;QT1[#channels];Counts", qtcname.Data()),high[270+i]-low[270+i],low[270+i],high[270+i]);
200        Add2RawsList( fhRawQT1[i],270+i, expert, !image, !saveCorr);
201       fhRawQT0[i] = new TH1F(qt1name.Data(),  Form("%s;QT0[#channels];Counts", qtcname.Data()),high[270+24+i]-low[270+24+i],low[270+24+i],high[270+24+i]);
202      Add2RawsList( fhRawQT0[i],270+24+i, expert, !image, !saveCorr);
203     }
204   TH1F* fhRawTrigger = new TH1F("hRawTrigger"," phys triggers;Trigger #;Counts",5,0,5);
205   Add2RawsList(fhRawTrigger ,97, expert, !image, !saveCorr);
206   TH1F* fhRawMean = new TH1F("hRawMean","online mean signal, physics event;", 10000,80000,100000);
207   Add2RawsList( fhRawMean,98, expert, !image, !saveCorr);
208
209   TH1F* fhRawVertex = new TH1F("hRawVertex","online vertex signal; counts", 10000,80000,100000);
210   Add2RawsList( fhRawVertex,99, expert, !image, !saveCorr);
211
212   TH1F* fhRawORA = new TH1F("hRawORA","online OR A; counts", high[100]-low[100],low[100],high[100]);
213   Add2RawsList( fhRawORA,100, expert, !image, !saveCorr);
214   TH1F* fhRawORC = new TH1F("hRawORC","online OR C;counts", high[101]-low[101],low[101],high[101]);
215   Add2RawsList( fhRawORC,101, expert, !image, !saveCorr);
216
217
218   for (Int_t i=0; i<24; i++)
219     {
220       // for events with trigger CALIBRATION_EVENT
221       timeCalname ="hRawCFDcal";
222       ledCalname = "hRawLEDcal";
223       ampCalname = "hRawLEDminCFDcal";
224       qtcCalname = "hRawQTCcal";
225       qt0Calname = "hRawQT0cal";
226       qt1Calname = "hRawQT1cal";
227       timeCalname += i+1;
228       ledCalname += i+1;
229       ampCalname += i+1;
230       qtcCalname += i+1;
231       qt0Calname += i+1;
232       qt1Calname += i+1;
233  
234       fhRawCFDcal[i] = new TH1F(timeCalname.Data(),  Form("%s;Time ;Counts", timeCalname.Data()),high[101+i+1]-low[101+i+1],low[101+i+1],high[101+i+1]);
235       Add2RawsList( fhRawCFDcal[i],101+i+1, expert, !image, !saveCorr);
236  
237      fhRawLEDcal[i] = new TH1F(ledCalname.Data(),  Form("%s;Time ;Counts", ledCalname.Data()),high[101+i+24+1]-low[101+i+24+1],low[101+i+24+1],high[101+i+24+1]);
238       Add2RawsList( fhRawLEDcal[i],101+i+24+1, expert, !image, !saveCorr);
239
240       fhRawLEDampcal[i] = new TH1F(ampCalname.Data(), Form("%s;Amplitude [ADC counts];Counts", ampCalname.Data()),1000,0,1000);
241       Add2RawsList( fhRawLEDampcal[i],101+i+48+1, expert, !image, !saveCorr);
242
243       fhRawQTCcal[i] = new TH1F(qtcCalname.Data(), Form("%s;Charge ;Counts",qtcCalname.Data()),10000,0,10000);
244       Add2RawsList( fhRawQTCcal[i],101+i+72+1, expert, !image, !saveCorr);
245
246       fhRawQT0cal[i] = new TH1F(qt0Calname.Data(), Form("%s;Charge ;Counts",qt0Calname.Data()),high[371+i]-low[371+i],low[371+i],high[371+i]);
247       Add2RawsList( fhRawQT0cal[i],371+i, expert, !image, !saveCorr);
248
249       fhRawQT1cal[i] = new TH1F(qt1Calname.Data(), Form("%s;Charge ;Counts",qt1Calname.Data()),high[i+371+24]-low[i+371+24],low[i+371+24],high[i+371+24]);
250       Add2RawsList( fhRawQT1cal[i],i+371+24, expert, !image, !saveCorr);
251
252       }
253
254   //from PMT1 (equalizing)
255   for (Int_t i=0; i<24; i++)
256     {
257       // for events with trigger CALIBRATION_EVENT
258       timeCalname ="hRawCFDcalpmt";
259       timename ="hRawCFDpmt";
260       timeCalname += i+1;
261       ledCalname += i+1;
262       timename += i+1;
263       ledname += i+1;
264       fhRawCFDcalpmt[i] = new TH1F(timeCalname.Data(),  Form("%s;Time;Counts", timeCalname.Data()),2000,-1000,1000);
265        Add2RawsList( fhRawCFDcalpmt[i],321+i , expert, !image, !saveCorr);
266
267       fhRawCFDpmt[i] = new TH1F(timename.Data(),  Form("%s;Time;Counts", timename.Data()),2000,-1000,1000);
268       Add2RawsList( fhRawCFDpmt[i],220+i, expert, !image, !saveCorr);
269      }
270
271   TH1F* fhRawTriggerCal = new TH1F("hRawTriggerCal"," laser triggers",6,0,6);
272   Add2RawsList(fhRawTriggerCal ,420 , !expert, image, !saveCorr);
273  
274   TH1F* fhRawMeanCal = new TH1F("hRawMeanCal","online mean signal, calibration event",high[198]-low[198],low[198],high[198]);
275   Add2RawsList( fhRawMeanCal,198, expert, !image, !saveCorr);
276  
277   TH1F* fhRawVertexCal = new TH1F("hRawVertexCal","online vertex signal, calibration event ", high[199]-low[199],low[199],high[199] );
278    Add2RawsList( fhRawVertexCal,199, expert, !image, !saveCorr);
279  
280  
281   TH1F* fhRawORAcal = new TH1F("hRawORAcal","laser OR A; counts", high[200]-low[200],low[200],high[200]);
282    Add2RawsList( fhRawORAcal,200, expert, !image, !saveCorr );
283  
284  
285   TH1F* fhRawORCcal = new TH1F("hRawORCcal","laserOR C;counts ", high[201]-low[201],low[201],high[201]);
286    Add2RawsList( fhRawORCcal,201, expert, !image, !saveCorr);
287  
288
289   //multiplicity trigger
290   TH1F* fhMultcal = new TH1F("hMultcal","full mulltiplicity;Multiplicity;Entries", high[202]-low[202],low[202],high[202]);
291   Add2RawsList( fhMultcal,202, expert, !image, !saveCorr );
292    TH1F* fhMultScal = new TH1F("hMultSemical","full multiplicity with semi-central trigger;Multiplicity;Entries",
293                              high[203]-low[203],low[203],high[203] );
294   Add2RawsList( fhMultScal,203, expert, !image, !saveCorr);
295   TH1F* fhMultCcal = new TH1F("hMultCentrcal","full multiplicity with central trigger;Multiplicity;Entries", 
296                              high[204]-low[204],low[204],high[204]);
297   Add2RawsList( fhMultCcal,204, expert, !image, !saveCorr);
298  
299   TH1F* fhEffCFD = new TH1F("hEffCFD","#PMT; #CFD counts/nEvents",24, 0 ,24); 
300   Add2RawsList( fhEffCFD,205, !expert, image, !saveCorr);
301  
302   TH1F* fhEffLED = new TH1F("hEffLED","#PMT; #LED counts/nEvent",24, 0 ,24);
303   Add2RawsList( fhEffLED,206, !expert, image, !saveCorr);
304
305   TH1F* fhEffQTC = new TH1F("hEffQTC","#PMT; QTC efficiency%s;",24, 0 ,24);
306   Add2RawsList( fhEffQTC,207, !expert, image, !saveCorr);
307
308   
309   TH2F* fhCFDcal = new TH2F("hCFDcal","CFD laser; #PMT; CFD {#channnels}",25, 0 ,25,high[208]-low[208],low[208],high[208]);
310   fhCFDcal->SetOption("COLZ");
311   Add2RawsList( fhCFDcal,208, !expert, image, !saveCorr);
312
313
314   TH2F* fhLEDcal = new TH2F("hLEDcal","LED laser; #PMT; LED [#channnels]",25, 0 ,25, high[209]-low[209],low[209],high[209]);
315   fhLEDcal->SetOption("COLZ");
316   Add2RawsList( fhLEDcal,209, !expert, image, !saveCorr);
317
318
319  const Char_t *triggers[6] = {"mean", "vertex","ORA","ORC","central","semi-central"};
320   for (Int_t itr=0; itr<6; itr++) {
321     GetRawsData(420)->Fill(triggers[itr], fNumTriggersCal[itr]);
322     GetRawsData(420)->SetBinContent(itr+1, fNumTriggersCal[itr]);
323     GetRawsData(97)->Fill(triggers[itr], fNumTriggers[itr]);
324     GetRawsData(97)->SetBinContent(itr+1, fNumTriggers[itr]);
325   }  
326 }
327
328 //____________________________________________________________________________ 
329 void AliT0QADataMakerRec::InitDigits()
330 {
331   // create Digits histograms in Digits subdir
332   const Bool_t expert   = kTRUE ; 
333   const Bool_t image    = kTRUE ; 
334   
335   TH2F * fhDigCFD = new TH2F("fhDigCFD", " CFD digits; #PMT; CFD digits[#channels]",25,-0.5,24.5,100,0,1000);
336   fhDigCFD->SetOption("COLZ");
337   Add2DigitsList( fhDigCFD,0, !expert, image);
338   TH2F *fhDigLEDamp = new TH2F("fhDigLEDamp", " LED-CFD digits; #PMT; LED-CFD amplitude ",25,-0.5,24.5,100,100,1000);
339   fhDigLEDamp->SetOption("COLZ");
340   Add2DigitsList( fhDigLEDamp,1, !expert, !image);
341   TH2F * fhDigQTC = new TH2F("fhDigQTC", " QTC digits; #PMT; QTC amplitude",25,-0.5,24.5,100,100,10000);
342   fhDigQTC->SetOption("COLZ");
343   Add2DigitsList( fhDigQTC,2, !expert, !image);}
344
345 //____________________________________________________________________________ 
346
347 void AliT0QADataMakerRec::InitRecPoints()
348 {
349   // create cluster histograms in RecPoint subdir
350   const Bool_t expert   = kTRUE ; 
351   const Bool_t image    = kTRUE ; 
352
353   TH2F* fhRecCFD = new TH2F("hRecCFD"," CFD time;Time [ns];Counts",24, 0 ,24, 
354                               100,-50,50);
355   fhRecCFD->SetOption("COLZ");
356   Add2RecPointsList ( fhRecCFD,0, !expert, image);
357
358   TH2F* fhRecAmpDiff = new TH2F("hRecAmpDiff"," LED-CFD  min QTC amplitude;Amplitude [ADC counts];Counts",
359                                 24, 0 ,24, 200,-10,10);
360   fhRecAmpDiff->SetOption("COLZ");
361   Add2RecPointsList (fhRecAmpDiff, 1, !expert, image);
362   
363   TH1F *fhMean = new TH1F("hMean","online - rec mean;online - rec mean[#channels];",2000, -1000, 1000);
364   Add2RecPointsList ( fhMean,2, !expert, image);
365
366 }
367
368 //____________________________________________________________________________
369 void AliT0QADataMakerRec::InitESDs()
370 {
371   //create ESDs histograms in ESDs subdir
372   const Bool_t expert   = kTRUE ; 
373   const Bool_t image    = kTRUE ; 
374   
375   TH1F *fhESDMean = new TH1F("hESDmean"," ESD mean; mean time[%channels]",1000,0,1000);
376   Add2ESDsList(fhESDMean, 0, !expert, image) ;
377   TH1F * fhESDVertex = new TH1F("hESDvertex","ESDvertex; vertex[cm];",82,-30,30);
378   Add2ESDsList(fhESDVertex, 1, !expert, image) ;
379   
380
381 }
382
383 //____________________________________________________________________________
384 void AliT0QADataMakerRec::MakeRaws( AliRawReader* rawReader)
385 {
386
387   rawReader->Reset() ; 
388   //fills QA histos for RAW
389   Int_t shift=0;
390   Int_t refPointParam = GetRecoParam()->GetRefPoint();
391   Int_t refpoint = 0;
392
393   AliT0RawReader *start = new AliT0RawReader(rawReader);
394   
395   if (! start->Next())
396     AliDebug(AliQAv1::GetQADebugLevel(),Form(" no raw data found!!"));
397   else
398     {  
399       
400       UInt_t type =rawReader->GetType();
401       if (type == 8){ shift=101; fnEventCal++;} 
402       if (type == 7){ shift=0;   fnEventPhys++;}
403       Int_t allData[110][5];
404       for (Int_t i0=0; i0<105; i0++)
405         {
406           for (Int_t j0=0; j0<5; j0++) allData[i0][j0]=0;
407         }
408       for (Int_t i=0; i<105; i++) 
409         for (Int_t iHit=0; iHit<5; iHit++)
410           allData[i][iHit]= start->GetData(i,iHit);
411       
412       if (allData[0][0] > 0 ) GetRawsData(0) -> Fill( allData[0][0]);
413  
414       refpoint = allData[refPointParam][0];
415       if (refPointParam <  0 ) refpoint=0; 
416       if (refPointParam == 0 ) refpoint = allData[0][0] - 5000;
417     
418       for (Int_t ik = 0; ik<12; ik++){
419         //      for (Int_t iHt=0; iHt<1; iHt++){
420         for (Int_t iHt=0; iHt<5; iHt++){
421           //cfd
422           if(allData[ik+1][iHt]>0) {
423             GetRawsData(shift+ik+1) -> Fill(allData[ik+1][iHt]-refpoint);
424             GetRawsData(shift+ik+220) -> Fill(allData[ik+1][iHt]-allData[1][0]);
425             //      cout<<"C  cfd "<<ik<<" "<<iHt<<" "<<allData[ik+1][iHt]<<" -RF "<<refpoint<<"  "<<allData[ik+1][iHt]-refpoint<<endl;
426             if(type == 8  ) {
427               feffC[ik]++;
428               GetRawsData(208)->Fill(ik+1, allData[ik+1][iHt]-refpoint);
429             } 
430           }
431           //led
432           if(allData[ik+13][iHt] > 0) { 
433             GetRawsData(shift+ik+24+1)->  Fill(allData[ik+13][iHt]-refpoint);
434             //      cout<<"C  led "<<ik<<" "<<iHt<<" "<<allData[ik+1][iHt]<<" -RF "<<refpoint<<"  "<<allData[ik+13][iHt]-refpoint<<endl;
435             if(type == 8  ) {
436               feffA[ik]++;
437               GetRawsData(209)->Fill(ik+1, allData[ik+13][iHt]-refpoint);
438             }
439           }
440           //led -cfd
441
442           if(allData[ik+13][iHt] > 0 && allData[ik+1][iHt] >0 )
443             GetRawsData(shift+ik+48+1)->
444               Fill(allData[ik+13][iHt]-allData[ik+1][iHt]);
445
446           //qtc
447           if(allData[2*ik+25][iHt] > 0 || allData[2*ik+26][iHt] > 0) {
448             GetRawsData(shift+ik+72+1)->
449               Fill(allData[2*ik+25][iHt]-allData[2*ik+26][iHt]);
450             GetRawsData(shift+ik+270)->Fill(allData[2*ik+26][iHt] - refpoint);
451             GetRawsData(shift+ik+24+270)->Fill(allData[2*ik+25][iHt] - refpoint);
452
453             if(type == 8  ) feffqtc[ik]++;
454           }
455         }
456       }
457       for (Int_t ik = 12; ik<24; ik++) {
458         //      for (Int_t iHt=0; iHt<1; iHt++) {
459         for (Int_t iHt=0; iHt<5; iHt++) {
460           if(allData[ik+45][iHt]>0) {
461             //cfd
462             GetRawsData(shift+ik+1)->
463               Fill(allData[ik+45][iHt]-refpoint);
464             GetRawsData(shift+ik+220) -> Fill(allData[ik+45][iHt]-allData[57][0]);
465
466             //      cout<<"A  cfd "<<ik<<" "<<iHt<<" "<<allData[ik+1][iHt]<<" -RF "<<refpoint<<"  "<<allData[ik+1][iHt]-refpoint<<endl;
467             if(type == 8  ) {
468               feffC[ik]++;
469               GetRawsData(208)->Fill(ik+1, allData[ik+45][iHt]-refpoint);
470             } 
471           }
472           //led
473           if(allData[ik+57][iHt] > 0 ) {
474             GetRawsData(shift+ik+24+1)->Fill(allData[ik+57][iHt]-refpoint);
475             //   cout<<"C  led "<<ik<<" "<<iHt<<" "<<allData[ik+1][iHt]<<" -RF "<<refpoint<<"  "<<allData[ik+13][iHt]-refpoint<<endl;
476             if(type == 8  ) {
477               feffA[ik]++;
478               GetRawsData(209)->Fill(ik+1, allData[ik+57][iHt]-refpoint);
479             }
480           }
481             //qtc         
482           if(allData[2*ik+57][iHt]>0 || allData[2*ik+58][iHt]>0)
483             {
484               GetRawsData(shift+ik+72+1)-> Fill(allData[2*ik+57][iHt]-allData[2*ik+58][iHt]);
485               GetRawsData(shift+ik+270)->Fill(allData[2*ik+58][iHt]-refpoint);
486               GetRawsData(shift+ik+24+270)->Fill(allData[2*ik+57][iHt]-refpoint);
487               if(type == 8  )  feffqtc[ik]++;
488             } 
489           //led-cfd
490           if(allData[ik+57][iHt] > 0 &&allData[ik+45][iHt]>0)
491             GetRawsData(shift+ik+48+1)->
492               Fill(allData[ik+57][iHt]-allData[ik+45][iHt]);
493         }
494       }
495       
496       Int_t trChannel[6] = {49,50,51,52,55,56};  
497        
498       if(type == 7)
499         {
500           for (Int_t iHt=0; iHt<6; iHt++) {
501             for (Int_t itr=0; itr<6; itr++) {
502               if(allData[trChannel[itr]][iHt]>0) {
503                 fNumTriggers[itr]++;
504                 GetRawsData(98+itr)->Fill(allData[trChannel[itr]][iHt]-refpoint);
505               }
506             }
507           }
508         }
509       
510         if(type == 8)
511           {
512             for (Int_t iHt=0; iHt<5; iHt++) {
513               for (Int_t itr=0; itr<6; itr++) {
514                 if(allData[trChannel[itr]][iHt]>0)
515                   {
516                     
517                     GetRawsData(198+itr)->Fill(allData[trChannel[itr]][iHt]-refpoint);
518                     fNumTriggersCal[itr]++;
519                   }
520               }
521               if(allData[53][iHt]>0 && allData[54][iHt]>0) {
522                 GetRawsData(204)->Fill(allData[53][iHt]-allData[54][iHt]);
523                 if(allData[55][iHt]>0) GetRawsData(202)->Fill(allData[53][iHt]-allData[54][iHt]);
524                 if(allData[56][iHt]>0) GetRawsData(203)->Fill(allData[53][iHt]-allData[54][iHt]);
525               }
526             }
527           } 
528         
529            delete start;
530     }
531 }
532
533
534
535 //____________________________________________________________________________
536 void AliT0QADataMakerRec::MakeDigits( TTree *digitsTree)
537 {
538   //fills QA histos for Digits
539
540   TArrayI *digCFD = new TArrayI(24);
541   TArrayI *digLED = new TArrayI(24);
542   TArrayI *digQT0 = new TArrayI(24);
543   TArrayI *digQT1 = new TArrayI(24);
544   Int_t refpoint=0;
545   
546   TBranch *brDigits=digitsTree->GetBranch("T0");
547   AliT0digit *fDigits = new AliT0digit() ;
548   if (brDigits) {
549     brDigits->SetAddress(&fDigits);
550   }else{
551     AliError(Form("EXEC Branch T0 digits not found"));
552     return;
553   }
554   digitsTree->GetEvent(0);
555   digitsTree->GetEntry(0);
556   brDigits->GetEntry(0);
557   fDigits->GetTimeCFD(*digCFD);
558   fDigits->GetTimeLED(*digLED);
559   fDigits->GetQT0(*digQT0);
560   fDigits->GetQT1(*digQT1);
561   refpoint = fDigits->RefPoint();
562   for (Int_t i=0; i<24; i++)
563     {
564     if (digCFD->At(i)>0) {
565       Int_t cfd=digCFD->At(i)- refpoint;
566       GetDigitsData(0) ->Fill(i,cfd);
567       GetDigitsData(1) -> Fill(i, (digLED->At(i) - digCFD->At(i)));
568       GetDigitsData(2) -> Fill(i, (digQT1->At(i) - digQT0->At(i)));
569     }
570     }  
571   
572   delete digCFD;
573   delete digLED;
574   delete digQT0;
575   delete digQT1;
576   
577 }
578
579 //____________________________________________________________________________
580 void AliT0QADataMakerRec::MakeRecPoints(TTree * clustersTree)
581 {
582   //fills QA histos for clusters
583
584   AliT0RecPoint* frecpoints= new AliT0RecPoint ();
585   if (!frecpoints) {
586     AliError(":MakeRecPoints >> no recpoints found");
587     return;
588   }
589   TBranch *brRec =clustersTree ->GetBranch("T0");
590   if (brRec) {
591     brRec->SetAddress(&frecpoints);
592   }else{
593     AliError(Form("EXEC Branch T0 rec not found "));
594     return;
595   } 
596
597   brRec->GetEntry(0);
598   
599   for ( Int_t i=0; i<24; i++) {
600     if(i<12)
601       GetRecPointsData(0) -> Fill(i, frecpoints -> GetTime(i) - frecpoints -> GetTime(0)); 
602     if(i>11)
603       GetRecPointsData(0) -> Fill(i,  frecpoints -> GetTime(i) - frecpoints -> GetTime(12)); 
604     GetRecPointsData(1) -> Fill( i, frecpoints -> GetAmp(i) - frecpoints->AmpLED(i));
605   }
606   Double_t mmm=frecpoints->GetOnlineMean()- frecpoints->GetMeanTime();
607   GetRecPointsData(2) ->Fill(mmm);
608   
609 }
610
611 //____________________________________________________________________________
612 void AliT0QADataMakerRec::MakeESDs(AliESDEvent * esd)
613 {
614   //fills QA histos for ESD
615   
616   GetESDsData(0) -> Fill(esd->GetT0());
617   GetESDsData(1)-> Fill(esd->GetT0zVertex());
618   
619 }