]> git.uio.no Git - u/mrichter/AliRoot.git/blame - VZERO/AliVZEROQADataMakerRec.cxx
Multiplicity added as global parameter
[u/mrichter/AliRoot.git] / VZERO / AliVZEROQADataMakerRec.cxx
CommitLineData
508b9fc0 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/*
18 Produces the data needed to calculate the quality assurance.
19 All data must be mergeable objects.
20*/
21
22// --- ROOT system ---
23#include <TClonesArray.h>
24#include <TFile.h>
25#include <TH1F.h>
26#include <TH1I.h>
4da80b8c 27#include <TH2I.h>
f81355e3 28#include <TParameter.h>
508b9fc0 29
30// --- Standard library ---
31
32// --- AliRoot header files ---
33#include "AliESDEvent.h"
34#include "AliLog.h"
1e376713 35#include "AliCDBManager.h"
36#include "AliCDBStorage.h"
37#include "AliCDBEntry.h"
508b9fc0 38#include "AliVZEROQADataMakerRec.h"
39#include "AliQAChecker.h"
4da80b8c 40#include "AliRawReader.h"
508b9fc0 41#include "AliVZERORawStream.h"
42#include "AliVZEROReconstructor.h"
43
44
45ClassImp(AliVZEROQADataMakerRec)
46
47//____________________________________________________________________________
48 AliVZEROQADataMakerRec::AliVZEROQADataMakerRec() :
1e376713 49 AliQADataMakerRec(AliQA::GetDetName(AliQA::kVZERO), "VZERO Quality Assurance Data Maker"),
50 fCalibData(GetCalibData()),
51 fEvent(0)
52
508b9fc0 53{
54 // constructor
1e376713 55
56 for(Int_t i=0; i<64; i++){
57 fEven[i] = 0;
58 fOdd[i] = 0; }
59
60 for(Int_t i=0; i<128; i++){
61 fADC_Mean[i] = 0.0; }
508b9fc0 62}
63
64//____________________________________________________________________________
1e376713 65 AliVZEROQADataMakerRec::AliVZEROQADataMakerRec(const AliVZEROQADataMakerRec& qadm) :
66 AliQADataMakerRec(),
67 fCalibData(GetCalibData()),
68 fEvent(0)
69
508b9fc0 70{
71 //copy constructor
1e376713 72 SetName((const char*)qadm.GetName()) ;
73 SetTitle((const char*)qadm.GetTitle());
508b9fc0 74}
75
76//__________________________________________________________________
77AliVZEROQADataMakerRec& AliVZEROQADataMakerRec::operator = (const AliVZEROQADataMakerRec& qadm )
78{
79 // Equal operator
80 this->~AliVZEROQADataMakerRec();
81 new(this) AliVZEROQADataMakerRec(qadm);
82 return *this;
83}
1e376713 84
85//____________________________________________________________________________
86AliVZEROCalibData* AliVZEROQADataMakerRec::GetCalibData() const
87
88{
89 AliCDBManager *man = AliCDBManager::Instance();
90
91 AliCDBEntry *entry=0;
92
93 entry = man->Get("VZERO/Calib/Data");
94
95 // Retrieval of data in directory VZERO/Calib/Data:
96
97 AliVZEROCalibData *calibdata = 0;
98
99 if (entry) calibdata = (AliVZEROCalibData*) entry->GetObject();
100 if (!calibdata) AliFatal("No calibration data from calibration database !");
101
102 return calibdata;
103}
508b9fc0 104
105//____________________________________________________________________________
106void AliVZEROQADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray * list)
107{
108 //Detector specific actions at end of cycle
109 // do the QA checking
1e376713 110 AliQAChecker::Instance()->Run(AliQA::kVZERO, task, list) ;
508b9fc0 111}
112
113//____________________________________________________________________________
114void AliVZEROQADataMakerRec::InitESDs()
115{
f81355e3 116 //Create histograms to control ESD
508b9fc0 117
1e376713 118 TH1I * h1 = new TH1I("hVZERONbPMA", "Number of PMs fired in V0A", 80, 0, 80);
508b9fc0 119 h1->Sumw2() ;
4da80b8c 120 Add2ESDsList(h1, 0) ;
121
1e376713 122 TH1I * h2 = new TH1I("hVZERONbPMC", "Number of PMs fired in V0C", 80, 0, 80);
508b9fc0 123 h2->Sumw2() ;
124 Add2ESDsList(h2, 1) ;
125
1e376713 126 TH1I * h3 = new TH1I("hVZEROMultA", "Multiplicity in V0A", 50, 0, 50) ;
508b9fc0 127 h3->Sumw2() ;
128 Add2ESDsList(h3, 2) ;
129
1e376713 130 TH1I * h4 = new TH1I("hVZEROMultC", "Multiplicity in V0C", 50, 0, 50) ;
508b9fc0 131 h4->Sumw2() ;
132 Add2ESDsList(h4, 3) ;
a055ee24 133
134 TH2F * h5 = new TH2F("fVzeroMult", "Vzero multiplicity",
28fdf12c 135 64, -0.5, 63.5,1000, -0.5, 99.5);
a055ee24 136 h5->GetXaxis()->SetTitle("Vzero PMT");
137 h5->GetYaxis()->SetTitle("Multiplicity");
138 h5->Sumw2() ;
139 Add2ESDsList(h5, 4) ;
140 TH1F * h6 = new TH1F("fBBA","BB Vzero A", 32, -0.5,31.5);
141 h6->Sumw2();
142 Add2ESDsList(h6, 5) ;
143 TH1F * h7 = new TH1F("fBGA","BG Vzero A", 32, -0.5,31.5);
144 h7->Sumw2();
145 Add2ESDsList(h7, 6) ;
146 TH1F * h8 = new TH1F("fBBC","BB Vzero C", 32, -0.5,31.5);
147 h8->Sumw2();
148 Add2ESDsList(h8, 7) ;
149 TH1F * h9 = new TH1F("fBGC","BG Vzero C", 32, -0.5,31.5);
150 h9->Sumw2();
151 Add2ESDsList(h9, 8) ;
508b9fc0 152
28fdf12c 153 TH2F *h10 = new TH2F("fVzeroAdc", "Vzero Adc",
154 64, -0.5, 63.5,1024, -0.5, 1023.5);
155 h10->GetXaxis()->SetTitle("Vzero PMT");
156 h10->GetYaxis()->SetTitle("Adc counts");
157 h10->Sumw2() ;
158 Add2ESDsList(h10, 9);
159
160 TH2F *h11 = new TH2F("fVzeroTime", "Vzero Time",
161 64, -0.5, 63.5,300, -0.5, 149.5);
162 h11->GetXaxis()->SetTitle("Vzero PMT");
163 h11->GetYaxis()->SetTitle("Time [100 ps]");
164 h11->Sumw2() ;
165 Add2ESDsList(h11,10);
166
167}
508b9fc0 168
169//____________________________________________________________________________
4da80b8c 170 void AliVZEROQADataMakerRec::InitRaws()
171 {
172 // create Raws histograms in Raws subdir
173
174 char ADCname[12];
175 char texte[40];
f81355e3 176 TH1I *hRawADC0[64];
177 TH1I *hRawADC1[64];
4da80b8c 178
f81355e3 179 Bool_t expert = kTRUE ;
180 Bool_t saveCorr = kTRUE ;
181
1e376713 182 TH2I *h0 = new TH2I("hCellADCMap0","ADC vs Cell for EVEN Integrator", 70, 0, 70, 512, 0, 1024);
4da80b8c 183 h0->Sumw2();
f81355e3 184 Add2RawsList(h0,0, !expert, !saveCorr) ;
1e376713 185 TH2I *h1 = new TH2I("hCellADCMap1","ADC vs Cell for ODD Integrator", 70, 0, 70, 512, 0, 1024);
4da80b8c 186 h1->Sumw2();
f81355e3 187 Add2RawsList(h1,1, !expert, !saveCorr) ;
1e376713 188
f81355e3 189 TH2F *hMeanADC0 = new TH2F("hCellMeanADCMap0","Mean ADC vs cell for EVEN integrator",70,-0.5,69.5,512,-0.5,511.5);
190 Add2RawsList(hMeanADC0,2, !expert, !saveCorr);
191 TH2F *hMeanADC1 = new TH2F("hCellMeanADCMap1","Mean ADC vs cell for ODD integrator",70,-0.5,69.5,512,-0.5,511.5);
192 Add2RawsList(hMeanADC1,3, !expert, !saveCorr);
193
194 TH1I *hMulV0A = new TH1I("hMulV0A", "Multiplicity in V0A", 40, 0, 40) ;
195 Add2RawsList(hMulV0A,4, !expert, saveCorr);
196 TH1I *hMulV0C = new TH1I("hMulV0C", "Multiplicity in V0C", 40, 0, 40) ;
197 Add2RawsList(hMulV0C,5, !expert, saveCorr);
198
4da80b8c 199 for (Int_t i=0; i<64; i++)
200 {
201 sprintf(ADCname,"hRaw0ADC%d",i);
202 sprintf(texte,"Raw ADC in cell %d for even integrator",i);
f81355e3 203 hRawADC0[i]= new TH1I(ADCname,texte,1024,0,1024);
204 Add2RawsList(hRawADC0[i],i+6, expert, !saveCorr);
1e376713 205
4da80b8c 206 sprintf(ADCname,"hRaw1ADC%d",i);
207 sprintf(texte,"Raw ADC in cell %d for odd integrator",i);
f81355e3 208 hRawADC1[i]= new TH1I(ADCname,texte,1024,0,1024);
209 Add2RawsList(hRawADC1[i],i+6+64, expert, !saveCorr);
4da80b8c 210 }
211 }
508b9fc0 212
213//____________________________________________________________________________
214void AliVZEROQADataMakerRec::MakeESDs(AliESDEvent * esd)
215{
216 // make QA data from ESDs
217
508b9fc0 218 AliESDVZERO *esdVZERO=esd->GetVZEROData();
219
220 if (esdVZERO) {
4da80b8c 221 GetESDsData(0)->Fill(esdVZERO->GetNbPMV0A());
222 GetESDsData(1)->Fill(esdVZERO->GetNbPMV0C());
223 GetESDsData(2)->Fill(esdVZERO->GetMTotV0A());
224 GetESDsData(3)->Fill(esdVZERO->GetMTotV0C());
28fdf12c 225 for(Int_t i=0;i<64;i++) {
f81355e3 226 GetESDsData(4)->Fill((Float_t) i,(Float_t) esdVZERO->GetMultiplicity(i));
227 GetESDsData(9)->Fill((Float_t) i,(Float_t) esdVZERO->GetAdc(i));
228 GetESDsData(10)->Fill((Float_t) i,(Float_t) esdVZERO->GetTime(i));
28fdf12c 229 }
a055ee24 230 for(Int_t i=0;i<32;i++) {
f81355e3 231 if(esdVZERO->BBTriggerV0A(i))
232 GetESDsData(5)->Fill((Float_t) i);
233 if(esdVZERO->BGTriggerV0A(i))
234 GetESDsData(6)->Fill((Float_t) i);
235 if(esdVZERO->BBTriggerV0C(i))
236 GetESDsData(7)->Fill((Float_t) i);
237 if(esdVZERO->BGTriggerV0C(i))
238 GetESDsData(8)->Fill((Float_t) i);
a055ee24 239 }
508b9fc0 240 }
28fdf12c 241
508b9fc0 242}
243
244//____________________________________________________________________________
4da80b8c 245 void AliVZEROQADataMakerRec::MakeRaws(AliRawReader* rawReader)
246 {
1e376713 247 //Fill histograms with Raws, computes average ADC values dynamically (pedestal subtracted)
248
f81355e3 249 rawReader->Reset() ;
250 AliVZERORawStream* rawStream = new AliVZERORawStream(rawReader);
4da80b8c 251 rawStream->Next();
1e376713 252
253 Float_t ChargeEoI, Threshold; // for pedestal subtraction
254
255// for(Int_t i=0; i<128; i++) { printf(" i = %d pedestal = %f sigma = %f \n\n",
256// i, fCalibData->GetPedestal(i),fCalibData->GetSigma(i) );}
257
258 GetRawsData(2)->Reset(); // to keep only the last value of the ADC average
259 GetRawsData(3)->Reset();
260
f81355e3 261 Int_t mulV0A = 0 ;
262 Int_t mulV0C = 0 ;
263
264 Int_t thresholV0A = 50 ;
265 Int_t thresholV0C = 50 ;
266
267 for(Int_t j=0; j<64; j++) {
268 Int_t i = rawStream->GetOfflineChannel(j); // Convert Online to Offline channel number
1e376713 269 if(!rawStream->GetIntegratorFlag(i,10))
270 {
f81355e3 271 // even integrator - fills index6 to 69
1e376713 272 GetRawsData(0)->Fill(i,rawStream->GetADC(i)) ;
f81355e3 273 GetRawsData(i+6)->Fill(rawStream->GetADC(i)) ;
1e376713 274 ChargeEoI = (float)rawStream->GetADC(i) - fCalibData->GetPedestal(i);
275 Threshold = 3.0 * fCalibData->GetSigma(i);
276 if(rawStream->GetADC(i)<1023 && ChargeEoI > Threshold) {
277 fADC_Mean[i] = ((fADC_Mean[i]*fEven[i]) + rawStream->GetADC(i)) / (fEven[i]+1);
278 GetRawsData(2)->Fill((Float_t) i, fADC_Mean[i]);
279 fEven[i]+=1; }
280 }
281 else if(rawStream->GetIntegratorFlag(i,10))
282 {
f81355e3 283 // odd integrator - fills index 70 to 133
284 GetRawsData(1)->Fill(i,rawStream->GetADC(i)) ;
285 GetRawsData(i+6+64)->Fill(rawStream->GetADC(i)) ;
1e376713 286 ChargeEoI = (float)rawStream->GetADC(i) - fCalibData->GetPedestal(i+64) ;
287 Threshold = 3.0 * fCalibData->GetSigma(i+64);
288 if(rawStream->GetADC(i)<1023 && ChargeEoI > Threshold) {
289 fADC_Mean[i+64] = ((fADC_Mean[i+64]*fOdd[i]) + rawStream->GetADC(i)) / (fOdd[i]+1);
290 GetRawsData(3)->Fill((Float_t) i, fADC_Mean[i+64]);
291 fOdd[i]+=1; }
292 }
f81355e3 293 if( i < 32 ){
294 if (rawStream->GetADC(i) > thresholV0C)
295 mulV0C++ ;
296 }else{
297 if (rawStream->GetADC(i) > thresholV0A)
298 mulV0A++ ;
299 }
300 }
301
302 fEvent++;
303 GetRawsData(4)->Fill(mulV0A) ;
304 TParameter<double> * p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQA::GetTaskName(AliQA::kRAWS).Data(), GetRawsData(4)->GetName()))) ;
305 p->SetVal(mulV0A) ;
306 GetRawsData(5)->Fill(mulV0C) ;
307 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQA::GetTaskName(AliQA::kRAWS).Data(), GetRawsData(5)->GetName()))) ;
308 p->SetVal(mulV0C) ;
4da80b8c 309 }
508b9fc0 310
311//____________________________________________________________________________
312void AliVZEROQADataMakerRec::StartOfDetectorCycle()
313{
314 // Detector specific actions at start of cycle
315
316}