]> git.uio.no Git - u/mrichter/AliRoot.git/blob - T0/AliT0QADataMakerRec.cxx
Getter added.
[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 //  All data must be mergeable objects.
22 //  A. Mastroserio
23 //---
24
25 // --- ROOT system ---
26 #include <TClonesArray.h>
27 #include <TFile.h> 
28 #include <TH1F.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
42 #include "iostream.h"
43 ClassImp(AliT0QADataMakerRec)
44            
45 //____________________________________________________________________________ 
46   AliT0QADataMakerRec::AliT0QADataMakerRec() : 
47   AliQADataMakerRec(AliQA::GetDetName(AliQA::kT0), "T0 Quality Assurance Data Maker")
48
49 {
50   // ctor
51   /*
52   for(Int_t i=0; i<24; i++) {
53     fhHitsTime[i]=0x0;
54    fhDigCFD[i]=0x0;
55     fhDigLEDamp[i]=0x0;
56     fhRecCFD[i]=0x0;
57     fhRecLEDamp[i]=0x0;
58     fhRecQTC[i]=0x0;
59   }
60   */
61  //   fDetectorDir = fOutput->GetDirectory(GetName()) ;  
62 //   if (!fDetectorDir) 
63 //     fDetectorDir = fOutput->mkdir(GetName()) ;  
64 }
65
66 //____________________________________________________________________________ 
67 AliT0QADataMakerRec::AliT0QADataMakerRec(const AliT0QADataMakerRec& qadm) :
68   AliQADataMakerRec() 
69 {
70   //copy ctor 
71   /*
72   for(Int_t i=0; i<24; i++) {
73     fhHitsTime[i]=0x0;
74     fhDigCFD[i]=0x0;
75     fhDigLEDamp[i]=0x0;
76     fhRecCFD[i]=0x0;
77     fhRecLEDamp[i]=0x0;
78     fhRecQTC[i]=0x0;
79   }
80   */
81   SetName((const char*)qadm.GetName()) ; 
82   SetTitle((const char*)qadm.GetTitle()); 
83 }
84
85 //__________________________________________________________________
86 AliT0QADataMakerRec& AliT0QADataMakerRec::operator = (const AliT0QADataMakerRec& qadm )
87 {
88   // Equal operator.
89   this->~AliT0QADataMakerRec();
90   new(this) AliT0QADataMakerRec(qadm);
91   return *this;
92 }
93 //____________________________________________________________________________
94 void AliT0QADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray * list)
95 {
96   //Detector specific actions at end of cycle
97   // do the QA checking
98   AliQAChecker::Instance()->Run(AliQA::kT0, task, list) ;
99 }
100
101 //____________________________________________________________________________
102 void AliT0QADataMakerRec::StartOfDetectorCycle()
103 {
104   //Detector specific actions at start of cycle
105
106 }
107  
108 //____________________________________________________________________________ 
109 void AliT0QADataMakerRec::InitRaws()
110 {
111   // create Raw histograms in Raw subdir
112   //  printf("   AliT0QADataMakerRec::InitRaws() started\n");
113   TString timename, ampname, qtcname;
114   TString timeCalname, ampCalname, qtcCalname;
115
116   TH1F* fhRefPoint = new TH1F("hRefPoint","Ref Point", 10,1252170, 1252180);
117   Add2RawsList( fhRefPoint,0);
118    
119   TH1F *fhRawCFD[24]; TH1F * fhRawLEDamp[24]; TH1F *fhRawQTC[24];
120   TH1F *fhRawCFDcal[24]; TH1F * fhRawLEDampcal[24]; TH1F *fhRawQTCcal[24];
121   
122   for (Int_t i=0; i<24; i++)
123     {
124       timename ="hRawCFD";
125       ampname = "hRawLED";
126       qtcname = "hRawQTC";
127       timename += i;
128       ampname += i;
129       qtcname += i;
130       fhRawCFD[i] = new TH1F(timename.Data(), timename.Data(),500,2100,2800);
131       Add2RawsList( fhRawCFD[i],i+1);
132       fhRawLEDamp[i] = new TH1F(ampname.Data(), ampname.Data(),100,300,600);
133       Add2RawsList( fhRawLEDamp[i],i+24+1);
134       fhRawQTC[i] = new TH1F(qtcname.Data(), qtcname.Data(),1500,1000,7000);
135       Add2RawsList( fhRawQTC[i],i+48+1);
136      }
137   
138   TH1F* fhRawMean = new TH1F("hRawMean","online mean signal", 100,2400,2500);
139   Add2RawsList( fhRawMean,73);
140   TH1F* fhRawVertex = new TH1F("hRawVertex","online vertex signal", 100,0,600);
141   Add2RawsList( fhRawVertex,74);
142   TH1F* fhRawORA = new TH1F("hRawORA","online OR A", 100,2500,2800);
143   Add2RawsList( fhRawORA,75);
144   TH1F* fhRawORC = new TH1F("hRawORC","online OR C", 100,2000,2300);
145   Add2RawsList( fhRawORC,76);
146   for (Int_t i=0; i<24; i++)
147     {
148       // for events with trigger CALIBRATION_EVENT
149       timeCalname ="hRawCFDcal";
150       ampCalname = "hRawLEDcal";
151       qtcCalname = "hRawQTCcal";
152       timeCalname += i;
153       ampCalname += i;
154       qtcCalname += i;
155       fhRawCFDcal[i] = new TH1F(timeCalname.Data(), timeCalname.Data(),1000,4000,6000);
156       Add2RawsList( fhRawCFDcal[i],76+i+1);
157       fhRawLEDampcal[i] = new TH1F(ampCalname.Data(), ampCalname.Data(),100,300,600);
158       Add2RawsList( fhRawLEDampcal[i],76+i+24+1);
159       fhRawQTCcal[i] = new TH1F(qtcCalname.Data(), qtcCalname.Data(),1000,0,7000);
160       Add2RawsList( fhRawQTCcal[i],76+i+48+1);
161     }
162   TH1F* fhRawMeanCal = new TH1F("hRawMeanCal","online mean signal, calibration event",
163                                 1000,7000,8000);
164   Add2RawsList( fhRawMeanCal,149);
165   TH1F* fhRawVertexCal = new TH1F("hRawVertexCal","online vertex signal, calibration even ",
166                                   1000,7000,8000);
167   Add2RawsList( fhRawVertexCal,150);
168   TH1F* fhRawORAcal = new TH1F("hRawORAcal","online OR A", 200,5000,7000);
169   Add2RawsList( fhRawORAcal,151);
170   TH1F* fhRawORCcal = new TH1F("hRawORCcal","online OR C", 200,5000,7000);
171   Add2RawsList( fhRawORCcal,152);
172   TH1F* fhMultcal = new TH1F("hMultcal","full mulltiplicity", 1000,0,10000);
173   Add2RawsList( fhMultcal,153);
174   TH1F* fhMultScal = new TH1F("hMultScal","full multiplicity with semi-central trigger",
175                               1000,0,10000);
176   Add2RawsList( fhMultScal,154);
177   TH1F* fhMultCcal = new TH1F("hMultCcal","full multiplicity with central trigger", 
178                               1000,0,10000);
179   Add2RawsList( fhMultCcal,155);
180 }
181
182 //____________________________________________________________________________ 
183
184 void AliT0QADataMakerRec::InitRecPoints()
185 {
186   // create cluster histograms in RecPoint subdir
187   /* 
188  TH2F * fhRecCFD = new TH2F("fhRecCFD", " CFD reconstructed",25,-0.5,24.5,100,12,13);
189   Add2DigitsList( fhRecCFD,0);
190   TH2F *fhRecLEDamp = new TH2F("fhRecLEDamp", " amplitude LED reconstructed",25,-0.5,24.5,100,1000,1000);
191   Add2DigitsList( fhRecLEDamp,1);
192  TH2F * fhRecQTC = new TH2F("fhRecQTC", " amplitude QTC reconstructed",25,-0.5,24.5,100,1000,1000);
193   Add2DigitsList( fhRecQTC,2);
194  TH1F * fhRecMean = new TH1F("hRecMean"," reconstructed mean signal",100,500,600);
195   Add2DigitsList( fhRecMean,3);
196   */ 
197   
198   //  printf(" !!!!!  AliT0QADataMakerRec::InitRecPoints() started\n");
199   TString timename,ampname, qtcname;
200   TH1F *fhRecCFD[24]; TH1F *fhRecLEDAmp[24];  TH1F * fhRecQTC[24];
201   for (Int_t i=0; i<24; i++)
202     {
203       timename ="hRecCFD";
204       ampname = "hRecLED";
205       qtcname = "hRecQTC";
206       timename += i;
207       ampname += i;
208       qtcname += i;
209       fhRecCFD[i] = new TH1F(timename.Data(), timename.Data(),100,2100,2800);
210      Add2RecPointsList ( fhRecCFD[i],i);
211       fhRecLEDAmp[i] = new TH1F(ampname.Data(), ampname.Data(),100,0, 100);
212     Add2RecPointsList ( fhRecLEDAmp[i],i+24);
213       fhRecQTC[i] = new TH1F(qtcname.Data(), qtcname.Data(),100,0,100);
214     Add2RecPointsList ( fhRecQTC[i],i+48);
215      }
216    
217   TH1F *fhOnlineMean = new TH1F("hOnlineMean","online mean",100,2400,2500);
218   Add2RecPointsList ( fhOnlineMean,72);
219   TH1F * fhRecMean = new TH1F("hRecMean"," reconstructed mean signal",100,2400,2500);
220   Add2RecPointsList( fhRecMean,73);
221   //  printf(" !!!!!!  AliT0QADataMakerRec::InitRecPoints() ended\n");
222   
223 }
224
225 //____________________________________________________________________________
226 void AliT0QADataMakerRec::InitESDs()
227 {
228   //create ESDs histograms in ESDs subdir
229   printf(" !!!!!  AliT0QADataMakerESD::InitESD() started\n");
230   TH1F *fhESDMean = new TH1F("hESDmean"," ESD mean",100,2400,2500);
231   Add2ESDsList(fhESDMean, 0) ;
232   TH1F * fhESDVertex = new TH1F("hESDvertex","EAD vertex",100,-50,50);
233   Add2ESDsList(fhESDVertex, 1) ;
234   
235   printf(" !!!!!!  AliT0QADataMakerRec::InitESD() ended\n");
236
237 }
238
239 //____________________________________________________________________________
240 void AliT0QADataMakerRec::MakeRaws( AliRawReader* rawReader)
241 {
242   //fills QA histos for RAW
243   Int_t shift=0;
244   AliT0RawReader *start = new AliT0RawReader(rawReader);
245   //  start->Next();
246   if (! start->Next())
247     AliDebug(1,Form(" no raw data found!!"));
248   else
249     {  
250
251       UInt_t type =rawReader->GetType();
252       //     cout<<" !!!!! new event type = "<<type<<endl;
253       Int_t allData[110][5];
254       for (Int_t i0=0; i0<105; i0++)
255         {
256           for (Int_t j0=0; j0<5; j0++) allData[i0][j0]=0;
257         }
258       for (Int_t i=0; i<105; i++) 
259         for (Int_t iHit=0; iHit<5; iHit++)
260           allData[i][iHit]= start->GetData(i,iHit);
261       
262       GetRawsData(0) -> Fill( allData[0][0]);
263       allData[0][0] = allData[0][0] - 5000; 
264       if (type == 8) shift=76;
265       if (type == 10) shift=0;
266             
267       for (Int_t ik = 0; ik<12; ik++){
268         for (Int_t iHt=0; iHt<5; iHt++){
269           if(allData[ik+1][iHt]>0){
270               GetRawsData(shift+ik+1) -> Fill(allData[ik+1][iHt]-allData[0][0]);
271               //              cout<<" type "<<type<<" shift "<<shift<<" koef "<<ik<<" index "<<shift+ik<<
272               //        " time "<<allData[ik+1][iHt]-allData[0][0]<<endl;
273               if(allData[2*ik+25][iHt] > 0 && allData[2*ik+26][iHt] > 0)
274                 GetRawsData(shift+ik+48+1)->Fill(allData[2*ik+25][iHt]-allData[2*ik+26][iHt]);
275               if(allData[ik+13][iHt]!=0 )
276                 GetRawsData(shift+ik+24+1)->Fill(allData[ik+13][iHt]-allData[ik+1][iHt]);
277           
278         }
279       }
280       }
281       for (Int_t ik = 12; ik<24; ik++) {
282         for (Int_t iHt=0; iHt<5; iHt++) {
283           if(allData[ik+45][iHt]>0) {
284             GetRawsData(shift+ik+1)->Fill(allData[ik+45][iHt]-allData[0][0]);
285             //  cout<<" type "<<type<<" shift "<<shift<<" index "<<shift+ik<<
286             // " time "<<allData[ik+1][iHt]-allData[0][0]<<endl;
287
288             if(allData[2*ik+57][iHt]!=0 && allData[2*ik+58][iHt]!=0)
289               GetRawsData(shift+ik+48+1)->Fill(allData[2*ik+57][iHt]-allData[2*ik+58][iHt]);
290             if(allData[ik+57][iHt] > 0 )
291               GetRawsData(shift+ik+24+1)->Fill(allData[ik+57][iHt]-allData[ik+45][iHt]);
292           }
293         }
294       }
295       
296
297       if(type == 10)
298         {
299           GetRawsData(73)->Fill(allData[49][0]-allData[0][0]);
300           GetRawsData(74)->Fill(allData[50][0]-allData[0][0]);
301           GetRawsData(75)->Fill(allData[51][0]-allData[0][0]);
302           GetRawsData(76)->Fill(allData[52][0]-allData[0][0]);
303         }
304       if(type == 8)
305         {
306           GetRawsData(149)->Fill(allData[49][0]-allData[0][0]);
307           GetRawsData(150)->Fill(allData[50][0]-allData[0][0]);
308           GetRawsData(151)->Fill(allData[51][0]-allData[0][0]);
309           GetRawsData(152)->Fill(allData[52][0]-allData[0][0]);
310           /*      cout<<" and "<<allData[49][0]-allData[0][0]<<
311             " vertex "<<allData[50][0]-allData[0][0]<<
312             " ORA "<<allData[51][0]-allData[0][0]<<
313             " ORC "<<allData[52][0]-allData[0][0]<<endl;*/
314
315           GetRawsData(153)->Fill(allData[53][0]-allData[54][0]);
316           if(allData[55][0])  GetRawsData(154)->Fill(allData[53][0]-allData[54][0]);
317           if(allData[55][0])  GetRawsData(155)->Fill(allData[53][0]-allData[54][0]);
318
319         }  
320       delete start;
321     }
322   
323 }
324
325 //____________________________________________________________________________
326 void AliT0QADataMakerRec::MakeRecPoints(TTree * clustersTree)
327 {
328   //fills QA histos for clusters
329
330   //   printf(" !!!!!  AliT0QADataMakerRec::MakeRecPoints() started\n");
331   AliT0RecPoint* frecpoints= new AliT0RecPoint ();
332     if (!frecpoints) {
333     AliError("Reconstruct Fill ESD >> no recpoints found");
334     return;
335   }
336   TBranch *brRec =clustersTree ->GetBranch("T0");
337   if (brRec) {
338     brRec->SetAddress(&frecpoints);
339   }else{
340       AliError(Form("EXEC Branch T0 rec not found "));
341       return;
342   } 
343     
344   brRec->GetEntry(0);
345   
346   for ( Int_t i=0; i<24; i++) {
347     
348     GetRecPointsData(i) -> Fill(frecpoints -> GetTime(i)); 
349     GetRecPointsData(i+24) -> Fill(frecpoints -> GetAmp(i));
350     GetRecPointsData(i+48) -> Fill(frecpoints->AmpLED(i));
351     
352     //  if(frecpoints -> GetTime(i) > 0) fhRecEff->Fill(i);
353   }
354      GetRecPointsData(72) ->Fill(frecpoints->GetOnlineMean());
355      GetRecPointsData(73) ->Fill(frecpoints->GetMeanTime());
356      //  printf(" !!!!!  AliT0QADataMakerRec::MakeRecPoints() end\n");
357   
358 }
359
360 //____________________________________________________________________________
361 void AliT0QADataMakerRec::MakeESDs(AliESDEvent * esd)
362 {
363   //fills QA histos for ESD
364   printf(" !!!!!  AliT0QADataMakerRec::MakeESD() started\n");
365
366   GetESDsData(0) -> Fill(esd->GetT0());
367   GetESDsData(1)-> Fill(esd->GetT0zVertex());
368
369 }
370