]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ZDC/AliZDCQADataMakerRec.cxx
Bug in QA class corrected
[u/mrichter/AliRoot.git] / ZDC / AliZDCQADataMakerRec.cxx
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 ///////////////////////////////////////////////////////////////////////
17 //                                                                   //
18 //  Produces the data needed to calculate the ZDC quality assurance. //
19 //  QA objects are 1 & 2 Dimensional histograms.                     //
20 //  author: C. Oppedisano                                            //
21 //                                                                   //
22 ///////////////////////////////////////////////////////////////////////
23
24 // --- ROOT system ---
25 #include <TClonesArray.h>
26 #include <TFile.h> 
27 #include <TH1F.h> 
28 #include <TH2F.h>
29 #include <TProfile.h>
30 #include <Riostream.h>
31 // --- Standard library ---
32
33 // --- AliRoot header files ---
34 #include "AliLog.h"
35 #include "AliQAChecker.h"
36 #include "AliZDCReco.h"
37 #include "AliRawReader.h"
38 #include "AliZDCQADataMakerRec.h"
39 #include "AliZDCPedestals.h"
40 #include "AliZDCRawStream.h"
41 #include "AliZDCDigit.h"
42 #include "AliESDZDC.h"
43 #include "AliESDEvent.h"
44
45 ClassImp(AliZDCQADataMakerRec)
46            
47 //____________________________________________________________________________ 
48   AliZDCQADataMakerRec::AliZDCQADataMakerRec() : 
49   AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kZDC), "ZDC Quality Assurance Data Maker"), 
50   fPedCalibData(0x0)
51 {
52   // ctor
53 }
54
55 //____________________________________________________________________________ 
56 AliZDCQADataMakerRec::AliZDCQADataMakerRec(const AliZDCQADataMakerRec& qadm) :
57   AliQADataMakerRec(),      
58   fPedCalibData(0x0)
59
60 {
61   //copy ctor 
62   SetName((const char*)qadm.GetName()); 
63   SetTitle((const char*)qadm.GetTitle()); 
64 }
65
66 //__________________________________________________________________
67 AliZDCQADataMakerRec& AliZDCQADataMakerRec::operator = (const AliZDCQADataMakerRec& qadm )
68 {
69   // Equal operator.
70   this->~AliZDCQADataMakerRec();
71   new(this) AliZDCQADataMakerRec(qadm);
72   return *this;
73 }
74
75 //____________________________________________________________________________ 
76 AliZDCPedestals* AliZDCQADataMakerRec::GetPedCalibData() const
77 {
78
79   // Retrieving pedestal calibration object from OCDB
80   AliCDBEntry  *entry = AliCDBManager::Instance()->Get("ZDC/Calib/Pedestals");
81   if(!entry) AliWarning("No calibration data loaded!");  
82
83   AliZDCPedestals *calibdata = (AliZDCPedestals*)  (entry->GetObject());
84   if(!calibdata) AliFatal("Wrong calibration object in calibration  file!");
85
86   return calibdata;
87
88 }
89
90 //____________________________________________________________________________
91 void AliZDCQADataMakerRec::InitRaws()
92 {
93   // create Digits histograms in Digits subdir
94   const Bool_t expert   = kTRUE ; 
95   const Bool_t image    = kTRUE ; 
96   
97   // **************************** NON EXPERT HISTOS ****************************
98   TH1F * hZNCSpectrum = new TH1F("hZNCSpectrum","ZNC spectrum;Amplitude [ADC counts];Counts",100,0.,3000.);
99   TH1F * hZPCSpectrum = new TH1F("hZPCSpectrum","ZPC spectrum;Amplitude [ADC counts];Counts",100,0.,3000.);
100   TH1F * hZNASpectrum = new TH1F("hZNASpectrum","ZNA spectrum;Amplitude [ADC counts];Counts",100,0.,3000.);
101   TH1F * hZPASpectrum = new TH1F("hZPASpectrum","ZPA spectrum;Amplitude [ADC counts];Counts",100,0.,3000.);
102   TH1F * hZEM1Spectrum = new TH1F("hZEM1Spectrum","ZEM1 spectrum;Amplitude [ADC counts];Counts",100,0.,2000.);
103   TH1F * hZEM2Spectrum = new TH1F("hZEM2Spectrum","ZEM2 spectrum;Amplitude [ADC counts];Counts",100,0.,2000.);
104   Add2RawsList(hZNCSpectrum, 0, !expert, image);
105   Add2RawsList(hZNASpectrum, 1, !expert, image);
106   Add2RawsList(hZPCSpectrum, 2, !expert, image);
107   Add2RawsList(hZPASpectrum, 3, !expert, image);
108   Add2RawsList(hZEM1Spectrum, 4, !expert, image);
109   Add2RawsList(hZEM2Spectrum, 5, !expert, image);
110   
111   // **************************** EXPERT HISTOS ****************************
112   // ------------------- HIGH GAIN CHAIN ---------------------------
113   TH1F * hRawSumQZNC = new TH1F("hRawSumQZNC", "Raw sumQ ZNC;Amplitude [ADC counts];Counts",100, 0., 1000.);
114   TH1F * hRawSumQZNA = new TH1F("hRawSumQZNA", "Raw sumQ ZNA;Amplitude [ADC counts];Counts",100, 0., 1000.);
115   TH1F * hRawSumQZPC = new TH1F("hRawSumQZPC", "Raw sumQ ZPC;Amplitude [ADC counts];Counts",100, 0., 1000.);
116   TH1F * hRawSumQZPA = new TH1F("hRawSumQZPA", "Raw sumQ ZPA;Amplitude [ADC counts];Counts",100, 0., 1000.);
117   Add2RawsList(hRawSumQZNC, 10, expert, !image);
118   Add2RawsList(hRawSumQZNA, 11, expert, !image);
119   Add2RawsList(hRawSumQZPC, 12, expert, !image);
120   Add2RawsList(hRawSumQZPA, 13, expert, !image);
121   //
122   TH1F * hRawPMCZNC = new TH1F("hRawPMCZNC", "Raw ZNC PMC;Amplitude [ADC counts];Counts",100, 0., 1000.);
123   TH1F * hRawPMCZNA = new TH1F("hRawPMCZNA", "Raw ZNA PMC;Amplitude [ADC counts];Counts",100, 0., 1000.);
124   TH1F * hRawPMCZPC = new TH1F("hRawPMCZPC", "Raw ZPC PMC;Amplitude [ADC counts];Counts",100, 0., 1000.);
125   TH1F * hRawPMCZPA = new TH1F("hRawPMCZPA", "Raw ZPA PMC;Amplitude [ADC counts];Counts",100, 0., 1000.);
126   Add2RawsList(hRawPMCZNC, 6, expert, !image);
127   Add2RawsList(hRawPMCZNA, 7, expert, !image);
128   Add2RawsList(hRawPMCZPC, 8, expert, !image);
129   Add2RawsList(hRawPMCZPA, 9, expert, !image);
130   //
131 }
132
133 //____________________________________________________________________________
134 void AliZDCQADataMakerRec::InitRecPoints()
135 {
136   // create Digits histograms in Digits subdir
137   const Bool_t expert = kTRUE ; 
138   const Bool_t image  = kTRUE ; 
139   //
140   // ------------------- HIGH GAIN CHAIN ---------------------------
141   TH1F * hRecZNCTot = new TH1F("hRecZNCTot", "Rec signal in ZNC;Amplitude [ADC counts];Counts", 100, 0., 2000.);
142   TH1F * hRecZNATot = new TH1F("hRecZNATot", "Rec signal in ZNA;Amplitude [ADC counts];Counts", 100, 0., 2000.);
143   TH1F * hRecZPCTot = new TH1F("hRecZPCTot", "Rec signal in ZPC;Amplitude [ADC counts];Counts", 100, 0., 8000.);
144   TH1F * hRecZPATot = new TH1F("hRecZPATot", "Rec signal in ZPA;Amplitude [ADC counts];Counts", 100, 0., 8000.);
145   Add2RecPointsList(hRecZNCTot, 0, !expert, image);
146   Add2RecPointsList(hRecZNATot, 1, !expert, image);
147   Add2RecPointsList(hRecZPCTot, 2, !expert, image);
148   Add2RecPointsList(hRecZPATot, 3, !expert, image);
149   //
150   TH1F * hRecSumQZNC = new TH1F("hRecSumQZNC", "Rec summed 4 ZNC quadrants;Amplitude [ADC counts];Counts",100, 0., 2000.);
151   TH1F * hRecSumQZNA = new TH1F("hRecSumQZNA", "Rec summed 4 ZNA quadrants;Amplitude [ADC counts];Counts",100, 0., 2000.);
152   TH1F * hRecSumQZPC = new TH1F("hRecSumQZPC", "Rec summed 4 ZPC quadrants;Amplitude [ADC counts];Counts",100, 0., 2000.);
153   TH1F * hRecSumQZPA = new TH1F("hRecSumQZPA", "Rec summed 4 ZPA quadrants;Amplitude [ADC counts];Counts",100, 0., 2000.);
154   Add2RecPointsList(hRecSumQZNC, 4, expert, !image);
155   Add2RecPointsList(hRecSumQZNA, 5, expert, !image);
156   Add2RecPointsList(hRecSumQZPC, 6, expert, !image);
157   Add2RecPointsList(hRecSumQZPA, 7, expert, !image);
158   //
159   TH1F * hRecPMCZNC = new TH1F("hRecPMCZNC", "Rec common ZNC PMT;Amplitude [ADC counts];Counts",100, 0., 2000.);
160   TH1F * hRecPMCZNA = new TH1F("hRecPMCZNA", "Rec common ZNA PMT;Amplitude [ADC counts];Counts",100, 0., 2000.);
161   TH1F * hRecPMCZPC = new TH1F("hRecPMCZPC", "Rec common ZPC PMT;Amplitude [ADC counts];Counts",100, 0., 2000.);
162   TH1F * hRecPMCZPA = new TH1F("hRecPMCZPA", "Rec common ZPA PMT;Amplitude [ADC counts];Counts",100, 0., 2000.);
163   Add2RecPointsList(hRecPMCZNC, 8 , expert, !image);
164   Add2RecPointsList(hRecPMCZNA, 9 , expert, !image);
165   Add2RecPointsList(hRecPMCZPC, 10, expert, !image);
166   Add2RecPointsList(hRecPMCZPA, 11, expert, !image); 
167 }
168
169 //____________________________________________________________________________
170 void AliZDCQADataMakerRec::InitESDs()
171 {
172   //Booking ESDs histograms
173   //
174   const Bool_t expert = kTRUE ; 
175   const Bool_t image  = kTRUE ; 
176   
177   TH2F * hZNCcentr  = new TH2F("hZNCcentr", "Centroid in ZNC;X [cm];Y[cm]", 100, -5.,5.,100,-5.,5.);
178   TH2F * hZNAcentr  = new TH2F("hZNAcentr", "Centroid in ZNA;X [cm];Y[cm]", 100, -5.,5.,100,-5.,5.);
179   Add2ESDsList(hZNCcentr, 0, !expert, image);
180   Add2ESDsList(hZNAcentr, 1, !expert, image);
181   //
182   // ------------------- HIGH GAIN CHAIN ---------------------------
183   TH1F * hESDZNCTot = new TH1F("hESDZNCTot", "Energy in ZNC", 100, 0., 4000.);
184   TH1F * hESDZNATot = new TH1F("hESDZNATot", "Energy in ZNA", 100, 0., 4000.);
185   TH1F * hESDZPCTot = new TH1F("hESDZPCTot", "Energy in ZPC", 100, 0., 4000.);
186   TH1F * hESDZPATot = new TH1F("hESDZPATot", "Energy in ZPA", 100, 0., 4000.);
187   Add2ESDsList(hESDZNCTot, 2, !expert, image);
188   Add2ESDsList(hESDZNATot, 3, !expert, image);
189   Add2ESDsList(hESDZPCTot, 4, !expert, image);
190   Add2ESDsList(hESDZPATot, 5, !expert, image);
191   //
192   TH1F * hESDZEM1 = new TH1F("hESDZEM1", "Energy in ZEM1", 100, 0., 2000.);
193   TH1F * hESDZEM2 = new TH1F("hESDZEM2", "Energy in ZEM2", 100, 0., 2000.);
194   Add2ESDsList(hESDZEM1,6, !expert, image);
195   Add2ESDsList(hESDZEM2,7, !expert, image);
196   //
197   TH1F * hESDSumQZNC = new TH1F("hESDSumQZNC", "Sum of 4 ZNC energy",100, 0., 2000.);
198   TH1F * hESDSumQZNA = new TH1F("hESDSumQZNA", "Sum of 4 ZNA energy",100, 0., 2000.);
199   TH1F * hESDSumQZPC = new TH1F("hESDSumQZPC", "Sum of 4 ZPC energy",100, 0., 2000.);
200   TH1F * hESDSumQZPA = new TH1F("hESDSumQZPA", "Sum of 4 ZPA energy",100, 0., 2000.);
201   Add2ESDsList(hESDSumQZNC, 8, expert, !image);
202   Add2ESDsList(hESDSumQZNA, 9, expert, !image);
203   Add2ESDsList(hESDSumQZPC, 10, expert, !image);
204   Add2ESDsList(hESDSumQZPA, 11, expert, !image);
205   //
206   TH1F * hESDPMCZNC = new TH1F("hESDPMCZNC", "Energy in ZNC PMC",100, 0., 2000.);
207   TH1F * hESDPMCZNA = new TH1F("hESDPMCZNA", "Energy in ZNA PMC",100, 0., 2000.);
208   TH1F * hESDPMCZPC = new TH1F("hESDPMCZPC", "Energy in ZPC PMC",100, 0., 2000.);
209   TH1F * hESDPMCZPA = new TH1F("hESDPMCZPA", "Energy in ZPA PMC",100, 0., 2000.);
210   Add2ESDsList(hESDPMCZNC, 12, expert, !image);
211   Add2ESDsList(hESDPMCZNA, 13, expert, !image);
212   Add2ESDsList(hESDPMCZPC, 14, expert, !image);
213   Add2ESDsList(hESDPMCZPA, 15, expert, !image);
214   // 
215   // ------------------- LOW GAIN CHAIN ---------------------------
216   TH1F * hESDSumQZNClg = new TH1F("hESDSumQZNClg", "Sum of 4 lg ZNC sectors",100, 0., 4000.);
217   TH1F * hESDSumQZNAlg = new TH1F("hESDSumQZNAlg", "Sum of 4 lg ZNA sectors",100, 0., 4000.);
218   TH1F * hESDSumQZPClg = new TH1F("hESDSumQZPClg", "Sum of 4 lg ZPC sectors",100, 0., 4000.);
219   TH1F * hESDSumQZPAlg = new TH1F("hESDSumQZPAlg", "Sum of 4 lg ZPA sectors",100, 0., 4000.);
220   Add2ESDsList(hESDSumQZNClg, 16, expert, !image);
221   Add2ESDsList(hESDSumQZNAlg, 17, expert, !image);
222   Add2ESDsList(hESDSumQZPClg, 18, expert, !image);
223   Add2ESDsList(hESDSumQZPAlg, 19, expert, !image);
224   //
225   TH1F * hESDPMCZNClg = new TH1F("hESDPMCZNClg", "Signal in common ZNC lg PMT",100, 0., 4000.);
226   TH1F * hESDPMCZNAlg = new TH1F("hESDPMCZNAlg", "Signal in common ZNA lg PMT",100, 0., 4000.);
227   TH1F * hESDPMCZPClg = new TH1F("hESDPMCZPClg", "Signal in common ZPC lg PMT",100, 0., 4000.);
228   TH1F * hESDPMCZPAlg = new TH1F("hESDPMCZPAlg", "Signal in common ZPA lg PMT",100, 0., 4000.);
229   Add2ESDsList(hESDPMCZNClg, 20, expert, !image);
230   Add2ESDsList(hESDPMCZNAlg, 21, expert, !image);
231   Add2ESDsList(hESDPMCZPClg, 22, expert, !image);
232   Add2ESDsList(hESDPMCZPAlg, 23, expert, !image);
233 }
234
235 //____________________________________________________________________________
236 void AliZDCQADataMakerRec::MakeRaws(AliRawReader *rawReader)
237 {
238   // Filling Raws QA histos
239   //
240   // Check if histograms already created for this Event Specie
241   if(!GetRawsData(0)) InitRaws();
242   
243   // Parameters for mean value pedestal subtraction
244   int const kNch = 24;
245   Float_t meanPed[2*kNch];    
246   for(Int_t jj=0; jj<2*kNch; jj++) meanPed[jj] = fPedCalibData->GetMeanPed(jj);
247   
248   AliZDCRawStream stream(rawReader);
249   while(stream.Next()){
250   
251     Float_t zncSignal=0., znaSignal=0., zpcSignal=0., zpaSignal=0.;
252     Float_t zncSumQ=0., znaSumQ=0., zpcSumQ=0., zpaSumQ=0.;
253     Bool_t isZNCFired=kFALSE, isZPCFired=kFALSE, isZNAFired=kFALSE, isZPAFired=kFALSE;
254     
255     if(stream.IsADCDataWord() && 
256      (stream.GetADCModule()==0 || stream.GetADCModule()==1)){
257      
258        Int_t det = stream.GetSector(0);
259        Int_t quad = stream.GetSector(1);
260        Int_t gain = stream.GetADCGain();
261        Int_t pedindex=0;
262        
263        // Stuff for pedestal subtraction
264        if(quad != 5){ // ZDCs (not reference PTMs)
265         if(det == 1){    
266           pedindex = quad;
267           if(gain == 0){
268             Float_t pedSubVal = (Float_t) (stream.GetADCValue()-meanPed[pedindex]); 
269             zncSignal  += pedSubVal; 
270             isZNCFired = kTRUE;
271             if(quad!=0) zncSumQ += pedSubVal;
272             else GetRawsData(10)->Fill(pedSubVal);
273           }
274         }
275         else if(det == 2){ 
276           pedindex = quad+5;
277           if(gain == 0){
278             Float_t pedSubVal = (Float_t) (stream.GetADCValue()-meanPed[pedindex]); 
279             zpcSignal += pedSubVal; 
280             isZPCFired = kTRUE;
281             if(quad!=0) zpcSumQ += pedSubVal;
282             else GetRawsData(12)->Fill(pedSubVal);
283           }
284         }
285         else if(det == 3){ 
286           pedindex = quad+9;
287           if(quad==1){     
288             if(gain == 0){
289               Float_t pedSubVal = (Float_t) (stream.GetADCValue()-meanPed[pedindex]); 
290               GetRawsData(4)->Fill(pedSubVal);
291             }
292           }
293           else if(quad==2){ 
294             if(gain == 0){
295               Float_t pedSubVal = (Float_t) (stream.GetADCValue()-meanPed[pedindex]); 
296               GetRawsData(5)->Fill(pedSubVal); 
297             }
298           }
299         }
300         else if(det == 4){       
301           pedindex = quad+12;
302           if(gain == 0){
303             Float_t pedSubVal = (Float_t) (stream.GetADCValue()-meanPed[pedindex]); 
304             znaSignal  += (Float_t) (stream.GetADCValue()-meanPed[pedindex]); 
305             isZNAFired = kTRUE;
306             if(quad!=0) znaSumQ += pedSubVal;
307             else GetRawsData(11)->Fill(pedSubVal);
308           }
309         }
310         else if(det == 5){
311           pedindex = quad+17;
312           if(gain == 0){
313             Float_t pedSubVal = (Float_t) (stream.GetADCValue()-meanPed[pedindex]); 
314             zpaSignal  += (Float_t) (stream.GetADCValue()-meanPed[pedindex]); 
315             isZPAFired = kTRUE;
316             if(quad!=0) zpaSumQ += pedSubVal;
317             else GetRawsData(13)->Fill(pedSubVal);
318           }
319         }
320        }
321        
322     } //IsADCDataWord
323     //
324     if(isZNCFired){
325       GetRawsData(0)->Fill(zncSignal);
326       GetRawsData(6)->Fill(zncSumQ);
327     }
328     if(isZPCFired){
329       GetRawsData(2)->Fill(zpcSignal);
330       GetRawsData(8)->Fill(zncSumQ);
331     }
332     if(isZNAFired){ 
333       GetRawsData(1)->Fill(znaSignal);
334       GetRawsData(7)->Fill(znaSumQ);
335     }
336     if(isZPAFired){ 
337       GetRawsData(3)->Fill(zpaSignal);
338       GetRawsData(9)->Fill(znaSumQ);
339     }
340     
341   } //stream.Next()
342
343 //   stream.Delete();
344 }
345
346 //____________________________________________________________________________
347 void AliZDCQADataMakerRec::MakeRecPoints(TTree * clustersTree)
348 {
349   // Filling QA histos from RecPoints
350
351   TBranch *branch = clustersTree->GetBranch("ZDC");
352   if(!branch){ 
353     AliError("Can't get the ZDC branch for rec points!");
354     return;
355   }
356   
357   if(!GetRecPointsData(0)) InitRecPoints() ;
358
359   Float_t sum_ZNC=0., sum_ZNA=0., sum_ZPC=0., sum_ZPA=0.;
360   Float_t sumQ_ZNC=0., sumQ_ZNA=0., sumQ_ZPC=0., sumQ_ZPA=0.;
361
362   AliZDCReco reco;
363   AliZDCReco* preco = &reco;
364   clustersTree->SetBranchAddress("ZDC", &preco);
365
366   clustersTree->GetEntry(0);
367   for(Int_t i=0; i<5; i++){
368     sum_ZNC += reco.GetZN1HREnTow(i);
369     sum_ZPC += reco.GetZN2HREnTow(i);
370     sum_ZNA += reco.GetZP1HREnTow(i);
371     sum_ZPA += reco.GetZP2HREnTow(i);
372     if(i==0){
373       GetRecPointsData(8)->Fill(reco.GetZN1HREnTow(i));
374       GetRecPointsData(9)->Fill(reco.GetZN2HREnTow(i));
375       GetRecPointsData(10)->Fill(reco.GetZP1HREnTow(i));
376       GetRecPointsData(11)->Fill(reco.GetZP2HREnTow(i));
377     }
378     else{
379       sumQ_ZNC += reco.GetZN1HREnTow(i);
380       sumQ_ZPC += reco.GetZN2HREnTow(i);
381       sumQ_ZNA += reco.GetZP1HREnTow(i);
382       sumQ_ZPA += reco.GetZP2HREnTow(i);
383     }
384   }
385   
386   GetRecPointsData(0)->Fill(sum_ZNC);
387   GetRecPointsData(1)->Fill(sum_ZNA);
388   GetRecPointsData(2)->Fill(sum_ZPC);
389   GetRecPointsData(3)->Fill(sum_ZPA);
390   //
391   GetRecPointsData(4)->Fill(sumQ_ZNC);
392   GetRecPointsData(5)->Fill(sumQ_ZNA);
393   GetRecPointsData(6)->Fill(sumQ_ZPC);
394   GetRecPointsData(7)->Fill(sumQ_ZPA);
395   
396 }  
397
398 //____________________________________________________________________________
399 void AliZDCQADataMakerRec::MakeESDs(AliESDEvent * esd)
400 {
401   // make QA data from ESDs
402   //
403   
404   // Check id histograms already created for this Event Specie
405   if(!GetESDsData(0)) InitESDs() ;
406
407   AliESDZDC * zdcESD =  esd->GetESDZDC();
408   //
409   TString beamType = esd->GetBeamType();
410   Double_t centr_ZNC[2]={999.,999}, centr_ZNA[2]={999.,999};
411   if(((beamType.CompareTo("pp"))==0) || ((beamType.CompareTo("p-p"))==0)
412      ||((beamType.CompareTo("PP"))==0) || ((beamType.CompareTo("P-P"))==0)){
413     zdcESD->GetZNCentroidInpp(centr_ZNC, centr_ZNA);
414   }
415   else if((beamType.CompareTo("A-A")) == 0){
416     Float_t beamEne = esd->GetBeamEnergy();
417     zdcESD->GetZNCentroidInPbPb(beamEne, centr_ZNC, centr_ZNA);
418   }
419   else printf(" ZDC -> not possible to evaluate centroids for %s beam type\n\n",beamType.Data());
420   GetESDsData(0)->Fill(centr_ZNC[0], centr_ZNC[1]);
421   GetESDsData(1)->Fill(centr_ZNA[0], centr_ZNA[1]);
422
423   //
424   GetESDsData(2)->Fill(esd->GetZDCN1Energy());
425   GetESDsData(3)->Fill(esd->GetZDCN2Energy());
426   GetESDsData(4)->Fill(esd->GetZDCP1Energy());
427   GetESDsData(5)->Fill(esd->GetZDCP2Energy());
428   GetESDsData(6)->Fill(esd->GetZDCEMEnergy(0));
429   GetESDsData(7)->Fill(esd->GetZDCEMEnergy(1));
430   //
431   Double_t sumQZNC=0., sumQZPC=0., sumQZNA=0., sumQZPA=0.;
432   Double_t sumQZNC_lg=0., sumQZPC_lg=0., sumQZNA_lg=0., sumQZPA_lg=0.;
433   //
434   const Double_t *towZNC, *towZPC, *towZNA, *towZPA;
435   const Double_t *towZNC_lg, *towZPC_lg, *towZNA_lg, *towZPA_lg;
436   //
437   towZNC = zdcESD->GetZN1TowerEnergy();
438   towZPC = zdcESD->GetZP1TowerEnergy();
439   towZNA = zdcESD->GetZN2TowerEnergy();
440   towZPA = zdcESD->GetZP2TowerEnergy();
441   //
442   towZNC_lg = zdcESD->GetZN1TowerEnergyLR();
443   towZPC_lg = zdcESD->GetZP1TowerEnergyLR();
444   towZNA_lg = zdcESD->GetZN2TowerEnergyLR();
445   towZPA_lg = zdcESD->GetZP2TowerEnergyLR();
446   //
447   for(Int_t i=0; i<5; i++){
448      if(i==0){
449        GetESDsData(12)->Fill(towZNC[i]);
450        GetESDsData(13)->Fill(towZNA[i]);
451        GetESDsData(14)->Fill(towZPC[i]);
452        GetESDsData(15)->Fill(towZPA[i]);
453        //
454        GetESDsData(20)->Fill(towZNC_lg[i]);
455        GetESDsData(21)->Fill(towZNA_lg[i]);
456        GetESDsData(22)->Fill(towZPC_lg[i]);
457        GetESDsData(23)->Fill(towZPA_lg[i]);
458      }
459      else{
460        sumQZNC += towZNC[i];
461        sumQZPC += towZPC[i];
462        sumQZNA += towZNA[i];
463        sumQZPA += towZPA[i];
464        //
465        sumQZNC_lg += towZNC_lg[i];
466        sumQZPC_lg += towZPC_lg[i];
467        sumQZNA_lg += towZNA_lg[i];
468        sumQZPA_lg += towZPA_lg[i];
469      }
470   }
471   GetESDsData(8)->Fill(sumQZNC);
472   GetESDsData(9)->Fill(sumQZNA);
473   GetESDsData(10)->Fill(sumQZPC);
474   GetESDsData(11)->Fill(sumQZPA);
475   //
476   GetESDsData(16)->Fill(sumQZNC_lg);
477   GetESDsData(17)->Fill(sumQZNA_lg);
478   GetESDsData(18)->Fill(sumQZPC_lg);
479   GetESDsData(19)->Fill(sumQZPA_lg);
480 }
481
482 //____________________________________________________________________________
483 void AliZDCQADataMakerRec::StartOfDetectorCycle()
484 {
485   //Detector specific actions at start of cycle
486
487   fPedCalibData = GetPedCalibData();
488   
489 }
490
491 //____________________________________________________________________________ 
492 void AliZDCQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
493 {
494   //Detector specific actions at end of cycle
495   // do the QA checking
496   AliQAChecker::Instance()->Run(AliQAv1::kZDC, task, list) ;  
497 }
498