1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
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
22 // --- ROOT system ---
23 #include <TClonesArray.h>
31 #include <TParameter.h>
32 #include <TTimeStamp.h>
34 // --- Standard library ---
36 // --- AliRoot header files ---
37 #include "AliESDEvent.h"
39 #include "AliCDBManager.h"
40 #include "AliCDBStorage.h"
41 #include "AliCDBEntry.h"
42 #include "AliVZEROQADataMakerRec.h"
43 #include "AliQAChecker.h"
44 #include "AliRawReader.h"
45 #include "AliVZERORawStream.h"
46 #include "AliVZEROdigit.h"
47 #include "AliVZEROConst.h"
48 #include "AliVZEROReconstructor.h"
49 #include "AliVZEROTrending.h"
50 #include "AliVZEROCalibData.h"
51 #include "AliCTPTimeParams.h"
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. ;
67 ClassImp(AliVZEROQADataMakerRec)
69 //____________________________________________________________________________
70 AliVZEROQADataMakerRec::AliVZEROQADataMakerRec() :
71 AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kVZERO), "VZERO Quality Assurance Data Maker"),
76 fTrendingUpdateEvent(0),
78 fTrendingUpdateTime(0),
86 AliDebug(AliQAv1::GetQADebugLevel(), "Construct VZERO QA Object");
88 for(Int_t i=0; i<64; i++){
93 for(Int_t i=0; i<128; i++){
97 //____________________________________________________________________________
98 AliVZEROQADataMakerRec::AliVZEROQADataMakerRec(const AliVZEROQADataMakerRec& qadm) :
104 fTrendingUpdateEvent(0),
105 fNTrendingUpdates(0),
106 fTrendingUpdateTime(0),
114 SetName((const char*)qadm.GetName()) ;
115 SetTitle((const char*)qadm.GetTitle());
118 //__________________________________________________________________
119 AliVZEROQADataMakerRec& AliVZEROQADataMakerRec::operator = (const AliVZEROQADataMakerRec& qadm )
123 this->~AliVZEROQADataMakerRec();
124 new(this) AliVZEROQADataMakerRec(qadm);
128 //____________________________________________________________________________
129 AliVZEROCalibData* AliVZEROQADataMakerRec::GetCalibData() const
132 AliCDBManager *man = AliCDBManager::Instance();
134 AliCDBEntry *entry=0;
136 entry = man->Get("VZERO/Calib/Data",fRun);
138 AliWarning("Load of calibration data from default storage failed!");
139 AliWarning("Calibration data will be loaded from local storage ($ALICE_ROOT)");
141 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
142 entry = man->Get("VZERO/Calib/Data",fRun);
144 // Retrieval of data in directory VZERO/Calib/Data:
146 AliVZEROCalibData *calibdata = 0;
148 if (entry) calibdata = (AliVZEROCalibData*) entry->GetObject();
149 if (!calibdata) AliFatal("No calibration data from calibration database !");
156 //____________________________________________________________________________
157 void AliVZEROQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
159 // Detector specific actions at end of cycle
160 // Does the QA checking
162 AliQAChecker::Instance()->Run(AliQAv1::kVZERO, task, list) ;
164 if(task == AliQAv1::kRAWS){
165 TTimeStamp currentTime;
166 fCycleStopTime = currentTime.GetSec();
169 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
170 if (! IsValidEventSpecie(specie, list))
172 SetEventSpecie(AliRecoParam::ConvertIndex(specie)) ;
173 if(task == AliQAv1::kRAWS){
174 } else if (task == AliQAv1::kESDS) {
179 //____________________________________________________________________________
180 void AliVZEROQADataMakerRec::InitESDs()
182 // Creates histograms to control ESDs
184 const Bool_t expert = kTRUE ;
185 const Bool_t image = kTRUE ;
191 h1i = new TH1I("H1I_Cell_Multiplicity_V0A", "Cell Multiplicity in V0A;Multiplicity (Nb of Cell);Counts", 35, 0, 35) ;
192 Add2ESDsList(h1i, kCellMultiV0A, !expert, image) ;
194 h1i = new TH1I("H1I_Cell_Multiplicity_V0C", "Cell Multiplicity in V0;Multiplicity (Nb of Cell);Counts", 35, 0, 35) ;
195 Add2ESDsList(h1i, kCellMultiV0C, !expert, image) ;
197 h1d = new TH1D("H1D_MIP_Multiplicity_V0A", "MIP Multiplicity in V0A;Multiplicity (Nb of MIP);Counts", 1000, 0, 1000) ;
198 Add2ESDsList(h1d, kMIPMultiV0A, !expert, image) ;
200 h1d = new TH1D("H1D_MIP_Multiplicity_V0C", "MIP Multiplicity in V0C;Multiplicity (Nb of MIP);Counts", 1000, 0, 1000) ;
201 Add2ESDsList(h1d, kMIPMultiV0C, !expert, image) ;
203 h2d = new TH2D("H2D_MIP_Multiplicity_Channel", "MIP Multiplicity per Channel;Channel;Multiplicity (Nb of MIP)",64, 0, 64, 100, 0, 100) ;
204 Add2ESDsList(h2d, kMIPMultiChannel, !expert, image) ;
206 h1d = new TH1D("H1D_BBFlag_Counters", "BB Flag Counters;Channel;Counts",64, 0, 64) ;
207 Add2ESDsList(h1d, kBBFlag, !expert, image) ;
209 h1d = new TH1D("H1D_BGFlag_Counters", "BG Flag Counters;Channel;Counts",64, 0, 64) ;
210 Add2ESDsList(h1d, kBGFlag, !expert, image) ;
212 h2d = new TH2D("H2D_Charge_Channel", "ADC Charge per channel;Channel;Charge (ADC counts)",64, 0, 64, 1024, 0, 1024) ;
213 Add2ESDsList(h2d, kChargeChannel, !expert, image) ;
215 h2d = new TH2D("H2D_Time_Channel", "Time per channel;Channel;Time (ns)",64, 0, 64, 400, -100, 100) ;
216 Add2ESDsList(h2d, kTimeChannel, !expert, image) ;
218 h1d = new TH1D("H1D_V0A_Time", "Mean V0A Time;Time (ns);Counts",1000, -100., 100.);
219 Add2ESDsList(h1d,kESDV0ATime, !expert, image);
221 h1d = new TH1D("H1D_V0C_Time", "Mean V0C Time;Time (ns);Counts",1000, -100., 100.);
222 Add2ESDsList(h1d,kESDV0CTime, !expert, image);
224 h1d = new TH1D("H1D_Diff_Time", "Diff Time V0A - V0C;Diff Time V0A - V0C (ns);Counts",1000, -200., 200.);
225 Add2ESDsList(h1d,kESDDiffTime, !expert, image);
229 //____________________________________________________________________________
230 void AliVZEROQADataMakerRec::InitRaws()
232 // Creates RAW histograms in Raws subdir
234 const Bool_t expert = kTRUE ;
235 const Bool_t saveCorr = kTRUE ;
236 const Bool_t image = kTRUE ;
238 const Int_t kNintegrator = 2;
240 const Int_t kNTdcTimeBins = 1280;
241 const Float_t kTdcTimeMin = 0.;
242 const Float_t kTdcTimeMax = 125.;
243 const Int_t kNTdcWidthBins = 128;
244 const Float_t kTdcWidthMin = 0;
245 const Float_t kTdcWidthMax = 50.;
246 const Int_t kNChargeBins = 1024;
247 const Float_t kChargeMin = 0;
248 const Float_t kChargeMax = 1024;
249 const Int_t kNChannelBins = 64;
250 const Float_t kChannelMin = 0;
251 const Float_t kChannelMax = 64;
252 const Int_t kNPedestalBins = 200;
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;
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");
279 // Creation of Cell Multiplicity Histograms
280 h1i = new TH1I("H1I_Multiplicity_V0A", "Cell Multiplicity in V0A;# of Cells;Entries", 35, 0, 35) ;
281 Add2RawsList(h1i,kMultiV0A, expert, image, saveCorr); iHisto++;
282 h1i = new TH1I("H1I_Multiplicity_V0C", "Cell Multiplicity in V0C;# of Cells;Entries", 35, 0, 35) ;
283 Add2RawsList(h1i,kMultiV0C, expert, image, saveCorr); iHisto++;
285 // Creation of Total Charge Histograms
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++;
293 // Creation of MIP Histograms
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++;
300 h2d = new TH2D("H2D_MIP_Channel", "Nb of MIP per channel;Channel;# of Mips", kNChannelBins, kChannelMin, kChannelMax,kNMIPBins,kMIPMin ,kMIPMax) ;
301 Add2RawsList(h2d,kRawMIPChannel, expert, !image, !saveCorr); iHisto++;
305 // Creation of Charge EoI histogram
306 h2d = new TH2D("H2D_ChargeEoI", "Charge Event of Interest;Channel Number;Charge [ADC counts]"
307 ,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, kChargeMax);
308 Add2RawsList(h2d,kChargeEoI, !expert, image, !saveCorr); iHisto++;
310 for(Int_t iInt=0;iInt<kNintegrator;iInt++){
311 // Creation of Pedestal histograms
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 );
314 Add2RawsList(h2i,(iInt == 0 ? kPedestalInt0 : kPedestalInt1), expert, !image, !saveCorr); iHisto++;
317 // Creation of Charge EoI histograms
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);
320 Add2RawsList(h2i,(iInt == 0 ? kChargeEoIInt0 : kChargeEoIInt1), expert, image, !saveCorr); iHisto++;
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);
324 Add2RawsList(h2i,(iInt == 0 ? kChargeEoIBBInt0 : kChargeEoIBBInt1), expert, !image, !saveCorr); iHisto++;
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);
328 Add2RawsList(h2i,(iInt == 0 ? kChargeEoIBGInt0: kChargeEoIBGInt1), expert, !image, !saveCorr); iHisto++;
330 // Creation of Charge versus LHC Clock histograms
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 );
333 Add2RawsList(h2d,(iInt == 0 ? kChargeVsClockInt0 : kChargeVsClockInt1 ), expert, !image, !saveCorr); iHisto++;
335 // Creation of Minimum Bias Charge histograms
336 for(Int_t iBB=0;iBB<2;iBB++){
337 for(Int_t iBG=0;iBG<2;iBG++){
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);
343 if(iBG==0) idx = kChargeMBBB0BG0Int0;
344 else idx = kChargeMBBB0BG1Int0;
346 if(iBG==0) idx = kChargeMBBB1BG0Int0;
347 else idx = kChargeMBBB1BG1Int0;
351 if(iBG==0) idx = kChargeMBBB0BG0Int1;
352 else idx = kChargeMBBB0BG1Int1;
354 if(iBG==0) idx = kChargeMBBB1BG0Int1;
355 else idx = kChargeMBBB1BG1Int1;
358 Add2RawsList(h2i,idx, expert, !image, !saveCorr); iHisto++;
364 // Creation of Time histograms
365 h2i = new TH2I("H2I_Width", "HPTDC Width;Channel;Width [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax);
366 Add2RawsList(h2i,kWidth, expert, !image, !saveCorr); iHisto++;
368 h2i = new TH2I("H2I_Width_BB", "HPTDC Width w/ BB Flag condition;Channel;Width [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax);
369 Add2RawsList(h2i,kWidthBB, expert, !image, !saveCorr); iHisto++;
371 h2i = new TH2I("H2I_Width_BG", "HPTDC Width w/ BG Flag condition;Channel;Width [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax);
372 Add2RawsList(h2i,kWidthBG, expert, !image, !saveCorr); iHisto++;
374 h2i = new TH2I("H2I_HPTDCTime", "HPTDC Time;Channel;Leading Time [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
375 Add2RawsList(h2i,kHPTDCTime, expert, image, !saveCorr); iHisto++;
377 h2i = new TH2I("H2I_HPTDCTime_BB", "HPTDC Time w/ BB Flag condition;Channel;Leading Time [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
378 Add2RawsList(h2i,kHPTDCTimeBB, !expert, image, !saveCorr); iHisto++;
380 h2i = new TH2I("H2I_HPTDCTime_BG", "HPTDC Time w/ BG Flag condition;Channel;Leading Time [ns]",kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
381 Add2RawsList(h2i,kHPTDCTimeBG, !expert, image, !saveCorr); iHisto++;
383 h1d = new TH1D("H1D_V0A_Time", "V0A Time;Time [ns];Counts",kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
384 Add2RawsList(h1d,kV0ATime, expert, !image, saveCorr); iHisto++;
386 h1d = new TH1D("H1D_V0C_Time", "V0C Time;Time [ns];Counts",kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
387 Add2RawsList(h1d,kV0CTime, expert, !image, saveCorr); iHisto++;
389 h1d = new TH1D("H1D_Diff_Time","Diff V0A-V0C Time;Time [ns];Counts",2*kNTdcTimeBins, -50., 50.);
390 Add2RawsList(h1d,kDiffTime, expert, !image, saveCorr); iHisto++;
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++;
396 // Creation of Flag versus LHC Clock histograms
398 h1d = new TH1D("H1D_BBFlagPerChannel", "BB-Flags Versus Channel;Channel;BB Flags Count",kNChannelBins, kChannelMin, kChannelMax );
400 Add2RawsList(h1d,kBBFlagsPerChannel, !expert, image, !saveCorr); iHisto++;
402 h2d = new TH2D("H2D_BBFlagVsClock", "BB-Flags Versus LHC-Clock;Channel;LHC Clocks",kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 );
403 Add2RawsList(h2d,kBBFlagVsClock, expert, !image, !saveCorr); iHisto++;
405 h2d = new TH2D("H2D_BGFlagVsClock", "BG-Flags Versus LHC-Clock;Channel;LHC Clocks",kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 );
406 Add2RawsList(h2d,kBGFlagVsClock, expert, !image, !saveCorr); iHisto++;
409 AliDebug(AliQAv1::GetQADebugLevel(), Form("%d Histograms has been added to the Raws List",iHisto));
412 //____________________________________________________________________________
413 void AliVZEROQADataMakerRec::InitDigits()
415 // create Digits histograms in Digits subdir
416 const Bool_t expert = kTRUE ;
417 const Bool_t image = kTRUE ;
422 // create Digits histograms in Digits subdir
423 TH1I * h0 = new TH1I("hDigitMultiplicity", "Digits multiplicity distribution in VZERO;# of Digits;Entries", 100, 0, 99) ;
425 Add2DigitsList(h0, 0, !expert, image) ;
427 for (Int_t i=0; i<64; i++)
429 fhDigTDC[i] = new TH1I(Form("hDigitTDC%d", i),Form("Digit TDC in cell %d; TDC value;Entries",i),300,0.,149.);
431 fhDigADC[i]= new TH1I(Form("hDigitADC%d",i),Form("Digit ADC in cell %d;ADC value;Entries",i),1024,0.,1023.);
433 Add2DigitsList(fhDigTDC[i],i+1, !expert, image);
434 Add2DigitsList(fhDigADC[i],i+1+64, !expert, image);
438 //____________________________________________________________________________
439 void AliVZEROQADataMakerRec::MakeDigits()
441 // makes data from Digits
443 GetDigitsData(0)->Fill(fDigitsArray->GetEntriesFast()) ;
444 TIter next(fDigitsArray) ;
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()) ;
454 //____________________________________________________________________________
455 void AliVZEROQADataMakerRec::MakeDigits(TTree *digitTree)
457 // makes data from Digit Tree
460 fDigitsArray->Clear() ;
462 fDigitsArray = new TClonesArray("AliVZEROdigit", 1000) ;
464 TBranch * branch = digitTree->GetBranch("VZERODigit") ;
466 AliWarning("VZERO branch in Digit Tree not found") ;
468 branch->SetAddress(&fDigitsArray) ;
469 branch->GetEntry(0) ;
475 //____________________________________________________________________________
476 void AliVZEROQADataMakerRec::MakeESDs(AliESDEvent * esd)
478 // Creates QA data from ESDs
480 UInt_t eventType = esd->GetEventType();
484 AliESDVZERO *esdVZERO=esd->GetVZEROData();
486 if (!esdVZERO) break;
488 GetESDsData(kCellMultiV0A)->Fill(esdVZERO->GetNbPMV0A());
489 GetESDsData(kCellMultiV0C)->Fill(esdVZERO->GetNbPMV0C());
490 GetESDsData(kMIPMultiV0A)->Fill(esdVZERO->GetMTotV0A());
491 GetESDsData(kMIPMultiV0C)->Fill(esdVZERO->GetMTotV0C());
493 for(Int_t i=0;i<64;i++) {
494 GetESDsData(kMIPMultiChannel)->Fill((Float_t) i,(Float_t) esdVZERO->GetMultiplicity(i));
495 GetESDsData(kChargeChannel)->Fill((Float_t) i,(Float_t) esdVZERO->GetAdc(i));
497 if(esdVZERO->BBTriggerV0C(i)) GetESDsData(kBBFlag)->Fill((Float_t) i);
498 if(esdVZERO->BGTriggerV0C(i)) GetESDsData(kBGFlag)->Fill((Float_t) i);
501 if(esdVZERO->BBTriggerV0A(i-32)) GetESDsData(kBBFlag)->Fill((Float_t) i);
502 if(esdVZERO->BGTriggerV0A(i-32)) GetESDsData(kBGFlag)->Fill((Float_t) i);
504 Float_t time = (Float_t) esdVZERO->GetTime(i); //Convert in ns: 1 TDC channel = 100ps
505 GetESDsData(kTimeChannel)->Fill((Float_t) i,time);
508 Float_t timeV0A = esdVZERO->GetV0ATime();
509 Float_t timeV0C = esdVZERO->GetV0CTime();
512 if(timeV0A<-1024.+1.e-6 || timeV0C<-1024.+1.e-6) diffTime = -1024.;
513 else diffTime = timeV0A - timeV0C;
515 GetESDsData(kESDV0ATime)->Fill(timeV0A);
516 GetESDsData(kESDV0CTime)->Fill(timeV0C);
517 GetESDsData(kESDDiffTime)->Fill(diffTime);
524 //____________________________________________________________________________
525 void AliVZEROQADataMakerRec::MakeRaws(AliRawReader* rawReader)
527 // Fills histograms with Raws, computes average ADC values dynamically (pedestal subtracted)
530 // Check id histograms already created for this Event Specie
531 if ( ! GetRawsData(kPedestalInt0) )
535 AliVZERORawStream* rawStream = new AliVZERORawStream(rawReader);
536 if(!(rawStream->Next())) return;
538 eventTypeType eventType = rawReader->GetType();
542 Double_t timeV0A =0., timeV0C = 0.;
543 Double_t weightV0A =0., weightV0C = 0.;
544 UInt_t itimeV0A=0, itimeV0C=0;
545 Double_t chargeV0A=0., chargeV0C=0.;
546 Double_t mipV0A=0., mipV0C=0.;
548 Double_t diffTime=-100000.;
564 Float_t adc[64], time[64], width[64], timeCorr[64];
566 for(Int_t iChannel=0; iChannel<64; iChannel++) { // BEGIN : Loop over channels
568 offlineCh = rawStream->GetOfflineChannel(iChannel);
570 // Fill Pedestal histograms
572 for(Int_t j=15; j<21; j++) {
573 if((rawStream->GetBGFlag(iChannel,j) || rawStream->GetBBFlag(iChannel,j))) iFlag++;
576 if(iFlag == 0){ //No Flag found
577 for(Int_t j=15; j<21; j++){
578 pedestal= (Int_t) rawStream->GetPedestal(iChannel, j);
579 integrator = rawStream->GetIntegratorFlag(iChannel, j);
581 GetRawsData((integrator == 0 ? kPedestalInt0 : kPedestalInt1))->Fill(offlineCh,pedestal);
585 // Fill Charge EoI histograms
587 adc[offlineCh] = 0.0;
589 // Search for the maximum charge in the train of 21 LHC clocks
590 // regardless of the integrator which has been operated:
593 Float_t adcPedSub[21];
594 for(Int_t iClock=0; iClock<21; iClock++){
595 Bool_t iIntegrator = rawStream->GetIntegratorFlag(iChannel,iClock);
596 Int_t k = offlineCh+64*iIntegrator;
598 //printf(Form("clock = %d adc = %f ped %f\n",iClock,rawStream->GetPedestal(iChannel,iClock),fPedestal[k]));
600 adcPedSub[iClock] = rawStream->GetPedestal(iChannel,iClock) - fCalibData->GetPedestal(k);
601 // if(adcPedSub[iClock] <= GetRecoParam()->GetNSigmaPed()*fCalibData->GetSigma(k)) {
602 if(adcPedSub[iClock] <= 2.*fCalibData->GetSigma(k)) {
603 adcPedSub[iClock] = 0;
606 // if(iClock < GetRecoParam()->GetStartClock() || iClock > GetRecoParam()->GetEndClock()) continue;
607 if(iClock < 8 || iClock > 12) continue;
608 if(adcPedSub[iClock] > maxadc) {
609 maxadc = adcPedSub[iClock];
613 //printf(Form("Channel %d (online), %d (offline)\n",iChannel,j));
615 // Int_t start = imax - GetRecoParam()->GetNPreClocks();
616 Int_t start = imax - 2;
617 if (start < 0) start = 0;
618 // Int_t end = imax + GetRecoParam()->GetNPostClocks();
619 Int_t end = imax + 1;
620 if (end > 20) end = 20;
621 for(Int_t iClock = start; iClock <= end; iClock++) {
622 adc[offlineCh] += adcPedSub[iClock];
628 charge = rawStream->GetPedestal(iChannel,iClock); // Charge at the maximum
630 integrator = rawStream->GetIntegratorFlag(iChannel,iClock);
631 flagBB[offlineCh] = rawStream->GetBBFlag(iChannel, iClock);
632 flagBG[offlineCh] = rawStream->GetBGFlag(iChannel,iClock );
633 Int_t board = AliVZEROCalibData::GetBoardNumber(offlineCh);
634 time[offlineCh] = rawStream->GetTime(iChannel)*fCalibData->GetTimeResolution(board);
635 width[offlineCh] = rawStream->GetWidth(iChannel)*fCalibData->GetWidthResolution(board);
637 if (time[offlineCh] >= 1e-6) GetRawsData(kChargeEoI)->Fill(offlineCh,adc[offlineCh]);
639 GetRawsData((integrator == 0 ? kChargeEoIInt0 : kChargeEoIInt1))->Fill(offlineCh,charge);
640 if(flagBB[offlineCh]) GetRawsData((integrator == 0 ? kChargeEoIBBInt0 : kChargeEoIBBInt1))->Fill(offlineCh,charge);
641 if(flagBG[offlineCh]) GetRawsData((integrator == 0 ? kChargeEoIBGInt0 : kChargeEoIBGInt1))->Fill(offlineCh,charge);
643 Float_t sigma = fCalibData->GetSigma(offlineCh+64*integrator);
646 // Calculation of the number of MIP
647 Double_t mipEoI = adc[offlineCh] * fCalibData->GetMIPperADC(offlineCh);
649 if((adc[offlineCh] > 2.*sigma) && !(time[offlineCh] <1.e-6)){
650 ((TH2D*)GetRawsData(kRawMIPChannel))->Fill(offlineCh,mipEoI);
653 chargeV0C += adc[offlineCh];
657 chargeV0A += adc[offlineCh];
662 // Fill Charge Minimum Bias Histograms
665 for(Int_t iBunch=0; iBunch<10; iBunch++){
666 integrator = rawStream->GetIntMBFlag(iChannel, iBunch);
667 bool bbFlag = rawStream->GetBBMBFlag(iChannel, iBunch);
668 bool bgFlag = rawStream->GetBGMBFlag(iChannel, iBunch);
669 mbCharge = rawStream->GetChargeMB(iChannel, iBunch);
673 if(bgFlag==0) idx = kChargeMBBB0BG0Int0;
674 else idx = kChargeMBBB0BG1Int0;
676 if(bgFlag==0) idx = kChargeMBBB1BG0Int0;
677 else idx = kChargeMBBB1BG1Int0;
681 if(bgFlag==0) idx = kChargeMBBB0BG0Int1;
682 else idx = kChargeMBBB0BG1Int1;
684 if(bgFlag==0) idx = kChargeMBBB1BG0Int1;
685 else idx = kChargeMBBB1BG1Int1;
688 GetRawsData(idx)->Fill(offlineCh,mbCharge);
691 // Fill HPTDC Time Histograms
692 timeCorr[offlineCh] = CorrectLeadingTime(offlineCh,time[offlineCh],adc[offlineCh]);
694 const Float_t p1 = 2.50; // photostatistics term in the time resolution
695 const Float_t p2 = 3.00; // slewing related term in the time resolution
696 if(timeCorr[offlineCh]>-1024 + 1.e-6){
697 Float_t nphe = adc[offlineCh]*kChargePerADC/(fCalibData->GetGain(offlineCh)*TMath::Qe());
699 if (nphe>1.e-6) timeErr = TMath::Sqrt(kIntTimeRes*kIntTimeRes+
701 p2*p2*(fTimeSlewing->GetParameter(0)*fTimeSlewing->GetParameter(1))*(fTimeSlewing->GetParameter(0)*fTimeSlewing->GetParameter(1))*
702 TMath::Power(adc[offlineCh]/fCalibData->GetCalibDiscriThr(offlineCh,kTRUE),2.*(fTimeSlewing->GetParameter(1)-1.))/
703 (fCalibData->GetCalibDiscriThr(offlineCh,kTRUE)*fCalibData->GetCalibDiscriThr(offlineCh,kTRUE)));
708 timeV0C += timeCorr[offlineCh]/(timeErr*timeErr);
709 weightV0C += 1./(timeErr*timeErr);
712 timeV0A += timeCorr[offlineCh]/(timeErr*timeErr);
713 weightV0A += 1./(timeErr*timeErr);
717 GetRawsData(kHPTDCTime)->Fill(offlineCh,timeCorr[offlineCh]);
718 GetRawsData(kWidth)->Fill(offlineCh,width[offlineCh]);
719 if(flagBB[offlineCh]) {
720 GetRawsData(kHPTDCTimeBB)->Fill(offlineCh,timeCorr[offlineCh]);
721 GetRawsData(kWidthBB)->Fill(offlineCh,width[offlineCh]);
723 if(flagBG[offlineCh]) {
724 GetRawsData(kHPTDCTimeBG)->Fill(offlineCh,timeCorr[offlineCh]);
725 GetRawsData(kWidthBG)->Fill(offlineCh,width[offlineCh]);
728 // Fill Flag and Charge Versus LHC-Clock histograms
730 for(Int_t iEvent=0; iEvent<21; iEvent++){
731 charge = rawStream->GetPedestal(iChannel,iEvent);
732 integrator = rawStream->GetIntegratorFlag(iChannel,iEvent);
733 bool bbFlag = rawStream->GetBBFlag(iChannel, iEvent);
734 bool bgFlag = rawStream->GetBGFlag(iChannel,iEvent );
736 ((TH2*) GetRawsData((integrator == 0 ? kChargeVsClockInt0 : kChargeVsClockInt1 )))->Fill(offlineCh,(float)iEvent-10,(float)charge);
737 ((TH2*) GetRawsData(kBBFlagVsClock))->Fill(offlineCh,(float)iEvent-10,(float)bbFlag);
738 ((TH2*) GetRawsData(kBGFlagVsClock))->Fill(offlineCh,(float)iEvent-10,(float)bgFlag);
739 if(iEvent==10) ((TH1*) GetRawsData(kBBFlagsPerChannel))->Fill(offlineCh,(float)bbFlag);
742 }// END of Loop over channels
744 if(weightV0A>1.e-6) timeV0A /= weightV0A;
745 else timeV0A = -1024.;
746 if(weightV0C>1.e-6) timeV0C /= weightV0C;
747 else timeV0C = -1024.;
748 if(timeV0A<-1024.+1.e-6 || timeV0C<-1024.+1.e-6) diffTime = -1024.;
749 else diffTime = timeV0A - timeV0C;
751 Bool_t v0ABB = kFALSE;
752 Bool_t v0CBB = kFALSE;
753 Bool_t v0ABG = kFALSE;
754 Bool_t v0CBG = kFALSE;
756 if(timeV0A>kMinBBA && timeV0A<kMaxBBA) {
758 } else if(timeV0A>kMinBGA && timeV0A<kMaxBGA) {
761 if(timeV0C>kMinBBC && timeV0C<kMaxBBC) {
763 } else if(timeV0C>kMinBGC && timeV0C<kMaxBGC) {
767 // Fill Trigger output histogram
768 if(v0ABB && v0CBB) GetRawsData(kTriggers)->Fill(0);
769 if((v0ABB || v0CBB) && !(v0ABG || v0CBG)) GetRawsData(kTriggers)->Fill(1);
770 if(v0ABG && v0CBB) GetRawsData(kTriggers)->Fill(2);
771 if(v0ABB && v0CBG) GetRawsData(kTriggers)->Fill(3);
774 GetRawsData(kV0ATime)->Fill(timeV0A);
775 GetRawsData(kV0CTime)->Fill(timeV0C);
776 GetRawsData(kDiffTime)->Fill(diffTime);
777 GetRawsData(kTimeV0AV0C)->Fill(timeV0A,timeV0C);
779 GetRawsData(kMultiV0A)->Fill(mulV0A);
780 GetRawsData(kMultiV0C)->Fill(mulV0C);
782 GetRawsData(kChargeV0A)->Fill(chargeV0A);
783 GetRawsData(kChargeV0C)->Fill(chargeV0C);
784 GetRawsData(kChargeV0)->Fill(chargeV0A + chargeV0C);
786 GetRawsData(kRawMIPV0A)->Fill(mipV0A);
787 GetRawsData(kRawMIPV0C)->Fill(mipV0C);
788 GetRawsData(kRawMIPV0)->Fill(mipV0A + mipV0C);
791 } // END of SWITCH : EVENT TYPE
794 TParameter<double> * p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kMultiV0A)->GetName()))) ;
795 if (p) p->SetVal((double)mulV0A) ;
797 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kMultiV0C)->GetName()))) ;
798 if (p) p->SetVal((double)mulV0C) ;
800 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kChargeV0A)->GetName()))) ;
801 if (p) p->SetVal((double)chargeV0A) ;
803 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kChargeV0C)->GetName()))) ;
804 if (p) p->SetVal((double)chargeV0C) ;
806 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kChargeV0)->GetName()))) ;
807 if (p) p->SetVal((double)(chargeV0A + chargeV0C)) ;
809 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kRawMIPV0A)->GetName()))) ;
810 if (p) p->SetVal((double)mipV0A) ;
812 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kRawMIPV0C)->GetName()))) ;
813 if (p) p->SetVal((double)mipV0C) ;
815 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kRawMIPV0)->GetName()))) ;
816 if (p) p->SetVal((double)(mipV0A + mipV0C)) ;
818 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kV0ATime)->GetName()))) ;
819 if (p) p->SetVal((double)timeV0A) ;
821 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kV0CTime)->GetName()))) ;
822 if (p) p->SetVal((double)timeV0C) ;
824 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kDiffTime)->GetName()))) ;
825 if (p) p->SetVal((double)diffTime) ;
827 delete rawStream; rawStream = 0x0;
832 //____________________________________________________________________________
833 void AliVZEROQADataMakerRec::StartOfDetectorCycle()
835 // Detector specific actions at start of cycle
837 // Reset of the histogram used - to have the trend versus time -
839 fCalibData = GetCalibData();
841 AliCDBEntry *entry = AliCDBManager::Instance()->Get("GRP/CTP/CTPtiming");
842 if (!entry) AliFatal("CTP timing parameters are not found in OCDB !");
843 AliCTPTimeParams *ctpParams = (AliCTPTimeParams*)entry->GetObject();
844 Float_t l1Delay = (Float_t)ctpParams->GetDelayL1L0()*25.0;
846 AliCDBEntry *entry1 = AliCDBManager::Instance()->Get("GRP/CTP/TimeAlign");
847 if (!entry1) AliFatal("CTP time-alignment is not found in OCDB !");
848 AliCTPTimeParams *ctpTimeAlign = (AliCTPTimeParams*)entry1->GetObject();
849 l1Delay += ((Float_t)ctpTimeAlign->GetDelayL1L0()*25.0);
851 AliCDBEntry *entry2 = AliCDBManager::Instance()->Get("VZERO/Calib/TimeDelays");
852 if (!entry2) AliFatal("VZERO time delays are not found in OCDB !");
853 TH1F *delays = (TH1F*)entry2->GetObject();
855 AliCDBEntry *entry3 = AliCDBManager::Instance()->Get("VZERO/Calib/TimeSlewing");
856 if (!entry3) AliFatal("VZERO time slewing function is not found in OCDB !");
857 fTimeSlewing = (TF1*)entry3->GetObject();
859 for(Int_t i = 0 ; i < 64; ++i) {
860 //Int_t board = AliVZEROCalibData::GetBoardNumber(i);
862 // ((Float_t)fCalibData->GetTriggerCountOffset(board) -
863 // (Float_t)fCalibData->GetRollOver(board))*25.0 +
864 // fCalibData->GetTimeOffset(i) -
866 delays->GetBinContent(i+1)//+
869 // AliInfo(Form(" fTimeOffset[%d] = %f kV0offset %f",i,fTimeOffset[i],kV0Offset));
876 TTimeStamp currentTime;
877 fCycleStartTime = currentTime.GetSec();
883 //-------------------------------------------------------------------------------------------------
884 Float_t AliVZEROQADataMakerRec::CorrectLeadingTime(Int_t i, Float_t time, Float_t adc) const
886 // Correct the leading time
887 // for slewing effect and
888 // misalignment of the channels
889 if (time < 1e-6) return -1024;
891 // Channel alignment and general offset subtraction
892 // if (i < 32) time -= kV0CDelayCables;
893 // time -= fTimeOffset[i];
894 //AliInfo(Form("time-offset %f", time));
896 // In case of pathological signals
897 if (adc < 1e-6) return time;
899 // Slewing correction
900 Float_t thr = fCalibData->GetCalibDiscriThr(i,kTRUE);
901 //AliInfo(Form("adc %f thr %f dtime %f ", adc,thr,fTimeSlewing->Eval(adc/thr)));
902 time -= fTimeSlewing->Eval(adc/thr);