]> git.uio.no Git - u/mrichter/AliRoot.git/blame - VZERO/AliVZEROQADataMakerRec.cxx
Fixes for report #71652 BAD_FREE reported by Coverity
[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
db72ff3b 215 h2d = new TH2D("H2D_Time_Channel", "Time per channel;Channel;Time (ns)",64, 0, 64, 820, 0, 410) ;
7d297381 216 Add2ESDsList(h2d, kTimeChannel, !expert, image) ;
9bd82f77 217
db72ff3b 218 h1d = new TH1D("H1D_V0A_Time", "Mean V0A Time;Time (ns);Counts",2048, 0., 409.6);
7d297381 219 Add2ESDsList(h1d,kESDV0ATime, !expert, image);
9bd82f77 220
db72ff3b 221 h1d = new TH1D("H1D_V0C_Time", "Mean V0C Time;Time (ns);Counts",2048, 0., 409.6);
7d297381 222 Add2ESDsList(h1d,kESDV0CTime, !expert, image);
9bd82f77 223
db72ff3b 224 h1d = new TH1D("H1D_Diff_Time", "Diff Time V0A - V0C;Diff Time V0A - V0C (ns);Counts",2*2048, -409.6, 409.6);
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
6bec7c7c 238 const Int_t kNintegrator = 2;
9bd82f77 239
c8d309e0 240 const Int_t kNTdcTimeBins = 1280;
46e6c4f9 241 const Float_t kTdcTimeMin = 0.;
242 const Float_t kTdcTimeMax = 125.;
6bec7c7c 243 const Int_t kNTdcWidthBins = 128;
46e6c4f9 244 const Float_t kTdcWidthMin = 0;
245 const Float_t kTdcWidthMax = 50.;
6bec7c7c 246 const Int_t kNChargeBins = 1024;
46e6c4f9 247 const Float_t kChargeMin = 0;
248 const Float_t kChargeMax = 1024;
6bec7c7c 249 const Int_t kNChannelBins = 64;
46e6c4f9 250 const Float_t kChannelMin = 0;
251 const Float_t kChannelMax = 64;
6bec7c7c 252 const Int_t kNPedestalBins = 200;
46e6c4f9 253 const Float_t kPedestalMin = 0;
254 const Float_t kPedestalMax = 200;
255 const Float_t kTimeMin = 0;
256 const Float_t kTimeMax = 100;
257 const Int_t kNMIPBins = 512;
258 const Float_t kMIPMin = 0;
259 const Float_t kMIPMax = 16;
6bec7c7c 260
261 TH2I * h2i;
262 TH2D * h2d;
263 TH1I * h1i;
264 TH1D * h1d;
265
266 int iHisto =0;
46e6c4f9 267 // Creation of Trigger Histogram
268 h1d = new TH1D("H1D_Trigger_Type", "V0 Trigger Type;;Counts", 4,0 ,4) ;
269 Add2RawsList(h1d,kTriggers, !expert, image, saveCorr); iHisto++;
270 h1d->SetFillColor(29);
271 h1d->SetLineWidth(2);
272 h1d->GetXaxis()->SetLabelSize(0.06);
273 h1d->GetXaxis()->SetNdivisions(808,kFALSE);
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
6bec7c7c 279 // Creation of Cell Multiplicity Histograms
db72ff3b 280 h1i = new TH1I("H1I_Multiplicity_V0A", "Cell Multiplicity in V0A;# of Cells;Entries", 35, 0, 35) ;
74995017 281 Add2RawsList(h1i,kMultiV0A, expert, image, saveCorr); iHisto++;
db72ff3b 282 h1i = new TH1I("H1I_Multiplicity_V0C", "Cell Multiplicity in V0C;# of Cells;Entries", 35, 0, 35) ;
74995017 283 Add2RawsList(h1i,kMultiV0C, expert, image, saveCorr); iHisto++;
9bd82f77 284
6bec7c7c 285 // Creation of Total Charge Histograms
46e6c4f9 286 h1d = new TH1D("H1D_Charge_V0A", "Total Charge in V0A;Charge [ADC counts];Counts", 2000, 0, 10000) ;
287 Add2RawsList(h1d,kChargeV0A, expert, !image, saveCorr); iHisto++;
288 h1d = new TH1D("H1D_Charge_V0C", "Total Charge in V0C;Charge [ADC counts];Counts", 2000, 0, 10000) ;
289 Add2RawsList(h1d,kChargeV0C, expert, !image, saveCorr); iHisto++;
290 h1d = new TH1D("H1D_Charge_V0", "Total Charge in V0;Charge [ADC counts];Counts", 2000, 0, 20000) ;
291 Add2RawsList(h1d,kChargeV0, expert, !image, saveCorr); iHisto++;
9bd82f77 292
293 // Creation of MIP Histograms
46e6c4f9 294 h1d = new TH1D("H1D_MIP_V0A", "Total MIP in V0A;Multiplicity [MIP];Counts", kNMIPBins,kMIPMin ,32*kMIPMax) ;
295 Add2RawsList(h1d,kRawMIPV0A, expert, !image, saveCorr); iHisto++;
296 h1d = new TH1D("H1D_MIP_V0C", "Total MIP in V0C;Multiplicity [MIP];Counts", kNMIPBins,kMIPMin ,32*kMIPMax) ;
297 Add2RawsList(h1d,kRawMIPV0C, expert, !image, saveCorr); iHisto++;
298 h1d = new TH1D("H1D_MIP_V0", "Total MIP in V0;Multiplicity [MIP];Counts", 2*kNMIPBins,kMIPMin ,64*kMIPMax) ;
299 Add2RawsList(h1d,kRawMIPV0, expert, !image, saveCorr); iHisto++;
db72ff3b 300 h2d = new TH2D("H2D_MIP_Channel", "Nb of MIP per channel;Channel;# of Mips", kNChannelBins, kChannelMin, kChannelMax,kNMIPBins,kMIPMin ,kMIPMax) ;
7d297381 301 Add2RawsList(h2d,kRawMIPChannel, expert, !image, !saveCorr); iHisto++;
9bd82f77 302
303
c8d309e0 304
305 // Creation of Charge EoI histogram
46e6c4f9 306 h2d = new TH2D("H2D_ChargeEoI", "Charge Event of Interest;Channel Number;Charge [ADC counts]"
307 ,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, kChargeMax);
c8d309e0 308 Add2RawsList(h2d,kChargeEoI, !expert, image, !saveCorr); iHisto++;
309
d62942e8 310 for(Int_t iInt=0;iInt<kNintegrator;iInt++){
9bd82f77 311 // Creation of Pedestal histograms
46e6c4f9 312 h2i = new TH2I(Form("H2I_Pedestal_Int%d",iInt), Form("Pedestal (Int%d);Channel;Pedestal [ADC counts]",iInt)
313 ,kNChannelBins, kChannelMin, kChannelMax,kNPedestalBins,kPedestalMin ,kPedestalMax );
7d297381 314 Add2RawsList(h2i,(iInt == 0 ? kPedestalInt0 : kPedestalInt1), expert, !image, !saveCorr); iHisto++;
9bd82f77 315
9bd82f77 316
317 // Creation of Charge EoI histograms
46e6c4f9 318 h2i = new TH2I(Form("H2I_ChargeEoI_Int%d",iInt), Form("Charge EoI (Int%d);Channel;Charge [ADC counts]",iInt)
319 ,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, kChargeMax);
74995017 320 Add2RawsList(h2i,(iInt == 0 ? kChargeEoIInt0 : kChargeEoIInt1), expert, image, !saveCorr); iHisto++;
f81355e3 321
46e6c4f9 322 h2i = new TH2I(Form("H2I_ChargeEoI_BB_Int%d",iInt), Form("Charge EoI w/ BB Flag (Int%d);Channel;Charge [ADC counts]",iInt)
323 ,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, kChargeMax);
7d297381 324 Add2RawsList(h2i,(iInt == 0 ? kChargeEoIBBInt0 : kChargeEoIBBInt1), expert, !image, !saveCorr); iHisto++;
f81355e3 325
46e6c4f9 326 h2i = new TH2I(Form("H2I_ChargeEoI_BG_Int%d",iInt), Form("Charge EoI w/ BG Flag (Int%d);Channel;Charge [ADC counts]",iInt)
327 ,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, kChargeMax);
7d297381 328 Add2RawsList(h2i,(iInt == 0 ? kChargeEoIBGInt0: kChargeEoIBGInt1), expert, !image, !saveCorr); iHisto++;
9bd82f77 329
330 // Creation of Charge versus LHC Clock histograms
46e6c4f9 331 h2d = new TH2D(Form("H2D_ChargeVsClock_Int%d",iInt), Form("Charge Versus LHC-Clock (Int%d);Channel;LHCClock;Charge [ADC counts]",iInt)
332 ,kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 );
7d297381 333 Add2RawsList(h2d,(iInt == 0 ? kChargeVsClockInt0 : kChargeVsClockInt1 ), expert, !image, !saveCorr); iHisto++;
9bd82f77 334
6bec7c7c 335 // Creation of Minimum Bias Charge histograms
336 for(Int_t iBB=0;iBB<2;iBB++){
d62942e8 337 for(Int_t iBG=0;iBG<2;iBG++){
46e6c4f9 338 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)
339 ,kNChannelBins, kChannelMin, kChannelMax,kNChargeBins, kChargeMin, kChargeMax);
9bd82f77 340 int idx;
341 if(iInt==0){
342 if(iBB==0){
6bec7c7c 343 if(iBG==0) idx = kChargeMBBB0BG0Int0;
344 else idx = kChargeMBBB0BG1Int0;
9bd82f77 345 } else {
6bec7c7c 346 if(iBG==0) idx = kChargeMBBB1BG0Int0;
347 else idx = kChargeMBBB1BG1Int0;
9bd82f77 348 }
349 } else {
350 if(iBB==0){
6bec7c7c 351 if(iBG==0) idx = kChargeMBBB0BG0Int1;
352 else idx = kChargeMBBB0BG1Int1;
9bd82f77 353 } else {
6bec7c7c 354 if(iBG==0) idx = kChargeMBBB1BG0Int1;
355 else idx = kChargeMBBB1BG1Int1;
9bd82f77 356 }
357 }
7d297381 358 Add2RawsList(h2i,idx, expert, !image, !saveCorr); iHisto++;
9bd82f77 359 }
6bec7c7c 360 }
9bd82f77 361
362 }
363
6bec7c7c 364 // Creation of Time histograms
46e6c4f9 365 h2i = new TH2I("H2I_Width", "HPTDC Width;Channel;Width [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax);
7d297381 366 Add2RawsList(h2i,kWidth, expert, !image, !saveCorr); iHisto++;
9bd82f77 367
46e6c4f9 368 h2i = new TH2I("H2I_Width_BB", "HPTDC Width w/ BB Flag condition;Channel;Width [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax);
7d297381 369 Add2RawsList(h2i,kWidthBB, expert, !image, !saveCorr); iHisto++;
9bd82f77 370
46e6c4f9 371 h2i = new TH2I("H2I_Width_BG", "HPTDC Width w/ BG Flag condition;Channel;Width [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax);
7d297381 372 Add2RawsList(h2i,kWidthBG, expert, !image, !saveCorr); iHisto++;
9bd82f77 373
46e6c4f9 374 h2i = new TH2I("H2I_HPTDCTime", "HPTDC Time;Channel;Leading Time [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
74995017 375 Add2RawsList(h2i,kHPTDCTime, expert, image, !saveCorr); iHisto++;
9bd82f77 376
46e6c4f9 377 h2i = new TH2I("H2I_HPTDCTime_BB", "HPTDC Time w/ BB Flag condition;Channel;Leading Time [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
c8d309e0 378 Add2RawsList(h2i,kHPTDCTimeBB, !expert, image, !saveCorr); iHisto++;
9bd82f77 379
46e6c4f9 380 h2i = new TH2I("H2I_HPTDCTime_BG", "HPTDC Time w/ BG Flag condition;Channel;Leading Time [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
c8d309e0 381 Add2RawsList(h2i,kHPTDCTimeBG, !expert, image, !saveCorr); iHisto++;
9bd82f77 382
46e6c4f9 383 h1d = new TH1D("H1D_V0A_Time", "V0A Time;Time [ns];Counts",kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
74995017 384 Add2RawsList(h1d,kV0ATime, expert, !image, saveCorr); iHisto++;
9bd82f77 385
46e6c4f9 386 h1d = new TH1D("H1D_V0C_Time", "V0C Time;Time [ns];Counts",kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
74995017 387 Add2RawsList(h1d,kV0CTime, expert, !image, saveCorr); iHisto++;
9bd82f77 388
46e6c4f9 389 h1d = new TH1D("H1D_Diff_Time","Diff V0A-V0C Time;Time [ns];Counts",2*kNTdcTimeBins, -50., 50.);
74995017 390 Add2RawsList(h1d,kDiffTime, expert, !image, saveCorr); iHisto++;
46e6c4f9 391
392 h2d = new TH2D("H2D_TimeV0A_V0C", "Mean Time in V0C versus V0A;Time V0A [ns];Time V0C [ns]",
393 150, kTimeMin,kTimeMax,150,kTimeMin,kTimeMax) ;
394 Add2RawsList(h2d,kTimeV0AV0C, expert, image, !saveCorr); iHisto++;
9bd82f77 395
9bd82f77 396 // Creation of Flag versus LHC Clock histograms
c8d309e0 397
46e6c4f9 398 h1d = new TH1D("H1D_BBFlagPerChannel", "BB-Flags Versus Channel;Channel;BB Flags Count",kNChannelBins, kChannelMin, kChannelMax );
399 h1d->SetMinimum(0);
c8d309e0 400 Add2RawsList(h1d,kBBFlagsPerChannel, !expert, image, !saveCorr); iHisto++;
401
46e6c4f9 402 h2d = new TH2D("H2D_BBFlagVsClock", "BB-Flags Versus LHC-Clock;Channel;LHC Clocks",kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 );
7d297381 403 Add2RawsList(h2d,kBBFlagVsClock, expert, !image, !saveCorr); iHisto++;
9bd82f77 404
46e6c4f9 405 h2d = new TH2D("H2D_BGFlagVsClock", "BG-Flags Versus LHC-Clock;Channel;LHC Clocks",kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 );
7d297381 406 Add2RawsList(h2d,kBGFlagVsClock, expert, !image, !saveCorr); iHisto++;
9bd82f77 407
a8e23456 408
5379c4a3 409 AliDebug(AliQAv1::GetQADebugLevel(), Form("%d Histograms has been added to the Raws List",iHisto));
4da80b8c 410 }
508b9fc0 411
44ed7a66 412//____________________________________________________________________________
413void AliVZEROQADataMakerRec::InitDigits()
414{
415 // create Digits histograms in Digits subdir
416 const Bool_t expert = kTRUE ;
417 const Bool_t image = kTRUE ;
418
44ed7a66 419 TH1I *fhDigTDC[64];
420 TH1I *fhDigADC[64];
44ed7a66 421
422 // create Digits histograms in Digits subdir
db72ff3b 423 TH1I * h0 = new TH1I("hDigitMultiplicity", "Digits multiplicity distribution in VZERO;# of Digits;Entries", 100, 0, 99) ;
44ed7a66 424 h0->Sumw2() ;
425 Add2DigitsList(h0, 0, !expert, image) ;
426
427 for (Int_t i=0; i<64; i++)
428 {
46e6c4f9 429 fhDigTDC[i] = new TH1I(Form("hDigitTDC%d", i),Form("Digit TDC in cell %d; TDC value;Entries",i),300,0.,149.);
44ed7a66 430
46e6c4f9 431 fhDigADC[i]= new TH1I(Form("hDigitADC%d",i),Form("Digit ADC in cell %d;ADC value;Entries",i),1024,0.,1023.);
44ed7a66 432
433 Add2DigitsList(fhDigTDC[i],i+1, !expert, image);
434 Add2DigitsList(fhDigADC[i],i+1+64, !expert, image);
435 }
436}
437
438//____________________________________________________________________________
6252ceeb 439void AliVZEROQADataMakerRec::MakeDigits()
44ed7a66 440{
441 // makes data from Digits
eca4fa66 442
6252ceeb 443 GetDigitsData(0)->Fill(fDigitsArray->GetEntriesFast()) ;
444 TIter next(fDigitsArray) ;
57eead61 445 AliVZEROdigit *aVZERODigit ;
446 while ( (aVZERODigit = dynamic_cast<AliVZEROdigit *>(next())) ) {
447 Int_t aPMNumber = aVZERODigit->PMNumber();
448 GetDigitsData(aPMNumber +1)->Fill( aVZERODigit->Time()) ; // in 100 of picoseconds
449 GetDigitsData(aPMNumber +1+64)->Fill( aVZERODigit->ADC()) ;
44ed7a66 450 }
451}
452
453
454//____________________________________________________________________________
455void AliVZEROQADataMakerRec::MakeDigits(TTree *digitTree)
456{
457 // makes data from Digit Tree
458
6252ceeb 459 if ( fDigitsArray )
460 fDigitsArray->Clear() ;
461 else
462 fDigitsArray = new TClonesArray("AliVZEROdigit", 1000) ;
44ed7a66 463
464 TBranch * branch = digitTree->GetBranch("VZERODigit") ;
465 if ( ! branch ) {
466 AliWarning("VZERO branch in Digit Tree not found") ;
467 } else {
6252ceeb 468 branch->SetAddress(&fDigitsArray) ;
44ed7a66 469 branch->GetEntry(0) ;
6252ceeb 470 MakeDigits() ;
44ed7a66 471 }
472}
473
474
508b9fc0 475//____________________________________________________________________________
476void AliVZEROQADataMakerRec::MakeESDs(AliESDEvent * esd)
477{
6bec7c7c 478 // Creates QA data from ESDs
479
480 UInt_t eventType = esd->GetEventType();
508b9fc0 481
6bec7c7c 482 switch (eventType){
9bd82f77 483 case PHYSICS_EVENT:
6bec7c7c 484 AliESDVZERO *esdVZERO=esd->GetVZEROData();
508b9fc0 485
6bec7c7c 486 if (!esdVZERO) break;
9bd82f77 487
488 GetESDsData(kCellMultiV0A)->Fill(esdVZERO->GetNbPMV0A());
489 GetESDsData(kCellMultiV0C)->Fill(esdVZERO->GetNbPMV0C());
490 GetESDsData(kMIPMultiV0A)->Fill(esdVZERO->GetMTotV0A());
491 GetESDsData(kMIPMultiV0C)->Fill(esdVZERO->GetMTotV0C());
492
6bec7c7c 493 Float_t timeV0A = 0., timeV0C = 0., diffTime;
494 Int_t iTimeV0A = 0, iTimeV0C = 0;
9bd82f77 495
6bec7c7c 496 for(Int_t i=0;i<64;i++) {
9bd82f77 497 GetESDsData(kMIPMultiChannel)->Fill((Float_t) i,(Float_t) esdVZERO->GetMultiplicity(i));
498 GetESDsData(kChargeChannel)->Fill((Float_t) i,(Float_t) esdVZERO->GetAdc(i));
499 if(esdVZERO->GetBBFlag(i)) GetESDsData(kBBFlag)->Fill((Float_t) i);
500 if(esdVZERO->GetBGFlag(i)) GetESDsData(kBGFlag)->Fill((Float_t) i);
501
6bec7c7c 502 Float_t time = (Float_t) esdVZERO->GetTime(i)/10.; //Convert in ns: 1 TDC channel = 100ps
503 GetESDsData(kTimeChannel)->Fill((Float_t) i,time);
9bd82f77 504
6bec7c7c 505 if(time>0.){
9bd82f77 506 if (i<32) {
507 iTimeV0C++;
6bec7c7c 508 timeV0C += time;
9bd82f77 509 }else{
510 iTimeV0A++;
6bec7c7c 511 timeV0A += time;
9bd82f77 512 }
513 }
514 }
6bec7c7c 515 if(iTimeV0A>0) timeV0A /= iTimeV0A;
516 else timeV0A = -1.;
517 if(iTimeV0C>0) timeV0C /= iTimeV0C;
518 else timeV0C = -1.;
519 if(timeV0A<0. || timeV0C<0.) diffTime = -10000.;
520 else diffTime = timeV0A - timeV0C;
9bd82f77 521
6bec7c7c 522 GetESDsData(kESDV0ATime)->Fill(timeV0A);
523 GetESDsData(kESDV0CTime)->Fill(timeV0C);
524 GetESDsData(kESDDiffTime)->Fill(diffTime);
9bd82f77 525
6bec7c7c 526 break;
9bd82f77 527 }
28fdf12c 528
508b9fc0 529}
530
531//____________________________________________________________________________
4da80b8c 532 void AliVZEROQADataMakerRec::MakeRaws(AliRawReader* rawReader)
533 {
6bec7c7c 534 // Fills histograms with Raws, computes average ADC values dynamically (pedestal subtracted)
1e376713 535
46e6c4f9 536
eca4fa66 537 // Check id histograms already created for this Event Specie
538 if ( ! GetRawsData(kPedestalInt0) )
539 InitRaws() ;
540
541 rawReader->Reset() ;
e58b4e66 542 AliVZERORawStream* rawStream = new AliVZERORawStream(rawReader);
543 if(!(rawStream->Next())) return;
a8e23456 544
6bec7c7c 545 eventTypeType eventType = rawReader->GetType();
9bd82f77 546
6bec7c7c 547 Int_t mulV0A = 0 ;
548 Int_t mulV0C = 0 ;
549 Double_t timeV0A =0., timeV0C = 0.;
46e6c4f9 550 Double_t weightV0A =0., weightV0C = 0.;
6bec7c7c 551 UInt_t itimeV0A=0, itimeV0C=0;
552 Double_t chargeV0A=0., chargeV0C=0.;
553 Double_t mipV0A=0., mipV0C=0.;
9bd82f77 554
6bec7c7c 555 Double_t diffTime=-100000.;
9bd82f77 556
557
6bec7c7c 558 switch (eventType){
559 case PHYSICS_EVENT:
a8e23456 560
561 fNTotEvents++;
562
6bec7c7c 563 Int_t iFlag=0;
564 Int_t pedestal;
565 Int_t integrator;
46e6c4f9 566 Bool_t flagBB[64];
567 Bool_t flagBG[64];
568 Int_t mbCharge;
a8e23456 569 Float_t charge;
6bec7c7c 570 Int_t offlineCh;
46e6c4f9 571 Float_t adc[64], time[64], width[64], timeCorr[64];
9bd82f77 572
d62942e8 573 for(Int_t iChannel=0; iChannel<64; iChannel++) { // BEGIN : Loop over channels
9bd82f77 574
e58b4e66 575 offlineCh = rawStream->GetOfflineChannel(iChannel);
9bd82f77 576
6bec7c7c 577 // Fill Pedestal histograms
578
579 for(Int_t j=15; j<21; j++) {
e58b4e66 580 if((rawStream->GetBGFlag(iChannel,j) || rawStream->GetBBFlag(iChannel,j))) iFlag++;
6bec7c7c 581 }
9bd82f77 582
6bec7c7c 583 if(iFlag == 0){ //No Flag found
d62942e8 584 for(Int_t j=15; j<21; j++){
e58b4e66 585 pedestal= (Int_t) rawStream->GetPedestal(iChannel, j);
586 integrator = rawStream->GetIntegratorFlag(iChannel, j);
9bd82f77 587
6bec7c7c 588 GetRawsData((integrator == 0 ? kPedestalInt0 : kPedestalInt1))->Fill(offlineCh,pedestal);
9bd82f77 589 }
6bec7c7c 590 }
9bd82f77 591
6bec7c7c 592 // Fill Charge EoI histograms
593
c8d309e0 594 adc[offlineCh] = 0.0;
595
596 // Search for the maximum charge in the train of 21 LHC clocks
597 // regardless of the integrator which has been operated:
598 Float_t maxadc = 0;
599 Int_t imax = -1;
600 Float_t adcPedSub[21];
601 for(Int_t iClock=0; iClock<21; iClock++){
602 Bool_t iIntegrator = rawStream->GetIntegratorFlag(iChannel,iClock);
603 Int_t k = offlineCh+64*iIntegrator;
604
605 //printf(Form("clock = %d adc = %f ped %f\n",iClock,rawStream->GetPedestal(iChannel,iClock),fPedestal[k]));
606
607 adcPedSub[iClock] = rawStream->GetPedestal(iChannel,iClock) - fCalibData->GetPedestal(k);
608// if(adcPedSub[iClock] <= GetRecoParam()->GetNSigmaPed()*fCalibData->GetSigma(k)) {
609 if(adcPedSub[iClock] <= 2.*fCalibData->GetSigma(k)) {
610 adcPedSub[iClock] = 0;
611 continue;
612 }
613// if(iClock < GetRecoParam()->GetStartClock() || iClock > GetRecoParam()->GetEndClock()) continue;
614 if(iClock < 8 || iClock > 12) continue;
615 if(adcPedSub[iClock] > maxadc) {
616 maxadc = adcPedSub[iClock];
617 imax = iClock;
618 }
619 }
620 //printf(Form("Channel %d (online), %d (offline)\n",iChannel,j));
621 if (imax != -1) {
622// Int_t start = imax - GetRecoParam()->GetNPreClocks();
623 Int_t start = imax - 2;
624 if (start < 0) start = 0;
625// Int_t end = imax + GetRecoParam()->GetNPostClocks();
626 Int_t end = imax + 1;
627 if (end > 20) end = 20;
628 for(Int_t iClock = start; iClock <= end; iClock++) {
629 adc[offlineCh] += adcPedSub[iClock];
630 }
631 }
632
633
634 Int_t iClock = imax;
635 charge = rawStream->GetPedestal(iChannel,iClock); // Charge at the maximum
9bd82f77 636
e58b4e66 637 integrator = rawStream->GetIntegratorFlag(iChannel,iClock);
46e6c4f9 638 flagBB[offlineCh] = rawStream->GetBBFlag(iChannel, iClock);
639 flagBG[offlineCh] = rawStream->GetBGFlag(iChannel,iClock );
c8d309e0 640 Int_t board = AliVZEROCalibData::GetBoardNumber(offlineCh);
46e6c4f9 641 time[offlineCh] = rawStream->GetTime(iChannel)*fCalibData->GetTimeResolution(board);
642 width[offlineCh] = rawStream->GetWidth(iChannel)*fCalibData->GetWidthResolution(board);
c8d309e0 643
46e6c4f9 644 if (time[offlineCh] >= 1e-6) GetRawsData(kChargeEoI)->Fill(offlineCh,adc[offlineCh]);
9bd82f77 645
6bec7c7c 646 GetRawsData((integrator == 0 ? kChargeEoIInt0 : kChargeEoIInt1))->Fill(offlineCh,charge);
46e6c4f9 647 if(flagBB[offlineCh]) GetRawsData((integrator == 0 ? kChargeEoIBBInt0 : kChargeEoIBBInt1))->Fill(offlineCh,charge);
648 if(flagBG[offlineCh]) GetRawsData((integrator == 0 ? kChargeEoIBGInt0 : kChargeEoIBGInt1))->Fill(offlineCh,charge);
9bd82f77 649
46e6c4f9 650 Float_t sigma = fCalibData->GetSigma(offlineCh+64*integrator);
9bd82f77 651
9bd82f77 652
6bec7c7c 653 // Calculation of the number of MIP
46e6c4f9 654 Double_t mipEoI = adc[offlineCh] * fCalibData->GetMIPperADC(offlineCh);
655
656 if((adc[offlineCh] > 2.*sigma) && !(time[offlineCh] <1.e-6)){
6bec7c7c 657 ((TH2D*)GetRawsData(kRawMIPChannel))->Fill(offlineCh,mipEoI);
658 if(offlineCh<32) {
9bd82f77 659 mulV0C++;
46e6c4f9 660 chargeV0C += adc[offlineCh];
6bec7c7c 661 mipV0C += mipEoI;
662 } else {
9bd82f77 663 mulV0A++;
46e6c4f9 664 chargeV0A += adc[offlineCh];
6bec7c7c 665 mipV0A += mipEoI;
9bd82f77 666 }
6bec7c7c 667 }
9bd82f77 668
6bec7c7c 669 // Fill Charge Minimum Bias Histograms
670
671 int idx;
672 for(Int_t iBunch=0; iBunch<10; iBunch++){
e58b4e66 673 integrator = rawStream->GetIntMBFlag(iChannel, iBunch);
46e6c4f9 674 bool bbFlag = rawStream->GetBBMBFlag(iChannel, iBunch);
675 bool bgFlag = rawStream->GetBGMBFlag(iChannel, iBunch);
676 mbCharge = rawStream->GetChargeMB(iChannel, iBunch);
9bd82f77 677
678 if(integrator==0){
46e6c4f9 679 if(bbFlag==0){
680 if(bgFlag==0) idx = kChargeMBBB0BG0Int0;
6bec7c7c 681 else idx = kChargeMBBB0BG1Int0;
9bd82f77 682 } else {
46e6c4f9 683 if(bgFlag==0) idx = kChargeMBBB1BG0Int0;
6bec7c7c 684 else idx = kChargeMBBB1BG1Int0;
9bd82f77 685 }
686 } else {
46e6c4f9 687 if(bbFlag==0){
688 if(bgFlag==0) idx = kChargeMBBB0BG0Int1;
6bec7c7c 689 else idx = kChargeMBBB0BG1Int1;
9bd82f77 690 } else {
46e6c4f9 691 if(bgFlag==0) idx = kChargeMBBB1BG0Int1;
6bec7c7c 692 else idx = kChargeMBBB1BG1Int1;
9bd82f77 693 }
694 }
46e6c4f9 695 GetRawsData(idx)->Fill(offlineCh,mbCharge);
c8d309e0 696 }
6bec7c7c 697
698 // Fill HPTDC Time Histograms
46e6c4f9 699 timeCorr[offlineCh] = CorrectLeadingTime(offlineCh,time[offlineCh],adc[offlineCh]);
700
701 const Float_t p1 = 2.50; // photostatistics term in the time resolution
702 const Float_t p2 = 3.00; // slewing related term in the time resolution
703 if(timeCorr[offlineCh]>-1024 + 1.e-6){
704 Float_t nphe = adc[offlineCh]*kChargePerADC/(fCalibData->GetGain(offlineCh)*TMath::Qe());
53072dd8 705 Float_t timeErr = 0;
a0d06293 706 if (nphe>1.e-6) timeErr = TMath::Sqrt(kIntTimeRes*kIntTimeRes+
46e6c4f9 707 p1*p1/nphe+
708 p2*p2*(fTimeSlewing->GetParameter(0)*fTimeSlewing->GetParameter(1))*(fTimeSlewing->GetParameter(0)*fTimeSlewing->GetParameter(1))*
709 TMath::Power(adc[offlineCh]/fCalibData->GetDiscriThr(offlineCh),2.*(fTimeSlewing->GetParameter(1)-1.))/
710 (fCalibData->GetDiscriThr(offlineCh)*fCalibData->GetDiscriThr(offlineCh)));
711
a0d06293 712 if (timeErr>1.e-6) {
53072dd8 713 if (offlineCh<32) {
714 itimeV0C++;
715 timeV0C += timeCorr[offlineCh]/(timeErr*timeErr);
716 weightV0C += 1./(timeErr*timeErr);
717 }else{
718 itimeV0A++;
719 timeV0A += timeCorr[offlineCh]/(timeErr*timeErr);
720 weightV0A += 1./(timeErr*timeErr);
721 }
46e6c4f9 722 }
6bec7c7c 723 }
46e6c4f9 724 GetRawsData(kHPTDCTime)->Fill(offlineCh,timeCorr[offlineCh]);
725 GetRawsData(kWidth)->Fill(offlineCh,width[offlineCh]);
726 if(flagBB[offlineCh]) {
727 GetRawsData(kHPTDCTimeBB)->Fill(offlineCh,timeCorr[offlineCh]);
728 GetRawsData(kWidthBB)->Fill(offlineCh,width[offlineCh]);
729 }
730 if(flagBG[offlineCh]) {
731 GetRawsData(kHPTDCTimeBG)->Fill(offlineCh,timeCorr[offlineCh]);
732 GetRawsData(kWidthBG)->Fill(offlineCh,width[offlineCh]);
733 }
9bd82f77 734
6bec7c7c 735 // Fill Flag and Charge Versus LHC-Clock histograms
736
d62942e8 737 for(Int_t iEvent=0; iEvent<21; iEvent++){
e58b4e66 738 charge = rawStream->GetPedestal(iChannel,iEvent);
739 integrator = rawStream->GetIntegratorFlag(iChannel,iEvent);
46e6c4f9 740 bool bbFlag = rawStream->GetBBFlag(iChannel, iEvent);
741 bool bgFlag = rawStream->GetBGFlag(iChannel,iEvent );
6bec7c7c 742
743 ((TH2*) GetRawsData((integrator == 0 ? kChargeVsClockInt0 : kChargeVsClockInt1 )))->Fill(offlineCh,(float)iEvent-10,(float)charge);
46e6c4f9 744 ((TH2*) GetRawsData(kBBFlagVsClock))->Fill(offlineCh,(float)iEvent-10,(float)bbFlag);
745 ((TH2*) GetRawsData(kBGFlagVsClock))->Fill(offlineCh,(float)iEvent-10,(float)bgFlag);
746 if(iEvent==10) ((TH1*) GetRawsData(kBBFlagsPerChannel))->Fill(offlineCh,(float)bbFlag);
9bd82f77 747 }
748
6bec7c7c 749 }// END of Loop over channels
9bd82f77 750
a0d06293 751 if(weightV0A>1.e-6) timeV0A /= weightV0A;
46e6c4f9 752 else timeV0A = -1024.;
a0d06293 753 if(weightV0C>1.e-6) timeV0C /= weightV0C;
46e6c4f9 754 else timeV0C = -1024.;
755 if(timeV0A<-1024.+1.e-6 || timeV0C<-1024.+1.e-6) diffTime = -1024.;
756 else diffTime = timeV0A - timeV0C;
757
758 Bool_t v0ABB = kFALSE;
759 Bool_t v0CBB = kFALSE;
760 Bool_t v0ABG = kFALSE;
761 Bool_t v0CBG = kFALSE;
9bd82f77 762
46e6c4f9 763 if(timeV0A>kMinBBA && timeV0A<kMaxBBA) {
764 v0ABB = kTRUE;
765 } else if(timeV0A>kMinBGA && timeV0A<kMaxBGA) {
766 v0ABG = kTRUE;
767 }
768 if(timeV0C>kMinBBC && timeV0C<kMaxBBC) {
769 v0CBB = kTRUE;
770 } else if(timeV0C>kMinBGC && timeV0C<kMaxBGC) {
771 v0CBG = kTRUE;
772 }
9bd82f77 773
46e6c4f9 774// Fill Trigger output histogram
775 if(v0ABB && v0CBB) GetRawsData(kTriggers)->Fill(0);
776 if((v0ABB || v0CBB) && !(v0ABG || v0CBG)) GetRawsData(kTriggers)->Fill(1);
777 if(v0ABG && v0CBB) GetRawsData(kTriggers)->Fill(2);
778 if(v0ABB && v0CBG) GetRawsData(kTriggers)->Fill(3);
9bd82f77 779
46e6c4f9 780
781 GetRawsData(kV0ATime)->Fill(timeV0A);
782 GetRawsData(kV0CTime)->Fill(timeV0C);
783 GetRawsData(kDiffTime)->Fill(diffTime);
784 GetRawsData(kTimeV0AV0C)->Fill(timeV0A,timeV0C);
785
786 GetRawsData(kMultiV0A)->Fill(mulV0A);
787 GetRawsData(kMultiV0C)->Fill(mulV0C);
788
789 GetRawsData(kChargeV0A)->Fill(chargeV0A);
790 GetRawsData(kChargeV0C)->Fill(chargeV0C);
791 GetRawsData(kChargeV0)->Fill(chargeV0A + chargeV0C);
792
793 GetRawsData(kRawMIPV0A)->Fill(mipV0A);
794 GetRawsData(kRawMIPV0C)->Fill(mipV0C);
795 GetRawsData(kRawMIPV0)->Fill(mipV0A + mipV0C);
796 break;
6bec7c7c 797
798 } // END of SWITCH : EVENT TYPE
9bd82f77 799
800 fEvent++;
4e25ac79 801 TParameter<double> * p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kMultiV0A)->GetName()))) ;
719e870c 802 if (p) p->SetVal((double)mulV0A) ;
9bd82f77 803
4e25ac79 804 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kMultiV0C)->GetName()))) ;
719e870c 805 if (p) p->SetVal((double)mulV0C) ;
9bd82f77 806
4e25ac79 807 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kChargeV0A)->GetName()))) ;
719e870c 808 if (p) p->SetVal((double)chargeV0A) ;
9bd82f77 809
4e25ac79 810 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kChargeV0C)->GetName()))) ;
719e870c 811 if (p) p->SetVal((double)chargeV0C) ;
9bd82f77 812
4e25ac79 813 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kChargeV0)->GetName()))) ;
719e870c 814 if (p) p->SetVal((double)(chargeV0A + chargeV0C)) ;
9bd82f77 815
4e25ac79 816 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kRawMIPV0A)->GetName()))) ;
719e870c 817 if (p) p->SetVal((double)mipV0A) ;
9bd82f77 818
4e25ac79 819 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kRawMIPV0C)->GetName()))) ;
719e870c 820 if (p) p->SetVal((double)mipV0C) ;
9bd82f77 821
4e25ac79 822 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kRawMIPV0)->GetName()))) ;
719e870c 823 if (p) p->SetVal((double)(mipV0A + mipV0C)) ;
9bd82f77 824
4e25ac79 825 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kV0ATime)->GetName()))) ;
719e870c 826 if (p) p->SetVal((double)timeV0A) ;
9bd82f77 827
4e25ac79 828 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kV0CTime)->GetName()))) ;
719e870c 829 if (p) p->SetVal((double)timeV0C) ;
9bd82f77 830
4e25ac79 831 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kDiffTime)->GetName()))) ;
719e870c 832 if (p) p->SetVal((double)diffTime) ;
9bd82f77 833
e58b4e66 834 delete rawStream; rawStream = 0x0;
835
9bd82f77 836
4da80b8c 837 }
508b9fc0 838
839//____________________________________________________________________________
840void AliVZEROQADataMakerRec::StartOfDetectorCycle()
841{
842 // Detector specific actions at start of cycle
843
6bec7c7c 844 // Reset of the histogram used - to have the trend versus time -
e6d13307 845
846 fCalibData = GetCalibData();
46e6c4f9 847
848 AliCDBEntry *entry = AliCDBManager::Instance()->Get("GRP/CTP/CTPtiming");
849 if (!entry) AliFatal("CTP timing parameters are not found in OCDB !");
850 AliCTPTimeParams *ctpParams = (AliCTPTimeParams*)entry->GetObject();
851 Float_t l1Delay = (Float_t)ctpParams->GetDelayL1L0()*25.0;
852
853 AliCDBEntry *entry1 = AliCDBManager::Instance()->Get("GRP/CTP/TimeAlign");
854 if (!entry1) AliFatal("CTP time-alignment is not found in OCDB !");
855 AliCTPTimeParams *ctpTimeAlign = (AliCTPTimeParams*)entry1->GetObject();
856 l1Delay += ((Float_t)ctpTimeAlign->GetDelayL1L0()*25.0);
857
858 AliCDBEntry *entry2 = AliCDBManager::Instance()->Get("VZERO/Calib/TimeDelays");
859 if (!entry2) AliFatal("VZERO time delays are not found in OCDB !");
860 TH1F *delays = (TH1F*)entry2->GetObject();
861
862 AliCDBEntry *entry3 = AliCDBManager::Instance()->Get("VZERO/Calib/TimeSlewing");
863 if (!entry3) AliFatal("VZERO time slewing function is not found in OCDB !");
864 fTimeSlewing = (TF1*)entry3->GetObject();
865
866 for(Int_t i = 0 ; i < 64; ++i) {
867 //Int_t board = AliVZEROCalibData::GetBoardNumber(i);
868 fTimeOffset[i] = (
869 // ((Float_t)fCalibData->GetTriggerCountOffset(board) -
870 // (Float_t)fCalibData->GetRollOver(board))*25.0 +
871 // fCalibData->GetTimeOffset(i) -
872 // l1Delay+
873 delays->GetBinContent(i+1)//+
874 // kV0Offset
875 );
876// AliInfo(Form(" fTimeOffset[%d] = %f kV0offset %f",i,fTimeOffset[i],kV0Offset));
877 }
878
879
880
6bec7c7c 881
46e6c4f9 882
a8e23456 883 TTimeStamp currentTime;
884 fCycleStartTime = currentTime.GetSec();
885
886 fNTotEvents = 0;
887}
9bd82f77 888
46e6c4f9 889
a8e23456 890//-------------------------------------------------------------------------------------------------
46e6c4f9 891Float_t AliVZEROQADataMakerRec::CorrectLeadingTime(Int_t i, Float_t time, Float_t adc) const
892{
893 // Correct the leading time
894 // for slewing effect and
895 // misalignment of the channels
896 if (time < 1e-6) return -1024;
3dc953e2 897
46e6c4f9 898 // Channel alignment and general offset subtraction
899// if (i < 32) time -= kV0CDelayCables;
900// time -= fTimeOffset[i];
901 //AliInfo(Form("time-offset %f", time));
902
903 // In case of pathological signals
904 if (adc < 1e-6) return time;
905
906 // Slewing correction
907 Float_t thr = fCalibData->GetDiscriThr(i);
908 //AliInfo(Form("adc %f thr %f dtime %f ", adc,thr,fTimeSlewing->Eval(adc/thr)));
909 time -= fTimeSlewing->Eval(adc/thr);
910
911 return time;
508b9fc0 912}
74995017 913