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