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>
30 #include <TParameter.h>
31 #include <TTimeStamp.h>
33 // --- Standard library ---
35 // --- AliRoot header files ---
36 #include "AliESDEvent.h"
38 #include "AliCDBManager.h"
39 #include "AliCDBStorage.h"
40 #include "AliCDBEntry.h"
41 #include "AliVZEROQADataMakerRec.h"
42 #include "AliQAChecker.h"
43 #include "AliRawReader.h"
44 #include "AliVZERORawStream.h"
45 #include "AliVZEROdigit.h"
46 #include "AliVZEROReconstructor.h"
47 #include "AliVZEROTrending.h"
48 #include "AliVZEROCalibData.h"
52 ClassImp(AliVZEROQADataMakerRec)
54 //____________________________________________________________________________
55 AliVZEROQADataMakerRec::AliVZEROQADataMakerRec() :
56 AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kVZERO), "VZERO Quality Assurance Data Maker"),
61 fTrendingUpdateEvent(0),
63 fTrendingUpdateTime(0),
71 AliDebug(AliQAv1::GetQADebugLevel(), "Construct VZERO QA Object");
72 for(Int_t i=0;i<8;i++){
73 fChargePerRing[i] = 0.;
76 for(Int_t i=0; i<64; i++){
79 fChargePerChannel[i] = 0.;
80 fFlagPerChannel[i] = 0.;
81 fMeanChargePerChannel[i] = 0.;
82 fMeanFlagPerChannel[i] = 0.;
85 for(Int_t i=0; i<128; i++){
89 //____________________________________________________________________________
90 AliVZEROQADataMakerRec::AliVZEROQADataMakerRec(const AliVZEROQADataMakerRec& qadm) :
96 fTrendingUpdateEvent(0),
98 fTrendingUpdateTime(0),
106 SetName((const char*)qadm.GetName()) ;
107 SetTitle((const char*)qadm.GetTitle());
110 //__________________________________________________________________
111 AliVZEROQADataMakerRec& AliVZEROQADataMakerRec::operator = (const AliVZEROQADataMakerRec& qadm )
115 this->~AliVZEROQADataMakerRec();
116 new(this) AliVZEROQADataMakerRec(qadm);
120 //____________________________________________________________________________
121 AliVZEROCalibData* AliVZEROQADataMakerRec::GetCalibData() const
124 AliCDBManager *man = AliCDBManager::Instance();
126 AliCDBEntry *entry=0;
128 entry = man->Get("VZERO/Calib/Data",fRun);
130 AliWarning("Load of calibration data from default storage failed!");
131 AliWarning("Calibration data will be loaded from local storage ($ALICE_ROOT)");
133 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
134 entry = man->Get("VZERO/Calib/Data",fRun);
136 // Retrieval of data in directory VZERO/Calib/Data:
138 AliVZEROCalibData *calibdata = 0;
140 if (entry) calibdata = (AliVZEROCalibData*) entry->GetObject();
141 if (!calibdata) AliFatal("No calibration data from calibration database !");
148 //____________________________________________________________________________
149 void AliVZEROQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
151 // Detector specific actions at end of cycle
152 // Does the QA checking
154 AliQAChecker::Instance()->Run(AliQAv1::kVZERO, task, list) ;
156 if(task == AliQAv1::kRAWS){
157 TTimeStamp currentTime;
158 fCycleStopTime = currentTime.GetSec();
159 if(fCycleStopTime-fCycleStartTime>0.) fMonitorRate = fNTotEvents/(fCycleStopTime-fCycleStartTime);
160 //printf("%d event have been monitored -> Monitoring Rate = %f Hz\n",fNTotEvents,fMonitorRate);
161 Bool_t update = kFALSE;
162 if(!fTrendingUpdateEvent) {
164 } else if ((TMath::Abs(fTrendingUpdateTime * fMonitorRate - fTrendingUpdateEvent) / fTrendingUpdateEvent) > 0.1){
167 if(update) fTrendingUpdateEvent = (size_t)(fTrendingUpdateTime * fMonitorRate);
168 //printf("Update trending information every %d events\n",fTrendingUpdateEvent);
172 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
173 if (! IsValidEventSpecie(specie, list))
175 SetEventSpecie(AliRecoParam::ConvertIndex(specie)) ;
176 if(task == AliQAv1::kRAWS){
177 int nMaxBin = GetRawsData(kPedestalTimeInt0)->GetNbinsY();
178 if(fCurrentCycle%nMaxBin==0) {
179 GetRawsData(kPedestalTimeInt0)->Reset();
180 GetRawsData(kPedestalTimeInt1)->Reset();
181 GetRawsData(kChargeEoITimeInt0)->Reset();
182 GetRawsData(kChargeEoITimeInt1)->Reset();
186 for(Int_t iChannel=0; iChannel<64; iChannel++) {
187 for(Int_t integrator=0;integrator<2;integrator++){
188 sprintf(name,"Ped_%d_%d",iChannel,integrator);
189 hProj = ((TH2I*)GetRawsData((integrator == 0 ? kPedestalCycleInt0 : kPedestalCycleInt1)))->ProjectionY(name,iChannel+1,iChannel+1);
190 ((TH2D*)GetRawsData((integrator == 0 ? kPedestalTimeInt0 : kPedestalTimeInt1)))->Fill((double)iChannel,(double)(fCurrentCycle%nMaxBin),(double)hProj->GetMean());
193 sprintf(name,"Charge_%d_%d",iChannel,integrator);
194 hProj = ((TH2I*)GetRawsData((integrator == 0 ? kChargeEoICycleInt0 : kChargeEoICycleInt1)))->ProjectionY(name,iChannel+1,iChannel+1);
195 ((TH2D*)GetRawsData((integrator == 0 ? kChargeEoITimeInt0 : kChargeEoITimeInt1)))->Fill((double)iChannel,(double)(fCurrentCycle%nMaxBin),hProj->GetMean());
199 } else if (task == AliQAv1::kESDS) {
204 //____________________________________________________________________________
205 void AliVZEROQADataMakerRec::InitESDs()
207 // Creates histograms to control ESDs
209 const Bool_t expert = kTRUE ;
210 const Bool_t image = kTRUE ;
216 h1i = new TH1I("H1I_Cell_Multiplicity_V0A", "Cell Multiplicity in V0A;Multiplicity (Nb of Cell);Counts", 35, 0, 35) ;
217 Add2ESDsList(h1i, kCellMultiV0A, !expert, image) ;
219 h1i = new TH1I("H1I_Cell_Multiplicity_V0C", "Cell Multiplicity in V0;Multiplicity (Nb of Cell);Counts", 35, 0, 35) ;
220 Add2ESDsList(h1i, kCellMultiV0C, !expert, image) ;
222 h1d = new TH1D("H1D_MIP_Multiplicity_V0A", "MIP Multiplicity in V0A;Multiplicity (Nb of MIP);Counts", 1000, 0, 1000) ;
223 Add2ESDsList(h1d, kMIPMultiV0A, !expert, image) ;
225 h1d = new TH1D("H1D_MIP_Multiplicity_V0C", "MIP Multiplicity in V0C;Multiplicity (Nb of MIP);Counts", 1000, 0, 1000) ;
226 Add2ESDsList(h1d, kMIPMultiV0C, !expert, image) ;
228 h2d = new TH2D("H2D_MIP_Multiplicity_Channel", "MIP Multiplicity per Channel;Channel;Multiplicity (Nb of MIP)",64, 0, 64, 100, 0, 100) ;
229 Add2ESDsList(h2d, kMIPMultiChannel, !expert, image) ;
231 h1d = new TH1D("H1D_BBFlag_Counters", "BB Flag Counters;Channel;Counts",64, 0, 64) ;
232 Add2ESDsList(h1d, kBBFlag, !expert, image) ;
234 h1d = new TH1D("H1D_BGFlag_Counters", "BG Flag Counters;Channel;Counts",64, 0, 64) ;
235 Add2ESDsList(h1d, kBGFlag, !expert, image) ;
237 h2d = new TH2D("H2D_Charge_Channel", "ADC Charge per channel;Channel;Charge (ADC counts)",64, 0, 64, 1024, 0, 1024) ;
238 Add2ESDsList(h2d, kChargeChannel, !expert, image) ;
240 h2d = new TH2D("H2D_Time_Channel", "Time per channel;Channel;Time (ns)",64, 0, 64, 820, 0, 410) ;
241 Add2ESDsList(h2d, kTimeChannel, !expert, image) ;
243 h1d = new TH1D("H1D_V0A_Time", "Mean V0A Time;Time (ns);Counts",2048, 0., 409.6);
244 Add2ESDsList(h1d,kESDV0ATime, !expert, image);
246 h1d = new TH1D("H1D_V0C_Time", "Mean V0C Time;Time (ns);Counts",2048, 0., 409.6);
247 Add2ESDsList(h1d,kESDV0CTime, !expert, image);
249 h1d = new TH1D("H1D_Diff_Time", "Diff Time V0A - V0C;Diff Time V0A - V0C (ns);Counts",2*2048, -409.6, 409.6);
250 Add2ESDsList(h1d,kESDDiffTime, !expert, image);
254 //____________________________________________________________________________
255 void AliVZEROQADataMakerRec::InitRaws()
257 // Creates RAW histograms in Raws subdir
259 const Bool_t expert = kTRUE ;
260 const Bool_t saveCorr = kTRUE ;
261 const Bool_t image = kTRUE ;
263 char name[50] , title[100];
264 const Int_t kNintegrator = 2;
266 const Int_t kNTdcTimeBins = 2048;
267 const Int_t kTdcTimeMin = 0;
268 const Int_t kTdcTimeMax = 4096;
269 const Int_t kNTdcWidthBins = 128;
270 const Int_t kTdcWidthMin = 0;
271 const Int_t kTdcWidthMax = 128;
272 const Int_t kNChargeBins = 1024;
273 const Int_t kChargeMin = 0;
274 const Int_t kChargeMax = 1024;
275 const Int_t kNChannelBins = 64;
276 const Int_t kChannelMin = 0;
277 const Int_t kChannelMax = 64;
278 const Int_t kNPedestalBins = 200;
279 const Int_t kPedestalMin = 0;
280 const Int_t kPedestalMax = 200;
281 const Int_t kTimeMin = 0;
282 const Int_t kTimeMax = 100;
283 const Int_t kNMIPBins = 200;
284 const Int_t kMIPMin = 0;
285 const Int_t kMIPMax = 200;
291 AliVZEROTrending * trend;
295 // Creation of Cell Multiplicity Histograms
296 h1i = new TH1I("H1I_Multiplicity_V0A", "Cell Multiplicity in V0A;# of Cells;Entries", 35, 0, 35) ;
297 Add2RawsList(h1i,kMultiV0A, expert, image, saveCorr); iHisto++;
298 h1i = new TH1I("H1I_Multiplicity_V0C", "Cell Multiplicity in V0C;# of Cells;Entries", 35, 0, 35) ;
299 Add2RawsList(h1i,kMultiV0C, expert, image, saveCorr); iHisto++;
301 // Creation of Total Charge Histograms
302 h1d = new TH1D("H1D_Charge_V0A", "Total Charge in V0A;Charge [ADC counts];Counts", 2048, 0, 32768) ;
303 Add2RawsList(h1d,kChargeV0A, expert, image, saveCorr); iHisto++;
304 h1d = new TH1D("H1D_Charge_V0C", "Total Charge in V0C;Charge [ADC counts];Counts", 2048, 0, 32768) ;
305 Add2RawsList(h1d,kChargeV0C, expert, image, saveCorr); iHisto++;
306 h1d = new TH1D("H1D_Charge_V0", "Total Charge in V0;Charge [ADC counts];Counts", 2048, 0, 65536) ;
307 Add2RawsList(h1d,kChargeV0, expert, image, saveCorr); iHisto++;
309 // Creation of MIP Histograms
310 h1d = new TH1D("H1D_MIP_V0A", "Total MIP in V0A;Charge [MIP];Counts", 2*kNMIPBins,kMIPMin ,32*kMIPMax) ;
311 Add2RawsList(h1d,kRawMIPV0A, expert, image, saveCorr); iHisto++;
312 h1d = new TH1D("H1D_MIP_V0C", "Total MIP in V0C;Charge [MIP];Counts", 2*kNMIPBins,kMIPMin ,32*kMIPMax) ;
313 Add2RawsList(h1d,kRawMIPV0C, expert, image, saveCorr); iHisto++;
314 h1d = new TH1D("H1D_MIP_V0", "Total MIP in V0;Charge [MIP];Counts", 2*kNMIPBins,kMIPMin ,32*kMIPMax) ;
315 Add2RawsList(h1d,kRawMIPV0, expert, image, saveCorr); iHisto++;
316 h2d = new TH2D("H2D_MIP_Channel", "Nb of MIP per channel;Channel;# of Mips", kNChannelBins, kChannelMin, kChannelMax,kNMIPBins,kMIPMin ,kMIPMax) ;
317 Add2RawsList(h2d,kRawMIPChannel, expert, !image, !saveCorr); iHisto++;
320 for(Int_t iInt=0;iInt<kNintegrator;iInt++){
321 // Creation of Pedestal histograms
322 sprintf(name,"H2I_Pedestal_Int%d",iInt);
323 sprintf(title,"Pedestal (Int%d);Pedestal [ADC counts];Counts",iInt);
324 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax,kNPedestalBins,kPedestalMin ,kPedestalMax );
325 Add2RawsList(h2i,(iInt == 0 ? kPedestalInt0 : kPedestalInt1), expert, !image, !saveCorr); iHisto++;
327 // Creation of temporary Pedestal histo used for the mean versus time histogram. This histogram will be reset at the end of each cycle
328 sprintf(name,"H2I_Pedestal_CycleInt%d",iInt);
329 sprintf(title,"One Cycle Pedestal (Int%d);Pedestal [ADC counts];Counts",iInt);
330 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax,kNPedestalBins,kPedestalMin ,kPedestalMax );
331 Add2RawsList(h2i,(iInt == 0 ? kPedestalCycleInt0 : kPedestalCycleInt1), expert, !image, !saveCorr); iHisto++;
333 // Creation of Pedestal versus time graph.
334 sprintf(name,"H2D_Pedestal_Time_Int%d",iInt);
335 sprintf(title,"Pedestal Versus Time (Int%d);Time [ns];Pedestal [ADC counts]",iInt);
336 h2d = new TH2D(name, title,kNChannelBins, kChannelMin, kChannelMax,kTimeMax,kTimeMin ,kTimeMax );
337 Add2RawsList(h2d,(iInt == 0 ? kPedestalTimeInt0 : kPedestalTimeInt1), expert, !image, !saveCorr); iHisto++;
339 // Creation of Charge EoI histograms
340 sprintf(name,"H2I_ChargeEoI_Int%d",iInt);
341 sprintf(title,"Charge EoI (Int%d);Charge [ADC counts];Counts",iInt);
342 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, kChargeMax);
343 Add2RawsList(h2i,(iInt == 0 ? kChargeEoIInt0 : kChargeEoIInt1), expert, image, !saveCorr); iHisto++;
345 // Creation of temporary Charge EoI histograms used for the mean versus time histogram. This histogram will be reset at the end of each cycle
346 sprintf(name,"H2I_ChargeEoI_CycleInt%d",iInt);
347 sprintf(title,"One Cycle Charge EoI (Int%d);Charge [ADC counts];Counts",iInt);
348 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, kChargeMax);
349 Add2RawsList(h2i,(iInt == 0 ? kChargeEoICycleInt0 : kChargeEoICycleInt1), expert, !image, !saveCorr); iHisto++;
351 // Creation of Charge EoI versus time graphs
352 sprintf(name,"H2D_ChargeEoI_Time_Int%d",iInt);
353 sprintf(title,"Charge EoI Versus Time (Int%d);Time [ns];Charge [ADC counts]",iInt);
354 h2d = new TH2D(name, title,kNChannelBins, kChannelMin, kChannelMax,kTimeMax,kTimeMin ,kTimeMax );
355 Add2RawsList(h2d,(iInt == 0 ? kChargeEoITimeInt0 : kChargeEoITimeInt1), expert, !image, !saveCorr); iHisto++;
357 sprintf(name,"H2I_ChargeEoI_BB_Int%d",iInt);
358 sprintf(title,"Charge EoI w/ BB Flag (Int%d);??;Charge [ADC counts]",iInt);
359 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, kChargeMax);
360 Add2RawsList(h2i,(iInt == 0 ? kChargeEoIBBInt0 : kChargeEoIBBInt1), expert, !image, !saveCorr); iHisto++;
362 sprintf(name,"H2I_ChargeEoI_BG_Int%d",iInt);
363 sprintf(title,"Charge EoI w/ BG Flag (Int%d);??;Charge [ADC counts]",iInt);
364 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, kChargeMax);
365 Add2RawsList(h2i,(iInt == 0 ? kChargeEoIBGInt0: kChargeEoIBGInt1), expert, !image, !saveCorr); iHisto++;
367 // Creation of Charge versus LHC Clock histograms
368 sprintf(name,"H2D_ChargeVsClock_Int%d",iInt);
369 sprintf(title,"Charge Versus LHC-Clock (Int%d);Tine [ns];Charge [ADC counts]",iInt);
370 h2d = new TH2D(name, title,kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 );
371 Add2RawsList(h2d,(iInt == 0 ? kChargeVsClockInt0 : kChargeVsClockInt1 ), expert, !image, !saveCorr); iHisto++;
373 // Creation of Minimum Bias Charge histograms
374 for(Int_t iBB=0;iBB<2;iBB++){
375 for(Int_t iBG=0;iBG<2;iBG++){
376 sprintf(name,"H2I_ChargeMB_BB%d_BG%d_Int%d",iBB,iBG,iInt);
377 sprintf(title,"MB Charge (BB=%d, BG=%d, Int=%d);Charge [ADC counts];Counts",iBB,iBG,iInt);
378 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax,kNChargeBins, kChargeMin, kChargeMax);
382 if(iBG==0) idx = kChargeMBBB0BG0Int0;
383 else idx = kChargeMBBB0BG1Int0;
385 if(iBG==0) idx = kChargeMBBB1BG0Int0;
386 else idx = kChargeMBBB1BG1Int0;
390 if(iBG==0) idx = kChargeMBBB0BG0Int1;
391 else idx = kChargeMBBB0BG1Int1;
393 if(iBG==0) idx = kChargeMBBB1BG0Int1;
394 else idx = kChargeMBBB1BG1Int1;
397 Add2RawsList(h2i,idx, expert, !image, !saveCorr); iHisto++;
403 // Creation of Time histograms
404 sprintf(name,"H2I_Width");
405 sprintf(title,"HPTDC Width;Width [ns];Counts");
406 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax, kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax);
407 Add2RawsList(h2i,kWidth, expert, !image, !saveCorr); iHisto++;
409 sprintf(name,"H2I_Width_BB");
410 sprintf(title,"HPTDC Width w/ BB Flag condition;??;Width [ns]");
411 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax, kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax);
412 Add2RawsList(h2i,kWidthBB, expert, !image, !saveCorr); iHisto++;
414 sprintf(name,"H2I_Width_BG");
415 sprintf(title,"HPTDC Width w/ BG Flag condition??;Width [ns]");
416 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax, kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax);
417 Add2RawsList(h2i,kWidthBG, expert, !image, !saveCorr); iHisto++;
419 sprintf(name,"H2I_HPTDCTime");
420 sprintf(title,"HPTDC Time;??;Width [ns]");
421 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
422 Add2RawsList(h2i,kHPTDCTime, expert, image, !saveCorr); iHisto++;
424 sprintf(name,"H2I_HPTDCTime_BB");
425 sprintf(title,"HPTDC Time w/ BB Flag condition;??;Width [ns]");
426 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
427 Add2RawsList(h2i,kHPTDCTimeBB, expert, !image, !saveCorr); iHisto++;
429 sprintf(name,"H2I_HPTDCTime_BG");
430 sprintf(title,"HPTDC Time w/ BG Flag condition;??;Width [ns]");
431 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
432 Add2RawsList(h2i,kHPTDCTimeBG, expert, !image, !saveCorr); iHisto++;
434 sprintf(name,"H1D_V0A_Time");
435 sprintf(title,"V0A Time;Time [ns];Counts");
436 h1d = new TH1D(name, title,kNTdcTimeBins, kTdcTimeMin/10, kTdcTimeMax/10);
437 Add2RawsList(h1d,kV0ATime, expert, !image, saveCorr); iHisto++;
439 sprintf(name,"H1D_V0C_Time");
440 sprintf(title,"V0C Time;Time [ns];Counts");
441 h1d = new TH1D(name, title,kNTdcTimeBins, kTdcTimeMin/10, kTdcTimeMax/10);
442 Add2RawsList(h1d,kV0CTime, expert, !image, saveCorr); iHisto++;
444 sprintf(name,"H1D_Diff_Time");
445 sprintf(title,"Diff V0A-V0C Time;Time [ns];Counts");
446 h1d = new TH1D(name, title,2*kNTdcTimeBins, -kTdcTimeMax/10, kTdcTimeMax/10);
447 Add2RawsList(h1d,kDiffTime, expert, !image, saveCorr); iHisto++;
449 // Creation of Flag versus LHC Clock histograms
450 sprintf(name,"H2D_BBFlagVsClock");
451 sprintf(title,"BB-Flags Versus LHC-Clock;Time [ns];??");
452 h2d = new TH2D(name, title,kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 );
453 Add2RawsList(h2d,kBBFlagVsClock, expert, !image, !saveCorr); iHisto++;
455 sprintf(name,"H2D_BGFlagVsClock");
456 sprintf(title,"BG-Flags Versus LHC-Clock;Time [ns];??");
457 h2d = new TH2D(name, title,kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 );
458 Add2RawsList(h2d,kBGFlagVsClock, expert, !image, !saveCorr); iHisto++;
460 sprintf(name,"TREND_MeanChargePerRing");
461 sprintf(title,"Mean Charge per Event and per Ring versus time ");
462 trend = new AliVZEROTrending(name, title);
463 Add2RawsList(trend,kRawMeanChargePerRing, expert, !image, !saveCorr); iHisto++;
465 sprintf(name,"TREND_MeanFlagPerRing");
466 sprintf(title,"Mean Flag per Event and per Ring versus time ");
467 trend = new AliVZEROTrending(name, title);
468 Add2RawsList(trend,kRawMeanFlagPerRing, expert, !image, !saveCorr); iHisto++;
470 sprintf(name,"H1D_DQMFlag");
471 sprintf(title,"Current Flag per Event / Mean Flag per Event ");
472 h1d = new TH1D(name, title, kNChannelBins, kChannelMin, kChannelMax);
473 h1d->SetFillColor(29);
474 h1d->SetLineWidth(2);
475 h1d->GetXaxis()->SetLabelSize(0.06);
476 h1d->GetXaxis()->SetNdivisions(808,kFALSE);
477 h1d->GetXaxis()->SetBinLabel(4, "V0C");h1d->GetXaxis()->SetBinLabel(5, "R0");
478 h1d->GetXaxis()->SetBinLabel(12, "V0C");h1d->GetXaxis()->SetBinLabel(13, "R1");
479 h1d->GetXaxis()->SetBinLabel(20, "V0C");h1d->GetXaxis()->SetBinLabel(21, "R2");
480 h1d->GetXaxis()->SetBinLabel(28, "V0C");h1d->GetXaxis()->SetBinLabel(29, "R3");
481 h1d->GetXaxis()->SetBinLabel(36, "V0A");h1d->GetXaxis()->SetBinLabel(37, "R0");
482 h1d->GetXaxis()->SetBinLabel(44, "V0A");h1d->GetXaxis()->SetBinLabel(45, "R1");
483 h1d->GetXaxis()->SetBinLabel(52, "V0A");h1d->GetXaxis()->SetBinLabel(53, "R2");
484 h1d->GetXaxis()->SetBinLabel(60, "V0A");h1d->GetXaxis()->SetBinLabel(61, "R3");
485 h1d->GetXaxis()->CenterTitle();
486 h1d->GetXaxis()->SetTitleOffset(0.8);
487 h1d->GetXaxis()->SetNdivisions(808,kFALSE);
488 Add2RawsList(h1d,kRawDQMFlag, !expert, image, !saveCorr); iHisto++;
490 sprintf(name,"H1D_DQMCharge");
491 sprintf(title,"Current Charge per Event / Mean Charge per Event ");
492 h1d = new TH1D(name, title, kNChannelBins, kChannelMin, kChannelMax);
493 h1d->SetFillColor(29);
494 h1d->SetLineWidth(2);
495 h1d->GetXaxis()->SetLabelSize(0.06);
496 h1d->GetXaxis()->SetNdivisions(808,kFALSE);
497 h1d->GetXaxis()->SetBinLabel(4, "V0C");h1d->GetXaxis()->SetBinLabel(5, "R0");
498 h1d->GetXaxis()->SetBinLabel(12, "V0C");h1d->GetXaxis()->SetBinLabel(13, "R1");
499 h1d->GetXaxis()->SetBinLabel(20, "V0C");h1d->GetXaxis()->SetBinLabel(21, "R2");
500 h1d->GetXaxis()->SetBinLabel(28, "V0C");h1d->GetXaxis()->SetBinLabel(29, "R3");
501 h1d->GetXaxis()->SetBinLabel(36, "V0A");h1d->GetXaxis()->SetBinLabel(37, "R0");
502 h1d->GetXaxis()->SetBinLabel(44, "V0A");h1d->GetXaxis()->SetBinLabel(45, "R1");
503 h1d->GetXaxis()->SetBinLabel(52, "V0A");h1d->GetXaxis()->SetBinLabel(53, "R2");
504 h1d->GetXaxis()->SetBinLabel(60, "V0A");h1d->GetXaxis()->SetBinLabel(61, "R3");
505 h1d->GetXaxis()->CenterTitle();
506 h1d->GetXaxis()->SetTitleOffset(0.8);
507 h1d->GetXaxis()->SetNdivisions(808,kFALSE);
508 Add2RawsList(h1d,kRawDQMCharge, !expert, image, !saveCorr); iHisto++;
510 AliDebug(AliQAv1::GetQADebugLevel(), Form("%d Histograms has been added to the Raws List",iHisto));
513 //____________________________________________________________________________
514 void AliVZEROQADataMakerRec::InitDigits()
516 // create Digits histograms in Digits subdir
517 const Bool_t expert = kTRUE ;
518 const Bool_t image = kTRUE ;
526 // create Digits histograms in Digits subdir
527 TH1I * h0 = new TH1I("hDigitMultiplicity", "Digits multiplicity distribution in VZERO;# of Digits;Entries", 100, 0, 99) ;
529 Add2DigitsList(h0, 0, !expert, image) ;
531 for (Int_t i=0; i<64; i++)
533 sprintf(TDCname, "hDigitTDC%d", i);
534 sprintf(texte,"Digit TDC in cell %d; TDC value;Entries",i);
535 fhDigTDC[i] = new TH1I(TDCname,texte,300,0.,149.);
537 sprintf(ADCname,"hDigitADC%d",i);
538 sprintf(texte,"Digit ADC in cell %d;ADC value;Entries",i);
539 fhDigADC[i]= new TH1I(ADCname,texte,1024,0.,1023.);
541 Add2DigitsList(fhDigTDC[i],i+1, !expert, image);
542 Add2DigitsList(fhDigADC[i],i+1+64, !expert, image);
546 //____________________________________________________________________________
547 void AliVZEROQADataMakerRec::MakeDigits()
549 // makes data from Digits
551 GetDigitsData(0)->Fill(fDigitsArray->GetEntriesFast()) ;
552 TIter next(fDigitsArray) ;
553 AliVZEROdigit *VZERODigit ;
554 while ( (VZERODigit = dynamic_cast<AliVZEROdigit *>(next())) ) {
555 Int_t PMNumber = VZERODigit->PMNumber();
556 GetDigitsData(PMNumber +1)->Fill( VZERODigit->Time()) ; // in 100 of picoseconds
557 GetDigitsData(PMNumber +1+64)->Fill( VZERODigit->ADC()) ;
562 //____________________________________________________________________________
563 void AliVZEROQADataMakerRec::MakeDigits(TTree *digitTree)
565 // makes data from Digit Tree
568 fDigitsArray->Clear() ;
570 fDigitsArray = new TClonesArray("AliVZEROdigit", 1000) ;
572 TBranch * branch = digitTree->GetBranch("VZERODigit") ;
574 AliWarning("VZERO branch in Digit Tree not found") ;
576 branch->SetAddress(&fDigitsArray) ;
577 branch->GetEntry(0) ;
583 //____________________________________________________________________________
584 void AliVZEROQADataMakerRec::MakeESDs(AliESDEvent * esd)
586 // Creates QA data from ESDs
588 UInt_t eventType = esd->GetEventType();
592 AliESDVZERO *esdVZERO=esd->GetVZEROData();
594 if (!esdVZERO) break;
596 GetESDsData(kCellMultiV0A)->Fill(esdVZERO->GetNbPMV0A());
597 GetESDsData(kCellMultiV0C)->Fill(esdVZERO->GetNbPMV0C());
598 GetESDsData(kMIPMultiV0A)->Fill(esdVZERO->GetMTotV0A());
599 GetESDsData(kMIPMultiV0C)->Fill(esdVZERO->GetMTotV0C());
601 Float_t timeV0A = 0., timeV0C = 0., diffTime;
602 Int_t iTimeV0A = 0, iTimeV0C = 0;
604 for(Int_t i=0;i<64;i++) {
605 GetESDsData(kMIPMultiChannel)->Fill((Float_t) i,(Float_t) esdVZERO->GetMultiplicity(i));
606 GetESDsData(kChargeChannel)->Fill((Float_t) i,(Float_t) esdVZERO->GetAdc(i));
607 if(esdVZERO->GetBBFlag(i)) GetESDsData(kBBFlag)->Fill((Float_t) i);
608 if(esdVZERO->GetBGFlag(i)) GetESDsData(kBGFlag)->Fill((Float_t) i);
610 Float_t time = (Float_t) esdVZERO->GetTime(i)/10.; //Convert in ns: 1 TDC channel = 100ps
611 GetESDsData(kTimeChannel)->Fill((Float_t) i,time);
623 if(iTimeV0A>0) timeV0A /= iTimeV0A;
625 if(iTimeV0C>0) timeV0C /= iTimeV0C;
627 if(timeV0A<0. || timeV0C<0.) diffTime = -10000.;
628 else diffTime = timeV0A - timeV0C;
630 GetESDsData(kESDV0ATime)->Fill(timeV0A);
631 GetESDsData(kESDV0CTime)->Fill(timeV0C);
632 GetESDsData(kESDDiffTime)->Fill(diffTime);
639 //____________________________________________________________________________
640 void AliVZEROQADataMakerRec::MakeRaws(AliRawReader* rawReader)
642 // Fills histograms with Raws, computes average ADC values dynamically (pedestal subtracted)
644 // Check id histograms already created for this Event Specie
645 if ( ! GetRawsData(kPedestalInt0) )
649 AliVZERORawStream* rawStream = new AliVZERORawStream(rawReader);
650 if(!(rawStream->Next())) return;
652 eventTypeType eventType = rawReader->GetType();
656 Double_t timeV0A =0., timeV0C = 0.;
657 UInt_t itimeV0A=0, itimeV0C=0;
658 Double_t chargeV0A=0., chargeV0C=0.;
659 Double_t mipV0A=0., mipV0C=0.;
661 Double_t diffTime=-100000.;
669 if(fNSubEvents++>=fTrendingUpdateEvent && fTrendingUpdateEvent>0) {
684 for(Int_t iChannel=0; iChannel<64; iChannel++) { // BEGIN : Loop over channels
686 offlineCh = rawStream->GetOfflineChannel(iChannel);
688 // Fill Pedestal histograms
690 for(Int_t j=15; j<21; j++) {
691 if((rawStream->GetBGFlag(iChannel,j) || rawStream->GetBBFlag(iChannel,j))) iFlag++;
694 if(iFlag == 0){ //No Flag found
695 for(Int_t j=15; j<21; j++){
696 pedestal= (Int_t) rawStream->GetPedestal(iChannel, j);
697 integrator = rawStream->GetIntegratorFlag(iChannel, j);
699 GetRawsData((integrator == 0 ? kPedestalInt0 : kPedestalInt1))->Fill(offlineCh,pedestal);
700 GetRawsData((integrator == 0 ? kPedestalCycleInt0 : kPedestalCycleInt1))->Fill(offlineCh,pedestal);
704 // Fill Charge EoI histograms
706 // Look for the maximum in the LHC clock train
710 for(Int_t iEvent=0; iEvent<21; iEvent++){
711 iCharge = rawStream->GetPedestal(iChannel,iEvent);
716 } // End of maximum searching procedure
718 integrator = rawStream->GetIntegratorFlag(iChannel,iClock);
719 BBFlag = rawStream->GetBBFlag(iChannel, iClock);
720 BGFlag = rawStream->GetBGFlag(iChannel,iClock );
722 GetRawsData((integrator == 0 ? kChargeEoIInt0 : kChargeEoIInt1))->Fill(offlineCh,charge);
723 if(BBFlag) GetRawsData((integrator == 0 ? kChargeEoIBBInt0 : kChargeEoIBBInt1))->Fill(offlineCh,charge);
724 if(BGFlag) GetRawsData((integrator == 0 ? kChargeEoIBGInt0 : kChargeEoIBGInt1))->Fill(offlineCh,charge);
726 hProj = ((TH2I*)GetRawsData((integrator == 0 ? kPedestalInt0 : kPedestalInt1)))->ProjectionY("",offlineCh+1,offlineCh+1);
727 Double_t ped = hProj->GetMean();
728 Double_t sigma = hProj->GetRMS();
731 Double_t chargeEoI = charge - ped;
733 // Calculation of the number of MIP
734 Double_t mipEoI = chargeEoI * fCalibData->GetMIPperADC(offlineCh);
736 int side = offlineCh/32;
737 int ring = (offlineCh - 32*side) / 8;
739 fFlagPerRing[side*4 + ring] += 1;
740 fFlagPerChannel[offlineCh] += 1;
743 if(charge<1023 && chargeEoI > 5.*sigma){
744 fChargePerRing[side*4 + ring] += chargeEoI;
745 fChargePerChannel[offlineCh] += chargeEoI;
746 ((TH2I*)GetRawsData((integrator == 0 ? kChargeEoICycleInt0 : kChargeEoICycleInt1)))->Fill(offlineCh,chargeEoI);
747 ((TH2D*)GetRawsData(kRawMIPChannel))->Fill(offlineCh,mipEoI);
750 chargeV0C += chargeEoI;
754 chargeV0A += chargeEoI;
759 // Fill Charge Minimum Bias Histograms
762 for(Int_t iBunch=0; iBunch<10; iBunch++){
763 integrator = rawStream->GetIntMBFlag(iChannel, iBunch);
764 BBFlag = rawStream->GetBBMBFlag(iChannel, iBunch);
765 BGFlag = rawStream->GetBGMBFlag(iChannel, iBunch);
766 MBCharge = rawStream->GetChargeMB(iChannel, iBunch);
770 if(BGFlag==0) idx = kChargeMBBB0BG0Int0;
771 else idx = kChargeMBBB0BG1Int0;
773 if(BGFlag==0) idx = kChargeMBBB1BG0Int0;
774 else idx = kChargeMBBB1BG1Int0;
778 if(BGFlag==0) idx = kChargeMBBB0BG0Int1;
779 else idx = kChargeMBBB0BG1Int1;
781 if(BGFlag==0) idx = kChargeMBBB1BG0Int1;
782 else idx = kChargeMBBB1BG1Int1;
785 GetRawsData(idx)->Fill(offlineCh,MBCharge);
788 // Fill HPTDC Time Histograms
790 BBFlag = rawStream->GetBBFlag(iChannel, 10);
791 BGFlag = rawStream->GetBGFlag(iChannel, 10);
792 time = rawStream->GetTime(iChannel);
793 width = rawStream->GetWidth(iChannel);
804 GetRawsData(kHPTDCTime)->Fill(offlineCh,time);
805 GetRawsData(kWidth)->Fill(offlineCh,width);
807 GetRawsData(kHPTDCTimeBB)->Fill(offlineCh,time);
808 GetRawsData(kWidthBB)->Fill(offlineCh,width);
811 GetRawsData(kHPTDCTimeBG)->Fill(offlineCh,time);
812 GetRawsData(kWidthBG)->Fill(offlineCh,width);
815 // Fill Flag and Charge Versus LHC-Clock histograms
817 for(Int_t iEvent=0; iEvent<21; iEvent++){
818 charge = rawStream->GetPedestal(iChannel,iEvent);
819 integrator = rawStream->GetIntegratorFlag(iChannel,iEvent);
820 BBFlag = rawStream->GetBBFlag(iChannel, iEvent);
821 BGFlag = rawStream->GetBGFlag(iChannel,iEvent );
823 ((TH2*) GetRawsData((integrator == 0 ? kChargeVsClockInt0 : kChargeVsClockInt1 )))->Fill(offlineCh,(float)iEvent-10,(float)charge);
824 ((TH2*) GetRawsData(kBBFlagVsClock))->Fill(offlineCh,(float)iEvent-10,(float)BBFlag);
825 ((TH2*) GetRawsData(kBGFlagVsClock))->Fill(offlineCh,(float)iEvent-10,(float)BGFlag);
828 }// END of Loop over channels
830 if(itimeV0A>0) timeV0A /= (itimeV0A * 10); // itimeV0A Channels and divide by 10 to have the result in ns because 1 TDC Channel = 100 ps
832 if(itimeV0C>0) timeV0C /= (itimeV0C * 10);
834 if(timeV0A<0. || timeV0C<0.) diffTime = -10000.;
835 else diffTime = timeV0A - timeV0C;
837 GetRawsData(kV0ATime)->Fill(timeV0A);
838 GetRawsData(kV0CTime)->Fill(timeV0C);
839 GetRawsData(kDiffTime)->Fill(diffTime);
841 GetRawsData(kMultiV0A)->Fill(mulV0A);
842 GetRawsData(kMultiV0C)->Fill(mulV0C);
844 GetRawsData(kChargeV0A)->Fill(chargeV0A);
845 GetRawsData(kChargeV0C)->Fill(chargeV0C);
846 GetRawsData(kChargeV0)->Fill(chargeV0A + chargeV0C);
848 GetRawsData(kRawMIPV0A)->Fill(mipV0A);
849 GetRawsData(kRawMIPV0C)->Fill(mipV0C);
850 GetRawsData(kRawMIPV0)->Fill(mipV0A + mipV0C);
853 } // END of SWITCH : EVENT TYPE
856 TParameter<double> * p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kMultiV0A)->GetName()))) ;
857 if (p) p->SetVal((double)mulV0A) ;
859 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kMultiV0C)->GetName()))) ;
860 if (p) p->SetVal((double)mulV0C) ;
862 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kChargeV0A)->GetName()))) ;
863 if (p) p->SetVal((double)chargeV0A) ;
865 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kChargeV0C)->GetName()))) ;
866 if (p) p->SetVal((double)chargeV0C) ;
868 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kChargeV0)->GetName()))) ;
869 if (p) p->SetVal((double)(chargeV0A + chargeV0C)) ;
871 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kRawMIPV0A)->GetName()))) ;
872 if (p) p->SetVal((double)mipV0A) ;
874 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kRawMIPV0C)->GetName()))) ;
875 if (p) p->SetVal((double)mipV0C) ;
877 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kRawMIPV0)->GetName()))) ;
878 if (p) p->SetVal((double)(mipV0A + mipV0C)) ;
880 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kV0ATime)->GetName()))) ;
881 if (p) p->SetVal((double)timeV0A) ;
883 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kV0CTime)->GetName()))) ;
884 if (p) p->SetVal((double)timeV0C) ;
886 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kDiffTime)->GetName()))) ;
887 if (p) p->SetVal((double)diffTime) ;
889 delete rawStream; rawStream = 0x0;
894 //____________________________________________________________________________
895 void AliVZEROQADataMakerRec::StartOfDetectorCycle()
897 // Detector specific actions at start of cycle
899 // Reset of the histogram used - to have the trend versus time -
901 fCalibData = GetCalibData();
904 h = GetRawsData(kPedestalCycleInt0);
906 h = GetRawsData(kPedestalCycleInt1);
908 h = GetRawsData(kChargeEoICycleInt0);
910 h = GetRawsData(kChargeEoICycleInt1);
913 TTimeStamp currentTime;
914 fCycleStartTime = currentTime.GetSec();
919 //-------------------------------------------------------------------------------------------------
920 void AliVZEROQADataMakerRec::AddTrendingEntry(){
921 //printf("AddTrendingEntry\n");
924 // Normalize to the number of events
925 for(int i=0; i<8;i++){
926 // fChargePerRing[i] *= TMath::Power(10.,i)/fTrendingUpdateEvent;
927 // fFlagPerRing[i] *= TMath::Power(10.,i)/fTrendingUpdateEvent;
928 fChargePerRing[i] /= fTrendingUpdateEvent;
929 fFlagPerRing[i] /= fTrendingUpdateEvent;
932 GetRawsData(kRawDQMCharge)->Reset();
933 GetRawsData(kRawDQMFlag)->Reset();
935 for(int i=0; i<64;i++){
936 fChargePerChannel[i] /= fTrendingUpdateEvent;
937 fFlagPerChannel[i] /= fTrendingUpdateEvent;
939 if(fMeanChargePerChannel[i]) GetRawsData(kRawDQMCharge)->Fill(i,fChargePerChannel[i]/fMeanChargePerChannel[i]);
940 else GetRawsData(kRawDQMCharge)->Fill(i,0.);
942 if(fMeanFlagPerChannel[i]) GetRawsData(kRawDQMFlag)->Fill(i,fFlagPerChannel[i]/fMeanFlagPerChannel[i]);
943 else GetRawsData(kRawDQMFlag)->Fill(i,0.);
945 fMeanChargePerChannel[i] = (fMeanChargePerChannel[i] * (fNTrendingUpdates-1) + fChargePerChannel[i]) / fNTrendingUpdates;
946 fMeanFlagPerChannel[i] = (fMeanFlagPerChannel[i] * (fNTrendingUpdates-1) + fFlagPerChannel[i]) / fNTrendingUpdates;
950 TTimeStamp currentTime;
951 ((AliVZEROTrending*)GetRawsData(kRawMeanChargePerRing))->AddEntry(fChargePerRing, currentTime.GetSec());
952 ((AliVZEROTrending*)GetRawsData(kRawMeanFlagPerRing))->AddEntry(fFlagPerRing, currentTime.GetSec());
953 //moMeanFlagPerRing->AddEntry(fFlagPerRing, currentTime.GetSec());
955 // Put back counters to zero
956 for(int i=0; i<8;i++){
957 fChargePerRing[i] = 0.;
958 fFlagPerRing[i] = 0.;
960 for(int i=0; i<64;i++){
961 fChargePerChannel[i] = 0.;
962 fFlagPerChannel[i] = 0.;