Bug fix: A certain kind of corrupted data the outputbuffer of the decoder could be...
[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
54a263d5 42//#include "iostream.h"
04236e67 43ClassImp(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//____________________________________________________________________________
67AliT0QADataMakerRec::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//__________________________________________________________________
86AliT0QADataMakerRec& AliT0QADataMakerRec::operator = (const AliT0QADataMakerRec& qadm )
87{
88 // Equal operator.
89 this->~AliT0QADataMakerRec();
90 new(this) AliT0QADataMakerRec(qadm);
91 return *this;
92}
93//____________________________________________________________________________
92a357bf 94void AliT0QADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray * list)
04236e67 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//____________________________________________________________________________
102void AliT0QADataMakerRec::StartOfDetectorCycle()
103{
104 //Detector specific actions at start of cycle
105
106}
107
108//____________________________________________________________________________
109void AliT0QADataMakerRec::InitRaws()
110{
111 // create Raw histograms in Raw subdir
446d6ec4 112 // printf(" AliT0QADataMakerRec::InitRaws() started\n");
04236e67 113 TString timename, ampname, qtcname;
114
86c020af 115 TH1F* fhRefPoint = new TH1F("hRefPoint","Ref Point", 10,1252170, 1252180);
116 Add2RawsList( fhRefPoint,0);
117
04236e67 118 TH1F *fhRawCFD[24]; TH1F * fhRawLEDamp[24]; TH1F *fhRawQTC[24];
86c020af 119
04236e67 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;
86c020af 128 fhRawCFD[i] = new TH1F(timename.Data(), timename.Data(),500,2100,2800);
129 Add2RawsList( fhRawCFD[i],i+1);
446d6ec4 130 fhRawLEDamp[i] = new TH1F(ampname.Data(), ampname.Data(),100,300,600);
86c020af 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);
04236e67 134 }
135
86c020af 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);
04236e67 144
145}
146
147//____________________________________________________________________________
148
149void 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
446d6ec4 163 // printf(" !!!!! AliT0QADataMakerRec::InitRecPoints() started\n");
04236e67 164 TString timename,ampname, qtcname;
165 TH1F *fhRecCFD[24]; TH1F *fhRecLEDAmp[24]; TH1F * fhRecQTC[24];
166 for (Int_t i=0; i<24; i++)
167 {
168 timename ="hRecCFD";
169 ampname = "hRecLED";
170 qtcname = "hRecQTC";
171 timename += i;
172 ampname += i;
173 qtcname += i;
446d6ec4 174 fhRecCFD[i] = new TH1F(timename.Data(), timename.Data(),100,2100,2800);
04236e67 175 Add2RecPointsList ( fhRecCFD[i],i);
446d6ec4 176 fhRecLEDAmp[i] = new TH1F(ampname.Data(), ampname.Data(),100,3000,4000);
04236e67 177 Add2RecPointsList ( fhRecLEDAmp[i],i+24);
446d6ec4 178 fhRecQTC[i] = new TH1F(qtcname.Data(), qtcname.Data(),100,0,10000);
04236e67 179 Add2RecPointsList ( fhRecQTC[i],i+48);
180 }
181
182 TH1F *fhRecEff = new TH1F("hRecEff","Efficiency rec.points",25,-0.5,24.5);
446d6ec4 183 Add2RecPointsList ( fhRecEff,72);
184 TH1F * fhRecMean = new TH1F("hRecMean"," reconstructed mean signal",100,2400,2500);
185 Add2RecPointsList( fhRecMean,73);
186 // printf(" !!!!!! AliT0QADataMakerRec::InitRecPoints() ended\n");
04236e67 187
188}
189
190//____________________________________________________________________________
191void AliT0QADataMakerRec::InitESDs()
192{
193 //create ESDs histograms in ESDs subdir
446d6ec4 194 /// printf(" !!!!! AliT0QADataMakerESD::InitRecPoints() started\n");
195 TH1F *fhESDMean = new TH1F("hESDmean"," ESD mean",100,2400,2500);
04236e67 196 Add2ESDsList(fhESDMean, 0) ;
197 TH1F * fhESDVertex = new TH1F("hESDvertex","EAD vertex",100,-50,50);
198 Add2ESDsList(fhESDVertex, 1) ;
199
446d6ec4 200 // printf(" !!!!!! AliT0QADataMakerRec::InitESD() ended\n");
04236e67 201
202}
203
204//____________________________________________________________________________
205void AliT0QADataMakerRec::MakeRaws( AliRawReader* rawReader)
206{
04236e67 207 //fills QA histos for RAW
86c020af 208 AliT0RawReader *start = new AliT0RawReader(rawReader);
209 // start->Next();
210 if (! start->Next())
211 AliDebug(1,Form(" no raw data found!!"));
212 else
213 {
214 Int_t allData[110][5];
215 for (Int_t i0=0; i0<105; i0++)
216 {
217 for (Int_t j0=0; j0<5; j0++) allData[i0][j0]=0;
04236e67 218 }
86c020af 219 for (Int_t i=0; i<105; i++)
220 for (Int_t iHit=0; iHit<5; iHit++)
221 allData[i][iHit]= start->GetData(i,iHit);
222
446d6ec4 223 GetRawsData(0) -> Fill( allData[0][0]);
86c020af 224 allData[0][0] = allData[0][0] - 5000;
446d6ec4 225
86c020af 226 for (Int_t ik = 0; ik<12; ik++){
227 for (Int_t iHt=0; iHt<5; iHt++){
228 if(allData[ik+1][iHt]>0){
229 GetRawsData(ik+1) -> Fill(allData[ik+1][iHt]-allData[0][0]);
230 if(allData[2*ik+25][iHt] > 0 && allData[2*ik+26][iHt] > 0)
231 GetRawsData(ik+48+1)->Fill(allData[2*ik+25][iHt]-allData[2*ik+26][iHt]);
232 if(allData[ik+13][iHt]!=0 )
233 GetRawsData(ik+24+1)->Fill(allData[ik+13][iHt]-allData[ik+1][iHt]);
234 }
04236e67 235 }
86c020af 236 }
237
238 for (Int_t ik = 12; ik<24; ik++) {
239 for (Int_t iHt=0; iHt<5; iHt++) {
240 if(allData[ik+45][iHt]>0) {
241 GetRawsData(ik+1)->Fill(allData[ik+45][iHt]-allData[0][0]);
242 if(allData[2*ik+57][iHt]!=0 && allData[2*ik+58][iHt]!=0)
243 GetRawsData(ik+48+1)->Fill(allData[2*ik+57][iHt]-allData[2*ik+58][iHt]);
244 if(allData[ik+57][iHt] > 0 )
245 GetRawsData(ik+24+1)->Fill(allData[ik+57][iHt]-allData[ik+45][iHt]);
246 }
247 }
248 }
249
04236e67 250
86c020af 251
252 GetRawsData(72)->Fill(allData[49][0]-allData[0][0]);
253 GetRawsData(73)->Fill(allData[50][0]-allData[0][0]);
254 GetRawsData(74)->Fill(allData[51][0]-allData[0][0]);
255 GetRawsData(75)->Fill(allData[52][0]-allData[0][0]);
256
257 delete start;
258 }
86c020af 259
04236e67 260}
261
262//____________________________________________________________________________
263void AliT0QADataMakerRec::MakeRecPoints(TTree * clustersTree)
264{
265 //fills QA histos for clusters
266
446d6ec4 267 // printf(" !!!!! AliT0QADataMakerRec::MakeRecPoints() started\n");
268 AliT0RecPoint* frecpoints= new AliT0RecPoint ();
04236e67 269 if (!frecpoints) {
270 AliError("Reconstruct Fill ESD >> no recpoints found");
271 return;
272 }
273 TBranch *brRec =clustersTree ->GetBranch("T0");
274 if (brRec) {
275 brRec->SetAddress(&frecpoints);
276 }else{
277 AliError(Form("EXEC Branch T0 rec not found "));
278 return;
279 }
280
281 brRec->GetEntry(0);
282
283 for ( Int_t i=0; i<24; i++) {
446d6ec4 284
04236e67 285 GetRecPointsData(i) -> Fill(frecpoints -> GetTime(i));
286 GetRecPointsData(i+24) -> Fill(frecpoints -> GetAmp(i));
287 GetRecPointsData(i+48) -> Fill(frecpoints->AmpLED(i));
446d6ec4 288
04236e67 289 // if(frecpoints -> GetTime(i) > 0) fhRecEff->Fill(i);
290 }
291 GetRecPointsData(72) ->Fill(frecpoints->GetMeanTime());
446d6ec4 292 // printf(" !!!!! AliT0QADataMakerRec::MakeRecPoints() end\n");
04236e67 293
294}
295
296//____________________________________________________________________________
297void AliT0QADataMakerRec::MakeESDs(AliESDEvent * esd)
298{
299 //fills QA histos for ESD
446d6ec4 300 // printf(" !!!!! AliT0QADataMakerRec::MakeESD() started\n");
04236e67 301
302 GetESDsData(0) -> Fill(esd->GetT0());
303 GetESDsData(1)-> Fill(esd->GetT0zVertex());
304
305}
306