]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - T0/AliT0QADataMaker.cxx
violations fixed
[u/mrichter/AliRoot.git] / T0 / AliT0QADataMaker.cxx
... / ...
CommitLineData
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 "AliT0QADataMaker.h"
39#include "AliQAChecker.h"
40#include "AliT0RawReader.h"
41
42ClassImp(AliT0QADataMaker)
43
44//____________________________________________________________________________
45 AliT0QADataMaker::AliT0QADataMaker() :
46 AliQADataMaker(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//____________________________________________________________________________
66AliT0QADataMaker::AliT0QADataMaker(const AliT0QADataMaker& qadm) :
67 AliQADataMaker()
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//__________________________________________________________________
85AliT0QADataMaker& AliT0QADataMaker::operator = (const AliT0QADataMaker& qadm )
86{
87 // Equal operator.
88 this->~AliT0QADataMaker();
89 new(this) AliT0QADataMaker(qadm);
90 return *this;
91}
92//____________________________________________________________________________
93void AliT0QADataMaker::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 AliT0QADataMaker::StartOfDetectorCycle()
102{
103 //Detector specific actions at start of cycle
104
105}
106
107//____________________________________________________________________________
108void AliT0QADataMaker::InitHits()
109{
110 // create Hits histograms in Hits subdir
111 TString timename;
112 TH1F * fhHitsTime[24];
113 for (Int_t i=0; i<24; i++)
114 {
115 timename ="hHitTime";
116 timename += i;
117 if(i<12) fhHitsTime[i] = new TH1F(timename.Data(),timename.Data(),100,2000,3000);
118 else
119 fhHitsTime[i] = new TH1F(timename.Data(),timename.Data(),100,12000,13000);
120 Add2HitsList( fhHitsTime[i],i);
121 }
122 /*
123 TH2F *fhHitsEffA = new TH2F("hHitsEffA", "Hits Efficiency A side", 25,-0.5,24.5, 100,12,13 );
124 Add2HitsList(fhHitsEffA,0);
125 TH2F *fhHitsEffC = new TH2F("hHitsEffC", "Hits Efficiency C side", 25,-0.5,24.5, 100,2,3 );
126 Add2HitsList(fhHitsEffC,1);
127 */
128}
129
130//____________________________________________________________________________
131void AliT0QADataMaker::InitDigits()
132{
133 // create Digits histograms in Digits subdir
134
135 /*
136 TH2F * fhDigCFD = new TH2F("fhDigCFD", " CFD digits",25,-0.5,24.5,100,100,1000);
137 Add2DigitsList( fhDigCFD,0);
138 TH2F *fhDigLEDamp = new TH2F("fhDigLEDamp", " LED-CFD digits",25,-0.5,24.5,100,100,1000);
139 Add2DigitsList( fhDigLEDamp,1);
140 TH2F * fhDigQTC = new TH2F("fhDigQTC", " QTC digits",25,-0.5,24.5,100,100,1000);
141 Add2DigitsList( fhDigQTC,2);
142 TH1F * fhDigMean = new TH1F("hDigMean","online mean signal", 100,500,600);
143 Add2DigitsList( fhDigMean,23);
144 */
145
146 TString timename, ampname, qtcname;
147
148 TH1F *fhDigCFD[24]; TH1F * fhDigLEDamp[24]; TH1F *fhDigQTC[24];
149
150 for (Int_t i=0; i<24; i++)
151 {
152 timename ="hDigCFD";
153 ampname = "hDigLED";
154 qtcname = "hDigQTC";
155 timename += i;
156 ampname += i;
157 qtcname += i;
158 fhDigCFD[i] = new TH1F(timename.Data(), timename.Data(),100,100,5000);
159 Add2DigitsList( fhDigCFD[i],i);
160 fhDigLEDamp[i] = new TH1F(ampname.Data(), ampname.Data(),100,120000,150000);
161 Add2DigitsList( fhDigLEDamp[i],i+24);
162 fhDigQTC[i] = new TH1F(qtcname.Data(), qtcname.Data(),100,100,500);
163 Add2DigitsList( fhDigQTC[i],i+48);
164 }
165
166 TH1F* fhDigEff = new TH1F("hDigEff","digits efficiency", 25,-0.5,24.5);
167 Add2DigitsList( fhDigEff,72);
168 TH1F* fhDigMean = new TH1F("hDigMean","online mean signal", 100,500,600);
169 Add2DigitsList( fhDigMean,73);
170
171}
172
173//____________________________________________________________________________
174void AliT0QADataMaker::InitRaws()
175{
176 // create Raw histograms in Raw subdir
177 printf(" AliT0QADataMaker::InitRaws() started\n");
178 TString timename, ampname, qtcname;
179
180 TH1F *fhRawCFD[24]; TH1F * fhRawLEDamp[24]; TH1F *fhRawQTC[24];
181
182 for (Int_t i=0; i<24; i++)
183 {
184 timename ="hRawCFD";
185 ampname = "hRawLED";
186 qtcname = "hRawQTC";
187 timename += i;
188 ampname += i;
189 qtcname += i;
190 fhRawCFD[i] = new TH1F(timename.Data(), timename.Data(),100,100,5000);
191 Add2RawsList( fhRawCFD[i],i);
192 fhRawLEDamp[i] = new TH1F(ampname.Data(), ampname.Data(),100,120000,150000);
193 Add2RawsList( fhRawLEDamp[i],i+24);
194 fhRawQTC[i] = new TH1F(qtcname.Data(), qtcname.Data(),100,100,500);
195 Add2RawsList( fhRawQTC[i],i+48);
196 }
197
198 TH1F* fhRawMean = new TH1F("hRawMean","online mean signal", 100,500,600);
199 Add2RawsList( fhRawMean,72);
200
201}
202
203//____________________________________________________________________________
204
205void AliT0QADataMaker::InitRecPoints()
206{
207 // create cluster histograms in RecPoint subdir
208 /*
209 TH2F * fhRecCFD = new TH2F("fhRecCFD", " CFD reconstructed",25,-0.5,24.5,100,12,13);
210 Add2DigitsList( fhRecCFD,0);
211 TH2F *fhRecLEDamp = new TH2F("fhRecLEDamp", " amplitude LED reconstructed",25,-0.5,24.5,100,1000,1000);
212 Add2DigitsList( fhRecLEDamp,1);
213 TH2F * fhRecQTC = new TH2F("fhRecQTC", " amplitude QTC reconstructed",25,-0.5,24.5,100,1000,1000);
214 Add2DigitsList( fhRecQTC,2);
215 TH1F * fhRecMean = new TH1F("hRecMean"," reconstructed mean signal",100,500,600);
216 Add2DigitsList( fhRecMean,3);
217 */
218
219 TString timename,ampname, qtcname;
220 TH1F *fhRecCFD[24]; TH1F *fhRecLEDAmp[24]; TH1F * fhRecQTC[24];
221 for (Int_t i=0; i<24; i++)
222 {
223 timename ="hRecCFD";
224 ampname = "hRecLED";
225 qtcname = "hRecQTC";
226 timename += i;
227 ampname += i;
228 qtcname += i;
229 fhRecCFD[i] = new TH1F(timename.Data(), timename.Data(),100,0,1000);
230 Add2RecPointsList ( fhRecCFD[i],i);
231 fhRecLEDAmp[i] = new TH1F(ampname.Data(), ampname.Data(),100,0,200);
232 Add2RecPointsList ( fhRecLEDAmp[i],i+24);
233 fhRecQTC[i] = new TH1F(qtcname.Data(), qtcname.Data(),100,0,200);
234 Add2RecPointsList ( fhRecQTC[i],i+48);
235 }
236
237 TH1F *fhRecEff = new TH1F("hRecEff","Efficiency rec.points",25,-0.5,24.5);
238 Add2RecPointsList ( fhRecEff,72);
239 TH1F * fhRecMean = new TH1F("hRecMean"," reconstructed mean signal",100,500,600);
240 Add2RecPointsList( fhRecMean,73);
241
242}
243//____________________________________________________________________________
244void AliT0QADataMaker::InitESDs()
245{
246 //create ESDs histograms in ESDs subdir
247 TH1F *fhESDMean = new TH1F("hESDmean"," ESD mean",100,0,100);
248 Add2ESDsList(fhESDMean, 0) ;
249 TH1F * fhESDVertex = new TH1F("hESDvertex","EAD vertex",100,-50,50);
250 Add2ESDsList(fhESDVertex, 1) ;
251
252
253}
254//____________________________________________________________________________
255
256void AliT0QADataMaker::MakeHits(TTree *hitTree)
257{
258 //fills QA histos for Hits
259 TClonesArray * hits = new TClonesArray("AliT0hit", 1000);
260
261 TBranch * branch = hitTree->GetBranch("T0") ;
262 if ( ! branch ) {
263 AliWarning("T0 branch in Hit Tree not found") ;
264 } else {
265
266 if (branch) {
267 branch->SetAddress(&hits);
268 }else{
269 AliError("Branch T0 hit not found");
270 exit(111);
271 }
272 Int_t ntracks = (Int_t) hitTree->GetEntries();
273
274 if (ntracks<=0) return;
275 // Start loop on tracks in the hits containers
276 for (Int_t track=0; track<ntracks;track++) {
277 branch->GetEntry(track);
278 Int_t nhits = hits->GetEntriesFast();
279 for (Int_t ihit=0;ihit<nhits;ihit++)
280 {
281 AliT0hit * startHit = (AliT0hit*) hits->UncheckedAt(ihit);
282 if (!startHit) {
283 AliError("The unchecked hit doesn't exist");
284 break;
285 }
286 Int_t pmt=startHit->Pmt();
287 GetHitsData(pmt-1)->Fill(startHit->Time()) ;
288 }
289 }
290 }
291}
292
293//____________________________________________________________________________
294void AliT0QADataMaker::MakeDigits( TTree *digitsTree)
295{
296 //fills QA histos for Digits
297
298 TArrayI *digCFD = new TArrayI(24);
299 TArrayI *digLED = new TArrayI(24);
300 TArrayI *digQT0 = new TArrayI(24);
301 TArrayI *digQT1 = new TArrayI(24);
302 Int_t refpoint=0;
303
304 TBranch *brDigits=digitsTree->GetBranch("T0");
305 AliT0digit *fDigits = new AliT0digit() ;
306 if (brDigits) {
307 brDigits->SetAddress(&fDigits);
308 }else{
309 AliError(Form("EXEC Branch T0 digits not found"));
310 return;
311 }
312
313 digitsTree->GetEvent(0);
314 digitsTree->GetEntry(0);
315 brDigits->GetEntry(0);
316 fDigits->GetTimeCFD(*digCFD);
317 fDigits->GetTimeLED(*digLED);
318 fDigits->GetQT0(*digQT0);
319 fDigits->GetQT1(*digQT1);
320 refpoint = fDigits->RefPoint();
321 for (Int_t i=0; i<24; i++)
322 {
323 if (digCFD->At(i)>0) {
324 Int_t cfd=digCFD->At(i)- refpoint;
325 GetDigitsData(i) ->Fill(cfd);
326 GetDigitsData(i+24) -> Fill(digLED->At(i) - digCFD->At(i));
327 GetDigitsData(i+48) -> Fill(digQT1->At(i) - digQT0->At(i));
328 }
329 }
330
331 delete digCFD;
332 delete digLED;
333 delete digQT0;
334 delete digQT1;
335
336}
337
338
339//____________________________________________________________________________
340void AliT0QADataMaker::MakeRaws( AliRawReader* rawReader)
341{
342 Int_t allData[110][5];
343 for (Int_t i0=0; i0<105; i0++)
344 {
345 for (Int_t j0=0; j0<5; j0++) allData[i0][j0]=0;
346 }
347 //fills QA histos for RAW
348AliT0RawReader *start = new AliT0RawReader(rawReader);
349
350 while (rawReader->NextEvent()) {
351 start->Next();
352 for (Int_t i=0; i<105; i++)
353 for (Int_t iHit=0; iHit<5; iHit++)
354 allData[i][iHit]= start->GetData(i,iHit);
355
356
357 for (Int_t ik = 0; ik<24; ik+=2){
358 for (Int_t iHt=0; iHt<5; iHt++){
359 Int_t cc = ik/2;
360 if(allData[cc+1][iHt]!=0){
361 GetRawsData(cc) -> Fill(allData[cc+1][iHt]-allData[0][0]);
362 if(allData[ik+25][iHt]!=0 && allData[ik+26][iHt]!=0)
363 GetRawsData(cc+48)->Fill(allData[ik+26][iHt]-allData[ik+25][iHt]);
364 if(allData[cc+13][iHt]!=0 )
365 GetRawsData(cc+24)->Fill(allData[cc+13][iHt]-allData[cc+1][iHt]);
366 }
367 }
368 }
369
370 for (Int_t ik = 24; ik<48; ik+=2) {
371 for (Int_t iHt=0; iHt<5; iHt++) {
372 Int_t cc = ik/2;
373 if(allData[cc+45][iHt]!=0) {
374 GetRawsData(cc)->Fill(allData[cc+1][iHt]-allData[0][0]);
375 if(allData[ik+57][iHt]!=0 && allData[ik+58][iHt]!=0)
376 GetRawsData(cc+48)->Fill(allData[ik+57][iHt]-allData[ik+58][iHt]);
377 if(allData[cc+57][iHt]!=0 )
378 GetRawsData(cc+48)->Fill(allData[cc+57][iHt]-allData[cc+45][iHt]);
379 }
380 }
381 }
382
383 }
384
385}
386
387//____________________________________________________________________________
388void AliT0QADataMaker::MakeRecPoints(TTree * clustersTree)
389{
390 //fills QA histos for clusters
391
392 AliT0RecPoint* frecpoints= new AliT0RecPoint ();
393 if (!frecpoints) {
394 AliError("Reconstruct Fill ESD >> no recpoints found");
395 return;
396 }
397 TBranch *brRec =clustersTree ->GetBranch("T0");
398 if (brRec) {
399 brRec->SetAddress(&frecpoints);
400 }else{
401 AliError(Form("EXEC Branch T0 rec not found "));
402 return;
403 }
404
405 brRec->GetEntry(0);
406
407 for ( Int_t i=0; i<24; i++) {
408 GetRecPointsData(i) -> Fill(frecpoints -> GetTime(i));
409 GetRecPointsData(i+24) -> Fill(frecpoints -> GetAmp(i));
410 GetRecPointsData(i+48) -> Fill(frecpoints->AmpLED(i));
411 // if(frecpoints -> GetTime(i) > 0) fhRecEff->Fill(i);
412 }
413 GetRecPointsData(72) ->Fill(frecpoints->GetMeanTime());
414
415}
416
417//____________________________________________________________________________
418void AliT0QADataMaker::MakeESDs(AliESDEvent * esd)
419{
420 //fills QA histos for ESD
421
422 GetESDsData(0) -> Fill(esd->GetT0());
423 GetESDsData(1)-> Fill(esd->GetT0zVertex());
424
425}
426