correct binError calc + check that histograms exist before trying to use them
[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>
25#include <TH1F.h>
26#include <TH1I.h>
4da80b8c 27#include <TH2I.h>
9bd82f77 28#include <TH2D.h>
29#include <TGraph.h>
f81355e3 30#include <TParameter.h>
a8e23456 31#include <TTimeStamp.h>
508b9fc0 32
33// --- Standard library ---
34
35// --- AliRoot header files ---
36#include "AliESDEvent.h"
37#include "AliLog.h"
1e376713 38#include "AliCDBManager.h"
39#include "AliCDBStorage.h"
40#include "AliCDBEntry.h"
508b9fc0 41#include "AliVZEROQADataMakerRec.h"
42#include "AliQAChecker.h"
4da80b8c 43#include "AliRawReader.h"
508b9fc0 44#include "AliVZERORawStream.h"
5192f264 45#include "AliVZEROdigit.h"
508b9fc0 46#include "AliVZEROReconstructor.h"
a8e23456 47#include "AliVZEROTrending.h"
e58b4e66 48#include "AliVZEROCalibData.h"
9bd82f77 49#include "event.h"
508b9fc0 50
51
52ClassImp(AliVZEROQADataMakerRec)
53
54//____________________________________________________________________________
55 AliVZEROQADataMakerRec::AliVZEROQADataMakerRec() :
4e25ac79 56 AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kVZERO), "VZERO Quality Assurance Data Maker"),
9bd82f77 57 fCalibData(0x0),
3dc953e2 58 fEvent(0),
59 fNTotEvents(0),
60 fNSubEvents(0),
61 fTrendingUpdateEvent(0),
62 fNTrendingUpdates(0),
63 fTrendingUpdateTime(0),
64 fCycleStartTime(0),
65 fCycleStopTime(0),
66 fMonitorRate(0.)
1e376713 67
508b9fc0 68{
6bec7c7c 69 // Constructor
70
5379c4a3 71 AliDebug(AliQAv1::GetQADebugLevel(), "Construct VZERO QA Object");
a8e23456 72 for(Int_t i=0;i<8;i++){
73 fChargePerRing[i] = 0.;
74 fFlagPerRing[i] = 0.;
75 }
1e376713 76 for(Int_t i=0; i<64; i++){
77 fEven[i] = 0;
3dc953e2 78 fOdd[i] = 0;
79 fChargePerChannel[i] = 0.;
80 fFlagPerChannel[i] = 0.;
81 fMeanChargePerChannel[i] = 0.;
82 fMeanFlagPerChannel[i] = 0.;
83 }
1e376713 84
85 for(Int_t i=0; i<128; i++){
6bec7c7c 86 fADCmean[i] = 0.0; }
508b9fc0 87}
88
89//____________________________________________________________________________
1e376713 90 AliVZEROQADataMakerRec::AliVZEROQADataMakerRec(const AliVZEROQADataMakerRec& qadm) :
91 AliQADataMakerRec(),
9bd82f77 92 fCalibData(0x0),
3dc953e2 93 fEvent(0),
94 fNTotEvents(0),
95 fNSubEvents(0),
96 fTrendingUpdateEvent(0),
97 fNTrendingUpdates(0),
98 fTrendingUpdateTime(0),
99 fCycleStartTime(0),
100 fCycleStopTime(0),
101 fMonitorRate(0.)
1e376713 102
508b9fc0 103{
6bec7c7c 104 // Copy constructor
105
1e376713 106 SetName((const char*)qadm.GetName()) ;
107 SetTitle((const char*)qadm.GetTitle());
508b9fc0 108}
109
110//__________________________________________________________________
111AliVZEROQADataMakerRec& AliVZEROQADataMakerRec::operator = (const AliVZEROQADataMakerRec& qadm )
112{
113 // Equal operator
6bec7c7c 114
508b9fc0 115 this->~AliVZEROQADataMakerRec();
116 new(this) AliVZEROQADataMakerRec(qadm);
117 return *this;
118}
1e376713 119
120//____________________________________________________________________________
121AliVZEROCalibData* AliVZEROQADataMakerRec::GetCalibData() const
122
123{
5f650de8 124 AliCDBManager *man = AliCDBManager::Instance();
6bec7c7c 125
5f650de8 126 AliCDBEntry *entry=0;
1e376713 127
5f650de8 128 entry = man->Get("VZERO/Calib/Data",fRun);
129 if(!entry){
130 AliWarning("Load of calibration data from default storage failed!");
131 AliWarning("Calibration data will be loaded from local storage ($ALICE_ROOT)");
132
133 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
134 entry = man->Get("VZERO/Calib/Data",fRun);
135 }
136 // Retrieval of data in directory VZERO/Calib/Data:
1e376713 137
5f650de8 138 AliVZEROCalibData *calibdata = 0;
1e376713 139
5f650de8 140 if (entry) calibdata = (AliVZEROCalibData*) entry->GetObject();
141 if (!calibdata) AliFatal("No calibration data from calibration database !");
1e376713 142
5f650de8 143 return calibdata;
1e376713 144}
5f650de8 145
146
508b9fc0 147
148//____________________________________________________________________________
4e25ac79 149void AliVZEROQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
508b9fc0 150{
6bec7c7c 151 // Detector specific actions at end of cycle
152 // Does the QA checking
153
4e25ac79 154 AliQAChecker::Instance()->Run(AliQAv1::kVZERO, task, list) ;
a8e23456 155
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) {
163 update = kTRUE;
164 } else if ((TMath::Abs(fTrendingUpdateTime * fMonitorRate - fTrendingUpdateEvent) / fTrendingUpdateEvent) > 0.1){
165 update = kTRUE;
166 }
e58b4e66 167 if(update) fTrendingUpdateEvent = (size_t)(fTrendingUpdateTime * fMonitorRate);
a8e23456 168 //printf("Update trending information every %d events\n",fTrendingUpdateEvent);
169
170 }
57acd2d2 171
172 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
6252ceeb 173 if (! IsValidEventSpecie(specie, list))
eca4fa66 174 continue ;
5e232cd6 175 SetEventSpecie(AliRecoParam::ConvertIndex(specie)) ;
4e25ac79 176 if(task == AliQAv1::kRAWS){
6bec7c7c 177 int nMaxBin = GetRawsData(kPedestalTimeInt0)->GetNbinsY();
57acd2d2 178 if(fCurrentCycle%nMaxBin==0) {
179 GetRawsData(kPedestalTimeInt0)->Reset();
180 GetRawsData(kPedestalTimeInt1)->Reset();
181 GetRawsData(kChargeEoITimeInt0)->Reset();
182 GetRawsData(kChargeEoITimeInt1)->Reset();
183 }
184 TH1D* hProj;
185 char name[50];
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());
191 delete hProj;
192
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());
196 delete hProj;
197 }
198 }
4e25ac79 199 } else if (task == AliQAv1::kESDS) {
57acd2d2 200 }
9bd82f77 201 }
508b9fc0 202}
203
204//____________________________________________________________________________
205void AliVZEROQADataMakerRec::InitESDs()
206{
6bec7c7c 207 // Creates histograms to control ESDs
208
7d297381 209 const Bool_t expert = kTRUE ;
210 const Bool_t image = kTRUE ;
9bd82f77 211
6bec7c7c 212 TH2D * h2d;
213 TH1I * h1i;
214 TH1D * h1d;
9bd82f77 215
db72ff3b 216 h1i = new TH1I("H1I_Cell_Multiplicity_V0A", "Cell Multiplicity in V0A;Multiplicity (Nb of Cell);Counts", 35, 0, 35) ;
7d297381 217 Add2ESDsList(h1i, kCellMultiV0A, !expert, image) ;
4da80b8c 218
db72ff3b 219 h1i = new TH1I("H1I_Cell_Multiplicity_V0C", "Cell Multiplicity in V0;Multiplicity (Nb of Cell);Counts", 35, 0, 35) ;
7d297381 220 Add2ESDsList(h1i, kCellMultiV0C, !expert, image) ;
9bd82f77 221
db72ff3b 222 h1d = new TH1D("H1D_MIP_Multiplicity_V0A", "MIP Multiplicity in V0A;Multiplicity (Nb of MIP);Counts", 1000, 0, 1000) ;
7d297381 223 Add2ESDsList(h1d, kMIPMultiV0A, !expert, image) ;
9bd82f77 224
db72ff3b 225 h1d = new TH1D("H1D_MIP_Multiplicity_V0C", "MIP Multiplicity in V0C;Multiplicity (Nb of MIP);Counts", 1000, 0, 1000) ;
7d297381 226 Add2ESDsList(h1d, kMIPMultiV0C, !expert, image) ;
28fdf12c 227
db72ff3b 228 h2d = new TH2D("H2D_MIP_Multiplicity_Channel", "MIP Multiplicity per Channel;Channel;Multiplicity (Nb of MIP)",64, 0, 64, 100, 0, 100) ;
7d297381 229 Add2ESDsList(h2d, kMIPMultiChannel, !expert, image) ;
9bd82f77 230
db72ff3b 231 h1d = new TH1D("H1D_BBFlag_Counters", "BB Flag Counters;Channel;Counts",64, 0, 64) ;
7d297381 232 Add2ESDsList(h1d, kBBFlag, !expert, image) ;
9bd82f77 233
db72ff3b 234 h1d = new TH1D("H1D_BGFlag_Counters", "BG Flag Counters;Channel;Counts",64, 0, 64) ;
7d297381 235 Add2ESDsList(h1d, kBGFlag, !expert, image) ;
9bd82f77 236
db72ff3b 237 h2d = new TH2D("H2D_Charge_Channel", "ADC Charge per channel;Channel;Charge (ADC counts)",64, 0, 64, 1024, 0, 1024) ;
7d297381 238 Add2ESDsList(h2d, kChargeChannel, !expert, image) ;
9bd82f77 239
db72ff3b 240 h2d = new TH2D("H2D_Time_Channel", "Time per channel;Channel;Time (ns)",64, 0, 64, 820, 0, 410) ;
7d297381 241 Add2ESDsList(h2d, kTimeChannel, !expert, image) ;
9bd82f77 242
db72ff3b 243 h1d = new TH1D("H1D_V0A_Time", "Mean V0A Time;Time (ns);Counts",2048, 0., 409.6);
7d297381 244 Add2ESDsList(h1d,kESDV0ATime, !expert, image);
9bd82f77 245
db72ff3b 246 h1d = new TH1D("H1D_V0C_Time", "Mean V0C Time;Time (ns);Counts",2048, 0., 409.6);
7d297381 247 Add2ESDsList(h1d,kESDV0CTime, !expert, image);
9bd82f77 248
db72ff3b 249 h1d = new TH1D("H1D_Diff_Time", "Diff Time V0A - V0C;Diff Time V0A - V0C (ns);Counts",2*2048, -409.6, 409.6);
7d297381 250 Add2ESDsList(h1d,kESDDiffTime, !expert, image);
9bd82f77 251
28fdf12c 252}
508b9fc0 253
254//____________________________________________________________________________
4da80b8c 255 void AliVZEROQADataMakerRec::InitRaws()
256 {
6bec7c7c 257 // Creates RAW histograms in Raws subdir
3dc953e2 258
7d297381 259 const Bool_t expert = kTRUE ;
260 const Bool_t saveCorr = kTRUE ;
261 const Bool_t image = kTRUE ;
9bd82f77 262
6bec7c7c 263 char name[50] , title[100];
264 const Int_t kNintegrator = 2;
9bd82f77 265
6bec7c7c 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;
286
287 TH2I * h2i;
288 TH2D * h2d;
289 TH1I * h1i;
290 TH1D * h1d;
a8e23456 291 AliVZEROTrending * trend;
6bec7c7c 292
293 int iHisto =0;
9bd82f77 294
6bec7c7c 295 // Creation of Cell Multiplicity Histograms
db72ff3b 296 h1i = new TH1I("H1I_Multiplicity_V0A", "Cell Multiplicity in V0A;# of Cells;Entries", 35, 0, 35) ;
74995017 297 Add2RawsList(h1i,kMultiV0A, expert, image, saveCorr); iHisto++;
db72ff3b 298 h1i = new TH1I("H1I_Multiplicity_V0C", "Cell Multiplicity in V0C;# of Cells;Entries", 35, 0, 35) ;
74995017 299 Add2RawsList(h1i,kMultiV0C, expert, image, saveCorr); iHisto++;
9bd82f77 300
6bec7c7c 301 // Creation of Total Charge Histograms
db72ff3b 302 h1d = new TH1D("H1D_Charge_V0A", "Total Charge in V0A;Charge [ADC counts];Counts", 2048, 0, 32768) ;
74995017 303 Add2RawsList(h1d,kChargeV0A, expert, image, saveCorr); iHisto++;
db72ff3b 304 h1d = new TH1D("H1D_Charge_V0C", "Total Charge in V0C;Charge [ADC counts];Counts", 2048, 0, 32768) ;
74995017 305 Add2RawsList(h1d,kChargeV0C, expert, image, saveCorr); iHisto++;
db72ff3b 306 h1d = new TH1D("H1D_Charge_V0", "Total Charge in V0;Charge [ADC counts];Counts", 2048, 0, 65536) ;
74995017 307 Add2RawsList(h1d,kChargeV0, expert, image, saveCorr); iHisto++;
9bd82f77 308
309 // Creation of MIP Histograms
db72ff3b 310 h1d = new TH1D("H1D_MIP_V0A", "Total MIP in V0A;Charge [MIP];Counts", 2*kNMIPBins,kMIPMin ,32*kMIPMax) ;
74995017 311 Add2RawsList(h1d,kRawMIPV0A, expert, image, saveCorr); iHisto++;
db72ff3b 312 h1d = new TH1D("H1D_MIP_V0C", "Total MIP in V0C;Charge [MIP];Counts", 2*kNMIPBins,kMIPMin ,32*kMIPMax) ;
74995017 313 Add2RawsList(h1d,kRawMIPV0C, expert, image, saveCorr); iHisto++;
db72ff3b 314 h1d = new TH1D("H1D_MIP_V0", "Total MIP in V0;Charge [MIP];Counts", 2*kNMIPBins,kMIPMin ,32*kMIPMax) ;
74995017 315 Add2RawsList(h1d,kRawMIPV0, expert, image, saveCorr); iHisto++;
db72ff3b 316 h2d = new TH2D("H2D_MIP_Channel", "Nb of MIP per channel;Channel;# of Mips", kNChannelBins, kChannelMin, kChannelMax,kNMIPBins,kMIPMin ,kMIPMax) ;
7d297381 317 Add2RawsList(h2d,kRawMIPChannel, expert, !image, !saveCorr); iHisto++;
9bd82f77 318
319
d62942e8 320 for(Int_t iInt=0;iInt<kNintegrator;iInt++){
9bd82f77 321 // Creation of Pedestal histograms
6bec7c7c 322 sprintf(name,"H2I_Pedestal_Int%d",iInt);
db72ff3b 323 sprintf(title,"Pedestal (Int%d);Pedestal [ADC counts];Counts",iInt);
6bec7c7c 324 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax,kNPedestalBins,kPedestalMin ,kPedestalMax );
7d297381 325 Add2RawsList(h2i,(iInt == 0 ? kPedestalInt0 : kPedestalInt1), expert, !image, !saveCorr); iHisto++;
9bd82f77 326
6bec7c7c 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);
db72ff3b 329 sprintf(title,"One Cycle Pedestal (Int%d);Pedestal [ADC counts];Counts",iInt);
6bec7c7c 330 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax,kNPedestalBins,kPedestalMin ,kPedestalMax );
7d297381 331 Add2RawsList(h2i,(iInt == 0 ? kPedestalCycleInt0 : kPedestalCycleInt1), expert, !image, !saveCorr); iHisto++;
9bd82f77 332
6bec7c7c 333 // Creation of Pedestal versus time graph.
334 sprintf(name,"H2D_Pedestal_Time_Int%d",iInt);
db72ff3b 335 sprintf(title,"Pedestal Versus Time (Int%d);Time [ns];Pedestal [ADC counts]",iInt);
6bec7c7c 336 h2d = new TH2D(name, title,kNChannelBins, kChannelMin, kChannelMax,kTimeMax,kTimeMin ,kTimeMax );
7d297381 337 Add2RawsList(h2d,(iInt == 0 ? kPedestalTimeInt0 : kPedestalTimeInt1), expert, !image, !saveCorr); iHisto++;
9bd82f77 338
339 // Creation of Charge EoI histograms
6bec7c7c 340 sprintf(name,"H2I_ChargeEoI_Int%d",iInt);
db72ff3b 341 sprintf(title,"Charge EoI (Int%d);Charge [ADC counts];Counts",iInt);
6bec7c7c 342 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, kChargeMax);
74995017 343 Add2RawsList(h2i,(iInt == 0 ? kChargeEoIInt0 : kChargeEoIInt1), expert, image, !saveCorr); iHisto++;
9bd82f77 344
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
6bec7c7c 346 sprintf(name,"H2I_ChargeEoI_CycleInt%d",iInt);
db72ff3b 347 sprintf(title,"One Cycle Charge EoI (Int%d);Charge [ADC counts];Counts",iInt);
6bec7c7c 348 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, kChargeMax);
7d297381 349 Add2RawsList(h2i,(iInt == 0 ? kChargeEoICycleInt0 : kChargeEoICycleInt1), expert, !image, !saveCorr); iHisto++;
9bd82f77 350
6bec7c7c 351 // Creation of Charge EoI versus time graphs
352 sprintf(name,"H2D_ChargeEoI_Time_Int%d",iInt);
db72ff3b 353 sprintf(title,"Charge EoI Versus Time (Int%d);Time [ns];Charge [ADC counts]",iInt);
6bec7c7c 354 h2d = new TH2D(name, title,kNChannelBins, kChannelMin, kChannelMax,kTimeMax,kTimeMin ,kTimeMax );
7d297381 355 Add2RawsList(h2d,(iInt == 0 ? kChargeEoITimeInt0 : kChargeEoITimeInt1), expert, !image, !saveCorr); iHisto++;
f81355e3 356
6bec7c7c 357 sprintf(name,"H2I_ChargeEoI_BB_Int%d",iInt);
db72ff3b 358 sprintf(title,"Charge EoI w/ BB Flag (Int%d);??;Charge [ADC counts]",iInt);
6bec7c7c 359 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, kChargeMax);
7d297381 360 Add2RawsList(h2i,(iInt == 0 ? kChargeEoIBBInt0 : kChargeEoIBBInt1), expert, !image, !saveCorr); iHisto++;
f81355e3 361
6bec7c7c 362 sprintf(name,"H2I_ChargeEoI_BG_Int%d",iInt);
db72ff3b 363 sprintf(title,"Charge EoI w/ BG Flag (Int%d);??;Charge [ADC counts]",iInt);
6bec7c7c 364 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, kChargeMax);
7d297381 365 Add2RawsList(h2i,(iInt == 0 ? kChargeEoIBGInt0: kChargeEoIBGInt1), expert, !image, !saveCorr); iHisto++;
9bd82f77 366
367 // Creation of Charge versus LHC Clock histograms
6bec7c7c 368 sprintf(name,"H2D_ChargeVsClock_Int%d",iInt);
db72ff3b 369 sprintf(title,"Charge Versus LHC-Clock (Int%d);Tine [ns];Charge [ADC counts]",iInt);
6bec7c7c 370 h2d = new TH2D(name, title,kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 );
7d297381 371 Add2RawsList(h2d,(iInt == 0 ? kChargeVsClockInt0 : kChargeVsClockInt1 ), expert, !image, !saveCorr); iHisto++;
9bd82f77 372
6bec7c7c 373 // Creation of Minimum Bias Charge histograms
374 for(Int_t iBB=0;iBB<2;iBB++){
d62942e8 375 for(Int_t iBG=0;iBG<2;iBG++){
6bec7c7c 376 sprintf(name,"H2I_ChargeMB_BB%d_BG%d_Int%d",iBB,iBG,iInt);
db72ff3b 377 sprintf(title,"MB Charge (BB=%d, BG=%d, Int=%d);Charge [ADC counts];Counts",iBB,iBG,iInt);
6bec7c7c 378 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax,kNChargeBins, kChargeMin, kChargeMax);
9bd82f77 379 int idx;
380 if(iInt==0){
381 if(iBB==0){
6bec7c7c 382 if(iBG==0) idx = kChargeMBBB0BG0Int0;
383 else idx = kChargeMBBB0BG1Int0;
9bd82f77 384 } else {
6bec7c7c 385 if(iBG==0) idx = kChargeMBBB1BG0Int0;
386 else idx = kChargeMBBB1BG1Int0;
9bd82f77 387 }
388 } else {
389 if(iBB==0){
6bec7c7c 390 if(iBG==0) idx = kChargeMBBB0BG0Int1;
391 else idx = kChargeMBBB0BG1Int1;
9bd82f77 392 } else {
6bec7c7c 393 if(iBG==0) idx = kChargeMBBB1BG0Int1;
394 else idx = kChargeMBBB1BG1Int1;
9bd82f77 395 }
396 }
7d297381 397 Add2RawsList(h2i,idx, expert, !image, !saveCorr); iHisto++;
9bd82f77 398 }
6bec7c7c 399 }
9bd82f77 400
401 }
402
6bec7c7c 403 // Creation of Time histograms
404 sprintf(name,"H2I_Width");
db72ff3b 405 sprintf(title,"HPTDC Width;Width [ns];Counts");
6bec7c7c 406 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax, kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax);
7d297381 407 Add2RawsList(h2i,kWidth, expert, !image, !saveCorr); iHisto++;
9bd82f77 408
6bec7c7c 409 sprintf(name,"H2I_Width_BB");
db72ff3b 410 sprintf(title,"HPTDC Width w/ BB Flag condition;??;Width [ns]");
6bec7c7c 411 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax, kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax);
7d297381 412 Add2RawsList(h2i,kWidthBB, expert, !image, !saveCorr); iHisto++;
9bd82f77 413
6bec7c7c 414 sprintf(name,"H2I_Width_BG");
db72ff3b 415 sprintf(title,"HPTDC Width w/ BG Flag condition??;Width [ns]");
6bec7c7c 416 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax, kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax);
7d297381 417 Add2RawsList(h2i,kWidthBG, expert, !image, !saveCorr); iHisto++;
9bd82f77 418
6bec7c7c 419 sprintf(name,"H2I_HPTDCTime");
db72ff3b 420 sprintf(title,"HPTDC Time;??;Width [ns]");
6bec7c7c 421 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
74995017 422 Add2RawsList(h2i,kHPTDCTime, expert, image, !saveCorr); iHisto++;
9bd82f77 423
6bec7c7c 424 sprintf(name,"H2I_HPTDCTime_BB");
db72ff3b 425 sprintf(title,"HPTDC Time w/ BB Flag condition;??;Width [ns]");
6bec7c7c 426 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
7d297381 427 Add2RawsList(h2i,kHPTDCTimeBB, expert, !image, !saveCorr); iHisto++;
9bd82f77 428
6bec7c7c 429 sprintf(name,"H2I_HPTDCTime_BG");
db72ff3b 430 sprintf(title,"HPTDC Time w/ BG Flag condition;??;Width [ns]");
6bec7c7c 431 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
7d297381 432 Add2RawsList(h2i,kHPTDCTimeBG, expert, !image, !saveCorr); iHisto++;
9bd82f77 433
6bec7c7c 434 sprintf(name,"H1D_V0A_Time");
db72ff3b 435 sprintf(title,"V0A Time;Time [ns];Counts");
6bec7c7c 436 h1d = new TH1D(name, title,kNTdcTimeBins, kTdcTimeMin/10, kTdcTimeMax/10);
74995017 437 Add2RawsList(h1d,kV0ATime, expert, !image, saveCorr); iHisto++;
9bd82f77 438
6bec7c7c 439 sprintf(name,"H1D_V0C_Time");
db72ff3b 440 sprintf(title,"V0C Time;Time [ns];Counts");
6bec7c7c 441 h1d = new TH1D(name, title,kNTdcTimeBins, kTdcTimeMin/10, kTdcTimeMax/10);
74995017 442 Add2RawsList(h1d,kV0CTime, expert, !image, saveCorr); iHisto++;
9bd82f77 443
6bec7c7c 444 sprintf(name,"H1D_Diff_Time");
db72ff3b 445 sprintf(title,"Diff V0A-V0C Time;Time [ns];Counts");
6bec7c7c 446 h1d = new TH1D(name, title,2*kNTdcTimeBins, -kTdcTimeMax/10, kTdcTimeMax/10);
74995017 447 Add2RawsList(h1d,kDiffTime, expert, !image, saveCorr); iHisto++;
9bd82f77 448
9bd82f77 449 // Creation of Flag versus LHC Clock histograms
6bec7c7c 450 sprintf(name,"H2D_BBFlagVsClock");
db72ff3b 451 sprintf(title,"BB-Flags Versus LHC-Clock;Time [ns];??");
6bec7c7c 452 h2d = new TH2D(name, title,kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 );
7d297381 453 Add2RawsList(h2d,kBBFlagVsClock, expert, !image, !saveCorr); iHisto++;
9bd82f77 454
6bec7c7c 455 sprintf(name,"H2D_BGFlagVsClock");
db72ff3b 456 sprintf(title,"BG-Flags Versus LHC-Clock;Time [ns];??");
6bec7c7c 457 h2d = new TH2D(name, title,kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 );
7d297381 458 Add2RawsList(h2d,kBGFlagVsClock, expert, !image, !saveCorr); iHisto++;
9bd82f77 459
a8e23456 460 sprintf(name,"TREND_MeanChargePerRing");
461 sprintf(title,"Mean Charge per Event and per Ring versus time ");
462 trend = new AliVZEROTrending(name, title);
3dc953e2 463 Add2RawsList(trend,kRawMeanChargePerRing, expert, !image, !saveCorr); iHisto++;
a8e23456 464
465 sprintf(name,"TREND_MeanFlagPerRing");
466 sprintf(title,"Mean Flag per Event and per Ring versus time ");
467 trend = new AliVZEROTrending(name, title);
3dc953e2 468 Add2RawsList(trend,kRawMeanFlagPerRing, expert, !image, !saveCorr); iHisto++;
469
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++;
489
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++;
a8e23456 509
5379c4a3 510 AliDebug(AliQAv1::GetQADebugLevel(), Form("%d Histograms has been added to the Raws List",iHisto));
4da80b8c 511 }
508b9fc0 512
44ed7a66 513//____________________________________________________________________________
514void AliVZEROQADataMakerRec::InitDigits()
515{
516 // create Digits histograms in Digits subdir
517 const Bool_t expert = kTRUE ;
518 const Bool_t image = kTRUE ;
519
57eead61 520 char tDCname[100];
521 char aDCname[100];
44ed7a66 522 TH1I *fhDigTDC[64];
523 TH1I *fhDigADC[64];
524 char texte[100];
525
526 // create Digits histograms in Digits subdir
db72ff3b 527 TH1I * h0 = new TH1I("hDigitMultiplicity", "Digits multiplicity distribution in VZERO;# of Digits;Entries", 100, 0, 99) ;
44ed7a66 528 h0->Sumw2() ;
529 Add2DigitsList(h0, 0, !expert, image) ;
530
531 for (Int_t i=0; i<64; i++)
532 {
57eead61 533 sprintf(tDCname, "hDigitTDC%d", i);
db72ff3b 534 sprintf(texte,"Digit TDC in cell %d; TDC value;Entries",i);
57eead61 535 fhDigTDC[i] = new TH1I(tDCname,texte,300,0.,149.);
44ed7a66 536
57eead61 537 sprintf(aDCname,"hDigitADC%d",i);
db72ff3b 538 sprintf(texte,"Digit ADC in cell %d;ADC value;Entries",i);
57eead61 539 fhDigADC[i]= new TH1I(aDCname,texte,1024,0.,1023.);
44ed7a66 540
541 Add2DigitsList(fhDigTDC[i],i+1, !expert, image);
542 Add2DigitsList(fhDigADC[i],i+1+64, !expert, image);
543 }
544}
545
546//____________________________________________________________________________
6252ceeb 547void AliVZEROQADataMakerRec::MakeDigits()
44ed7a66 548{
549 // makes data from Digits
eca4fa66 550
6252ceeb 551 GetDigitsData(0)->Fill(fDigitsArray->GetEntriesFast()) ;
552 TIter next(fDigitsArray) ;
57eead61 553 AliVZEROdigit *aVZERODigit ;
554 while ( (aVZERODigit = dynamic_cast<AliVZEROdigit *>(next())) ) {
555 Int_t aPMNumber = aVZERODigit->PMNumber();
556 GetDigitsData(aPMNumber +1)->Fill( aVZERODigit->Time()) ; // in 100 of picoseconds
557 GetDigitsData(aPMNumber +1+64)->Fill( aVZERODigit->ADC()) ;
44ed7a66 558 }
559}
560
561
562//____________________________________________________________________________
563void AliVZEROQADataMakerRec::MakeDigits(TTree *digitTree)
564{
565 // makes data from Digit Tree
566
6252ceeb 567 if ( fDigitsArray )
568 fDigitsArray->Clear() ;
569 else
570 fDigitsArray = new TClonesArray("AliVZEROdigit", 1000) ;
44ed7a66 571
572 TBranch * branch = digitTree->GetBranch("VZERODigit") ;
573 if ( ! branch ) {
574 AliWarning("VZERO branch in Digit Tree not found") ;
575 } else {
6252ceeb 576 branch->SetAddress(&fDigitsArray) ;
44ed7a66 577 branch->GetEntry(0) ;
6252ceeb 578 MakeDigits() ;
44ed7a66 579 }
580}
581
582
508b9fc0 583//____________________________________________________________________________
584void AliVZEROQADataMakerRec::MakeESDs(AliESDEvent * esd)
585{
6bec7c7c 586 // Creates QA data from ESDs
587
588 UInt_t eventType = esd->GetEventType();
508b9fc0 589
6bec7c7c 590 switch (eventType){
9bd82f77 591 case PHYSICS_EVENT:
6bec7c7c 592 AliESDVZERO *esdVZERO=esd->GetVZEROData();
508b9fc0 593
6bec7c7c 594 if (!esdVZERO) break;
9bd82f77 595
596 GetESDsData(kCellMultiV0A)->Fill(esdVZERO->GetNbPMV0A());
597 GetESDsData(kCellMultiV0C)->Fill(esdVZERO->GetNbPMV0C());
598 GetESDsData(kMIPMultiV0A)->Fill(esdVZERO->GetMTotV0A());
599 GetESDsData(kMIPMultiV0C)->Fill(esdVZERO->GetMTotV0C());
600
6bec7c7c 601 Float_t timeV0A = 0., timeV0C = 0., diffTime;
602 Int_t iTimeV0A = 0, iTimeV0C = 0;
9bd82f77 603
6bec7c7c 604 for(Int_t i=0;i<64;i++) {
9bd82f77 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);
609
6bec7c7c 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);
9bd82f77 612
6bec7c7c 613 if(time>0.){
9bd82f77 614 if (i<32) {
615 iTimeV0C++;
6bec7c7c 616 timeV0C += time;
9bd82f77 617 }else{
618 iTimeV0A++;
6bec7c7c 619 timeV0A += time;
9bd82f77 620 }
621 }
622 }
6bec7c7c 623 if(iTimeV0A>0) timeV0A /= iTimeV0A;
624 else timeV0A = -1.;
625 if(iTimeV0C>0) timeV0C /= iTimeV0C;
626 else timeV0C = -1.;
627 if(timeV0A<0. || timeV0C<0.) diffTime = -10000.;
628 else diffTime = timeV0A - timeV0C;
9bd82f77 629
6bec7c7c 630 GetESDsData(kESDV0ATime)->Fill(timeV0A);
631 GetESDsData(kESDV0CTime)->Fill(timeV0C);
632 GetESDsData(kESDDiffTime)->Fill(diffTime);
9bd82f77 633
6bec7c7c 634 break;
9bd82f77 635 }
28fdf12c 636
508b9fc0 637}
638
639//____________________________________________________________________________
4da80b8c 640 void AliVZEROQADataMakerRec::MakeRaws(AliRawReader* rawReader)
641 {
6bec7c7c 642 // Fills histograms with Raws, computes average ADC values dynamically (pedestal subtracted)
1e376713 643
eca4fa66 644 // Check id histograms already created for this Event Specie
645 if ( ! GetRawsData(kPedestalInt0) )
646 InitRaws() ;
647
648 rawReader->Reset() ;
e58b4e66 649 AliVZERORawStream* rawStream = new AliVZERORawStream(rawReader);
650 if(!(rawStream->Next())) return;
a8e23456 651
6bec7c7c 652 eventTypeType eventType = rawReader->GetType();
9bd82f77 653
6bec7c7c 654 Int_t mulV0A = 0 ;
655 Int_t mulV0C = 0 ;
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.;
9bd82f77 660
6bec7c7c 661 Double_t diffTime=-100000.;
9bd82f77 662
663
6bec7c7c 664 switch (eventType){
665 case PHYSICS_EVENT:
a8e23456 666
667 fNTotEvents++;
668
669 if(fNSubEvents++>=fTrendingUpdateEvent && fTrendingUpdateEvent>0) {
670 fNSubEvents=0;
671 AddTrendingEntry();
672 }
6bec7c7c 673 Int_t iFlag=0;
674 Int_t pedestal;
675 Int_t integrator;
676 Bool_t BBFlag;
9bd82f77 677 Bool_t BGFlag;
e58b4e66 678 Float_t time, width;
a8e23456 679 Int_t MBCharge;
680 Float_t charge;
6bec7c7c 681 Int_t offlineCh;
682 TH1D * hProj;
9bd82f77 683
d62942e8 684 for(Int_t iChannel=0; iChannel<64; iChannel++) { // BEGIN : Loop over channels
9bd82f77 685
e58b4e66 686 offlineCh = rawStream->GetOfflineChannel(iChannel);
9bd82f77 687
6bec7c7c 688 // Fill Pedestal histograms
689
690 for(Int_t j=15; j<21; j++) {
e58b4e66 691 if((rawStream->GetBGFlag(iChannel,j) || rawStream->GetBBFlag(iChannel,j))) iFlag++;
6bec7c7c 692 }
9bd82f77 693
6bec7c7c 694 if(iFlag == 0){ //No Flag found
d62942e8 695 for(Int_t j=15; j<21; j++){
e58b4e66 696 pedestal= (Int_t) rawStream->GetPedestal(iChannel, j);
697 integrator = rawStream->GetIntegratorFlag(iChannel, j);
9bd82f77 698
6bec7c7c 699 GetRawsData((integrator == 0 ? kPedestalInt0 : kPedestalInt1))->Fill(offlineCh,pedestal);
700 GetRawsData((integrator == 0 ? kPedestalCycleInt0 : kPedestalCycleInt1))->Fill(offlineCh,pedestal);
9bd82f77 701 }
6bec7c7c 702 }
9bd82f77 703
6bec7c7c 704 // Fill Charge EoI histograms
705
706 // Look for the maximum in the LHC clock train
707 charge = 0;
9bd82f77 708 Int_t iClock = 0;
a8e23456 709 Float_t iCharge = 0;
d62942e8 710 for(Int_t iEvent=0; iEvent<21; iEvent++){
e58b4e66 711 iCharge = rawStream->GetPedestal(iChannel,iEvent);
6bec7c7c 712 if(iCharge>charge) {
713 charge = iCharge;
9bd82f77 714 iClock = iEvent;
715 }
716 } // End of maximum searching procedure
717
e58b4e66 718 integrator = rawStream->GetIntegratorFlag(iChannel,iClock);
719 BBFlag = rawStream->GetBBFlag(iChannel, iClock);
720 BGFlag = rawStream->GetBGFlag(iChannel,iClock );
9bd82f77 721
6bec7c7c 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);
9bd82f77 725
6bec7c7c 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();
729 delete hProj;
9bd82f77 730
6bec7c7c 731 Double_t chargeEoI = charge - ped;
9bd82f77 732
6bec7c7c 733 // Calculation of the number of MIP
734 Double_t mipEoI = chargeEoI * fCalibData->GetMIPperADC(offlineCh);
9bd82f77 735
a8e23456 736 int side = offlineCh/32;
737 int ring = (offlineCh - 32*side) / 8;
3dc953e2 738 if(BBFlag) {
739 fFlagPerRing[side*4 + ring] += 1;
740 fFlagPerChannel[offlineCh] += 1;
741 }
a8e23456 742
6bec7c7c 743 if(charge<1023 && chargeEoI > 5.*sigma){
a8e23456 744 fChargePerRing[side*4 + ring] += chargeEoI;
3dc953e2 745 fChargePerChannel[offlineCh] += chargeEoI;
6bec7c7c 746 ((TH2I*)GetRawsData((integrator == 0 ? kChargeEoICycleInt0 : kChargeEoICycleInt1)))->Fill(offlineCh,chargeEoI);
747 ((TH2D*)GetRawsData(kRawMIPChannel))->Fill(offlineCh,mipEoI);
748 if(offlineCh<32) {
9bd82f77 749 mulV0C++;
6bec7c7c 750 chargeV0C += chargeEoI;
751 mipV0C += mipEoI;
752 } else {
9bd82f77 753 mulV0A++;
6bec7c7c 754 chargeV0A += chargeEoI;
755 mipV0A += mipEoI;
9bd82f77 756 }
6bec7c7c 757 }
9bd82f77 758
6bec7c7c 759 // Fill Charge Minimum Bias Histograms
760
761 int idx;
762 for(Int_t iBunch=0; iBunch<10; iBunch++){
e58b4e66 763 integrator = rawStream->GetIntMBFlag(iChannel, iBunch);
764 BBFlag = rawStream->GetBBMBFlag(iChannel, iBunch);
765 BGFlag = rawStream->GetBGMBFlag(iChannel, iBunch);
766 MBCharge = rawStream->GetChargeMB(iChannel, iBunch);
9bd82f77 767
768 if(integrator==0){
769 if(BBFlag==0){
6bec7c7c 770 if(BGFlag==0) idx = kChargeMBBB0BG0Int0;
771 else idx = kChargeMBBB0BG1Int0;
9bd82f77 772 } else {
6bec7c7c 773 if(BGFlag==0) idx = kChargeMBBB1BG0Int0;
774 else idx = kChargeMBBB1BG1Int0;
9bd82f77 775 }
776 } else {
777 if(BBFlag==0){
6bec7c7c 778 if(BGFlag==0) idx = kChargeMBBB0BG0Int1;
779 else idx = kChargeMBBB0BG1Int1;
9bd82f77 780 } else {
6bec7c7c 781 if(BGFlag==0) idx = kChargeMBBB1BG0Int1;
782 else idx = kChargeMBBB1BG1Int1;
9bd82f77 783 }
784 }
6bec7c7c 785 GetRawsData(idx)->Fill(offlineCh,MBCharge);
786 }
787
788 // Fill HPTDC Time Histograms
789
e58b4e66 790 BBFlag = rawStream->GetBBFlag(iChannel, 10);
791 BGFlag = rawStream->GetBGFlag(iChannel, 10);
792 time = rawStream->GetTime(iChannel);
793 width = rawStream->GetWidth(iChannel);
6bec7c7c 794
795 if(time>0.){
796 if (offlineCh<32) {
797 itimeV0C++;
798 timeV0C += time;
799 }else{
800 itimeV0A++;
801 timeV0A += time;
802 }
803 }
804 GetRawsData(kHPTDCTime)->Fill(offlineCh,time);
805 GetRawsData(kWidth)->Fill(offlineCh,width);
9bd82f77 806 if(BBFlag) {
6bec7c7c 807 GetRawsData(kHPTDCTimeBB)->Fill(offlineCh,time);
808 GetRawsData(kWidthBB)->Fill(offlineCh,width);
9bd82f77 809 }
6bec7c7c 810 if(BGFlag) {
811 GetRawsData(kHPTDCTimeBG)->Fill(offlineCh,time);
812 GetRawsData(kWidthBG)->Fill(offlineCh,width);
9bd82f77 813 }
814
6bec7c7c 815 // Fill Flag and Charge Versus LHC-Clock histograms
816
d62942e8 817 for(Int_t iEvent=0; iEvent<21; iEvent++){
e58b4e66 818 charge = rawStream->GetPedestal(iChannel,iEvent);
819 integrator = rawStream->GetIntegratorFlag(iChannel,iEvent);
820 BBFlag = rawStream->GetBBFlag(iChannel, iEvent);
821 BGFlag = rawStream->GetBGFlag(iChannel,iEvent );
6bec7c7c 822
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);
9bd82f77 826 }
827
6bec7c7c 828 }// END of Loop over channels
9bd82f77 829
6bec7c7c 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
831 else timeV0A = -1.;
832 if(itimeV0C>0) timeV0C /= (itimeV0C * 10);
833 else timeV0C = -1.;
834 if(timeV0A<0. || timeV0C<0.) diffTime = -10000.;
835 else diffTime = timeV0A - timeV0C;
9bd82f77 836
6bec7c7c 837 GetRawsData(kV0ATime)->Fill(timeV0A);
838 GetRawsData(kV0CTime)->Fill(timeV0C);
839 GetRawsData(kDiffTime)->Fill(diffTime);
9bd82f77 840
6bec7c7c 841 GetRawsData(kMultiV0A)->Fill(mulV0A);
842 GetRawsData(kMultiV0C)->Fill(mulV0C);
9bd82f77 843
6bec7c7c 844 GetRawsData(kChargeV0A)->Fill(chargeV0A);
845 GetRawsData(kChargeV0C)->Fill(chargeV0C);
846 GetRawsData(kChargeV0)->Fill(chargeV0A + chargeV0C);
9bd82f77 847
6bec7c7c 848 GetRawsData(kRawMIPV0A)->Fill(mipV0A);
849 GetRawsData(kRawMIPV0C)->Fill(mipV0C);
850 GetRawsData(kRawMIPV0)->Fill(mipV0A + mipV0C);
851 break;
852
853 } // END of SWITCH : EVENT TYPE
9bd82f77 854
855 fEvent++;
4e25ac79 856 TParameter<double> * p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kMultiV0A)->GetName()))) ;
719e870c 857 if (p) p->SetVal((double)mulV0A) ;
9bd82f77 858
4e25ac79 859 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kMultiV0C)->GetName()))) ;
719e870c 860 if (p) p->SetVal((double)mulV0C) ;
9bd82f77 861
4e25ac79 862 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kChargeV0A)->GetName()))) ;
719e870c 863 if (p) p->SetVal((double)chargeV0A) ;
9bd82f77 864
4e25ac79 865 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kChargeV0C)->GetName()))) ;
719e870c 866 if (p) p->SetVal((double)chargeV0C) ;
9bd82f77 867
4e25ac79 868 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kChargeV0)->GetName()))) ;
719e870c 869 if (p) p->SetVal((double)(chargeV0A + chargeV0C)) ;
9bd82f77 870
4e25ac79 871 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kRawMIPV0A)->GetName()))) ;
719e870c 872 if (p) p->SetVal((double)mipV0A) ;
9bd82f77 873
4e25ac79 874 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kRawMIPV0C)->GetName()))) ;
719e870c 875 if (p) p->SetVal((double)mipV0C) ;
9bd82f77 876
4e25ac79 877 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kRawMIPV0)->GetName()))) ;
719e870c 878 if (p) p->SetVal((double)(mipV0A + mipV0C)) ;
9bd82f77 879
4e25ac79 880 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kV0ATime)->GetName()))) ;
719e870c 881 if (p) p->SetVal((double)timeV0A) ;
9bd82f77 882
4e25ac79 883 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kV0CTime)->GetName()))) ;
719e870c 884 if (p) p->SetVal((double)timeV0C) ;
9bd82f77 885
4e25ac79 886 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kDiffTime)->GetName()))) ;
719e870c 887 if (p) p->SetVal((double)diffTime) ;
9bd82f77 888
e58b4e66 889 delete rawStream; rawStream = 0x0;
890
9bd82f77 891
4da80b8c 892 }
508b9fc0 893
894//____________________________________________________________________________
895void AliVZEROQADataMakerRec::StartOfDetectorCycle()
896{
897 // Detector specific actions at start of cycle
898
6bec7c7c 899 // Reset of the histogram used - to have the trend versus time -
e6d13307 900
901 fCalibData = GetCalibData();
6bec7c7c 902
9bd82f77 903 TH1* h;
6bec7c7c 904 h = GetRawsData(kPedestalCycleInt0);
9bd82f77 905 if(h) h->Reset();
6bec7c7c 906 h = GetRawsData(kPedestalCycleInt1);
9bd82f77 907 if(h) h->Reset();
6bec7c7c 908 h = GetRawsData(kChargeEoICycleInt0);
9bd82f77 909 if(h) h->Reset();
6bec7c7c 910 h = GetRawsData(kChargeEoICycleInt1);
9bd82f77 911 if(h) h->Reset();
a8e23456 912
913 TTimeStamp currentTime;
914 fCycleStartTime = currentTime.GetSec();
915
916 fNTotEvents = 0;
917}
9bd82f77 918
a8e23456 919//-------------------------------------------------------------------------------------------------
920void AliVZEROQADataMakerRec::AddTrendingEntry(){
3dc953e2 921 //printf("AddTrendingEntry\n");
922 fNTrendingUpdates++;
a8e23456 923
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;
930 }
931
3dc953e2 932 GetRawsData(kRawDQMCharge)->Reset();
933 GetRawsData(kRawDQMFlag)->Reset();
934
935 for(int i=0; i<64;i++){
936 fChargePerChannel[i] /= fTrendingUpdateEvent;
937 fFlagPerChannel[i] /= fTrendingUpdateEvent;
938
939 if(fMeanChargePerChannel[i]) GetRawsData(kRawDQMCharge)->Fill(i,fChargePerChannel[i]/fMeanChargePerChannel[i]);
940 else GetRawsData(kRawDQMCharge)->Fill(i,0.);
941
942 if(fMeanFlagPerChannel[i]) GetRawsData(kRawDQMFlag)->Fill(i,fFlagPerChannel[i]/fMeanFlagPerChannel[i]);
943 else GetRawsData(kRawDQMFlag)->Fill(i,0.);
944
945 fMeanChargePerChannel[i] = (fMeanChargePerChannel[i] * (fNTrendingUpdates-1) + fChargePerChannel[i]) / fNTrendingUpdates;
946 fMeanFlagPerChannel[i] = (fMeanFlagPerChannel[i] * (fNTrendingUpdates-1) + fFlagPerChannel[i]) / fNTrendingUpdates;
947
948 }
949
a8e23456 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());
954
955 // Put back counters to zero
956 for(int i=0; i<8;i++){
957 fChargePerRing[i] = 0.;
958 fFlagPerRing[i] = 0.;
959 }
3dc953e2 960 for(int i=0; i<64;i++){
961 fChargePerChannel[i] = 0.;
962 fFlagPerChannel[i] = 0.;
963 }
a8e23456 964
508b9fc0 965}
74995017 966