Coding conventions...
[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>
9bd82f77 28#include <TH2D.h>
29#include <TGraph.h>
f81355e3 30#include <TParameter.h>
508b9fc0 31
32// --- Standard library ---
33
34// --- AliRoot header files ---
35#include "AliESDEvent.h"
36#include "AliLog.h"
1e376713 37#include "AliCDBManager.h"
38#include "AliCDBStorage.h"
39#include "AliCDBEntry.h"
508b9fc0 40#include "AliVZEROQADataMakerRec.h"
41#include "AliQAChecker.h"
4da80b8c 42#include "AliRawReader.h"
508b9fc0 43#include "AliVZERORawStream.h"
44#include "AliVZEROReconstructor.h"
9bd82f77 45#include "event.h"
508b9fc0 46
47
48ClassImp(AliVZEROQADataMakerRec)
49
50//____________________________________________________________________________
51 AliVZEROQADataMakerRec::AliVZEROQADataMakerRec() :
9bd82f77 52 AliQADataMakerRec(AliQA::GetDetName(AliQA::kVZERO), "VZERO Quality Assurance Data Maker"),
53 fCalibData(0x0),
1e376713 54 fEvent(0)
55
508b9fc0 56{
9bd82f77 57 AliInfo("Construct VZERO QA Object");
508b9fc0 58 // constructor
1e376713 59
60 for(Int_t i=0; i<64; i++){
61 fEven[i] = 0;
62 fOdd[i] = 0; }
63
64 for(Int_t i=0; i<128; i++){
65 fADC_Mean[i] = 0.0; }
508b9fc0 66}
67
68//____________________________________________________________________________
1e376713 69 AliVZEROQADataMakerRec::AliVZEROQADataMakerRec(const AliVZEROQADataMakerRec& qadm) :
70 AliQADataMakerRec(),
9bd82f77 71 fCalibData(0x0),
1e376713 72 fEvent(0)
73
508b9fc0 74{
75 //copy constructor
1e376713 76 SetName((const char*)qadm.GetName()) ;
77 SetTitle((const char*)qadm.GetTitle());
508b9fc0 78}
79
80//__________________________________________________________________
81AliVZEROQADataMakerRec& AliVZEROQADataMakerRec::operator = (const AliVZEROQADataMakerRec& qadm )
82{
83 // Equal operator
84 this->~AliVZEROQADataMakerRec();
85 new(this) AliVZEROQADataMakerRec(qadm);
86 return *this;
87}
1e376713 88
89//____________________________________________________________________________
90AliVZEROCalibData* AliVZEROQADataMakerRec::GetCalibData() const
91
92{
93 AliCDBManager *man = AliCDBManager::Instance();
9bd82f77 94
95 //man->SetDefaultStorage("local://$ALICE_ROOT");
1e376713 96
97 AliCDBEntry *entry=0;
9bd82f77 98
99 entry = man->Get("VZERO/Calib/Data",fRun);
1e376713 100
101 // Retrieval of data in directory VZERO/Calib/Data:
102
103 AliVZEROCalibData *calibdata = 0;
104
105 if (entry) calibdata = (AliVZEROCalibData*) entry->GetObject();
106 if (!calibdata) AliFatal("No calibration data from calibration database !");
107
108 return calibdata;
109}
508b9fc0 110
111//____________________________________________________________________________
112void AliVZEROQADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray * list)
113{
114 //Detector specific actions at end of cycle
115 // do the QA checking
1e376713 116 AliQAChecker::Instance()->Run(AliQA::kVZERO, task, list) ;
9bd82f77 117
118 if(task == AliQA::kRAWS){
119 int NMaxBin = GetRawsData(kPedestal_Time_Int0)->GetNbinsY();
120 if(fCurrentCycle%NMaxBin==0) {
121 GetRawsData(kPedestal_Time_Int0)->Reset();
122 GetRawsData(kPedestal_Time_Int1)->Reset();
123 GetRawsData(kChargeEoI_Time_Int0)->Reset();
124 GetRawsData(kChargeEoI_Time_Int1)->Reset();
125 }
126 TH1D* hProj;
127 char Name[50];
d62942e8 128 for(Int_t iChannel=0; iChannel<64; iChannel++) {
129 for(Int_t integrator=0;integrator<2;integrator++){
9bd82f77 130 sprintf(Name,"Ped_%d_%d",iChannel,integrator);
131 hProj = ((TH2I*)GetRawsData((integrator == 0 ? kPedestal_Cycle_Int0 : kPedestal_Cycle_Int1)))->ProjectionY(Name,iChannel+1,iChannel+1);
132 ((TH2D*)GetRawsData((integrator == 0 ? kPedestal_Time_Int0 : kPedestal_Time_Int1)))->Fill((double)iChannel,(double)(fCurrentCycle%NMaxBin),(double)hProj->GetMean());
133 delete hProj;
134
135 sprintf(Name,"Charge_%d_%d",iChannel,integrator);
136 hProj = ((TH2I*)GetRawsData((integrator == 0 ? kChargeEoI_Cycle_Int0 : kChargeEoI_Cycle_Int1)))->ProjectionY(Name,iChannel+1,iChannel+1);
137 ((TH2D*)GetRawsData((integrator == 0 ? kChargeEoI_Time_Int0 : kChargeEoI_Time_Int1)))->Fill((double)iChannel,(double)(fCurrentCycle%NMaxBin),hProj->GetMean());
138 delete hProj;
139 }
140 }
141 } else if (task == AliQA::kESDS) {
142 }
143
508b9fc0 144}
145
146//____________________________________________________________________________
147void AliVZEROQADataMakerRec::InitESDs()
148{
f81355e3 149 //Create histograms to control ESD
9bd82f77 150 Bool_t expert = kTRUE ;
151
152 TH2D * h2d;
153 TH1I * h1i;
154 TH1D * h1d;
155
156 h1i = new TH1I("H1I_Cell_Multiplicity_V0A", "Cell Multiplicity in V0A", 35, 0, 35) ;
157 Add2ESDsList(h1i, kCellMultiV0A, !expert) ;
158 h1i->GetXaxis()->SetTitle("Multiplicity (Nb of Cell)");
4da80b8c 159
9bd82f77 160 h1i = new TH1I("H1I_Cell_Multiplicity_V0C", "Cell Multiplicity in V0C", 35, 0, 35) ;
161 Add2ESDsList(h1i, kCellMultiV0C, !expert) ;
162 h1i->GetXaxis()->SetTitle("Multiplicity (Nb of Cell)");
163
164 h1d = new TH1D("H1D_MIP_Multiplicity_V0A", "MIP Multiplicity in V0A", 1000, 0, 1000) ;
165 Add2ESDsList(h1d, kMIPMultiV0A, !expert) ;
166 h1d->GetXaxis()->SetTitle("Multiplicity (Nb of MIP)");
167
168 h1d = new TH1D("H1D_MIP_Multiplicity_V0C", "MIP Multiplicity in V0C", 1000, 0, 1000) ;
169 Add2ESDsList(h1d, kMIPMultiV0C, !expert) ;
170 h1d->GetXaxis()->SetTitle("Multiplicity (Nb of MIP)");
28fdf12c 171
9bd82f77 172 h2d = new TH2D("H2D_MIP_Multiplicity_Channel", "MIP Multiplicity per Channel",64, 0, 64, 100, 0, 100) ;
173 h2d->GetXaxis()->SetTitle("Channel");
174 h2d->GetYaxis()->SetTitle("Multiplicity (Nb of MIP)");
175 Add2ESDsList(h2d, kMIPMultiChannel, !expert) ;
176
177 h1d = new TH1D("H1D_BBFlag_Counters", "BB Flag Counters",64, 0, 64) ;
178 h1d->GetXaxis()->SetTitle("Channel");
179 Add2ESDsList(h1d, kBBFlag, !expert) ;
180
181 h1d = new TH1D("H1D_BGFlag_Counters", "BG Flag Counters",64, 0, 64) ;
182 h1d->GetXaxis()->SetTitle("Channel");
183 Add2ESDsList(h1d, kBGFlag, !expert) ;
184
185 h2d = new TH2D("H2D_Charge_Channel", "ADC Charge per channel",64, 0, 64, 1024, 0, 1024) ;
186 h2d->GetXaxis()->SetTitle("Channel");
187 h2d->GetYaxis()->SetTitle("Charge (ADC counts)");
188 Add2ESDsList(h2d, kChargeChannel, !expert) ;
189
190 h2d = new TH2D("H2D_Time_Channel", "Time per channel",64, 0, 64, 820, 0, 410) ;
191 h2d->GetXaxis()->SetTitle("Channel");
192 h2d->GetYaxis()->SetTitle("Time (ns)");
193 Add2ESDsList(h2d, kTimeChannel, !expert) ;
194
195 h1d = new TH1D("H1D_V0A_Time", "Mean V0A Time",2048, 0., 409.6);
196 h1d->GetXaxis()->SetTitle("Time (ns)");
197 Add2ESDsList(h1d,kESDV0ATime, !expert);
198
199 h1d = new TH1D("H1D_V0C_Time", "Mean V0C Time",2048, 0., 409.6);
200 h1d->GetXaxis()->SetTitle("Time (ns)");
201 Add2ESDsList(h1d,kESDV0CTime, !expert);
202
203 h1d = new TH1D("H1D_Diff_Time", "Diff Time V0A - V0C",2*2048, -409.6, 409.6);
204 h1d->GetXaxis()->SetTitle("Diff Time V0A - V0C (ns)");
205 Add2ESDsList(h1d,kESDDiffTime, !expert);
206
28fdf12c 207}
508b9fc0 208
209//____________________________________________________________________________
4da80b8c 210 void AliVZEROQADataMakerRec::InitRaws()
211 {
212 // create Raws histograms in Raws subdir
9bd82f77 213 fCalibData = GetCalibData();
4da80b8c 214
f81355e3 215 Bool_t expert = kTRUE ;
216 Bool_t saveCorr = kTRUE ;
9bd82f77 217
218 char Name[50] , Title[100];
d62942e8 219 const Int_t kNintegrator = 2;
9bd82f77 220
221 const Int_t kNTdcTimeBins = 2048;
222 const Int_t kTdcTimeMin = 0;
223 const Int_t kTdcTimeMax = 4096;
224 const Int_t kNTdcWidthBins = 128;
225 const Int_t kTdcWidthMin = 0;
226 const Int_t kTdcWidthMax = 128;
227 const Int_t kNChargeBins = 1024;
228 const Int_t kChargeMin = 0;
229 const Int_t kChargeMax = 1024;
230 const Int_t kNChannelBins = 64;
231 const Int_t kChannelMin = 0;
232 const Int_t kChannelMax = 64;
233 const Int_t kNPedestalBins = 200;
234 const Int_t kPedestalMin = 0;
235 const Int_t kPedestalMax = 200;
236 const Int_t kTimeMin = 0;
237 const Int_t kTimeMax = 100;
238 const Int_t kNMIPBins = 200;
239 const Int_t kMIPMin = 0;
240 const Int_t kMIPMax = 200;
241
242
243 TH2I * h2i;
244 TH2D * h2d;
245 TH1I * h1i;
246 TH1D * h1d;
247
248 int iHisto =0;
249
250
251 // Creation Cell Multiplicity Histograms
252 h1i = new TH1I("H1I_Multiplicity_V0A", "Cell Multiplicity in V0A", 35, 0, 35) ;
253 Add2RawsList(h1i,kMultiV0A, !expert, saveCorr); iHisto++;
254 h1i = new TH1I("H1I_Multiplicity_V0C", "Cell Multiplicity in V0C", 35, 0, 35) ;
255 Add2RawsList(h1i,kMultiV0C, !expert, saveCorr); iHisto++;
256
257 // Creation Total Charge Histograms
258 h1d = new TH1D("H1D_Charge_V0A", "Total Charge in V0A", 2048, 0, 32768) ;
259 Add2RawsList(h1d,kChargeV0A, !expert, saveCorr); iHisto++;
260 h1d = new TH1D("H1D_Charge_V0C", "Total Charge in V0C", 2048, 0, 32768) ;
261 Add2RawsList(h1d,kChargeV0C, !expert, saveCorr); iHisto++;
262 h1d = new TH1D("H1D_Charge_V0", "Total Charge in V0", 2048, 0, 65536) ;
263 Add2RawsList(h1d,kChargeV0, !expert, saveCorr); iHisto++;
264
265 // Creation of MIP Histograms
266 h1d = new TH1D("H1D_MIP_V0A", "Total MIP in V0A", 2*kNMIPBins,kMIPMin ,32*kMIPMax) ;
267 Add2RawsList(h1d,kRawMIPV0A, !expert, saveCorr); iHisto++;
268 h1d = new TH1D("H1D_MIP_V0C", "Total MIP in V0C", 2*kNMIPBins,kMIPMin ,32*kMIPMax) ;
269 Add2RawsList(h1d,kRawMIPV0C, !expert, saveCorr); iHisto++;
270 h1d = new TH1D("H1D_MIP_V0", "Total MIP in V0", 2*kNMIPBins,kMIPMin ,32*kMIPMax) ;
271 Add2RawsList(h1d,kRawMIPV0, !expert, saveCorr); iHisto++;
272 h2d = new TH2D("H2D_MIP_Channel", "Nb of MIP per channel", kNChannelBins, kChannelMin, kChannelMax,kNMIPBins,kMIPMin ,kMIPMax) ;
273 Add2RawsList(h2d,kRawMIPChannel, expert, !saveCorr); iHisto++;
274
275
d62942e8 276 for(Int_t iInt=0;iInt<kNintegrator;iInt++){
9bd82f77 277 // Creation of Pedestal histograms
278 sprintf(Name,"H2I_Pedestal_Int%d",iInt);
279 sprintf(Title,"Pedestal (Int%d)",iInt);
280 h2i = new TH2I(Name, Title,kNChannelBins, kChannelMin, kChannelMax,kNPedestalBins,kPedestalMin ,kPedestalMax );
281 Add2RawsList(h2i,(iInt == 0 ? kPedestal_Int0 : kPedestal_Int1), expert, !saveCorr); iHisto++;
282
283 // Creation of temporary Pedestal histo used for the mean versus time histogram. This histogram will be reset at the end of each cycle
284 sprintf(Name,"H2I_Pedestal_Cycle_Int%d",iInt);
285 sprintf(Title,"One Cycle Pedestal (Int%d)",iInt);
286 h2i = new TH2I(Name, Title,kNChannelBins, kChannelMin, kChannelMax,kNPedestalBins,kPedestalMin ,kPedestalMax );
287 Add2RawsList(h2i,(iInt == 0 ? kPedestal_Cycle_Int0 : kPedestal_Cycle_Int1), expert, !saveCorr); iHisto++;
288
289 // Creation of Pedestal versus time graph.
290 sprintf(Name,"H2D_Pedestal_Time_Int%d",iInt);
291 sprintf(Title,"Pedestal Versus Time (Int%d)",iInt);
292 h2d = new TH2D(Name, Title,kNChannelBins, kChannelMin, kChannelMax,kTimeMax,kTimeMin ,kTimeMax );
293 Add2RawsList(h2d,(iInt == 0 ? kPedestal_Time_Int0 : kPedestal_Time_Int1), expert, !saveCorr); iHisto++;
294
295 // Creation of Charge EoI histograms
296 sprintf(Name,"H2I_ChargeEoI_Int%d",iInt);
297 sprintf(Title,"Charge EoI (Int%d)",iInt);
298 h2i = new TH2I(Name, Title,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, kChargeMax);
299 Add2RawsList(h2i,(iInt == 0 ? kChargeEoI_Int0 : kChargeEoI_Int1), !expert, !saveCorr); iHisto++;
300
301 // Creation of temporary Charge EoI histograms used for the mean versus time histogram. This histogram will be reset at the end of each cycle
302 sprintf(Name,"H2I_ChargeEoI_Cycle_Int%d",iInt);
303 sprintf(Title,"One Cycle Charge EoI (Int%d)",iInt);
304 h2i = new TH2I(Name, Title,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, kChargeMax);
305 Add2RawsList(h2i,(iInt == 0 ? kChargeEoI_Cycle_Int0 : kChargeEoI_Cycle_Int1), expert, !saveCorr); iHisto++;
306
307 // Creation of Chercge EoI versus time graph.
308 sprintf(Name,"H2D_ChargeEoI_Time_Int%d",iInt);
309 sprintf(Title,"Charge EoI Versus Time (Int%d)",iInt);
310 h2d = new TH2D(Name, Title,kNChannelBins, kChannelMin, kChannelMax,kTimeMax,kTimeMin ,kTimeMax );
311 Add2RawsList(h2d,(iInt == 0 ? kChargeEoI_Time_Int0 : kChargeEoI_Time_Int1), expert, !saveCorr); iHisto++;
f81355e3 312
9bd82f77 313 sprintf(Name,"H2I_ChargeEoI_BB_Int%d",iInt);
314 sprintf(Title,"Charge EoI w/ BB Flag (Int%d)",iInt);
315 h2i = new TH2I(Name, Title,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, kChargeMax);
316 Add2RawsList(h2i,(iInt == 0 ? kChargeEoI_BB_Int0 : kChargeEoI_BB_Int1), expert, !saveCorr); iHisto++;
f81355e3 317
9bd82f77 318 sprintf(Name,"H2I_ChargeEoI_BG_Int%d",iInt);
319 sprintf(Title,"Charge EoI w/ BG Flag (Int%d)",iInt);
320 h2i = new TH2I(Name, Title,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, kChargeMax);
321 Add2RawsList(h2i,(iInt == 0 ? kChargeEoI_BG_Int0: kChargeEoI_BG_Int1), expert, !saveCorr); iHisto++;
322
323 // Creation of Charge versus LHC Clock histograms
324 sprintf(Name,"H2D_ChargeVsClock_Int%d",iInt);
325 sprintf(Title,"Charge Versus LHC-Clock (Int%d)",iInt);
326 h2d = new TH2D(Name, Title,kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 );
327 Add2RawsList(h2d,(iInt == 0 ? kChargeVsClock_Int0 : kChargeVsClock_Int1 ), expert, !saveCorr); iHisto++;
328
329 // Creation of Minimum Bias Charge histograms
d62942e8 330 for(Int_t iBB=0;iBB<2;iBB++){
331 for(Int_t iBG=0;iBG<2;iBG++){
9bd82f77 332 sprintf(Name,"H2I_ChargeMB_BB%d_BG%d_Int%d",iBB,iBG,iInt);
333 sprintf(Title,"MB Charge (BB=%d, BG=%d, Int=%d)",iBB,iBG,iInt);
334 h2i = new TH2I(Name, Title,kNChannelBins, kChannelMin, kChannelMax,kNChargeBins, kChargeMin, kChargeMax);
335 int idx;
336 if(iInt==0){
337 if(iBB==0){
338 if(iBG==0) idx = kChargeMB_BB0_BG0_Int0;
339 else idx = kChargeMB_BB0_BG1_Int0;
340 } else {
341 if(iBG==0) idx = kChargeMB_BB1_BG0_Int0;
342 else idx = kChargeMB_BB1_BG1_Int0;
343 }
344 } else {
345 if(iBB==0){
346 if(iBG==0) idx = kChargeMB_BB0_BG0_Int1;
347 else idx = kChargeMB_BB0_BG1_Int1;
348 } else {
349 if(iBG==0) idx = kChargeMB_BB1_BG0_Int1;
350 else idx = kChargeMB_BB1_BG1_Int1;
351 }
352 }
353 Add2RawsList(h2i,idx, expert, !saveCorr); iHisto++;
354 }
355 }
356
357 }
358
359// Creation of Time histograms
360 sprintf(Name,"H2I_Width");
361 sprintf(Title,"HPTDC Width");
362 h2i = new TH2I(Name, Title,kNChannelBins, kChannelMin, kChannelMax, kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax);
363 Add2RawsList(h2i,kWidth, expert, !saveCorr); iHisto++;
364
365 sprintf(Name,"H2I_Width_BB");
366 sprintf(Title,"HPTDC Width w/ BB Flag condition");
367 h2i = new TH2I(Name, Title,kNChannelBins, kChannelMin, kChannelMax, kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax);
368 Add2RawsList(h2i,kWidth_BB, expert, !saveCorr); iHisto++;
369
370 sprintf(Name,"H2I_Width_BG");
371 sprintf(Title,"HPTDC Width w/ BG Flag condition");
372 h2i = new TH2I(Name, Title,kNChannelBins, kChannelMin, kChannelMax, kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax);
373 Add2RawsList(h2i,kWidth_BG, expert, !saveCorr); iHisto++;
374
375 sprintf(Name,"H2I_HPTDCTime");
376 sprintf(Title,"HPTDC Time");
377 h2i = new TH2I(Name, Title,kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
378 Add2RawsList(h2i,kHPTDCTime, !expert, !saveCorr); iHisto++;
379
380 sprintf(Name,"H2I_HPTDCTime_BB");
381 sprintf(Title,"HPTDC Time w/ BB Flag condition");
382 h2i = new TH2I(Name, Title,kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
383 Add2RawsList(h2i,kHPTDCTime_BB, expert, !saveCorr); iHisto++;
384
385 sprintf(Name,"H2I_HPTDCTime_BG");
386 sprintf(Title,"HPTDC Time w/ BG Flag condition");
387 h2i = new TH2I(Name, Title,kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
388 Add2RawsList(h2i,kHPTDCTime_BG, expert, !saveCorr); iHisto++;
389
390 sprintf(Name,"H1D_V0A_Time");
391 sprintf(Title,"V0A Time");
392 h1d = new TH1D(Name, Title,kNTdcTimeBins, kTdcTimeMin/10, kTdcTimeMax/10);
393 Add2RawsList(h1d,kV0ATime, !expert, saveCorr); iHisto++;
394
395 sprintf(Name,"H1D_V0C_Time");
396 sprintf(Title,"V0C Time");
397 h1d = new TH1D(Name, Title,kNTdcTimeBins, kTdcTimeMin/10, kTdcTimeMax/10);
398 Add2RawsList(h1d,kV0CTime, !expert, saveCorr); iHisto++;
399
400 sprintf(Name,"H1D_Diff_Time");
401 sprintf(Title,"Diff V0A-V0C Time");
402 h1d = new TH1D(Name, Title,2*kNTdcTimeBins, -kTdcTimeMax/10, kTdcTimeMax/10);
403 Add2RawsList(h1d,kDiffTime, !expert, saveCorr); iHisto++;
404
405
406 // Creation of Flag versus LHC Clock histograms
407 sprintf(Name,"H2D_BBFlagVsClock");
408 sprintf(Title,"BB-Flags Versus LHC-Clock");
409 h2d = new TH2D(Name, Title,kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 );
410 Add2RawsList(h2d,kBBFlagVsClock, expert, !saveCorr); iHisto++;
411
412 sprintf(Name,"H2D_BGFlagVsClock");
413 sprintf(Title,"BG-Flags Versus LHC-Clock");
414 h2d = new TH2D(Name, Title,kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 );
415 Add2RawsList(h2d,kBGFlagVsClock, expert, !saveCorr); iHisto++;
416
417 AliInfo(Form("%d Histograms has been added to the Raws List",iHisto));
4da80b8c 418 }
508b9fc0 419
420//____________________________________________________________________________
421void AliVZEROQADataMakerRec::MakeESDs(AliESDEvent * esd)
422{
423 // make QA data from ESDs
9bd82f77 424 UInt_t EventType = esd->GetEventType();
508b9fc0 425
9bd82f77 426 switch (EventType){
427 case PHYSICS_EVENT:
428 AliESDVZERO *esdVZERO=esd->GetVZEROData();
508b9fc0 429
9bd82f77 430 if (!esdVZERO) break;
431
432 GetESDsData(kCellMultiV0A)->Fill(esdVZERO->GetNbPMV0A());
433 GetESDsData(kCellMultiV0C)->Fill(esdVZERO->GetNbPMV0C());
434 GetESDsData(kMIPMultiV0A)->Fill(esdVZERO->GetMTotV0A());
435 GetESDsData(kMIPMultiV0C)->Fill(esdVZERO->GetMTotV0C());
436
437 Float_t TimeV0A = 0., TimeV0C =0., DiffTime;
438 Int_t iTimeV0A=0, iTimeV0C=0;
439
440 for(Int_t i=0;i<64;i++) {
441 GetESDsData(kMIPMultiChannel)->Fill((Float_t) i,(Float_t) esdVZERO->GetMultiplicity(i));
442 GetESDsData(kChargeChannel)->Fill((Float_t) i,(Float_t) esdVZERO->GetAdc(i));
443 if(esdVZERO->GetBBFlag(i)) GetESDsData(kBBFlag)->Fill((Float_t) i);
444 if(esdVZERO->GetBGFlag(i)) GetESDsData(kBGFlag)->Fill((Float_t) i);
445
446 Float_t Time = (Float_t) esdVZERO->GetTime(i)/10.; //Convert in ns: 1 TDC channel = 100ps
447 GetESDsData(kTimeChannel)->Fill((Float_t) i,Time);
448
449 if(Time>0.){
450 if (i<32) {
451 iTimeV0C++;
452 TimeV0C += Time;
453 }else{
454 iTimeV0A++;
455 TimeV0A += Time;
456 }
457 }
458 }
459 if(iTimeV0A>0) TimeV0A /= iTimeV0A;
460 else TimeV0A = -1.;
461 if(iTimeV0C>0) TimeV0C /= iTimeV0C;
462 else TimeV0C = -1.;
463 if(TimeV0A<0. || TimeV0C<0.) DiffTime = -10000.;
464 else DiffTime = TimeV0A - TimeV0C;
465
466 GetESDsData(kESDV0ATime)->Fill(TimeV0A);
467 GetESDsData(kESDV0CTime)->Fill(TimeV0C);
468 GetESDsData(kESDDiffTime)->Fill(DiffTime);
469
470 break;
471 }
28fdf12c 472
508b9fc0 473}
474
475//____________________________________________________________________________
4da80b8c 476 void AliVZEROQADataMakerRec::MakeRaws(AliRawReader* rawReader)
477 {
1e376713 478 //Fill histograms with Raws, computes average ADC values dynamically (pedestal subtracted)
479
f81355e3 480 rawReader->Reset() ;
481 AliVZERORawStream* rawStream = new AliVZERORawStream(rawReader);
4da80b8c 482 rawStream->Next();
1e376713 483
9bd82f77 484 eventTypeType EventType = rawReader->GetType();
485
486
487 Int_t mulV0A = 0 ;
488 Int_t mulV0C = 0 ;
489 Double_t TimeV0A =0., TimeV0C = 0.;
490 UInt_t iTimeV0A=0, iTimeV0C=0;
491 Double_t ChargeV0A=0., ChargeV0C=0.;
492 Double_t MIPV0A=0., MIPV0C=0.;
493
494 Double_t DiffTime=-100000.;
495
496
497 switch (EventType){
498 case PHYSICS_EVENT:
499 int iFlag=0;
500 int pedestal;
501 int integrator;
502 Bool_t BBFlag;
503 Bool_t BGFlag;
9798ef23 504 UInt_t Time, Width;
9bd82f77 505 Int_t MBCharge, Charge;
506 Int_t OfflineCh;
507 TH1D * hProj;
508
509 //printf("----------------------------------------\n");
d62942e8 510 for(Int_t iChannel=0; iChannel<64; iChannel++) { // BEGIN : Loop over channels
9bd82f77 511
512 OfflineCh = rawStream->GetOfflineChannel(iChannel);
513
514 // Fill Pedestal histograms
515 //-------------------------
516
d62942e8 517 for(Int_t j=15; j<21; j++) {
9bd82f77 518 if((rawStream->GetBGFlag(iChannel,j) || rawStream->GetBBFlag(iChannel,j))) iFlag++;
519 }
520
521 if(iFlag == 0){ //No Flag found
d62942e8 522 for(Int_t j=15; j<21; j++){
9bd82f77 523 pedestal=rawStream->GetPedestal(iChannel, j);
524 integrator = rawStream->GetIntegratorFlag(iChannel, j);
525
526 GetRawsData((integrator == 0 ? kPedestal_Int0 : kPedestal_Int1))->Fill(OfflineCh,pedestal);
527 GetRawsData((integrator == 0 ? kPedestal_Cycle_Int0 : kPedestal_Cycle_Int1))->Fill(OfflineCh,pedestal);
528 }
529 }
530
531 // Fill Charge EoI histograms
532 //---------------------------
533 // Look for the maximum in the LHC clock train
534 Charge = 0;
535 Int_t iClock = 0;
536 Int_t iCharge = 0;
d62942e8 537 for(Int_t iEvent=0; iEvent<21; iEvent++){
9bd82f77 538 iCharge = rawStream->GetPedestal(iChannel,iEvent);
539 if(iCharge>Charge) {
540 Charge = iCharge;
541 iClock = iEvent;
542 }
543 } // End of maximum searching procedure
544
545 integrator = rawStream->GetIntegratorFlag(iChannel,iClock);
546 BBFlag = rawStream->GetBBFlag(iChannel, iClock);
547 BGFlag = rawStream->GetBGFlag(iChannel,iClock );
548
549 GetRawsData((integrator == 0 ? kChargeEoI_Int0 : kChargeEoI_Int1))->Fill(OfflineCh,Charge);
550 if(BBFlag) GetRawsData((integrator == 0 ? kChargeEoI_BB_Int0 : kChargeEoI_BB_Int1))->Fill(OfflineCh,Charge);
551 if(BGFlag) GetRawsData((integrator == 0 ? kChargeEoI_BG_Int0 : kChargeEoI_BG_Int1))->Fill(OfflineCh,Charge);
552
553 hProj = ((TH2I*)GetRawsData((integrator == 0 ? kPedestal_Int0 : kPedestal_Int1)))->ProjectionY("",OfflineCh+1,OfflineCh+1);
554 Double_t ped = hProj->GetMean();
555 Double_t sigma = hProj->GetRMS();
556 delete hProj;
557
558 Double_t ChargeEoI = Charge - ped;
559
560 // Calculation of the number of MIP
561 Double_t MIPEoI = ChargeEoI * fCalibData->GetMIPperADC(OfflineCh);
562
563
564 if(Charge<1023 && ChargeEoI > 5.*sigma){
565 ((TH2I*)GetRawsData((integrator == 0 ? kChargeEoI_Cycle_Int0 : kChargeEoI_Cycle_Int1)))->Fill(OfflineCh,ChargeEoI);
566 ((TH2D*)GetRawsData(kRawMIPChannel))->Fill(OfflineCh,MIPEoI);
567 if(OfflineCh<32) {
568 mulV0C++;
569 ChargeV0C += ChargeEoI;
570 MIPV0C += MIPEoI;
571 } else {
572 mulV0A++;
573 ChargeV0A += ChargeEoI;
574 MIPV0A += MIPEoI;
575 }
576 }
577
578 // Fill Charge Minimum Bias Histograms
579 //------------------------------------
580 int idx;
d62942e8 581 for(Int_t iBunch=0; iBunch<10; iBunch++){
9bd82f77 582 integrator = rawStream->GetIntMBFlag(iChannel, iBunch);
583 BBFlag = rawStream->GetBBMBFlag(iChannel, iBunch);
584 BGFlag = rawStream->GetBGMBFlag(iChannel, iBunch);
585 MBCharge = rawStream->GetChargeMB(iChannel, iBunch);
586
587 if(integrator==0){
588 if(BBFlag==0){
589 if(BGFlag==0) idx = kChargeMB_BB0_BG0_Int0;
590 else idx = kChargeMB_BB0_BG1_Int0;
591 } else {
592 if(BGFlag==0) idx = kChargeMB_BB1_BG0_Int0;
593 else idx = kChargeMB_BB1_BG1_Int0;
594 }
595 } else {
596 if(BBFlag==0){
597 if(BGFlag==0) idx = kChargeMB_BB0_BG0_Int1;
598 else idx = kChargeMB_BB0_BG1_Int1;
599 } else {
600 if(BGFlag==0) idx = kChargeMB_BB1_BG0_Int1;
601 else idx = kChargeMB_BB1_BG1_Int1;
602 }
603 }
604 GetRawsData(idx)->Fill(OfflineCh,MBCharge);
605 }
606
607 // Fill HPTDC Time Histograms
608 //---------------------------
609
610 BBFlag = rawStream->GetBBFlag(iChannel, 10);
611 BGFlag = rawStream->GetBGFlag(iChannel, 10);
612 Time = rawStream->GetTime(iChannel);
613 Width = rawStream->GetWidth(iChannel);
614
615 if(Time>0.){
616 if (OfflineCh<32) {
617 iTimeV0C++;
618 TimeV0C += Time;
619 }else{
620 iTimeV0A++;
621 TimeV0A += Time;
622 }
623 }
624 GetRawsData(kHPTDCTime)->Fill(OfflineCh,Time);
625 GetRawsData(kWidth)->Fill(OfflineCh,Width);
626 if(BBFlag) {
627 GetRawsData(kHPTDCTime_BB)->Fill(OfflineCh,Time);
628 GetRawsData(kWidth_BB)->Fill(OfflineCh,Width);
629 }
630 if(BGFlag) {
631 GetRawsData(kHPTDCTime_BG)->Fill(OfflineCh,Time);
632 GetRawsData(kWidth_BG)->Fill(OfflineCh,Width);
633 }
634
635 // Fill Flag and Charge Versus LHC-Clock histograms
636 //-------------------------------------------------
637
d62942e8 638 for(Int_t iEvent=0; iEvent<21; iEvent++){
9bd82f77 639 Charge = rawStream->GetPedestal(iChannel,iEvent);
640 integrator = rawStream->GetIntegratorFlag(iChannel,iEvent);
641 BBFlag = rawStream->GetBBFlag(iChannel, iEvent);
642 BGFlag = rawStream->GetBGFlag(iChannel,iEvent );
643
644 ((TH2*) GetRawsData((integrator == 0 ? kChargeVsClock_Int0 : kChargeVsClock_Int1 )))->Fill(OfflineCh,(float)iEvent-10,(float)Charge);
645 ((TH2*) GetRawsData(kBBFlagVsClock))->Fill(OfflineCh,(float)iEvent-10,(float)BBFlag);
646 ((TH2*) GetRawsData(kBGFlagVsClock))->Fill(OfflineCh,(float)iEvent-10,(float)BGFlag);
647 }
648
649 }// END : Loop over channels
650
651 if(iTimeV0A>0) TimeV0A /= (iTimeV0A * 10); // iTimeV0A Channels and divide by 10 to have the result in ns because 1 TDC Channel = 100 ps
652 else TimeV0A = -1.;
653 if(iTimeV0C>0) TimeV0C /= (iTimeV0C * 10);
654 else TimeV0C = -1.;
655 if(TimeV0A<0. || TimeV0C<0.) DiffTime = -10000.;
656 else DiffTime = TimeV0A - TimeV0C;
657
658 GetRawsData(kV0ATime)->Fill(TimeV0A);
659 GetRawsData(kV0CTime)->Fill(TimeV0C);
660 GetRawsData(kDiffTime)->Fill(DiffTime);
661
662 GetRawsData(kMultiV0A)->Fill(mulV0A);
663 GetRawsData(kMultiV0C)->Fill(mulV0C);
664
665 GetRawsData(kChargeV0A)->Fill(ChargeV0A);
666 GetRawsData(kChargeV0C)->Fill(ChargeV0C);
667 GetRawsData(kChargeV0)->Fill(ChargeV0A + ChargeV0C);
668
669 GetRawsData(kRawMIPV0A)->Fill(MIPV0A);
670 GetRawsData(kRawMIPV0C)->Fill(MIPV0C);
671 GetRawsData(kRawMIPV0)->Fill(MIPV0A + MIPV0C);
672 break;
673 } //---------> END : SWITCH EVENT TYPE
674
675 fEvent++;
676 TParameter<double> * p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQA::GetTaskName(AliQA::kRAWS).Data(), GetRawsData(kMultiV0A)->GetName()))) ;
677 p->SetVal((double)mulV0A) ;
678
679 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQA::GetTaskName(AliQA::kRAWS).Data(), GetRawsData(kMultiV0C)->GetName()))) ;
680 p->SetVal((double)mulV0C) ;
681
682 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQA::GetTaskName(AliQA::kRAWS).Data(), GetRawsData(kChargeV0A)->GetName()))) ;
683 p->SetVal((double)ChargeV0A) ;
684
685 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQA::GetTaskName(AliQA::kRAWS).Data(), GetRawsData(kChargeV0C)->GetName()))) ;
686 p->SetVal((double)ChargeV0C) ;
687
688 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQA::GetTaskName(AliQA::kRAWS).Data(), GetRawsData(kChargeV0)->GetName()))) ;
689 p->SetVal((double)(ChargeV0A + ChargeV0C)) ;
690
691 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQA::GetTaskName(AliQA::kRAWS).Data(), GetRawsData(kRawMIPV0A)->GetName()))) ;
692 p->SetVal((double)MIPV0A) ;
693
694 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQA::GetTaskName(AliQA::kRAWS).Data(), GetRawsData(kRawMIPV0C)->GetName()))) ;
695 p->SetVal((double)MIPV0C) ;
696
697 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQA::GetTaskName(AliQA::kRAWS).Data(), GetRawsData(kRawMIPV0)->GetName()))) ;
698 p->SetVal((double)(MIPV0A + MIPV0C)) ;
699
700 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQA::GetTaskName(AliQA::kRAWS).Data(), GetRawsData(kV0ATime)->GetName()))) ;
701 p->SetVal((double)TimeV0A) ;
702
703 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQA::GetTaskName(AliQA::kRAWS).Data(), GetRawsData(kV0CTime)->GetName()))) ;
704 p->SetVal((double)TimeV0C) ;
705
706 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQA::GetTaskName(AliQA::kRAWS).Data(), GetRawsData(kDiffTime)->GetName()))) ;
707 p->SetVal((double)DiffTime) ;
708
709 delete rawStream; rawStream = 0x0;
710
711
4da80b8c 712 }
508b9fc0 713
714//____________________________________________________________________________
715void AliVZEROQADataMakerRec::StartOfDetectorCycle()
716{
717 // Detector specific actions at start of cycle
718
9bd82f77 719 // Resetting the histogram used to have the trend versus time.
720 TH1* h;
721 h = GetRawsData(kPedestal_Cycle_Int0);
722 if(h) h->Reset();
723 h = GetRawsData(kPedestal_Cycle_Int1);
724 if(h) h->Reset();
725 h = GetRawsData(kChargeEoI_Cycle_Int0);
726 if(h) h->Reset();
727 h = GetRawsData(kChargeEoI_Cycle_Int1);
728 if(h) h->Reset();
729
508b9fc0 730}