Splitting of the QA maker into simulation and reconstruction dependent parts (Yves)
[u/mrichter/AliRoot.git] / T0 / AliT0QADataMakerSim.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 "AliT0QADataMakerSim.h"
39#include "AliQAChecker.h"
40#include "AliT0RawReader.h"
41
42ClassImp(AliT0QADataMakerSim)
43
44//____________________________________________________________________________
45 AliT0QADataMakerSim::AliT0QADataMakerSim() :
46 AliQADataMakerSim(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//____________________________________________________________________________
66AliT0QADataMakerSim::AliT0QADataMakerSim(const AliT0QADataMakerSim& qadm) :
67 AliQADataMakerSim()
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//__________________________________________________________________
85AliT0QADataMakerSim& AliT0QADataMakerSim::operator = (const AliT0QADataMakerSim& qadm )
86{
87 // Equal operator.
88 this->~AliT0QADataMakerSim();
89 new(this) AliT0QADataMakerSim(qadm);
90 return *this;
91}
92//____________________________________________________________________________
93void AliT0QADataMakerSim::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 AliT0QADataMakerSim::StartOfDetectorCycle()
102{
103 //Detector specific actions at start of cycle
104
105}
106
107//____________________________________________________________________________
108void AliT0QADataMakerSim::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 AliT0QADataMakerSim::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//____________________________________________________________________________
174
175void AliT0QADataMakerSim::MakeHits(TTree *hitTree)
176{
177 //fills QA histos for Hits
178 TClonesArray * hits = new TClonesArray("AliT0hit", 1000);
179
180 TBranch * branch = hitTree->GetBranch("T0") ;
181 if ( ! branch ) {
182 AliWarning("T0 branch in Hit Tree not found") ;
183 } else {
184
185 if (branch) {
186 branch->SetAddress(&hits);
187 }else{
188 AliError("Branch T0 hit not found");
189 exit(111);
190 }
191 Int_t ntracks = (Int_t) hitTree->GetEntries();
192
193 if (ntracks<=0) return;
194 // Start loop on tracks in the hits containers
195 for (Int_t track=0; track<ntracks;track++) {
196 branch->GetEntry(track);
197 Int_t nhits = hits->GetEntriesFast();
198 for (Int_t ihit=0;ihit<nhits;ihit++)
199 {
200 AliT0hit * startHit = (AliT0hit*) hits->UncheckedAt(ihit);
201 if (!startHit) {
202 AliError("The unchecked hit doesn't exist");
203 break;
204 }
205 Int_t pmt=startHit->Pmt();
206 GetHitsData(pmt-1)->Fill(startHit->Time()) ;
207 }
208 }
209 }
210}
211
212//____________________________________________________________________________
213void AliT0QADataMakerSim::MakeDigits( TTree *digitsTree)
214{
215 //fills QA histos for Digits
216
217 TArrayI *digCFD = new TArrayI(24);
218 TArrayI *digLED = new TArrayI(24);
219 TArrayI *digQT0 = new TArrayI(24);
220 TArrayI *digQT1 = new TArrayI(24);
221 Int_t refpoint=0;
222
223 TBranch *brDigits=digitsTree->GetBranch("T0");
224 AliT0digit *fDigits = new AliT0digit() ;
225 if (brDigits) {
226 brDigits->SetAddress(&fDigits);
227 }else{
228 AliError(Form("EXEC Branch T0 digits not found"));
229 return;
230 }
231
232 digitsTree->GetEvent(0);
233 digitsTree->GetEntry(0);
234 brDigits->GetEntry(0);
235 fDigits->GetTimeCFD(*digCFD);
236 fDigits->GetTimeLED(*digLED);
237 fDigits->GetQT0(*digQT0);
238 fDigits->GetQT1(*digQT1);
239 refpoint = fDigits->RefPoint();
240 for (Int_t i=0; i<24; i++)
241 {
242 if (digCFD->At(i)>0) {
243 Int_t cfd=digCFD->At(i)- refpoint;
244 GetDigitsData(i) ->Fill(cfd);
245 GetDigitsData(i+24) -> Fill(digLED->At(i) - digCFD->At(i));
246 GetDigitsData(i+48) -> Fill(digQT1->At(i) - digQT0->At(i));
247 }
248 }
249
250 delete digCFD;
251 delete digLED;
252 delete digQT0;
253 delete digQT1;
254
255}