fixed typo for setting fraction of shared clusters
[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>
46e6c4f9 25#include <TF1.h>
508b9fc0 26#include <TH1F.h>
27#include <TH1I.h>
4da80b8c 28#include <TH2I.h>
9bd82f77 29#include <TH2D.h>
30#include <TGraph.h>
f81355e3 31#include <TParameter.h>
a8e23456 32#include <TTimeStamp.h>
508b9fc0 33
34// --- Standard library ---
35
36// --- AliRoot header files ---
37#include "AliESDEvent.h"
38#include "AliLog.h"
1e376713 39#include "AliCDBManager.h"
40#include "AliCDBStorage.h"
41#include "AliCDBEntry.h"
508b9fc0 42#include "AliVZEROQADataMakerRec.h"
43#include "AliQAChecker.h"
4da80b8c 44#include "AliRawReader.h"
508b9fc0 45#include "AliVZERORawStream.h"
5192f264 46#include "AliVZEROdigit.h"
46e6c4f9 47#include "AliVZEROConst.h"
508b9fc0 48#include "AliVZEROReconstructor.h"
a8e23456 49#include "AliVZEROTrending.h"
e58b4e66 50#include "AliVZEROCalibData.h"
46e6c4f9 51#include "AliCTPTimeParams.h"
9bd82f77 52#include "event.h"
508b9fc0 53
46e6c4f9 54 const Float_t kMinBBA = 68. ;
55 const Float_t kMaxBBA = 100. ;
56 const Float_t kMinBBC = 75.5 ;
57 const Float_t kMaxBBC = 100. ;
58 const Float_t kMinBGA = 54. ;
59 const Float_t kMaxBGA = 58. ;
60 const Float_t kMinBGC = 69.5 ;
61 const Float_t kMaxBGC = 74. ;
62
63
64
65
508b9fc0 66
67ClassImp(AliVZEROQADataMakerRec)
68
69//____________________________________________________________________________
70 AliVZEROQADataMakerRec::AliVZEROQADataMakerRec() :
4e25ac79 71 AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kVZERO), "VZERO Quality Assurance Data Maker"),
9bd82f77 72 fCalibData(0x0),
3dc953e2 73 fEvent(0),
74 fNTotEvents(0),
75 fNSubEvents(0),
76 fTrendingUpdateEvent(0),
77 fNTrendingUpdates(0),
78 fTrendingUpdateTime(0),
79 fCycleStartTime(0),
46e6c4f9 80 fCycleStopTime(0),
81 fTimeSlewing(0)
1e376713 82
508b9fc0 83{
6bec7c7c 84 // Constructor
85
5379c4a3 86 AliDebug(AliQAv1::GetQADebugLevel(), "Construct VZERO QA Object");
46e6c4f9 87
1e376713 88 for(Int_t i=0; i<64; i++){
89 fEven[i] = 0;
3dc953e2 90 fOdd[i] = 0;
3dc953e2 91 }
1e376713 92
93 for(Int_t i=0; i<128; i++){
6bec7c7c 94 fADCmean[i] = 0.0; }
508b9fc0 95}
96
97//____________________________________________________________________________
1e376713 98 AliVZEROQADataMakerRec::AliVZEROQADataMakerRec(const AliVZEROQADataMakerRec& qadm) :
99 AliQADataMakerRec(),
9bd82f77 100 fCalibData(0x0),
3dc953e2 101 fEvent(0),
102 fNTotEvents(0),
103 fNSubEvents(0),
104 fTrendingUpdateEvent(0),
105 fNTrendingUpdates(0),
106 fTrendingUpdateTime(0),
107 fCycleStartTime(0),
46e6c4f9 108 fCycleStopTime(0),
109 fTimeSlewing(0)
1e376713 110
508b9fc0 111{
6bec7c7c 112 // Copy constructor
113
1e376713 114 SetName((const char*)qadm.GetName()) ;
115 SetTitle((const char*)qadm.GetTitle());
508b9fc0 116}
117
118//__________________________________________________________________
119AliVZEROQADataMakerRec& AliVZEROQADataMakerRec::operator = (const AliVZEROQADataMakerRec& qadm )
120{
121 // Equal operator
6bec7c7c 122
508b9fc0 123 this->~AliVZEROQADataMakerRec();
124 new(this) AliVZEROQADataMakerRec(qadm);
125 return *this;
126}
1e376713 127
128//____________________________________________________________________________
129AliVZEROCalibData* AliVZEROQADataMakerRec::GetCalibData() const
130
131{
5f650de8 132 AliCDBManager *man = AliCDBManager::Instance();
6bec7c7c 133
5f650de8 134 AliCDBEntry *entry=0;
1e376713 135
5f650de8 136 entry = man->Get("VZERO/Calib/Data",fRun);
137 if(!entry){
138 AliWarning("Load of calibration data from default storage failed!");
139 AliWarning("Calibration data will be loaded from local storage ($ALICE_ROOT)");
140
141 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
142 entry = man->Get("VZERO/Calib/Data",fRun);
143 }
144 // Retrieval of data in directory VZERO/Calib/Data:
1e376713 145
5f650de8 146 AliVZEROCalibData *calibdata = 0;
1e376713 147
5f650de8 148 if (entry) calibdata = (AliVZEROCalibData*) entry->GetObject();
149 if (!calibdata) AliFatal("No calibration data from calibration database !");
1e376713 150
5f650de8 151 return calibdata;
1e376713 152}
5f650de8 153
154
508b9fc0 155
156//____________________________________________________________________________
4e25ac79 157void AliVZEROQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
508b9fc0 158{
6bec7c7c 159 // Detector specific actions at end of cycle
160 // Does the QA checking
161
4e25ac79 162 AliQAChecker::Instance()->Run(AliQAv1::kVZERO, task, list) ;
a8e23456 163
164 if(task == AliQAv1::kRAWS){
165 TTimeStamp currentTime;
166 fCycleStopTime = currentTime.GetSec();
a8e23456 167 }
57acd2d2 168
169 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
6252ceeb 170 if (! IsValidEventSpecie(specie, list))
eca4fa66 171 continue ;
5e232cd6 172 SetEventSpecie(AliRecoParam::ConvertIndex(specie)) ;
4e25ac79 173 if(task == AliQAv1::kRAWS){
4e25ac79 174 } else if (task == AliQAv1::kESDS) {
57acd2d2 175 }
9bd82f77 176 }
508b9fc0 177}
178
179//____________________________________________________________________________
180void AliVZEROQADataMakerRec::InitESDs()
181{
6bec7c7c 182 // Creates histograms to control ESDs
183
7d297381 184 const Bool_t expert = kTRUE ;
185 const Bool_t image = kTRUE ;
9bd82f77 186
6bec7c7c 187 TH2D * h2d;
188 TH1I * h1i;
189 TH1D * h1d;
9bd82f77 190
db72ff3b 191 h1i = new TH1I("H1I_Cell_Multiplicity_V0A", "Cell Multiplicity in V0A;Multiplicity (Nb of Cell);Counts", 35, 0, 35) ;
7d297381 192 Add2ESDsList(h1i, kCellMultiV0A, !expert, image) ;
4da80b8c 193
db72ff3b 194 h1i = new TH1I("H1I_Cell_Multiplicity_V0C", "Cell Multiplicity in V0;Multiplicity (Nb of Cell);Counts", 35, 0, 35) ;
7d297381 195 Add2ESDsList(h1i, kCellMultiV0C, !expert, image) ;
9bd82f77 196
db72ff3b 197 h1d = new TH1D("H1D_MIP_Multiplicity_V0A", "MIP Multiplicity in V0A;Multiplicity (Nb of MIP);Counts", 1000, 0, 1000) ;
7d297381 198 Add2ESDsList(h1d, kMIPMultiV0A, !expert, image) ;
9bd82f77 199
db72ff3b 200 h1d = new TH1D("H1D_MIP_Multiplicity_V0C", "MIP Multiplicity in V0C;Multiplicity (Nb of MIP);Counts", 1000, 0, 1000) ;
7d297381 201 Add2ESDsList(h1d, kMIPMultiV0C, !expert, image) ;
28fdf12c 202
db72ff3b 203 h2d = new TH2D("H2D_MIP_Multiplicity_Channel", "MIP Multiplicity per Channel;Channel;Multiplicity (Nb of MIP)",64, 0, 64, 100, 0, 100) ;
7d297381 204 Add2ESDsList(h2d, kMIPMultiChannel, !expert, image) ;
9bd82f77 205
db72ff3b 206 h1d = new TH1D("H1D_BBFlag_Counters", "BB Flag Counters;Channel;Counts",64, 0, 64) ;
7d297381 207 Add2ESDsList(h1d, kBBFlag, !expert, image) ;
9bd82f77 208
db72ff3b 209 h1d = new TH1D("H1D_BGFlag_Counters", "BG Flag Counters;Channel;Counts",64, 0, 64) ;
7d297381 210 Add2ESDsList(h1d, kBGFlag, !expert, image) ;
9bd82f77 211
db72ff3b 212 h2d = new TH2D("H2D_Charge_Channel", "ADC Charge per channel;Channel;Charge (ADC counts)",64, 0, 64, 1024, 0, 1024) ;
7d297381 213 Add2ESDsList(h2d, kChargeChannel, !expert, image) ;
9bd82f77 214
362e65bd 215 h2d = new TH2D("H2D_Time_Channel", "Time per channel;Channel;Time (ns)",64, 0, 64, 400, -100, 100) ;
7d297381 216 Add2ESDsList(h2d, kTimeChannel, !expert, image) ;
9bd82f77 217
362e65bd 218 h1d = new TH1D("H1D_V0A_Time", "Mean V0A Time;Time (ns);Counts",1000, -100., 100.);
7d297381 219 Add2ESDsList(h1d,kESDV0ATime, !expert, image);
9bd82f77 220
362e65bd 221 h1d = new TH1D("H1D_V0C_Time", "Mean V0C Time;Time (ns);Counts",1000, -100., 100.);
7d297381 222 Add2ESDsList(h1d,kESDV0CTime, !expert, image);
9bd82f77 223
362e65bd 224 h1d = new TH1D("H1D_Diff_Time", "Diff Time V0A - V0C;Diff Time V0A - V0C (ns);Counts",1000, -200., 200.);
7d297381 225 Add2ESDsList(h1d,kESDDiffTime, !expert, image);
9bd82f77 226
28fdf12c 227}
508b9fc0 228
229//____________________________________________________________________________
4da80b8c 230 void AliVZEROQADataMakerRec::InitRaws()
231 {
6bec7c7c 232 // Creates RAW histograms in Raws subdir
3dc953e2 233
7d297381 234 const Bool_t expert = kTRUE ;
235 const Bool_t saveCorr = kTRUE ;
236 const Bool_t image = kTRUE ;
9bd82f77 237
2563588b 238
6bec7c7c 239 const Int_t kNintegrator = 2;
9bd82f77 240
126647af 241 const Int_t kNTdcTimeBins = 1280;
46e6c4f9 242 const Float_t kTdcTimeMin = 0.;
e716a558 243 const Float_t kTdcTimeMax = 75.;
126647af 244 const Int_t kNTdcWidthBins = 128;
46e6c4f9 245 const Float_t kTdcWidthMin = 0;
126647af 246 const Float_t kTdcWidthMax = 50.;
6bec7c7c 247 const Int_t kNChargeBins = 1024;
46e6c4f9 248 const Float_t kChargeMin = 0;
249 const Float_t kChargeMax = 1024;
6bec7c7c 250 const Int_t kNChannelBins = 64;
46e6c4f9 251 const Float_t kChannelMin = 0;
252 const Float_t kChannelMax = 64;
6bec7c7c 253 const Int_t kNPedestalBins = 200;
46e6c4f9 254 const Float_t kPedestalMin = 0;
255 const Float_t kPedestalMax = 200;
46e6c4f9 256 const Int_t kNMIPBins = 512;
257 const Float_t kMIPMin = 0;
258 const Float_t kMIPMax = 16;
6bec7c7c 259
260 TH2I * h2i;
261 TH2D * h2d;
262 TH1I * h1i;
263 TH1D * h1d;
264
265 int iHisto =0;
46e6c4f9 266 // Creation of Trigger Histogram
267 h1d = new TH1D("H1D_Trigger_Type", "V0 Trigger Type;;Counts", 4,0 ,4) ;
268 Add2RawsList(h1d,kTriggers, !expert, image, saveCorr); iHisto++;
269 h1d->SetFillColor(29);
270 h1d->SetLineWidth(2);
271 h1d->GetXaxis()->SetLabelSize(0.06);
272 h1d->GetXaxis()->SetNdivisions(808,kFALSE);
273 h1d->GetXaxis()->SetBinLabel(1, "V0-AND");
274 h1d->GetXaxis()->SetBinLabel(2, "V0-OR");
275 h1d->GetXaxis()->SetBinLabel(3, "V0-BGA");
276 h1d->GetXaxis()->SetBinLabel(4, "V0-BGC");
277
2563588b 278 h2d = new TH2D("H2D_Trigger_Type", "V0 Trigger Type;V0A;V0C", 4,0 ,4,4,0,4) ;
279 Add2RawsList(h2d,kTriggers2, !expert, image, saveCorr); iHisto++;
280 h2d->SetDrawOption("coltext");
281 h2d->GetXaxis()->SetLabelSize(0.06);
282 h2d->GetXaxis()->SetNdivisions(808,kFALSE);
283 h2d->GetYaxis()->SetNdivisions(808,kFALSE);
284 h2d->GetXaxis()->SetBinLabel(1, "Empty");
285 h2d->GetXaxis()->SetBinLabel(2, "Fake");
286 h2d->GetXaxis()->SetBinLabel(3, "BB");
287 h2d->GetXaxis()->SetBinLabel(4, "BG");
288 h2d->GetYaxis()->SetBinLabel(1, "Empty");
289 h2d->GetYaxis()->SetBinLabel(2, "Fake");
290 h2d->GetYaxis()->SetBinLabel(3, "BB");
291 h2d->GetYaxis()->SetBinLabel(4, "BG");
292
6bec7c7c 293 // Creation of Cell Multiplicity Histograms
db72ff3b 294 h1i = new TH1I("H1I_Multiplicity_V0A", "Cell Multiplicity in V0A;# of Cells;Entries", 35, 0, 35) ;
74995017 295 Add2RawsList(h1i,kMultiV0A, expert, image, saveCorr); iHisto++;
db72ff3b 296 h1i = new TH1I("H1I_Multiplicity_V0C", "Cell Multiplicity in V0C;# of Cells;Entries", 35, 0, 35) ;
74995017 297 Add2RawsList(h1i,kMultiV0C, expert, image, saveCorr); iHisto++;
9bd82f77 298
6bec7c7c 299 // Creation of Total Charge Histograms
46e6c4f9 300 h1d = new TH1D("H1D_Charge_V0A", "Total Charge in V0A;Charge [ADC counts];Counts", 2000, 0, 10000) ;
301 Add2RawsList(h1d,kChargeV0A, expert, !image, saveCorr); iHisto++;
302 h1d = new TH1D("H1D_Charge_V0C", "Total Charge in V0C;Charge [ADC counts];Counts", 2000, 0, 10000) ;
303 Add2RawsList(h1d,kChargeV0C, expert, !image, saveCorr); iHisto++;
304 h1d = new TH1D("H1D_Charge_V0", "Total Charge in V0;Charge [ADC counts];Counts", 2000, 0, 20000) ;
305 Add2RawsList(h1d,kChargeV0, expert, !image, saveCorr); iHisto++;
9bd82f77 306
307 // Creation of MIP Histograms
46e6c4f9 308 h1d = new TH1D("H1D_MIP_V0A", "Total MIP in V0A;Multiplicity [MIP];Counts", kNMIPBins,kMIPMin ,32*kMIPMax) ;
309 Add2RawsList(h1d,kRawMIPV0A, expert, !image, saveCorr); iHisto++;
310 h1d = new TH1D("H1D_MIP_V0C", "Total MIP in V0C;Multiplicity [MIP];Counts", kNMIPBins,kMIPMin ,32*kMIPMax) ;
311 Add2RawsList(h1d,kRawMIPV0C, expert, !image, saveCorr); iHisto++;
312 h1d = new TH1D("H1D_MIP_V0", "Total MIP in V0;Multiplicity [MIP];Counts", 2*kNMIPBins,kMIPMin ,64*kMIPMax) ;
313 Add2RawsList(h1d,kRawMIPV0, expert, !image, saveCorr); iHisto++;
db72ff3b 314 h2d = new TH2D("H2D_MIP_Channel", "Nb of MIP per channel;Channel;# of Mips", kNChannelBins, kChannelMin, kChannelMax,kNMIPBins,kMIPMin ,kMIPMax) ;
7d297381 315 Add2RawsList(h2d,kRawMIPChannel, expert, !image, !saveCorr); iHisto++;
9bd82f77 316
317
c8d309e0 318
319 // Creation of Charge EoI histogram
46e6c4f9 320 h2d = new TH2D("H2D_ChargeEoI", "Charge Event of Interest;Channel Number;Charge [ADC counts]"
321 ,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, kChargeMax);
c8d309e0 322 Add2RawsList(h2d,kChargeEoI, !expert, image, !saveCorr); iHisto++;
323
d62942e8 324 for(Int_t iInt=0;iInt<kNintegrator;iInt++){
9bd82f77 325 // Creation of Pedestal histograms
46e6c4f9 326 h2i = new TH2I(Form("H2I_Pedestal_Int%d",iInt), Form("Pedestal (Int%d);Channel;Pedestal [ADC counts]",iInt)
327 ,kNChannelBins, kChannelMin, kChannelMax,kNPedestalBins,kPedestalMin ,kPedestalMax );
7d297381 328 Add2RawsList(h2i,(iInt == 0 ? kPedestalInt0 : kPedestalInt1), expert, !image, !saveCorr); iHisto++;
9bd82f77 329
9bd82f77 330
331 // Creation of Charge EoI histograms
46e6c4f9 332 h2i = new TH2I(Form("H2I_ChargeEoI_Int%d",iInt), Form("Charge EoI (Int%d);Channel;Charge [ADC counts]",iInt)
333 ,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, kChargeMax);
74995017 334 Add2RawsList(h2i,(iInt == 0 ? kChargeEoIInt0 : kChargeEoIInt1), expert, image, !saveCorr); iHisto++;
f81355e3 335
46e6c4f9 336 h2i = new TH2I(Form("H2I_ChargeEoI_BB_Int%d",iInt), Form("Charge EoI w/ BB Flag (Int%d);Channel;Charge [ADC counts]",iInt)
337 ,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, kChargeMax);
7d297381 338 Add2RawsList(h2i,(iInt == 0 ? kChargeEoIBBInt0 : kChargeEoIBBInt1), expert, !image, !saveCorr); iHisto++;
f81355e3 339
46e6c4f9 340 h2i = new TH2I(Form("H2I_ChargeEoI_BG_Int%d",iInt), Form("Charge EoI w/ BG Flag (Int%d);Channel;Charge [ADC counts]",iInt)
341 ,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, kChargeMax);
7d297381 342 Add2RawsList(h2i,(iInt == 0 ? kChargeEoIBGInt0: kChargeEoIBGInt1), expert, !image, !saveCorr); iHisto++;
9bd82f77 343
344 // Creation of Charge versus LHC Clock histograms
46e6c4f9 345 h2d = new TH2D(Form("H2D_ChargeVsClock_Int%d",iInt), Form("Charge Versus LHC-Clock (Int%d);Channel;LHCClock;Charge [ADC counts]",iInt)
346 ,kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 );
7d297381 347 Add2RawsList(h2d,(iInt == 0 ? kChargeVsClockInt0 : kChargeVsClockInt1 ), expert, !image, !saveCorr); iHisto++;
9bd82f77 348
6bec7c7c 349 // Creation of Minimum Bias Charge histograms
350 for(Int_t iBB=0;iBB<2;iBB++){
d62942e8 351 for(Int_t iBG=0;iBG<2;iBG++){
46e6c4f9 352 h2i = new TH2I(Form("H2I_ChargeMB_BB%d_BG%d_Int%d",iBB,iBG,iInt), Form("MB Charge (BB=%d, BG=%d, Int=%d);Channel;Charge [ADC counts]",iBB,iBG,iInt)
353 ,kNChannelBins, kChannelMin, kChannelMax,kNChargeBins, kChargeMin, kChargeMax);
9bd82f77 354 int idx;
355 if(iInt==0){
356 if(iBB==0){
6bec7c7c 357 if(iBG==0) idx = kChargeMBBB0BG0Int0;
358 else idx = kChargeMBBB0BG1Int0;
9bd82f77 359 } else {
6bec7c7c 360 if(iBG==0) idx = kChargeMBBB1BG0Int0;
361 else idx = kChargeMBBB1BG1Int0;
9bd82f77 362 }
363 } else {
364 if(iBB==0){
6bec7c7c 365 if(iBG==0) idx = kChargeMBBB0BG0Int1;
366 else idx = kChargeMBBB0BG1Int1;
9bd82f77 367 } else {
6bec7c7c 368 if(iBG==0) idx = kChargeMBBB1BG0Int1;
369 else idx = kChargeMBBB1BG1Int1;
9bd82f77 370 }
371 }
7d297381 372 Add2RawsList(h2i,idx, expert, !image, !saveCorr); iHisto++;
9bd82f77 373 }
6bec7c7c 374 }
9bd82f77 375
376 }
377
6bec7c7c 378 // Creation of Time histograms
46e6c4f9 379 h2i = new TH2I("H2I_Width", "HPTDC Width;Channel;Width [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax);
7d297381 380 Add2RawsList(h2i,kWidth, expert, !image, !saveCorr); iHisto++;
9bd82f77 381
46e6c4f9 382 h2i = new TH2I("H2I_Width_BB", "HPTDC Width w/ BB Flag condition;Channel;Width [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax);
7d297381 383 Add2RawsList(h2i,kWidthBB, expert, !image, !saveCorr); iHisto++;
9bd82f77 384
46e6c4f9 385 h2i = new TH2I("H2I_Width_BG", "HPTDC Width w/ BG Flag condition;Channel;Width [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax);
7d297381 386 Add2RawsList(h2i,kWidthBG, expert, !image, !saveCorr); iHisto++;
9bd82f77 387
46e6c4f9 388 h2i = new TH2I("H2I_HPTDCTime", "HPTDC Time;Channel;Leading Time [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
74995017 389 Add2RawsList(h2i,kHPTDCTime, expert, image, !saveCorr); iHisto++;
9bd82f77 390
46e6c4f9 391 h2i = new TH2I("H2I_HPTDCTime_BB", "HPTDC Time w/ BB Flag condition;Channel;Leading Time [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
c8d309e0 392 Add2RawsList(h2i,kHPTDCTimeBB, !expert, image, !saveCorr); iHisto++;
9bd82f77 393
46e6c4f9 394 h2i = new TH2I("H2I_HPTDCTime_BG", "HPTDC Time w/ BG Flag condition;Channel;Leading Time [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
c8d309e0 395 Add2RawsList(h2i,kHPTDCTimeBG, !expert, image, !saveCorr); iHisto++;
9bd82f77 396
46e6c4f9 397 h1d = new TH1D("H1D_V0A_Time", "V0A Time;Time [ns];Counts",kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
74995017 398 Add2RawsList(h1d,kV0ATime, expert, !image, saveCorr); iHisto++;
9bd82f77 399
46e6c4f9 400 h1d = new TH1D("H1D_V0C_Time", "V0C Time;Time [ns];Counts",kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
74995017 401 Add2RawsList(h1d,kV0CTime, expert, !image, saveCorr); iHisto++;
9bd82f77 402
2563588b 403 h1d = new TH1D("H1D_Diff_Time","Diff V0A-V0C Time;Time [ns];Counts",kNTdcTimeBins, -50., 50.);
404 Add2RawsList(h1d,kDiffTime, expert, image, saveCorr); iHisto++;
46e6c4f9 405
406 h2d = new TH2D("H2D_TimeV0A_V0C", "Mean Time in V0C versus V0A;Time V0A [ns];Time V0C [ns]",
2563588b 407 kNTdcTimeBins/8, kTdcTimeMin,kTdcTimeMax,kNTdcTimeBins/8, kTdcTimeMin,kTdcTimeMax) ;
b38b290c 408 Add2RawsList(h2d,kTimeV0AV0C, !expert, image, !saveCorr); iHisto++;
9bd82f77 409
9bd82f77 410 // Creation of Flag versus LHC Clock histograms
c8d309e0 411
46e6c4f9 412 h1d = new TH1D("H1D_BBFlagPerChannel", "BB-Flags Versus Channel;Channel;BB Flags Count",kNChannelBins, kChannelMin, kChannelMax );
413 h1d->SetMinimum(0);
c8d309e0 414 Add2RawsList(h1d,kBBFlagsPerChannel, !expert, image, !saveCorr); iHisto++;
415
46e6c4f9 416 h2d = new TH2D("H2D_BBFlagVsClock", "BB-Flags Versus LHC-Clock;Channel;LHC Clocks",kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 );
7d297381 417 Add2RawsList(h2d,kBBFlagVsClock, expert, !image, !saveCorr); iHisto++;
9bd82f77 418
46e6c4f9 419 h2d = new TH2D("H2D_BGFlagVsClock", "BG-Flags Versus LHC-Clock;Channel;LHC Clocks",kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 );
7d297381 420 Add2RawsList(h2d,kBGFlagVsClock, expert, !image, !saveCorr); iHisto++;
9bd82f77 421
a8e23456 422
5379c4a3 423 AliDebug(AliQAv1::GetQADebugLevel(), Form("%d Histograms has been added to the Raws List",iHisto));
4da80b8c 424 }
508b9fc0 425
44ed7a66 426//____________________________________________________________________________
427void AliVZEROQADataMakerRec::InitDigits()
428{
429 // create Digits histograms in Digits subdir
430 const Bool_t expert = kTRUE ;
431 const Bool_t image = kTRUE ;
432
44ed7a66 433 TH1I *fhDigTDC[64];
434 TH1I *fhDigADC[64];
44ed7a66 435
436 // create Digits histograms in Digits subdir
db72ff3b 437 TH1I * h0 = new TH1I("hDigitMultiplicity", "Digits multiplicity distribution in VZERO;# of Digits;Entries", 100, 0, 99) ;
44ed7a66 438 h0->Sumw2() ;
439 Add2DigitsList(h0, 0, !expert, image) ;
440
441 for (Int_t i=0; i<64; i++)
442 {
46e6c4f9 443 fhDigTDC[i] = new TH1I(Form("hDigitTDC%d", i),Form("Digit TDC in cell %d; TDC value;Entries",i),300,0.,149.);
44ed7a66 444
46e6c4f9 445 fhDigADC[i]= new TH1I(Form("hDigitADC%d",i),Form("Digit ADC in cell %d;ADC value;Entries",i),1024,0.,1023.);
44ed7a66 446
447 Add2DigitsList(fhDigTDC[i],i+1, !expert, image);
448 Add2DigitsList(fhDigADC[i],i+1+64, !expert, image);
449 }
450}
451
452//____________________________________________________________________________
6252ceeb 453void AliVZEROQADataMakerRec::MakeDigits()
44ed7a66 454{
455 // makes data from Digits
eca4fa66 456
6252ceeb 457 GetDigitsData(0)->Fill(fDigitsArray->GetEntriesFast()) ;
458 TIter next(fDigitsArray) ;
57eead61 459 AliVZEROdigit *aVZERODigit ;
460 while ( (aVZERODigit = dynamic_cast<AliVZEROdigit *>(next())) ) {
461 Int_t aPMNumber = aVZERODigit->PMNumber();
462 GetDigitsData(aPMNumber +1)->Fill( aVZERODigit->Time()) ; // in 100 of picoseconds
463 GetDigitsData(aPMNumber +1+64)->Fill( aVZERODigit->ADC()) ;
44ed7a66 464 }
465}
466
467
468//____________________________________________________________________________
469void AliVZEROQADataMakerRec::MakeDigits(TTree *digitTree)
470{
471 // makes data from Digit Tree
472
6252ceeb 473 if ( fDigitsArray )
474 fDigitsArray->Clear() ;
475 else
476 fDigitsArray = new TClonesArray("AliVZEROdigit", 1000) ;
44ed7a66 477
478 TBranch * branch = digitTree->GetBranch("VZERODigit") ;
479 if ( ! branch ) {
480 AliWarning("VZERO branch in Digit Tree not found") ;
481 } else {
6252ceeb 482 branch->SetAddress(&fDigitsArray) ;
44ed7a66 483 branch->GetEntry(0) ;
6252ceeb 484 MakeDigits() ;
44ed7a66 485 }
486}
487
488
508b9fc0 489//____________________________________________________________________________
490void AliVZEROQADataMakerRec::MakeESDs(AliESDEvent * esd)
491{
6bec7c7c 492 // Creates QA data from ESDs
493
494 UInt_t eventType = esd->GetEventType();
508b9fc0 495
6bec7c7c 496 switch (eventType){
9bd82f77 497 case PHYSICS_EVENT:
6bec7c7c 498 AliESDVZERO *esdVZERO=esd->GetVZEROData();
508b9fc0 499
6bec7c7c 500 if (!esdVZERO) break;
9bd82f77 501
502 GetESDsData(kCellMultiV0A)->Fill(esdVZERO->GetNbPMV0A());
503 GetESDsData(kCellMultiV0C)->Fill(esdVZERO->GetNbPMV0C());
504 GetESDsData(kMIPMultiV0A)->Fill(esdVZERO->GetMTotV0A());
505 GetESDsData(kMIPMultiV0C)->Fill(esdVZERO->GetMTotV0C());
506
6bec7c7c 507 for(Int_t i=0;i<64;i++) {
9bd82f77 508 GetESDsData(kMIPMultiChannel)->Fill((Float_t) i,(Float_t) esdVZERO->GetMultiplicity(i));
509 GetESDsData(kChargeChannel)->Fill((Float_t) i,(Float_t) esdVZERO->GetAdc(i));
362e65bd 510 if (i < 32) {
511 if(esdVZERO->BBTriggerV0C(i)) GetESDsData(kBBFlag)->Fill((Float_t) i);
512 if(esdVZERO->BGTriggerV0C(i)) GetESDsData(kBGFlag)->Fill((Float_t) i);
9bd82f77 513 }
362e65bd 514 else {
515 if(esdVZERO->BBTriggerV0A(i-32)) GetESDsData(kBBFlag)->Fill((Float_t) i);
516 if(esdVZERO->BGTriggerV0A(i-32)) GetESDsData(kBGFlag)->Fill((Float_t) i);
517 }
518 Float_t time = (Float_t) esdVZERO->GetTime(i); //Convert in ns: 1 TDC channel = 100ps
519 GetESDsData(kTimeChannel)->Fill((Float_t) i,time);
9bd82f77 520 }
9bd82f77 521
362e65bd 522 Float_t timeV0A = esdVZERO->GetV0ATime();
523 Float_t timeV0C = esdVZERO->GetV0CTime();
524 Float_t diffTime;
525
526 if(timeV0A<-1024.+1.e-6 || timeV0C<-1024.+1.e-6) diffTime = -1024.;
527 else diffTime = timeV0A - timeV0C;
528
6bec7c7c 529 GetESDsData(kESDV0ATime)->Fill(timeV0A);
530 GetESDsData(kESDV0CTime)->Fill(timeV0C);
531 GetESDsData(kESDDiffTime)->Fill(diffTime);
9bd82f77 532
6bec7c7c 533 break;
9bd82f77 534 }
28fdf12c 535
508b9fc0 536}
537
538//____________________________________________________________________________
4da80b8c 539 void AliVZEROQADataMakerRec::MakeRaws(AliRawReader* rawReader)
540 {
6bec7c7c 541 // Fills histograms with Raws, computes average ADC values dynamically (pedestal subtracted)
1e376713 542
46e6c4f9 543
eca4fa66 544 // Check id histograms already created for this Event Specie
545 if ( ! GetRawsData(kPedestalInt0) )
546 InitRaws() ;
547
548 rawReader->Reset() ;
e58b4e66 549 AliVZERORawStream* rawStream = new AliVZERORawStream(rawReader);
550 if(!(rawStream->Next())) return;
a8e23456 551
6bec7c7c 552 eventTypeType eventType = rawReader->GetType();
9bd82f77 553
6bec7c7c 554 Int_t mulV0A = 0 ;
555 Int_t mulV0C = 0 ;
556 Double_t timeV0A =0., timeV0C = 0.;
46e6c4f9 557 Double_t weightV0A =0., weightV0C = 0.;
6bec7c7c 558 UInt_t itimeV0A=0, itimeV0C=0;
559 Double_t chargeV0A=0., chargeV0C=0.;
560 Double_t mipV0A=0., mipV0C=0.;
9bd82f77 561
6bec7c7c 562 Double_t diffTime=-100000.;
9bd82f77 563
564
6bec7c7c 565 switch (eventType){
566 case PHYSICS_EVENT:
a8e23456 567
568 fNTotEvents++;
569
6bec7c7c 570 Int_t iFlag=0;
571 Int_t pedestal;
572 Int_t integrator;
46e6c4f9 573 Bool_t flagBB[64];
574 Bool_t flagBG[64];
575 Int_t mbCharge;
a8e23456 576 Float_t charge;
6bec7c7c 577 Int_t offlineCh;
46e6c4f9 578 Float_t adc[64], time[64], width[64], timeCorr[64];
9bd82f77 579
d62942e8 580 for(Int_t iChannel=0; iChannel<64; iChannel++) { // BEGIN : Loop over channels
9bd82f77 581
e58b4e66 582 offlineCh = rawStream->GetOfflineChannel(iChannel);
9bd82f77 583
6bec7c7c 584 // Fill Pedestal histograms
585
586 for(Int_t j=15; j<21; j++) {
e58b4e66 587 if((rawStream->GetBGFlag(iChannel,j) || rawStream->GetBBFlag(iChannel,j))) iFlag++;
6bec7c7c 588 }
9bd82f77 589
6bec7c7c 590 if(iFlag == 0){ //No Flag found
d62942e8 591 for(Int_t j=15; j<21; j++){
e58b4e66 592 pedestal= (Int_t) rawStream->GetPedestal(iChannel, j);
593 integrator = rawStream->GetIntegratorFlag(iChannel, j);
9bd82f77 594
6bec7c7c 595 GetRawsData((integrator == 0 ? kPedestalInt0 : kPedestalInt1))->Fill(offlineCh,pedestal);
9bd82f77 596 }
6bec7c7c 597 }
9bd82f77 598
6bec7c7c 599 // Fill Charge EoI histograms
600
c8d309e0 601 adc[offlineCh] = 0.0;
602
603 // Search for the maximum charge in the train of 21 LHC clocks
604 // regardless of the integrator which has been operated:
605 Float_t maxadc = 0;
606 Int_t imax = -1;
607 Float_t adcPedSub[21];
608 for(Int_t iClock=0; iClock<21; iClock++){
609 Bool_t iIntegrator = rawStream->GetIntegratorFlag(iChannel,iClock);
610 Int_t k = offlineCh+64*iIntegrator;
611
612 //printf(Form("clock = %d adc = %f ped %f\n",iClock,rawStream->GetPedestal(iChannel,iClock),fPedestal[k]));
613
614 adcPedSub[iClock] = rawStream->GetPedestal(iChannel,iClock) - fCalibData->GetPedestal(k);
615// if(adcPedSub[iClock] <= GetRecoParam()->GetNSigmaPed()*fCalibData->GetSigma(k)) {
616 if(adcPedSub[iClock] <= 2.*fCalibData->GetSigma(k)) {
617 adcPedSub[iClock] = 0;
618 continue;
619 }
620// if(iClock < GetRecoParam()->GetStartClock() || iClock > GetRecoParam()->GetEndClock()) continue;
621 if(iClock < 8 || iClock > 12) continue;
622 if(adcPedSub[iClock] > maxadc) {
623 maxadc = adcPedSub[iClock];
624 imax = iClock;
625 }
626 }
627 //printf(Form("Channel %d (online), %d (offline)\n",iChannel,j));
628 if (imax != -1) {
629// Int_t start = imax - GetRecoParam()->GetNPreClocks();
630 Int_t start = imax - 2;
631 if (start < 0) start = 0;
632// Int_t end = imax + GetRecoParam()->GetNPostClocks();
633 Int_t end = imax + 1;
634 if (end > 20) end = 20;
635 for(Int_t iClock = start; iClock <= end; iClock++) {
636 adc[offlineCh] += adcPedSub[iClock];
637 }
638 }
639
640
641 Int_t iClock = imax;
642 charge = rawStream->GetPedestal(iChannel,iClock); // Charge at the maximum
9bd82f77 643
e58b4e66 644 integrator = rawStream->GetIntegratorFlag(iChannel,iClock);
46e6c4f9 645 flagBB[offlineCh] = rawStream->GetBBFlag(iChannel, iClock);
646 flagBG[offlineCh] = rawStream->GetBGFlag(iChannel,iClock );
c8d309e0 647 Int_t board = AliVZEROCalibData::GetBoardNumber(offlineCh);
46e6c4f9 648 time[offlineCh] = rawStream->GetTime(iChannel)*fCalibData->GetTimeResolution(board);
649 width[offlineCh] = rawStream->GetWidth(iChannel)*fCalibData->GetWidthResolution(board);
c8d309e0 650
46e6c4f9 651 if (time[offlineCh] >= 1e-6) GetRawsData(kChargeEoI)->Fill(offlineCh,adc[offlineCh]);
9bd82f77 652
6bec7c7c 653 GetRawsData((integrator == 0 ? kChargeEoIInt0 : kChargeEoIInt1))->Fill(offlineCh,charge);
46e6c4f9 654 if(flagBB[offlineCh]) GetRawsData((integrator == 0 ? kChargeEoIBBInt0 : kChargeEoIBBInt1))->Fill(offlineCh,charge);
655 if(flagBG[offlineCh]) GetRawsData((integrator == 0 ? kChargeEoIBGInt0 : kChargeEoIBGInt1))->Fill(offlineCh,charge);
9bd82f77 656
46e6c4f9 657 Float_t sigma = fCalibData->GetSigma(offlineCh+64*integrator);
9bd82f77 658
9bd82f77 659
6bec7c7c 660 // Calculation of the number of MIP
46e6c4f9 661 Double_t mipEoI = adc[offlineCh] * fCalibData->GetMIPperADC(offlineCh);
662
663 if((adc[offlineCh] > 2.*sigma) && !(time[offlineCh] <1.e-6)){
6bec7c7c 664 ((TH2D*)GetRawsData(kRawMIPChannel))->Fill(offlineCh,mipEoI);
665 if(offlineCh<32) {
9bd82f77 666 mulV0C++;
46e6c4f9 667 chargeV0C += adc[offlineCh];
6bec7c7c 668 mipV0C += mipEoI;
669 } else {
9bd82f77 670 mulV0A++;
46e6c4f9 671 chargeV0A += adc[offlineCh];
6bec7c7c 672 mipV0A += mipEoI;
9bd82f77 673 }
6bec7c7c 674 }
9bd82f77 675
6bec7c7c 676 // Fill Charge Minimum Bias Histograms
677
678 int idx;
679 for(Int_t iBunch=0; iBunch<10; iBunch++){
e58b4e66 680 integrator = rawStream->GetIntMBFlag(iChannel, iBunch);
46e6c4f9 681 bool bbFlag = rawStream->GetBBMBFlag(iChannel, iBunch);
682 bool bgFlag = rawStream->GetBGMBFlag(iChannel, iBunch);
683 mbCharge = rawStream->GetChargeMB(iChannel, iBunch);
9bd82f77 684
685 if(integrator==0){
46e6c4f9 686 if(bbFlag==0){
687 if(bgFlag==0) idx = kChargeMBBB0BG0Int0;
6bec7c7c 688 else idx = kChargeMBBB0BG1Int0;
9bd82f77 689 } else {
46e6c4f9 690 if(bgFlag==0) idx = kChargeMBBB1BG0Int0;
6bec7c7c 691 else idx = kChargeMBBB1BG1Int0;
9bd82f77 692 }
693 } else {
46e6c4f9 694 if(bbFlag==0){
695 if(bgFlag==0) idx = kChargeMBBB0BG0Int1;
6bec7c7c 696 else idx = kChargeMBBB0BG1Int1;
9bd82f77 697 } else {
46e6c4f9 698 if(bgFlag==0) idx = kChargeMBBB1BG0Int1;
6bec7c7c 699 else idx = kChargeMBBB1BG1Int1;
9bd82f77 700 }
701 }
46e6c4f9 702 GetRawsData(idx)->Fill(offlineCh,mbCharge);
c8d309e0 703 }
6bec7c7c 704
705 // Fill HPTDC Time Histograms
46e6c4f9 706 timeCorr[offlineCh] = CorrectLeadingTime(offlineCh,time[offlineCh],adc[offlineCh]);
707
708 const Float_t p1 = 2.50; // photostatistics term in the time resolution
709 const Float_t p2 = 3.00; // slewing related term in the time resolution
710 if(timeCorr[offlineCh]>-1024 + 1.e-6){
711 Float_t nphe = adc[offlineCh]*kChargePerADC/(fCalibData->GetGain(offlineCh)*TMath::Qe());
53072dd8 712 Float_t timeErr = 0;
a0d06293 713 if (nphe>1.e-6) timeErr = TMath::Sqrt(kIntTimeRes*kIntTimeRes+
46e6c4f9 714 p1*p1/nphe+
715 p2*p2*(fTimeSlewing->GetParameter(0)*fTimeSlewing->GetParameter(1))*(fTimeSlewing->GetParameter(0)*fTimeSlewing->GetParameter(1))*
b0eaf826 716 TMath::Power(adc[offlineCh]/fCalibData->GetCalibDiscriThr(offlineCh,kTRUE),2.*(fTimeSlewing->GetParameter(1)-1.))/
717 (fCalibData->GetCalibDiscriThr(offlineCh,kTRUE)*fCalibData->GetCalibDiscriThr(offlineCh,kTRUE)));
46e6c4f9 718
a0d06293 719 if (timeErr>1.e-6) {
53072dd8 720 if (offlineCh<32) {
721 itimeV0C++;
722 timeV0C += timeCorr[offlineCh]/(timeErr*timeErr);
723 weightV0C += 1./(timeErr*timeErr);
724 }else{
725 itimeV0A++;
726 timeV0A += timeCorr[offlineCh]/(timeErr*timeErr);
727 weightV0A += 1./(timeErr*timeErr);
728 }
46e6c4f9 729 }
6bec7c7c 730 }
46e6c4f9 731 GetRawsData(kHPTDCTime)->Fill(offlineCh,timeCorr[offlineCh]);
732 GetRawsData(kWidth)->Fill(offlineCh,width[offlineCh]);
733 if(flagBB[offlineCh]) {
734 GetRawsData(kHPTDCTimeBB)->Fill(offlineCh,timeCorr[offlineCh]);
735 GetRawsData(kWidthBB)->Fill(offlineCh,width[offlineCh]);
736 }
737 if(flagBG[offlineCh]) {
738 GetRawsData(kHPTDCTimeBG)->Fill(offlineCh,timeCorr[offlineCh]);
739 GetRawsData(kWidthBG)->Fill(offlineCh,width[offlineCh]);
740 }
9bd82f77 741
6bec7c7c 742 // Fill Flag and Charge Versus LHC-Clock histograms
743
d62942e8 744 for(Int_t iEvent=0; iEvent<21; iEvent++){
e58b4e66 745 charge = rawStream->GetPedestal(iChannel,iEvent);
746 integrator = rawStream->GetIntegratorFlag(iChannel,iEvent);
46e6c4f9 747 bool bbFlag = rawStream->GetBBFlag(iChannel, iEvent);
748 bool bgFlag = rawStream->GetBGFlag(iChannel,iEvent );
6bec7c7c 749
750 ((TH2*) GetRawsData((integrator == 0 ? kChargeVsClockInt0 : kChargeVsClockInt1 )))->Fill(offlineCh,(float)iEvent-10,(float)charge);
46e6c4f9 751 ((TH2*) GetRawsData(kBBFlagVsClock))->Fill(offlineCh,(float)iEvent-10,(float)bbFlag);
752 ((TH2*) GetRawsData(kBGFlagVsClock))->Fill(offlineCh,(float)iEvent-10,(float)bgFlag);
753 if(iEvent==10) ((TH1*) GetRawsData(kBBFlagsPerChannel))->Fill(offlineCh,(float)bbFlag);
9bd82f77 754 }
755
6bec7c7c 756 }// END of Loop over channels
9bd82f77 757
a0d06293 758 if(weightV0A>1.e-6) timeV0A /= weightV0A;
46e6c4f9 759 else timeV0A = -1024.;
a0d06293 760 if(weightV0C>1.e-6) timeV0C /= weightV0C;
46e6c4f9 761 else timeV0C = -1024.;
762 if(timeV0A<-1024.+1.e-6 || timeV0C<-1024.+1.e-6) diffTime = -1024.;
763 else diffTime = timeV0A - timeV0C;
764
765 Bool_t v0ABB = kFALSE;
766 Bool_t v0CBB = kFALSE;
767 Bool_t v0ABG = kFALSE;
768 Bool_t v0CBG = kFALSE;
2563588b 769 Bool_t v0AFake = kFALSE;
770 Bool_t v0CFake = kFALSE;
771 Bool_t v0AEmpty = kFALSE;
772 Bool_t v0CEmpty = kFALSE;
773 Int_t v0ATrigger=0;
774 Int_t v0CTrigger=0;
775
776 // Change default BB and BG windows according to the Trigger Count Offset setting with respect to the default one which is 3247.
777 Float_t winOffset = (fCalibData->GetTriggerCountOffset(0) - 3247)*25.;
778
779 if((timeV0A>kMinBBA-winOffset) && (timeV0A<kMaxBBA-winOffset)) {
46e6c4f9 780 v0ABB = kTRUE;
2563588b 781 v0ATrigger=2;
782 } else if((timeV0A>kMinBGA-winOffset) && (timeV0A<kMaxBGA-winOffset)) {
46e6c4f9 783 v0ABG = kTRUE;
2563588b 784 v0ATrigger=3;
785 } else if(timeV0A>-1024.+1.e-6) {
786 v0AFake = kTRUE;
787 v0ATrigger=1;
788 } else {
789 v0AEmpty = kTRUE;
790 v0ATrigger=0;
46e6c4f9 791 }
2563588b 792
793 if((timeV0C>kMinBBC-winOffset) && (timeV0C<kMaxBBC-winOffset)) {
46e6c4f9 794 v0CBB = kTRUE;
2563588b 795 v0CTrigger=2;
796 } else if((timeV0C>kMinBGC-winOffset) && (timeV0C<kMaxBGC-winOffset)) {
46e6c4f9 797 v0CBG = kTRUE;
2563588b 798 v0CTrigger=3;
799 } else if(timeV0C>-1024.+1.e-6) {
800 v0CFake = kTRUE;
801 v0CTrigger=1;
802 } else {
803 v0CEmpty = kTRUE;
804 v0CTrigger=0;
46e6c4f9 805 }
9bd82f77 806
2563588b 807// Fill Trigger output histograms
46e6c4f9 808 if(v0ABB && v0CBB) GetRawsData(kTriggers)->Fill(0);
809 if((v0ABB || v0CBB) && !(v0ABG || v0CBG)) GetRawsData(kTriggers)->Fill(1);
810 if(v0ABG && v0CBB) GetRawsData(kTriggers)->Fill(2);
811 if(v0ABB && v0CBG) GetRawsData(kTriggers)->Fill(3);
9bd82f77 812
2563588b 813 GetRawsData(kTriggers2)->Fill(v0ATrigger,v0CTrigger);
814
46e6c4f9 815 GetRawsData(kV0ATime)->Fill(timeV0A);
816 GetRawsData(kV0CTime)->Fill(timeV0C);
817 GetRawsData(kDiffTime)->Fill(diffTime);
818 GetRawsData(kTimeV0AV0C)->Fill(timeV0A,timeV0C);
819
820 GetRawsData(kMultiV0A)->Fill(mulV0A);
821 GetRawsData(kMultiV0C)->Fill(mulV0C);
822
823 GetRawsData(kChargeV0A)->Fill(chargeV0A);
824 GetRawsData(kChargeV0C)->Fill(chargeV0C);
825 GetRawsData(kChargeV0)->Fill(chargeV0A + chargeV0C);
826
827 GetRawsData(kRawMIPV0A)->Fill(mipV0A);
828 GetRawsData(kRawMIPV0C)->Fill(mipV0C);
829 GetRawsData(kRawMIPV0)->Fill(mipV0A + mipV0C);
830 break;
6bec7c7c 831
832 } // END of SWITCH : EVENT TYPE
9bd82f77 833
834 fEvent++;
4e25ac79 835 TParameter<double> * p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kMultiV0A)->GetName()))) ;
719e870c 836 if (p) p->SetVal((double)mulV0A) ;
9bd82f77 837
4e25ac79 838 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kMultiV0C)->GetName()))) ;
719e870c 839 if (p) p->SetVal((double)mulV0C) ;
9bd82f77 840
4e25ac79 841 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kChargeV0A)->GetName()))) ;
719e870c 842 if (p) p->SetVal((double)chargeV0A) ;
9bd82f77 843
4e25ac79 844 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kChargeV0C)->GetName()))) ;
719e870c 845 if (p) p->SetVal((double)chargeV0C) ;
9bd82f77 846
4e25ac79 847 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kChargeV0)->GetName()))) ;
719e870c 848 if (p) p->SetVal((double)(chargeV0A + chargeV0C)) ;
9bd82f77 849
4e25ac79 850 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kRawMIPV0A)->GetName()))) ;
719e870c 851 if (p) p->SetVal((double)mipV0A) ;
9bd82f77 852
4e25ac79 853 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kRawMIPV0C)->GetName()))) ;
719e870c 854 if (p) p->SetVal((double)mipV0C) ;
9bd82f77 855
4e25ac79 856 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kRawMIPV0)->GetName()))) ;
719e870c 857 if (p) p->SetVal((double)(mipV0A + mipV0C)) ;
9bd82f77 858
4e25ac79 859 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kV0ATime)->GetName()))) ;
719e870c 860 if (p) p->SetVal((double)timeV0A) ;
9bd82f77 861
4e25ac79 862 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kV0CTime)->GetName()))) ;
719e870c 863 if (p) p->SetVal((double)timeV0C) ;
9bd82f77 864
4e25ac79 865 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kDiffTime)->GetName()))) ;
719e870c 866 if (p) p->SetVal((double)diffTime) ;
9bd82f77 867
e58b4e66 868 delete rawStream; rawStream = 0x0;
869
9bd82f77 870
4da80b8c 871 }
508b9fc0 872
873//____________________________________________________________________________
874void AliVZEROQADataMakerRec::StartOfDetectorCycle()
875{
876 // Detector specific actions at start of cycle
877
6bec7c7c 878 // Reset of the histogram used - to have the trend versus time -
e6d13307 879
880 fCalibData = GetCalibData();
46e6c4f9 881
882 AliCDBEntry *entry = AliCDBManager::Instance()->Get("GRP/CTP/CTPtiming");
883 if (!entry) AliFatal("CTP timing parameters are not found in OCDB !");
884 AliCTPTimeParams *ctpParams = (AliCTPTimeParams*)entry->GetObject();
885 Float_t l1Delay = (Float_t)ctpParams->GetDelayL1L0()*25.0;
886
887 AliCDBEntry *entry1 = AliCDBManager::Instance()->Get("GRP/CTP/TimeAlign");
888 if (!entry1) AliFatal("CTP time-alignment is not found in OCDB !");
889 AliCTPTimeParams *ctpTimeAlign = (AliCTPTimeParams*)entry1->GetObject();
890 l1Delay += ((Float_t)ctpTimeAlign->GetDelayL1L0()*25.0);
891
892 AliCDBEntry *entry2 = AliCDBManager::Instance()->Get("VZERO/Calib/TimeDelays");
893 if (!entry2) AliFatal("VZERO time delays are not found in OCDB !");
894 TH1F *delays = (TH1F*)entry2->GetObject();
895
896 AliCDBEntry *entry3 = AliCDBManager::Instance()->Get("VZERO/Calib/TimeSlewing");
897 if (!entry3) AliFatal("VZERO time slewing function is not found in OCDB !");
898 fTimeSlewing = (TF1*)entry3->GetObject();
899
900 for(Int_t i = 0 ; i < 64; ++i) {
901 //Int_t board = AliVZEROCalibData::GetBoardNumber(i);
902 fTimeOffset[i] = (
903 // ((Float_t)fCalibData->GetTriggerCountOffset(board) -
904 // (Float_t)fCalibData->GetRollOver(board))*25.0 +
905 // fCalibData->GetTimeOffset(i) -
906 // l1Delay+
907 delays->GetBinContent(i+1)//+
908 // kV0Offset
909 );
910// AliInfo(Form(" fTimeOffset[%d] = %f kV0offset %f",i,fTimeOffset[i],kV0Offset));
911 }
912
913
914
6bec7c7c 915
46e6c4f9 916
a8e23456 917 TTimeStamp currentTime;
918 fCycleStartTime = currentTime.GetSec();
919
920 fNTotEvents = 0;
921}
9bd82f77 922
46e6c4f9 923
a8e23456 924//-------------------------------------------------------------------------------------------------
46e6c4f9 925Float_t AliVZEROQADataMakerRec::CorrectLeadingTime(Int_t i, Float_t time, Float_t adc) const
926{
927 // Correct the leading time
928 // for slewing effect and
929 // misalignment of the channels
930 if (time < 1e-6) return -1024;
3dc953e2 931
46e6c4f9 932 // Channel alignment and general offset subtraction
933// if (i < 32) time -= kV0CDelayCables;
934// time -= fTimeOffset[i];
935 //AliInfo(Form("time-offset %f", time));
936
937 // In case of pathological signals
938 if (adc < 1e-6) return time;
939
940 // Slewing correction
b0eaf826 941 Float_t thr = fCalibData->GetCalibDiscriThr(i,kTRUE);
46e6c4f9 942 //AliInfo(Form("adc %f thr %f dtime %f ", adc,thr,fTimeSlewing->Eval(adc/thr)));
943 time -= fTimeSlewing->Eval(adc/thr);
944
945 return time;
508b9fc0 946}
74995017 947