Splitting of the QA maker into simulation and reconstruction dependent parts (Yves)
[u/mrichter/AliRoot.git] / T0 / AliT0QADataMakerRec.cxx
CommitLineData
04236e67 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
42ClassImp(AliT0QADataMakerRec)
43
44//____________________________________________________________________________
45 AliT0QADataMakerRec::AliT0QADataMakerRec() :
46 AliQADataMakerRec(AliQA::GetDetName(AliQA::kT0), "T0 Quality Assurance Data Maker")
47
48{
49 // ctor
50 /*
51 for(Int_t i=0; i<24; i++) {
52 fhHitsTime[i]=0x0;
53 fhDigCFD[i]=0x0;
54 fhDigLEDamp[i]=0x0;
55 fhRecCFD[i]=0x0;
56 fhRecLEDamp[i]=0x0;
57 fhRecQTC[i]=0x0;
58 }
59 */
60 // fDetectorDir = fOutput->GetDirectory(GetName()) ;
61// if (!fDetectorDir)
62// fDetectorDir = fOutput->mkdir(GetName()) ;
63}
64
65//____________________________________________________________________________
66AliT0QADataMakerRec::AliT0QADataMakerRec(const AliT0QADataMakerRec& qadm) :
67 AliQADataMakerRec()
68{
69 //copy ctor
70 /*
71 for(Int_t i=0; i<24; i++) {
72 fhHitsTime[i]=0x0;
73 fhDigCFD[i]=0x0;
74 fhDigLEDamp[i]=0x0;
75 fhRecCFD[i]=0x0;
76 fhRecLEDamp[i]=0x0;
77 fhRecQTC[i]=0x0;
78 }
79 */
80 SetName((const char*)qadm.GetName()) ;
81 SetTitle((const char*)qadm.GetTitle());
82}
83
84//__________________________________________________________________
85AliT0QADataMakerRec& AliT0QADataMakerRec::operator = (const AliT0QADataMakerRec& qadm )
86{
87 // Equal operator.
88 this->~AliT0QADataMakerRec();
89 new(this) AliT0QADataMakerRec(qadm);
90 return *this;
91}
92//____________________________________________________________________________
93void AliT0QADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX task, TObjArray * list)
94{
95 //Detector specific actions at end of cycle
96 // do the QA checking
97 AliQAChecker::Instance()->Run(AliQA::kT0, task, list) ;
98}
99
100//____________________________________________________________________________
101void AliT0QADataMakerRec::StartOfDetectorCycle()
102{
103 //Detector specific actions at start of cycle
104
105}
106
107//____________________________________________________________________________
108void AliT0QADataMakerRec::InitRaws()
109{
110 // create Raw histograms in Raw subdir
111 printf(" AliT0QADataMakerRec::InitRaws() started\n");
112 TString timename, ampname, qtcname;
113
114 TH1F *fhRawCFD[24]; TH1F * fhRawLEDamp[24]; TH1F *fhRawQTC[24];
115
116 for (Int_t i=0; i<24; i++)
117 {
118 timename ="hRawCFD";
119 ampname = "hRawLED";
120 qtcname = "hRawQTC";
121 timename += i;
122 ampname += i;
123 qtcname += i;
124 fhRawCFD[i] = new TH1F(timename.Data(), timename.Data(),100,100,5000);
125 Add2RawsList( fhRawCFD[i],i);
126 fhRawLEDamp[i] = new TH1F(ampname.Data(), ampname.Data(),100,120000,150000);
127 Add2RawsList( fhRawLEDamp[i],i+24);
128 fhRawQTC[i] = new TH1F(qtcname.Data(), qtcname.Data(),100,100,500);
129 Add2RawsList( fhRawQTC[i],i+48);
130 }
131
132 TH1F* fhRawMean = new TH1F("hRawMean","online mean signal", 100,500,600);
133 Add2RawsList( fhRawMean,72);
134
135}
136
137//____________________________________________________________________________
138
139void AliT0QADataMakerRec::InitRecPoints()
140{
141 // create cluster histograms in RecPoint subdir
142 /*
143 TH2F * fhRecCFD = new TH2F("fhRecCFD", " CFD reconstructed",25,-0.5,24.5,100,12,13);
144 Add2DigitsList( fhRecCFD,0);
145 TH2F *fhRecLEDamp = new TH2F("fhRecLEDamp", " amplitude LED reconstructed",25,-0.5,24.5,100,1000,1000);
146 Add2DigitsList( fhRecLEDamp,1);
147 TH2F * fhRecQTC = new TH2F("fhRecQTC", " amplitude QTC reconstructed",25,-0.5,24.5,100,1000,1000);
148 Add2DigitsList( fhRecQTC,2);
149 TH1F * fhRecMean = new TH1F("hRecMean"," reconstructed mean signal",100,500,600);
150 Add2DigitsList( fhRecMean,3);
151 */
152
153 TString timename,ampname, qtcname;
154 TH1F *fhRecCFD[24]; TH1F *fhRecLEDAmp[24]; TH1F * fhRecQTC[24];
155 for (Int_t i=0; i<24; i++)
156 {
157 timename ="hRecCFD";
158 ampname = "hRecLED";
159 qtcname = "hRecQTC";
160 timename += i;
161 ampname += i;
162 qtcname += i;
163 fhRecCFD[i] = new TH1F(timename.Data(), timename.Data(),100,0,1000);
164 Add2RecPointsList ( fhRecCFD[i],i);
165 fhRecLEDAmp[i] = new TH1F(ampname.Data(), ampname.Data(),100,0,200);
166 Add2RecPointsList ( fhRecLEDAmp[i],i+24);
167 fhRecQTC[i] = new TH1F(qtcname.Data(), qtcname.Data(),100,0,200);
168 Add2RecPointsList ( fhRecQTC[i],i+48);
169 }
170
171 TH1F *fhRecEff = new TH1F("hRecEff","Efficiency rec.points",25,-0.5,24.5);
172 Add2RecPointsList ( fhRecEff,72);
173 TH1F * fhRecMean = new TH1F("hRecMean"," reconstructed mean signal",100,500,600);
174 Add2RecPointsList( fhRecMean,73);
175
176}
177
178//____________________________________________________________________________
179void AliT0QADataMakerRec::InitESDs()
180{
181 //create ESDs histograms in ESDs subdir
182 TH1F *fhESDMean = new TH1F("hESDmean"," ESD mean",100,0,100);
183 Add2ESDsList(fhESDMean, 0) ;
184 TH1F * fhESDVertex = new TH1F("hESDvertex","EAD vertex",100,-50,50);
185 Add2ESDsList(fhESDVertex, 1) ;
186
187
188}
189
190//____________________________________________________________________________
191void AliT0QADataMakerRec::MakeRaws( AliRawReader* rawReader)
192{
193 Int_t allData[110][5];
194 for (Int_t i0=0; i0<105; i0++)
195 {
196 for (Int_t j0=0; j0<5; j0++) allData[i0][j0]=0;
197 }
198 //fills QA histos for RAW
199AliT0RawReader *start = new AliT0RawReader(rawReader);
200
201 while (rawReader->NextEvent()) {
202 start->Next();
203 for (Int_t i=0; i<105; i++)
204 for (Int_t iHit=0; iHit<5; iHit++)
205 allData[i][iHit]= start->GetData(i,iHit);
206
207
208 for (Int_t ik = 0; ik<24; ik+=2){
209 for (Int_t iHt=0; iHt<5; iHt++){
210 Int_t cc = ik/2;
211 if(allData[cc+1][iHt]!=0){
212 GetRawsData(cc) -> Fill(allData[cc+1][iHt]-allData[0][0]);
213 if(allData[ik+25][iHt]!=0 && allData[ik+26][iHt]!=0)
214 GetRawsData(cc+48)->Fill(allData[ik+26][iHt]-allData[ik+25][iHt]);
215 if(allData[cc+13][iHt]!=0 )
216 GetRawsData(cc+24)->Fill(allData[cc+13][iHt]-allData[cc+1][iHt]);
217 }
218 }
219 }
220
221 for (Int_t ik = 24; ik<48; ik+=2) {
222 for (Int_t iHt=0; iHt<5; iHt++) {
223 Int_t cc = ik/2;
224 if(allData[cc+45][iHt]!=0) {
225 GetRawsData(cc)->Fill(allData[cc+1][iHt]-allData[0][0]);
226 if(allData[ik+57][iHt]!=0 && allData[ik+58][iHt]!=0)
227 GetRawsData(cc+48)->Fill(allData[ik+57][iHt]-allData[ik+58][iHt]);
228 if(allData[cc+57][iHt]!=0 )
229 GetRawsData(cc+48)->Fill(allData[cc+57][iHt]-allData[cc+45][iHt]);
230 }
231 }
232 }
233
234 }
235
236}
237
238//____________________________________________________________________________
239void AliT0QADataMakerRec::MakeRecPoints(TTree * clustersTree)
240{
241 //fills QA histos for clusters
242
243 AliT0RecPoint* frecpoints= new AliT0RecPoint ();
244 if (!frecpoints) {
245 AliError("Reconstruct Fill ESD >> no recpoints found");
246 return;
247 }
248 TBranch *brRec =clustersTree ->GetBranch("T0");
249 if (brRec) {
250 brRec->SetAddress(&frecpoints);
251 }else{
252 AliError(Form("EXEC Branch T0 rec not found "));
253 return;
254 }
255
256 brRec->GetEntry(0);
257
258 for ( Int_t i=0; i<24; i++) {
259 GetRecPointsData(i) -> Fill(frecpoints -> GetTime(i));
260 GetRecPointsData(i+24) -> Fill(frecpoints -> GetAmp(i));
261 GetRecPointsData(i+48) -> Fill(frecpoints->AmpLED(i));
262 // if(frecpoints -> GetTime(i) > 0) fhRecEff->Fill(i);
263 }
264 GetRecPointsData(72) ->Fill(frecpoints->GetMeanTime());
265
266}
267
268//____________________________________________________________________________
269void AliT0QADataMakerRec::MakeESDs(AliESDEvent * esd)
270{
271 //fills QA histos for ESD
272
273 GetESDsData(0) -> Fill(esd->GetT0());
274 GetESDsData(1)-> Fill(esd->GetT0zVertex());
275
276}
277