]> git.uio.no Git - u/mrichter/AliRoot.git/blob - T0/AliT0QADataMakerRec.cxx
RAW QA all histograms
[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
115   TH1F* fhRefPoint = new TH1F("hRefPoint","Ref Point", 10,1252170, 1252180);
116   Add2RawsList( fhRefPoint,0);
117    
118   TH1F *fhRawCFD[24]; TH1F * fhRawLEDamp[24]; TH1F *fhRawQTC[24];
119   
120   for (Int_t i=0; i<24; i++)
121     {
122       timename ="hRawCFD";
123       ampname = "hRawLED";
124       qtcname = "hRawQTC";
125       timename += i;
126       ampname += i;
127       qtcname += i;
128       fhRawCFD[i] = new TH1F(timename.Data(), timename.Data(),500,2100,2800);
129       Add2RawsList( fhRawCFD[i],i+1);
130       fhRawLEDamp[i] = new TH1F(ampname.Data(), ampname.Data(),300,350,650);
131       Add2RawsList( fhRawLEDamp[i],i+24+1);
132       fhRawQTC[i] = new TH1F(qtcname.Data(), qtcname.Data(),1500,1000,7000);
133       Add2RawsList( fhRawQTC[i],i+48+1);
134      }
135   
136   TH1F* fhRawMean = new TH1F("hRawMean","online mean signal", 100,2400,2500);
137   Add2RawsList( fhRawMean,73);
138   TH1F* fhRawVertex = new TH1F("hRawVertex","online vertex signal", 100,0,600);
139   Add2RawsList( fhRawVertex,74);
140   TH1F* fhRawORA = new TH1F("hRawORA","online OR A", 100,2500,2800);
141   Add2RawsList( fhRawORA,75);
142   TH1F* fhRawORC = new TH1F("hRawORC","online OR C", 100,2000,2300);
143   Add2RawsList( fhRawORC,76);
144   
145 }
146
147 //____________________________________________________________________________ 
148
149 void AliT0QADataMakerRec::InitRecPoints()
150 {
151   // create cluster histograms in RecPoint subdir
152   /* 
153  TH2F * fhRecCFD = new TH2F("fhRecCFD", " CFD reconstructed",25,-0.5,24.5,100,12,13);
154   Add2DigitsList( fhRecCFD,0);
155   TH2F *fhRecLEDamp = new TH2F("fhRecLEDamp", " amplitude LED reconstructed",25,-0.5,24.5,100,1000,1000);
156   Add2DigitsList( fhRecLEDamp,1);
157  TH2F * fhRecQTC = new TH2F("fhRecQTC", " amplitude QTC reconstructed",25,-0.5,24.5,100,1000,1000);
158   Add2DigitsList( fhRecQTC,2);
159  TH1F * fhRecMean = new TH1F("hRecMean"," reconstructed mean signal",100,500,600);
160   Add2DigitsList( fhRecMean,3);
161   */ 
162   
163   TString timename,ampname, qtcname;
164   TH1F *fhRecCFD[24]; TH1F *fhRecLEDAmp[24];  TH1F * fhRecQTC[24];
165   for (Int_t i=0; i<24; i++)
166     {
167       timename ="hRecCFD";
168       ampname = "hRecLED";
169       qtcname = "hRecQTC";
170       timename += i;
171       ampname += i;
172       qtcname += i;
173       fhRecCFD[i] = new TH1F(timename.Data(), timename.Data(),100,0,1000);
174      Add2RecPointsList ( fhRecCFD[i],i);
175       fhRecLEDAmp[i] = new TH1F(ampname.Data(), ampname.Data(),100,0,200);
176     Add2RecPointsList ( fhRecLEDAmp[i],i+24);
177       fhRecQTC[i] = new TH1F(qtcname.Data(), qtcname.Data(),100,0,200);
178     Add2RecPointsList ( fhRecQTC[i],i+48);
179      }
180    
181   TH1F *fhRecEff = new TH1F("hRecEff","Efficiency rec.points",25,-0.5,24.5);
182  Add2RecPointsList ( fhRecEff,72);
183   TH1F * fhRecMean = new TH1F("hRecMean"," reconstructed mean signal",100,500,600);
184  Add2RecPointsList( fhRecMean,73);
185   
186 }
187
188 //____________________________________________________________________________
189 void AliT0QADataMakerRec::InitESDs()
190 {
191   //create ESDs histograms in ESDs subdir
192   TH1F *fhESDMean = new TH1F("hESDmean"," ESD mean",100,0,100);
193   Add2ESDsList(fhESDMean, 0) ;
194  TH1F * fhESDVertex = new TH1F("hESDvertex","EAD vertex",100,-50,50);
195   Add2ESDsList(fhESDVertex, 1) ;
196
197
198 }
199
200 //____________________________________________________________________________
201 void AliT0QADataMakerRec::MakeRaws( AliRawReader* rawReader)
202 {
203   //fills QA histos for RAW
204   cout<<" !!!! AliT0QADataMakerRec::MakeRaws start "<<endl;
205   AliT0RawReader *start = new AliT0RawReader(rawReader);
206   //  start->Next();
207   if (! start->Next())
208     AliDebug(1,Form(" no raw data found!!"));
209   else
210     {  
211       Int_t allData[110][5];
212       for (Int_t i0=0; i0<105; i0++)
213         {
214           for (Int_t j0=0; j0<5; j0++) allData[i0][j0]=0;
215         }
216       for (Int_t i=0; i<105; i++) 
217         for (Int_t iHit=0; iHit<5; iHit++)
218           allData[i][iHit]= start->GetData(i,iHit);
219       
220       allData[0][0] = allData[0][0] - 5000; 
221       cout<<" refPoint "<<allData[0][0]<<endl;
222       
223       for (Int_t ik = 0; ik<12; ik++){
224         for (Int_t iHt=0; iHt<5; iHt++){
225           if(allData[ik+1][iHt]>0){
226             GetRawsData(ik+1) -> Fill(allData[ik+1][iHt]-allData[0][0]);
227             if(allData[2*ik+25][iHt] > 0 && allData[2*ik+26][iHt] > 0)
228               GetRawsData(ik+48+1)->Fill(allData[2*ik+25][iHt]-allData[2*ik+26][iHt]);
229             if(allData[ik+13][iHt]!=0 )
230               GetRawsData(ik+24+1)->Fill(allData[ik+13][iHt]-allData[ik+1][iHt]);
231           }
232         }
233       }
234       
235       for (Int_t ik = 12; ik<24; ik++) {
236         for (Int_t iHt=0; iHt<5; iHt++) {
237           if(allData[ik+45][iHt]>0) {
238             GetRawsData(ik+1)->Fill(allData[ik+45][iHt]-allData[0][0]);
239             if(allData[2*ik+57][iHt]!=0 && allData[2*ik+58][iHt]!=0)
240               GetRawsData(ik+48+1)->Fill(allData[2*ik+57][iHt]-allData[2*ik+58][iHt]);
241             if(allData[ik+57][iHt] > 0 )
242               GetRawsData(ik+24+1)->Fill(allData[ik+57][iHt]-allData[ik+45][iHt]);
243           }
244         }
245       }
246       
247
248
249       GetRawsData(72)->Fill(allData[49][0]-allData[0][0]);
250       GetRawsData(73)->Fill(allData[50][0]-allData[0][0]);
251       GetRawsData(74)->Fill(allData[51][0]-allData[0][0]);
252       GetRawsData(75)->Fill(allData[52][0]-allData[0][0]);
253       
254       delete start;
255     }
256   cout<<" !!!! AliT0QADataMakerRec::MakeRaws end "<<endl;
257   
258 }
259
260 //____________________________________________________________________________
261 void AliT0QADataMakerRec::MakeRecPoints(TTree * clustersTree)
262 {
263   //fills QA histos for clusters
264
265    AliT0RecPoint* frecpoints= new AliT0RecPoint ();
266     if (!frecpoints) {
267     AliError("Reconstruct Fill ESD >> no recpoints found");
268     return;
269   }
270   TBranch *brRec =clustersTree ->GetBranch("T0");
271   if (brRec) {
272     brRec->SetAddress(&frecpoints);
273   }else{
274       AliError(Form("EXEC Branch T0 rec not found "));
275       return;
276   } 
277     
278   brRec->GetEntry(0);
279   
280   for ( Int_t i=0; i<24; i++) {
281     GetRecPointsData(i) -> Fill(frecpoints -> GetTime(i)); 
282     GetRecPointsData(i+24) -> Fill(frecpoints -> GetAmp(i));
283     GetRecPointsData(i+48) -> Fill(frecpoints->AmpLED(i));
284     //  if(frecpoints -> GetTime(i) > 0) fhRecEff->Fill(i);
285   }
286      GetRecPointsData(72) ->Fill(frecpoints->GetMeanTime());
287   
288 }
289
290 //____________________________________________________________________________
291 void AliT0QADataMakerRec::MakeESDs(AliESDEvent * esd)
292 {
293   //fills QA histos for ESD
294
295   GetESDsData(0) -> Fill(esd->GetT0());
296   GetESDsData(1)-> Fill(esd->GetT0zVertex());
297
298 }
299