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