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