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