Revision of SSD ClusterFinder (S. Borysov)
[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
c8d309e0 266 const Int_t kNTdcTimeBins = 1280;
267 const Int_t kTdcTimeMin = 0.;
268 const Int_t kTdcTimeMax = 125.;
6bec7c7c 269 const Int_t kNTdcWidthBins = 128;
270 const Int_t kTdcWidthMin = 0;
c8d309e0 271 const Int_t kTdcWidthMax = 50.;
6bec7c7c 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
c8d309e0 320
321 // Creation of Charge EoI histogram
322 sprintf(name,"H2D_ChargeEoI");
323 sprintf(title,"Charge Event of Interest;Channel;Charge [ADC counts]");
324 h2d = new TH2D(name, title,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, kChargeMax);
325 Add2RawsList(h2d,kChargeEoI, !expert, image, !saveCorr); iHisto++;
326
d62942e8 327 for(Int_t iInt=0;iInt<kNintegrator;iInt++){
9bd82f77 328 // Creation of Pedestal histograms
6bec7c7c 329 sprintf(name,"H2I_Pedestal_Int%d",iInt);
c8d309e0 330 sprintf(title,"Pedestal (Int%d);Channel;Pedestal [ADC counts]",iInt);
6bec7c7c 331 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax,kNPedestalBins,kPedestalMin ,kPedestalMax );
7d297381 332 Add2RawsList(h2i,(iInt == 0 ? kPedestalInt0 : kPedestalInt1), expert, !image, !saveCorr); iHisto++;
9bd82f77 333
6bec7c7c 334 // Creation of temporary Pedestal histo used for the mean versus time histogram. This histogram will be reset at the end of each cycle
335 sprintf(name,"H2I_Pedestal_CycleInt%d",iInt);
db72ff3b 336 sprintf(title,"One Cycle Pedestal (Int%d);Pedestal [ADC counts];Counts",iInt);
6bec7c7c 337 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax,kNPedestalBins,kPedestalMin ,kPedestalMax );
7d297381 338 Add2RawsList(h2i,(iInt == 0 ? kPedestalCycleInt0 : kPedestalCycleInt1), expert, !image, !saveCorr); iHisto++;
9bd82f77 339
6bec7c7c 340 // Creation of Pedestal versus time graph.
341 sprintf(name,"H2D_Pedestal_Time_Int%d",iInt);
db72ff3b 342 sprintf(title,"Pedestal Versus Time (Int%d);Time [ns];Pedestal [ADC counts]",iInt);
6bec7c7c 343 h2d = new TH2D(name, title,kNChannelBins, kChannelMin, kChannelMax,kTimeMax,kTimeMin ,kTimeMax );
7d297381 344 Add2RawsList(h2d,(iInt == 0 ? kPedestalTimeInt0 : kPedestalTimeInt1), expert, !image, !saveCorr); iHisto++;
9bd82f77 345
346 // Creation of Charge EoI histograms
6bec7c7c 347 sprintf(name,"H2I_ChargeEoI_Int%d",iInt);
c8d309e0 348 sprintf(title,"Charge EoI (Int%d);Channel;Charge [ADC counts]",iInt);
6bec7c7c 349 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, kChargeMax);
74995017 350 Add2RawsList(h2i,(iInt == 0 ? kChargeEoIInt0 : kChargeEoIInt1), expert, image, !saveCorr); iHisto++;
9bd82f77 351
352 // 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 353 sprintf(name,"H2I_ChargeEoI_CycleInt%d",iInt);
db72ff3b 354 sprintf(title,"One Cycle Charge EoI (Int%d);Charge [ADC counts];Counts",iInt);
6bec7c7c 355 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, kChargeMax);
7d297381 356 Add2RawsList(h2i,(iInt == 0 ? kChargeEoICycleInt0 : kChargeEoICycleInt1), expert, !image, !saveCorr); iHisto++;
9bd82f77 357
6bec7c7c 358 // Creation of Charge EoI versus time graphs
359 sprintf(name,"H2D_ChargeEoI_Time_Int%d",iInt);
c8d309e0 360 sprintf(title,"Charge EoI Versus Time (Int%d);Channel;Time",iInt);
6bec7c7c 361 h2d = new TH2D(name, title,kNChannelBins, kChannelMin, kChannelMax,kTimeMax,kTimeMin ,kTimeMax );
7d297381 362 Add2RawsList(h2d,(iInt == 0 ? kChargeEoITimeInt0 : kChargeEoITimeInt1), expert, !image, !saveCorr); iHisto++;
f81355e3 363
6bec7c7c 364 sprintf(name,"H2I_ChargeEoI_BB_Int%d",iInt);
c8d309e0 365 sprintf(title,"Charge EoI w/ BB Flag (Int%d);Channel;Charge [ADC counts]",iInt);
6bec7c7c 366 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, kChargeMax);
7d297381 367 Add2RawsList(h2i,(iInt == 0 ? kChargeEoIBBInt0 : kChargeEoIBBInt1), expert, !image, !saveCorr); iHisto++;
f81355e3 368
6bec7c7c 369 sprintf(name,"H2I_ChargeEoI_BG_Int%d",iInt);
c8d309e0 370 sprintf(title,"Charge EoI w/ BG Flag (Int%d);Channel;Charge [ADC counts]",iInt);
6bec7c7c 371 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, kChargeMax);
7d297381 372 Add2RawsList(h2i,(iInt == 0 ? kChargeEoIBGInt0: kChargeEoIBGInt1), expert, !image, !saveCorr); iHisto++;
9bd82f77 373
374 // Creation of Charge versus LHC Clock histograms
6bec7c7c 375 sprintf(name,"H2D_ChargeVsClock_Int%d",iInt);
c8d309e0 376 sprintf(title,"Charge Versus LHC-Clock (Int%d);Channel;LHCClock;Charge [ADC counts]",iInt);
6bec7c7c 377 h2d = new TH2D(name, title,kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 );
7d297381 378 Add2RawsList(h2d,(iInt == 0 ? kChargeVsClockInt0 : kChargeVsClockInt1 ), expert, !image, !saveCorr); iHisto++;
9bd82f77 379
6bec7c7c 380 // Creation of Minimum Bias Charge histograms
381 for(Int_t iBB=0;iBB<2;iBB++){
d62942e8 382 for(Int_t iBG=0;iBG<2;iBG++){
6bec7c7c 383 sprintf(name,"H2I_ChargeMB_BB%d_BG%d_Int%d",iBB,iBG,iInt);
c8d309e0 384 sprintf(title,"MB Charge (BB=%d, BG=%d, Int=%d);Channel;Charge [ADC counts]",iBB,iBG,iInt);
6bec7c7c 385 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax,kNChargeBins, kChargeMin, kChargeMax);
9bd82f77 386 int idx;
387 if(iInt==0){
388 if(iBB==0){
6bec7c7c 389 if(iBG==0) idx = kChargeMBBB0BG0Int0;
390 else idx = kChargeMBBB0BG1Int0;
9bd82f77 391 } else {
6bec7c7c 392 if(iBG==0) idx = kChargeMBBB1BG0Int0;
393 else idx = kChargeMBBB1BG1Int0;
9bd82f77 394 }
395 } else {
396 if(iBB==0){
6bec7c7c 397 if(iBG==0) idx = kChargeMBBB0BG0Int1;
398 else idx = kChargeMBBB0BG1Int1;
9bd82f77 399 } else {
6bec7c7c 400 if(iBG==0) idx = kChargeMBBB1BG0Int1;
401 else idx = kChargeMBBB1BG1Int1;
9bd82f77 402 }
403 }
7d297381 404 Add2RawsList(h2i,idx, expert, !image, !saveCorr); iHisto++;
9bd82f77 405 }
6bec7c7c 406 }
9bd82f77 407
408 }
409
6bec7c7c 410 // Creation of Time histograms
411 sprintf(name,"H2I_Width");
c8d309e0 412 sprintf(title,"HPTDC Width;Channel;Width [ns]");
6bec7c7c 413 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax, kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax);
7d297381 414 Add2RawsList(h2i,kWidth, expert, !image, !saveCorr); iHisto++;
9bd82f77 415
6bec7c7c 416 sprintf(name,"H2I_Width_BB");
c8d309e0 417 sprintf(title,"HPTDC Width w/ BB Flag condition;Channel;Width [ns]");
6bec7c7c 418 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax, kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax);
7d297381 419 Add2RawsList(h2i,kWidthBB, expert, !image, !saveCorr); iHisto++;
9bd82f77 420
6bec7c7c 421 sprintf(name,"H2I_Width_BG");
c8d309e0 422 sprintf(title,"HPTDC Width w/ BG Flag condition;Channel;Width [ns]");
6bec7c7c 423 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax, kNTdcWidthBins, kTdcWidthMin, kTdcWidthMax);
7d297381 424 Add2RawsList(h2i,kWidthBG, expert, !image, !saveCorr); iHisto++;
9bd82f77 425
6bec7c7c 426 sprintf(name,"H2I_HPTDCTime");
c8d309e0 427 sprintf(title,"HPTDC Time;Channel;Leading Time [ns]");
6bec7c7c 428 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
74995017 429 Add2RawsList(h2i,kHPTDCTime, expert, image, !saveCorr); iHisto++;
9bd82f77 430
6bec7c7c 431 sprintf(name,"H2I_HPTDCTime_BB");
c8d309e0 432 sprintf(title,"HPTDC Time w/ BB Flag condition;Channel;Leading Time [ns]");
6bec7c7c 433 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
c8d309e0 434 Add2RawsList(h2i,kHPTDCTimeBB, !expert, image, !saveCorr); iHisto++;
9bd82f77 435
6bec7c7c 436 sprintf(name,"H2I_HPTDCTime_BG");
c8d309e0 437 sprintf(title,"HPTDC Time w/ BG Flag condition;Channel;Leading Time [ns]");
6bec7c7c 438 h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
c8d309e0 439 Add2RawsList(h2i,kHPTDCTimeBG, !expert, image, !saveCorr); iHisto++;
9bd82f77 440
6bec7c7c 441 sprintf(name,"H1D_V0A_Time");
db72ff3b 442 sprintf(title,"V0A Time;Time [ns];Counts");
c8d309e0 443 h1d = new TH1D(name, title,kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
74995017 444 Add2RawsList(h1d,kV0ATime, expert, !image, saveCorr); iHisto++;
9bd82f77 445
6bec7c7c 446 sprintf(name,"H1D_V0C_Time");
db72ff3b 447 sprintf(title,"V0C Time;Time [ns];Counts");
c8d309e0 448 h1d = new TH1D(name, title,kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
74995017 449 Add2RawsList(h1d,kV0CTime, expert, !image, saveCorr); iHisto++;
9bd82f77 450
6bec7c7c 451 sprintf(name,"H1D_Diff_Time");
db72ff3b 452 sprintf(title,"Diff V0A-V0C Time;Time [ns];Counts");
c8d309e0 453 h1d = new TH1D(name, title,2*kNTdcTimeBins, -kTdcTimeMax, kTdcTimeMax);
74995017 454 Add2RawsList(h1d,kDiffTime, expert, !image, saveCorr); iHisto++;
9bd82f77 455
9bd82f77 456 // Creation of Flag versus LHC Clock histograms
c8d309e0 457
458 sprintf(name,"H1D_BBFlagPerChannel");
459 sprintf(title,"BB-Flags Versus Channel;Channel;BB Flags Count");
460 h1d = new TH1D(name, title,kNChannelBins, kChannelMin, kChannelMax );
461 Add2RawsList(h1d,kBBFlagsPerChannel, !expert, image, !saveCorr); iHisto++;
462
6bec7c7c 463 sprintf(name,"H2D_BBFlagVsClock");
c8d309e0 464 sprintf(title,"BB-Flags Versus LHC-Clock;Channel;LHC Clocks");
6bec7c7c 465 h2d = new TH2D(name, title,kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 );
7d297381 466 Add2RawsList(h2d,kBBFlagVsClock, expert, !image, !saveCorr); iHisto++;
9bd82f77 467
6bec7c7c 468 sprintf(name,"H2D_BGFlagVsClock");
c8d309e0 469 sprintf(title,"BG-Flags Versus LHC-Clock;Channel;LHC Clocks");
6bec7c7c 470 h2d = new TH2D(name, title,kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 );
7d297381 471 Add2RawsList(h2d,kBGFlagVsClock, expert, !image, !saveCorr); iHisto++;
9bd82f77 472
a8e23456 473 sprintf(name,"TREND_MeanChargePerRing");
474 sprintf(title,"Mean Charge per Event and per Ring versus time ");
475 trend = new AliVZEROTrending(name, title);
3dc953e2 476 Add2RawsList(trend,kRawMeanChargePerRing, expert, !image, !saveCorr); iHisto++;
a8e23456 477
478 sprintf(name,"TREND_MeanFlagPerRing");
479 sprintf(title,"Mean Flag per Event and per Ring versus time ");
480 trend = new AliVZEROTrending(name, title);
3dc953e2 481 Add2RawsList(trend,kRawMeanFlagPerRing, expert, !image, !saveCorr); iHisto++;
482
483 sprintf(name,"H1D_DQMFlag");
484 sprintf(title,"Current Flag per Event / Mean Flag per Event ");
485 h1d = new TH1D(name, title, kNChannelBins, kChannelMin, kChannelMax);
486 h1d->SetFillColor(29);
487 h1d->SetLineWidth(2);
488 h1d->GetXaxis()->SetLabelSize(0.06);
489 h1d->GetXaxis()->SetNdivisions(808,kFALSE);
490 h1d->GetXaxis()->SetBinLabel(4, "V0C");h1d->GetXaxis()->SetBinLabel(5, "R0");
491 h1d->GetXaxis()->SetBinLabel(12, "V0C");h1d->GetXaxis()->SetBinLabel(13, "R1");
492 h1d->GetXaxis()->SetBinLabel(20, "V0C");h1d->GetXaxis()->SetBinLabel(21, "R2");
493 h1d->GetXaxis()->SetBinLabel(28, "V0C");h1d->GetXaxis()->SetBinLabel(29, "R3");
494 h1d->GetXaxis()->SetBinLabel(36, "V0A");h1d->GetXaxis()->SetBinLabel(37, "R0");
495 h1d->GetXaxis()->SetBinLabel(44, "V0A");h1d->GetXaxis()->SetBinLabel(45, "R1");
496 h1d->GetXaxis()->SetBinLabel(52, "V0A");h1d->GetXaxis()->SetBinLabel(53, "R2");
497 h1d->GetXaxis()->SetBinLabel(60, "V0A");h1d->GetXaxis()->SetBinLabel(61, "R3");
498 h1d->GetXaxis()->CenterTitle();
499 h1d->GetXaxis()->SetTitleOffset(0.8);
500 h1d->GetXaxis()->SetNdivisions(808,kFALSE);
c8d309e0 501 Add2RawsList(h1d,kRawDQMFlag, expert, image, !saveCorr); iHisto++;
3dc953e2 502
503 sprintf(name,"H1D_DQMCharge");
504 sprintf(title,"Current Charge per Event / Mean Charge per Event ");
505 h1d = new TH1D(name, title, kNChannelBins, kChannelMin, kChannelMax);
506 h1d->SetFillColor(29);
507 h1d->SetLineWidth(2);
508 h1d->GetXaxis()->SetLabelSize(0.06);
509 h1d->GetXaxis()->SetNdivisions(808,kFALSE);
510 h1d->GetXaxis()->SetBinLabel(4, "V0C");h1d->GetXaxis()->SetBinLabel(5, "R0");
511 h1d->GetXaxis()->SetBinLabel(12, "V0C");h1d->GetXaxis()->SetBinLabel(13, "R1");
512 h1d->GetXaxis()->SetBinLabel(20, "V0C");h1d->GetXaxis()->SetBinLabel(21, "R2");
513 h1d->GetXaxis()->SetBinLabel(28, "V0C");h1d->GetXaxis()->SetBinLabel(29, "R3");
514 h1d->GetXaxis()->SetBinLabel(36, "V0A");h1d->GetXaxis()->SetBinLabel(37, "R0");
515 h1d->GetXaxis()->SetBinLabel(44, "V0A");h1d->GetXaxis()->SetBinLabel(45, "R1");
516 h1d->GetXaxis()->SetBinLabel(52, "V0A");h1d->GetXaxis()->SetBinLabel(53, "R2");
517 h1d->GetXaxis()->SetBinLabel(60, "V0A");h1d->GetXaxis()->SetBinLabel(61, "R3");
518 h1d->GetXaxis()->CenterTitle();
519 h1d->GetXaxis()->SetTitleOffset(0.8);
520 h1d->GetXaxis()->SetNdivisions(808,kFALSE);
c8d309e0 521 Add2RawsList(h1d,kRawDQMCharge, expert, image, !saveCorr); iHisto++;
a8e23456 522
5379c4a3 523 AliDebug(AliQAv1::GetQADebugLevel(), Form("%d Histograms has been added to the Raws List",iHisto));
4da80b8c 524 }
508b9fc0 525
44ed7a66 526//____________________________________________________________________________
527void AliVZEROQADataMakerRec::InitDigits()
528{
529 // create Digits histograms in Digits subdir
530 const Bool_t expert = kTRUE ;
531 const Bool_t image = kTRUE ;
532
57eead61 533 char tDCname[100];
534 char aDCname[100];
44ed7a66 535 TH1I *fhDigTDC[64];
536 TH1I *fhDigADC[64];
537 char texte[100];
538
539 // create Digits histograms in Digits subdir
db72ff3b 540 TH1I * h0 = new TH1I("hDigitMultiplicity", "Digits multiplicity distribution in VZERO;# of Digits;Entries", 100, 0, 99) ;
44ed7a66 541 h0->Sumw2() ;
542 Add2DigitsList(h0, 0, !expert, image) ;
543
544 for (Int_t i=0; i<64; i++)
545 {
57eead61 546 sprintf(tDCname, "hDigitTDC%d", i);
db72ff3b 547 sprintf(texte,"Digit TDC in cell %d; TDC value;Entries",i);
57eead61 548 fhDigTDC[i] = new TH1I(tDCname,texte,300,0.,149.);
44ed7a66 549
57eead61 550 sprintf(aDCname,"hDigitADC%d",i);
db72ff3b 551 sprintf(texte,"Digit ADC in cell %d;ADC value;Entries",i);
57eead61 552 fhDigADC[i]= new TH1I(aDCname,texte,1024,0.,1023.);
44ed7a66 553
554 Add2DigitsList(fhDigTDC[i],i+1, !expert, image);
555 Add2DigitsList(fhDigADC[i],i+1+64, !expert, image);
556 }
557}
558
559//____________________________________________________________________________
6252ceeb 560void AliVZEROQADataMakerRec::MakeDigits()
44ed7a66 561{
562 // makes data from Digits
eca4fa66 563
6252ceeb 564 GetDigitsData(0)->Fill(fDigitsArray->GetEntriesFast()) ;
565 TIter next(fDigitsArray) ;
57eead61 566 AliVZEROdigit *aVZERODigit ;
567 while ( (aVZERODigit = dynamic_cast<AliVZEROdigit *>(next())) ) {
568 Int_t aPMNumber = aVZERODigit->PMNumber();
569 GetDigitsData(aPMNumber +1)->Fill( aVZERODigit->Time()) ; // in 100 of picoseconds
570 GetDigitsData(aPMNumber +1+64)->Fill( aVZERODigit->ADC()) ;
44ed7a66 571 }
572}
573
574
575//____________________________________________________________________________
576void AliVZEROQADataMakerRec::MakeDigits(TTree *digitTree)
577{
578 // makes data from Digit Tree
579
6252ceeb 580 if ( fDigitsArray )
581 fDigitsArray->Clear() ;
582 else
583 fDigitsArray = new TClonesArray("AliVZEROdigit", 1000) ;
44ed7a66 584
585 TBranch * branch = digitTree->GetBranch("VZERODigit") ;
586 if ( ! branch ) {
587 AliWarning("VZERO branch in Digit Tree not found") ;
588 } else {
6252ceeb 589 branch->SetAddress(&fDigitsArray) ;
44ed7a66 590 branch->GetEntry(0) ;
6252ceeb 591 MakeDigits() ;
44ed7a66 592 }
593}
594
595
508b9fc0 596//____________________________________________________________________________
597void AliVZEROQADataMakerRec::MakeESDs(AliESDEvent * esd)
598{
6bec7c7c 599 // Creates QA data from ESDs
600
601 UInt_t eventType = esd->GetEventType();
508b9fc0 602
6bec7c7c 603 switch (eventType){
9bd82f77 604 case PHYSICS_EVENT:
6bec7c7c 605 AliESDVZERO *esdVZERO=esd->GetVZEROData();
508b9fc0 606
6bec7c7c 607 if (!esdVZERO) break;
9bd82f77 608
609 GetESDsData(kCellMultiV0A)->Fill(esdVZERO->GetNbPMV0A());
610 GetESDsData(kCellMultiV0C)->Fill(esdVZERO->GetNbPMV0C());
611 GetESDsData(kMIPMultiV0A)->Fill(esdVZERO->GetMTotV0A());
612 GetESDsData(kMIPMultiV0C)->Fill(esdVZERO->GetMTotV0C());
613
6bec7c7c 614 Float_t timeV0A = 0., timeV0C = 0., diffTime;
615 Int_t iTimeV0A = 0, iTimeV0C = 0;
9bd82f77 616
6bec7c7c 617 for(Int_t i=0;i<64;i++) {
9bd82f77 618 GetESDsData(kMIPMultiChannel)->Fill((Float_t) i,(Float_t) esdVZERO->GetMultiplicity(i));
619 GetESDsData(kChargeChannel)->Fill((Float_t) i,(Float_t) esdVZERO->GetAdc(i));
620 if(esdVZERO->GetBBFlag(i)) GetESDsData(kBBFlag)->Fill((Float_t) i);
621 if(esdVZERO->GetBGFlag(i)) GetESDsData(kBGFlag)->Fill((Float_t) i);
622
6bec7c7c 623 Float_t time = (Float_t) esdVZERO->GetTime(i)/10.; //Convert in ns: 1 TDC channel = 100ps
624 GetESDsData(kTimeChannel)->Fill((Float_t) i,time);
9bd82f77 625
6bec7c7c 626 if(time>0.){
9bd82f77 627 if (i<32) {
628 iTimeV0C++;
6bec7c7c 629 timeV0C += time;
9bd82f77 630 }else{
631 iTimeV0A++;
6bec7c7c 632 timeV0A += time;
9bd82f77 633 }
634 }
635 }
6bec7c7c 636 if(iTimeV0A>0) timeV0A /= iTimeV0A;
637 else timeV0A = -1.;
638 if(iTimeV0C>0) timeV0C /= iTimeV0C;
639 else timeV0C = -1.;
640 if(timeV0A<0. || timeV0C<0.) diffTime = -10000.;
641 else diffTime = timeV0A - timeV0C;
9bd82f77 642
6bec7c7c 643 GetESDsData(kESDV0ATime)->Fill(timeV0A);
644 GetESDsData(kESDV0CTime)->Fill(timeV0C);
645 GetESDsData(kESDDiffTime)->Fill(diffTime);
9bd82f77 646
6bec7c7c 647 break;
9bd82f77 648 }
28fdf12c 649
508b9fc0 650}
651
652//____________________________________________________________________________
4da80b8c 653 void AliVZEROQADataMakerRec::MakeRaws(AliRawReader* rawReader)
654 {
6bec7c7c 655 // Fills histograms with Raws, computes average ADC values dynamically (pedestal subtracted)
1e376713 656
eca4fa66 657 // Check id histograms already created for this Event Specie
658 if ( ! GetRawsData(kPedestalInt0) )
659 InitRaws() ;
660
661 rawReader->Reset() ;
e58b4e66 662 AliVZERORawStream* rawStream = new AliVZERORawStream(rawReader);
663 if(!(rawStream->Next())) return;
a8e23456 664
6bec7c7c 665 eventTypeType eventType = rawReader->GetType();
9bd82f77 666
6bec7c7c 667 Int_t mulV0A = 0 ;
668 Int_t mulV0C = 0 ;
669 Double_t timeV0A =0., timeV0C = 0.;
670 UInt_t itimeV0A=0, itimeV0C=0;
671 Double_t chargeV0A=0., chargeV0C=0.;
672 Double_t mipV0A=0., mipV0C=0.;
9bd82f77 673
6bec7c7c 674 Double_t diffTime=-100000.;
9bd82f77 675
676
6bec7c7c 677 switch (eventType){
678 case PHYSICS_EVENT:
a8e23456 679
680 fNTotEvents++;
681
682 if(fNSubEvents++>=fTrendingUpdateEvent && fTrendingUpdateEvent>0) {
683 fNSubEvents=0;
684 AddTrendingEntry();
685 }
6bec7c7c 686 Int_t iFlag=0;
687 Int_t pedestal;
688 Int_t integrator;
689 Bool_t BBFlag;
9bd82f77 690 Bool_t BGFlag;
e58b4e66 691 Float_t time, width;
a8e23456 692 Int_t MBCharge;
693 Float_t charge;
6bec7c7c 694 Int_t offlineCh;
695 TH1D * hProj;
c8d309e0 696 Float_t adc[64];
9bd82f77 697
d62942e8 698 for(Int_t iChannel=0; iChannel<64; iChannel++) { // BEGIN : Loop over channels
9bd82f77 699
e58b4e66 700 offlineCh = rawStream->GetOfflineChannel(iChannel);
9bd82f77 701
6bec7c7c 702 // Fill Pedestal histograms
703
704 for(Int_t j=15; j<21; j++) {
e58b4e66 705 if((rawStream->GetBGFlag(iChannel,j) || rawStream->GetBBFlag(iChannel,j))) iFlag++;
6bec7c7c 706 }
9bd82f77 707
6bec7c7c 708 if(iFlag == 0){ //No Flag found
d62942e8 709 for(Int_t j=15; j<21; j++){
e58b4e66 710 pedestal= (Int_t) rawStream->GetPedestal(iChannel, j);
711 integrator = rawStream->GetIntegratorFlag(iChannel, j);
9bd82f77 712
6bec7c7c 713 GetRawsData((integrator == 0 ? kPedestalInt0 : kPedestalInt1))->Fill(offlineCh,pedestal);
714 GetRawsData((integrator == 0 ? kPedestalCycleInt0 : kPedestalCycleInt1))->Fill(offlineCh,pedestal);
9bd82f77 715 }
6bec7c7c 716 }
9bd82f77 717
6bec7c7c 718 // Fill Charge EoI histograms
719
c8d309e0 720 adc[offlineCh] = 0.0;
721
722 // Search for the maximum charge in the train of 21 LHC clocks
723 // regardless of the integrator which has been operated:
724 Float_t maxadc = 0;
725 Int_t imax = -1;
726 Float_t adcPedSub[21];
727 for(Int_t iClock=0; iClock<21; iClock++){
728 Bool_t iIntegrator = rawStream->GetIntegratorFlag(iChannel,iClock);
729 Int_t k = offlineCh+64*iIntegrator;
730
731 //printf(Form("clock = %d adc = %f ped %f\n",iClock,rawStream->GetPedestal(iChannel,iClock),fPedestal[k]));
732
733 adcPedSub[iClock] = rawStream->GetPedestal(iChannel,iClock) - fCalibData->GetPedestal(k);
734// if(adcPedSub[iClock] <= GetRecoParam()->GetNSigmaPed()*fCalibData->GetSigma(k)) {
735 if(adcPedSub[iClock] <= 2.*fCalibData->GetSigma(k)) {
736 adcPedSub[iClock] = 0;
737 continue;
738 }
739// if(iClock < GetRecoParam()->GetStartClock() || iClock > GetRecoParam()->GetEndClock()) continue;
740 if(iClock < 8 || iClock > 12) continue;
741 if(adcPedSub[iClock] > maxadc) {
742 maxadc = adcPedSub[iClock];
743 imax = iClock;
744 }
745 }
746 //printf(Form("Channel %d (online), %d (offline)\n",iChannel,j));
747 if (imax != -1) {
748// Int_t start = imax - GetRecoParam()->GetNPreClocks();
749 Int_t start = imax - 2;
750 if (start < 0) start = 0;
751// Int_t end = imax + GetRecoParam()->GetNPostClocks();
752 Int_t end = imax + 1;
753 if (end > 20) end = 20;
754 for(Int_t iClock = start; iClock <= end; iClock++) {
755 adc[offlineCh] += adcPedSub[iClock];
756 }
757 }
758
759
760 Int_t iClock = imax;
761 charge = rawStream->GetPedestal(iChannel,iClock); // Charge at the maximum
9bd82f77 762
e58b4e66 763 integrator = rawStream->GetIntegratorFlag(iChannel,iClock);
764 BBFlag = rawStream->GetBBFlag(iChannel, iClock);
765 BGFlag = rawStream->GetBGFlag(iChannel,iClock );
c8d309e0 766 Int_t board = AliVZEROCalibData::GetBoardNumber(offlineCh);
767 time = rawStream->GetTime(iChannel)*fCalibData->GetTimeResolution(board);
768 width = rawStream->GetWidth(iChannel)*fCalibData->GetWidthResolution(board);
769
770 GetRawsData(kChargeEoI)->Fill(offlineCh,adc[offlineCh]);
9bd82f77 771
6bec7c7c 772 GetRawsData((integrator == 0 ? kChargeEoIInt0 : kChargeEoIInt1))->Fill(offlineCh,charge);
773 if(BBFlag) GetRawsData((integrator == 0 ? kChargeEoIBBInt0 : kChargeEoIBBInt1))->Fill(offlineCh,charge);
774 if(BGFlag) GetRawsData((integrator == 0 ? kChargeEoIBGInt0 : kChargeEoIBGInt1))->Fill(offlineCh,charge);
9bd82f77 775
6bec7c7c 776 hProj = ((TH2I*)GetRawsData((integrator == 0 ? kPedestalInt0 : kPedestalInt1)))->ProjectionY("",offlineCh+1,offlineCh+1);
777 Double_t ped = hProj->GetMean();
778 Double_t sigma = hProj->GetRMS();
779 delete hProj;
9bd82f77 780
6bec7c7c 781 Double_t chargeEoI = charge - ped;
9bd82f77 782
6bec7c7c 783 // Calculation of the number of MIP
784 Double_t mipEoI = chargeEoI * fCalibData->GetMIPperADC(offlineCh);
9bd82f77 785
a8e23456 786 int side = offlineCh/32;
787 int ring = (offlineCh - 32*side) / 8;
3dc953e2 788 if(BBFlag) {
789 fFlagPerRing[side*4 + ring] += 1;
790 fFlagPerChannel[offlineCh] += 1;
791 }
a8e23456 792
c8d309e0 793 if((chargeEoI > 2.*sigma) && !(time <1.e-6)){
a8e23456 794 fChargePerRing[side*4 + ring] += chargeEoI;
3dc953e2 795 fChargePerChannel[offlineCh] += chargeEoI;
6bec7c7c 796 ((TH2I*)GetRawsData((integrator == 0 ? kChargeEoICycleInt0 : kChargeEoICycleInt1)))->Fill(offlineCh,chargeEoI);
797 ((TH2D*)GetRawsData(kRawMIPChannel))->Fill(offlineCh,mipEoI);
798 if(offlineCh<32) {
9bd82f77 799 mulV0C++;
6bec7c7c 800 chargeV0C += chargeEoI;
801 mipV0C += mipEoI;
802 } else {
9bd82f77 803 mulV0A++;
6bec7c7c 804 chargeV0A += chargeEoI;
805 mipV0A += mipEoI;
9bd82f77 806 }
6bec7c7c 807 }
9bd82f77 808
6bec7c7c 809 // Fill Charge Minimum Bias Histograms
810
811 int idx;
812 for(Int_t iBunch=0; iBunch<10; iBunch++){
e58b4e66 813 integrator = rawStream->GetIntMBFlag(iChannel, iBunch);
814 BBFlag = rawStream->GetBBMBFlag(iChannel, iBunch);
815 BGFlag = rawStream->GetBGMBFlag(iChannel, iBunch);
816 MBCharge = rawStream->GetChargeMB(iChannel, iBunch);
9bd82f77 817
818 if(integrator==0){
819 if(BBFlag==0){
6bec7c7c 820 if(BGFlag==0) idx = kChargeMBBB0BG0Int0;
821 else idx = kChargeMBBB0BG1Int0;
9bd82f77 822 } else {
6bec7c7c 823 if(BGFlag==0) idx = kChargeMBBB1BG0Int0;
824 else idx = kChargeMBBB1BG1Int0;
9bd82f77 825 }
826 } else {
827 if(BBFlag==0){
6bec7c7c 828 if(BGFlag==0) idx = kChargeMBBB0BG0Int1;
829 else idx = kChargeMBBB0BG1Int1;
9bd82f77 830 } else {
6bec7c7c 831 if(BGFlag==0) idx = kChargeMBBB1BG0Int1;
832 else idx = kChargeMBBB1BG1Int1;
9bd82f77 833 }
834 }
6bec7c7c 835 GetRawsData(idx)->Fill(offlineCh,MBCharge);
c8d309e0 836 }
6bec7c7c 837
838 // Fill HPTDC Time Histograms
839
e58b4e66 840 BBFlag = rawStream->GetBBFlag(iChannel, 10);
841 BGFlag = rawStream->GetBGFlag(iChannel, 10);
6bec7c7c 842
c8d309e0 843 if(!(time<1.e-6)){
6bec7c7c 844 if (offlineCh<32) {
845 itimeV0C++;
846 timeV0C += time;
847 }else{
848 itimeV0A++;
849 timeV0A += time;
850 }
851 }
852 GetRawsData(kHPTDCTime)->Fill(offlineCh,time);
853 GetRawsData(kWidth)->Fill(offlineCh,width);
9bd82f77 854 if(BBFlag) {
6bec7c7c 855 GetRawsData(kHPTDCTimeBB)->Fill(offlineCh,time);
856 GetRawsData(kWidthBB)->Fill(offlineCh,width);
9bd82f77 857 }
6bec7c7c 858 if(BGFlag) {
859 GetRawsData(kHPTDCTimeBG)->Fill(offlineCh,time);
860 GetRawsData(kWidthBG)->Fill(offlineCh,width);
9bd82f77 861 }
862
6bec7c7c 863 // Fill Flag and Charge Versus LHC-Clock histograms
864
d62942e8 865 for(Int_t iEvent=0; iEvent<21; iEvent++){
e58b4e66 866 charge = rawStream->GetPedestal(iChannel,iEvent);
867 integrator = rawStream->GetIntegratorFlag(iChannel,iEvent);
868 BBFlag = rawStream->GetBBFlag(iChannel, iEvent);
869 BGFlag = rawStream->GetBGFlag(iChannel,iEvent );
6bec7c7c 870
871 ((TH2*) GetRawsData((integrator == 0 ? kChargeVsClockInt0 : kChargeVsClockInt1 )))->Fill(offlineCh,(float)iEvent-10,(float)charge);
872 ((TH2*) GetRawsData(kBBFlagVsClock))->Fill(offlineCh,(float)iEvent-10,(float)BBFlag);
873 ((TH2*) GetRawsData(kBGFlagVsClock))->Fill(offlineCh,(float)iEvent-10,(float)BGFlag);
c8d309e0 874 if(iEvent==10) ((TH1*) GetRawsData(kBBFlagsPerChannel))->Fill(offlineCh,(float)BBFlag);
9bd82f77 875 }
876
6bec7c7c 877 }// END of Loop over channels
9bd82f77 878
c8d309e0 879 if(itimeV0A>0) timeV0A /= itimeV0A;
6bec7c7c 880 else timeV0A = -1.;
c8d309e0 881 if(itimeV0C>0) timeV0C /= itimeV0C;
6bec7c7c 882 else timeV0C = -1.;
883 if(timeV0A<0. || timeV0C<0.) diffTime = -10000.;
884 else diffTime = timeV0A - timeV0C;
9bd82f77 885
6bec7c7c 886 GetRawsData(kV0ATime)->Fill(timeV0A);
887 GetRawsData(kV0CTime)->Fill(timeV0C);
888 GetRawsData(kDiffTime)->Fill(diffTime);
9bd82f77 889
6bec7c7c 890 GetRawsData(kMultiV0A)->Fill(mulV0A);
891 GetRawsData(kMultiV0C)->Fill(mulV0C);
9bd82f77 892
6bec7c7c 893 GetRawsData(kChargeV0A)->Fill(chargeV0A);
894 GetRawsData(kChargeV0C)->Fill(chargeV0C);
895 GetRawsData(kChargeV0)->Fill(chargeV0A + chargeV0C);
9bd82f77 896
6bec7c7c 897 GetRawsData(kRawMIPV0A)->Fill(mipV0A);
898 GetRawsData(kRawMIPV0C)->Fill(mipV0C);
899 GetRawsData(kRawMIPV0)->Fill(mipV0A + mipV0C);
900 break;
901
902 } // END of SWITCH : EVENT TYPE
9bd82f77 903
904 fEvent++;
4e25ac79 905 TParameter<double> * p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kMultiV0A)->GetName()))) ;
719e870c 906 if (p) p->SetVal((double)mulV0A) ;
9bd82f77 907
4e25ac79 908 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kMultiV0C)->GetName()))) ;
719e870c 909 if (p) p->SetVal((double)mulV0C) ;
9bd82f77 910
4e25ac79 911 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kChargeV0A)->GetName()))) ;
719e870c 912 if (p) p->SetVal((double)chargeV0A) ;
9bd82f77 913
4e25ac79 914 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kChargeV0C)->GetName()))) ;
719e870c 915 if (p) p->SetVal((double)chargeV0C) ;
9bd82f77 916
4e25ac79 917 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kChargeV0)->GetName()))) ;
719e870c 918 if (p) p->SetVal((double)(chargeV0A + chargeV0C)) ;
9bd82f77 919
4e25ac79 920 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kRawMIPV0A)->GetName()))) ;
719e870c 921 if (p) p->SetVal((double)mipV0A) ;
9bd82f77 922
4e25ac79 923 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kRawMIPV0C)->GetName()))) ;
719e870c 924 if (p) p->SetVal((double)mipV0C) ;
9bd82f77 925
4e25ac79 926 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kRawMIPV0)->GetName()))) ;
719e870c 927 if (p) p->SetVal((double)(mipV0A + mipV0C)) ;
9bd82f77 928
4e25ac79 929 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kV0ATime)->GetName()))) ;
719e870c 930 if (p) p->SetVal((double)timeV0A) ;
9bd82f77 931
4e25ac79 932 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kV0CTime)->GetName()))) ;
719e870c 933 if (p) p->SetVal((double)timeV0C) ;
9bd82f77 934
4e25ac79 935 p = dynamic_cast<TParameter<double>*>(GetParameterList()->FindObject(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(AliQAv1::kRAWS).Data(), GetRawsData(kDiffTime)->GetName()))) ;
719e870c 936 if (p) p->SetVal((double)diffTime) ;
9bd82f77 937
e58b4e66 938 delete rawStream; rawStream = 0x0;
939
9bd82f77 940
4da80b8c 941 }
508b9fc0 942
943//____________________________________________________________________________
944void AliVZEROQADataMakerRec::StartOfDetectorCycle()
945{
946 // Detector specific actions at start of cycle
947
6bec7c7c 948 // Reset of the histogram used - to have the trend versus time -
e6d13307 949
950 fCalibData = GetCalibData();
6bec7c7c 951
9bd82f77 952 TH1* h;
6bec7c7c 953 h = GetRawsData(kPedestalCycleInt0);
9bd82f77 954 if(h) h->Reset();
6bec7c7c 955 h = GetRawsData(kPedestalCycleInt1);
9bd82f77 956 if(h) h->Reset();
6bec7c7c 957 h = GetRawsData(kChargeEoICycleInt0);
9bd82f77 958 if(h) h->Reset();
6bec7c7c 959 h = GetRawsData(kChargeEoICycleInt1);
9bd82f77 960 if(h) h->Reset();
a8e23456 961
962 TTimeStamp currentTime;
963 fCycleStartTime = currentTime.GetSec();
964
965 fNTotEvents = 0;
966}
9bd82f77 967
a8e23456 968//-------------------------------------------------------------------------------------------------
969void AliVZEROQADataMakerRec::AddTrendingEntry(){
3dc953e2 970 //printf("AddTrendingEntry\n");
971 fNTrendingUpdates++;
a8e23456 972
973 // Normalize to the number of events
974 for(int i=0; i<8;i++){
975// fChargePerRing[i] *= TMath::Power(10.,i)/fTrendingUpdateEvent;
976// fFlagPerRing[i] *= TMath::Power(10.,i)/fTrendingUpdateEvent;
977 fChargePerRing[i] /= fTrendingUpdateEvent;
978 fFlagPerRing[i] /= fTrendingUpdateEvent;
979 }
980
3dc953e2 981 GetRawsData(kRawDQMCharge)->Reset();
982 GetRawsData(kRawDQMFlag)->Reset();
983
984 for(int i=0; i<64;i++){
985 fChargePerChannel[i] /= fTrendingUpdateEvent;
986 fFlagPerChannel[i] /= fTrendingUpdateEvent;
987
988 if(fMeanChargePerChannel[i]) GetRawsData(kRawDQMCharge)->Fill(i,fChargePerChannel[i]/fMeanChargePerChannel[i]);
989 else GetRawsData(kRawDQMCharge)->Fill(i,0.);
990
991 if(fMeanFlagPerChannel[i]) GetRawsData(kRawDQMFlag)->Fill(i,fFlagPerChannel[i]/fMeanFlagPerChannel[i]);
992 else GetRawsData(kRawDQMFlag)->Fill(i,0.);
993
994 fMeanChargePerChannel[i] = (fMeanChargePerChannel[i] * (fNTrendingUpdates-1) + fChargePerChannel[i]) / fNTrendingUpdates;
995 fMeanFlagPerChannel[i] = (fMeanFlagPerChannel[i] * (fNTrendingUpdates-1) + fFlagPerChannel[i]) / fNTrendingUpdates;
996
997 }
998
a8e23456 999 TTimeStamp currentTime;
1000 ((AliVZEROTrending*)GetRawsData(kRawMeanChargePerRing))->AddEntry(fChargePerRing, currentTime.GetSec());
1001 ((AliVZEROTrending*)GetRawsData(kRawMeanFlagPerRing))->AddEntry(fFlagPerRing, currentTime.GetSec());
1002 //moMeanFlagPerRing->AddEntry(fFlagPerRing, currentTime.GetSec());
1003
1004 // Put back counters to zero
1005 for(int i=0; i<8;i++){
1006 fChargePerRing[i] = 0.;
1007 fFlagPerRing[i] = 0.;
1008 }
3dc953e2 1009 for(int i=0; i<64;i++){
1010 fChargePerChannel[i] = 0.;
1011 fFlagPerChannel[i] = 0.;
1012 }
a8e23456 1013
508b9fc0 1014}
74995017 1015