]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ZDC/AliZDCQADataMakerRec.cxx
Fixes for memory problems
[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 "AliRawReader.h"
37 #include "AliZDCQADataMakerRec.h"
38 #include "AliZDCRawStream.h"
39 #include "AliZDCDigit.h"
40 #include "AliESDZDC.h"
41 #include "AliESDEvent.h"
42
43 ClassImp(AliZDCQADataMakerRec)
44            
45 //____________________________________________________________________________ 
46   AliZDCQADataMakerRec::AliZDCQADataMakerRec() : 
47   AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kZDC), "ZDC Quality Assurance Data Maker"), 
48   fDigit(0)
49 {
50   // ctor
51 }
52
53 //____________________________________________________________________________ 
54 AliZDCQADataMakerRec::AliZDCQADataMakerRec(const AliZDCQADataMakerRec& qadm) :
55   AliQADataMakerRec(),      
56   fDigit(0)
57 {
58   //copy ctor 
59   SetName((const char*)qadm.GetName()); 
60   SetTitle((const char*)qadm.GetTitle()); 
61 }
62
63 //__________________________________________________________________
64 AliZDCQADataMakerRec& AliZDCQADataMakerRec::operator = (const AliZDCQADataMakerRec& qadm )
65 {
66   // Equal operator.
67   this->~AliZDCQADataMakerRec();
68   new(this) AliZDCQADataMakerRec(qadm);
69   return *this;
70 }
71
72 //____________________________________________________________________________
73
74 void AliZDCQADataMakerRec::InitRaws()
75 {
76   // create Digits histograms in Digits subdir
77   const Bool_t expert   = kTRUE ; 
78   const Bool_t image    = kTRUE ; 
79   //
80   // ------------------- HIGH GAIN CHAIN ---------------------------
81   TH1F * hRawZNCTot = new TH1F("hRawZNCTot", "Raw signal in ZNC;Amplitude [ADC counts];Counts", 100, 0., 6000.);
82   TH1F * hRawZNATot = new TH1F("hRawZNATot", "Raw signal in ZNA;Amplitude [ADC counts];Counts", 100, 0., 6000.);
83   TH1F * hRawZPCTot = new TH1F("hRawZPCTot", "Raw signal in ZPC;Amplitude [ADC counts];Counts", 100, 0., 10000.);
84   TH1F * hRawZPATot = new TH1F("hRawZPATot", "Raw signal in ZPA;Amplitude [ADC counts];Counts", 100, 0., 10000.);
85   Add2RawsList(hRawZNCTot, 0, !expert, image);
86   Add2RawsList(hRawZNATot, 1, !expert, image);
87   Add2RawsList(hRawZPCTot, 2, !expert, image);
88   Add2RawsList(hRawZPATot, 3, !expert, image);
89   //
90   TH1F * hRawSumQZNC = new TH1F("hRawSumQZNC", "Raw summed 4 ZNC quadrants;Amplitude [ADC counts];Counts",100, 0., 4000.);
91   TH1F * hRawSumQZNA = new TH1F("hRawSumQZNA", "Raw summed 4 ZNA quadrants;Amplitude [ADC counts];Counts",100, 0., 4000.);
92   TH1F * hRawSumQZPC = new TH1F("hRawSumQZPC", "Raw summed 4 ZPC quadrants;Amplitude [ADC counts];Counts",100, 0., 4000.);
93   TH1F * hRawSumQZPA = new TH1F("hRawSumQZPA", "Raw summed 4 ZPA quadrants;Amplitude [ADC counts];Counts",100, 0., 4000.);
94   Add2RawsList(hRawSumQZNC, 4, expert, !image);
95   Add2RawsList(hRawSumQZNA, 5, expert, !image);
96   Add2RawsList(hRawSumQZPC, 6, expert, !image);
97   Add2RawsList(hRawSumQZPA, 7, expert, !image);
98   //
99   TH1F * hRawPMCZNC = new TH1F("hRawPMCZNC", "Raw common ZNC PMT;Amplitude [ADC counts];Counts",100, 0., 4000.);
100   TH1F * hRawPMCZNA = new TH1F("hRawPMCZNA", "Raw common ZNA PMT;Amplitude [ADC counts];Counts",100, 0., 4000.);
101   TH1F * hRawPMCZPC = new TH1F("hRawPMCZPC", "Raw common ZPC PMT;Amplitude [ADC counts];Counts",100, 0., 4000.);
102   TH1F * hRawPMCZPA = new TH1F("hRawPMCZPA", "Raw common ZPA PMT;Amplitude [ADC counts];Counts",100, 0., 4000.);
103   Add2RawsList(hRawPMCZNC, 8 , expert, !image);
104   Add2RawsList(hRawPMCZNA, 9 , expert, !image);
105   Add2RawsList(hRawPMCZPC, 10, expert, !image);
106   Add2RawsList(hRawPMCZPA, 11, expert, !image);
107   // 
108   // ------------------- LOW GAIN CHAIN ---------------------------
109   TH1F * hRawZNCTotlg = new TH1F("hRawZNCTotlg", "Rawit lg signal in ZNC", 100, 0., 6000.);
110   TH1F * hRawZNATotlg = new TH1F("hRawZNATotlg", "Rawit lg signal in ZNA", 100, 0., 6000.);
111   TH1F * hRawZPCTotlg = new TH1F("hRawZPCTotlg", "Rawit lg signal in ZPC", 100, 0., 10000.);
112   TH1F * hRawZPATotlg = new TH1F("hRawZPATotlg", "Rawit lg signal in ZPA", 100, 0., 10000.);
113   Add2RawsList(hRawZNCTotlg, 12, !expert, image);
114   Add2RawsList(hRawZNATotlg, 13, !expert, image);
115   Add2RawsList(hRawZPCTotlg, 14, !expert, image);
116   Add2RawsList(hRawZPATotlg, 15, !expert, image);
117   //
118   TH1F * hRawSumQZNClg = new TH1F("hRawSumQZNClg", "Raw summed 4 lg ZNC quadrants",100, 0., 4000.);
119   TH1F * hRawSumQZNAlg = new TH1F("hRawSumQZNAlg", "Raw summed 4 lg ZNA quadrants",100, 0., 4000.);
120   TH1F * hRawSumQZPClg = new TH1F("hRawSumQZPClg", "Raw summed 4 lg ZPC quadrants",100, 0., 4000.);
121   TH1F * hRawSumQZPAlg = new TH1F("hRawSumQZPAlg", "Raw summed 4 lg ZPA quadrants",100, 0., 4000.);
122   Add2RawsList(hRawSumQZNClg, 16, kTRUE, expert, !image);
123   Add2RawsList(hRawSumQZNAlg, 17, kTRUE, expert, !image);
124   Add2RawsList(hRawSumQZPClg, 18, kTRUE, expert, !image);
125   Add2RawsList(hRawSumQZPAlg, 19, kTRUE, expert, !image);
126   //
127   TH1F * hRawPMCZNClg = new TH1F("hRawPMCZNClg", "Raw common lg ZNC PMT",100, 0., 4000.);
128   TH1F * hRawPMCZNAlg = new TH1F("hRawPMCZNAlg", "Raw common lg ZNA PMT",100, 0., 4000.);
129   TH1F * hRawPMCZPClg = new TH1F("hRawPMCZPClg", "Raw common lg ZPC PMT",100, 0., 4000.);
130   TH1F * hRawPMCZPAlg = new TH1F("hRawPMCZPAlg", "Raw common lg ZPA PMT",100, 0., 4000.);
131   Add2RawsList(hRawPMCZNClg, 20, kTRUE, expert, !image);
132   Add2RawsList(hRawPMCZNAlg, 21, kTRUE, expert, !image);
133   Add2RawsList(hRawPMCZPClg, 22, kTRUE, expert, !image);
134   Add2RawsList(hRawPMCZPAlg, 23, kTRUE, expert, !image);
135 }
136
137 //____________________________________________________________________________ 
138 void AliZDCQADataMakerRec::InitDigits()
139 {
140   // create Digits histograms in Digits subdir
141   //
142   const Bool_t expert   = kTRUE ; 
143   const Bool_t image    = kTRUE ; 
144   
145   // ------------------- HIGH GAIN CHAIN ---------------------------
146   TH1F * hDigZNCTot = new TH1F("hDigZNCTot", "Signal in ZNC;Amplitude [ADC counts];Counts", 100, 0., 6000.);
147   TH1F * hDigZNATot = new TH1F("hDigZNATot", "Signal in ZNA;Amplitude [ADC counts];Counts", 100, 0., 6000.);
148   TH1F * hDigZPCTot = new TH1F("hDigZPCTot", "Signal in ZPC;Amplitude [ADC counts];Counts", 100, 0., 6000.);
149   TH1F * hDigZPATot = new TH1F("hDigZPATot", "Signal in ZPA;Amplitude [ADC counts];Counts", 100, 0., 6000.);
150   Add2DigitsList(hDigZNCTot, 0, !expert, image);
151   Add2DigitsList(hDigZNATot, 1, !expert, image);
152   Add2DigitsList(hDigZPCTot, 2, !expert, image);
153   Add2DigitsList(hDigZPATot, 3, !expert, image);
154   //
155   TH1F * hDigSumQZNC = new TH1F("hDigSumQZNC", "Signal in 4 ZNC PMQ;Amplitude [ADC counts];Counts",100, 0., 4000.);
156   TH1F * hDigSumQZNA = new TH1F("hDigSumQZNA", "Signal in 4 ZNA PMQ;Amplitude [ADC counts];Counts",100, 0., 4000.);
157   TH1F * hDigSumQZPC = new TH1F("hDigSumQZPC", "Signal in 4 ZPC PMQ;Amplitude [ADC counts];Counts",100, 0., 4000.);
158   TH1F * hDigSumQZPA = new TH1F("hDigSumQZPA", "Signal in 4 ZPA PMQ;Amplitude [ADC counts];Counts",100, 0., 4000.);
159   Add2DigitsList(hDigSumQZNC, 4, expert, !image);
160   Add2DigitsList(hDigSumQZNA, 5, expert, !image);
161   Add2DigitsList(hDigSumQZPC, 6, expert, !image);
162   Add2DigitsList(hDigSumQZPA, 7, expert, !image);
163   //
164   TH1F * hDigPMCZNC = new TH1F("hDigPMCZNC", "Signal in ZNC PMC;Amplitude [ADC counts];Counts",100, 0., 4000.);
165   TH1F * hDigPMCZNA = new TH1F("hDigPMCZNA", "Signal in ZNA PMC;Amplitude [ADC counts];Counts",100, 0., 4000.);
166   TH1F * hDigPMCZPC = new TH1F("hDigPMCZPC", "Signal in ZPC PMC;Amplitude [ADC counts];Counts",100, 0., 4000.);
167   TH1F * hDigPMCZPA = new TH1F("hDigPMCZPA", "Signal in ZPA PMC;Amplitude [ADC counts];Counts",100, 0., 4000.);
168   Add2DigitsList(hDigPMCZNC, 8, expert, !image);
169   Add2DigitsList(hDigPMCZNA, 9, expert, !image);
170   Add2DigitsList(hDigPMCZPC, 10, expert, !image);
171   Add2DigitsList(hDigPMCZPA, 11, expert, !image);
172   // 
173   // ------------------- LOW GAIN CHAIN ---------------------------
174   TH1F * hDigZNCTotlg = new TH1F("hDigZNCTotlg", "Digit lg signal in ZNC", 100, 0., 6000.);
175   TH1F * hDigZNATotlg = new TH1F("hDigZNATotlg", "Digit lg signal in ZNA", 100, 0., 6000.);
176   TH1F * hDigZPCTotlg = new TH1F("hDigZPCTotlg", "Digit lg signal in ZPC", 100, 0., 6000.);
177   TH1F * hDigZPATotlg = new TH1F("hDigZPATotlg", "Digit lg signal in ZPA", 100, 0., 6000.);
178   Add2DigitsList(hDigZNCTotlg, 12, !expert, image);
179   Add2DigitsList(hDigZNATotlg, 13, !expert, image);
180   Add2DigitsList(hDigZPCTotlg, 14, !expert, image);
181   Add2DigitsList(hDigZPATotlg, 15, !expert, image);
182   //
183   TH1F * hDigSumQZNClg = new TH1F("hDigSumQZNClg", "Signal in 4 ZNC PMQlg",100, 0., 4000.);
184   TH1F * hDigSumQZNAlg = new TH1F("hDigSumQZNAlg", "Signal in 4 ZNA PMQlg",100, 0., 4000.);
185   TH1F * hDigSumQZPClg = new TH1F("hDigSumQZPClg", "Signal in 4 ZPC PMQlg",100, 0., 4000.);
186   TH1F * hDigSumQZPAlg = new TH1F("hDigSumQZPAlg", "Signal in 4 ZPA PMQlg",100, 0., 4000.);
187   Add2DigitsList(hDigSumQZNClg, 16, expert, !image);
188   Add2DigitsList(hDigSumQZNAlg, 17, expert, !image);
189   Add2DigitsList(hDigSumQZPClg, 18, expert, !image);
190   Add2DigitsList(hDigSumQZPAlg, 19, expert, !image);
191   //
192   TH1F * hDigPMCZNClg = new TH1F("hDigPMCZNClg", "Signal in ZNC PMClg",100, 0., 4000.);
193   TH1F * hDigPMCZNAlg = new TH1F("hDigPMCZNAlg", "Signal in ZNA PMClg",100, 0., 4000.);
194   TH1F * hDigPMCZPClg = new TH1F("hDigPMCZPClg", "Signal in ZPC PMClg",100, 0., 4000.);
195   TH1F * hDigPMCZPAlg = new TH1F("hDigPMCZPAlg", "Signal in ZPA PMClg",100, 0., 4000.);
196   Add2DigitsList(hDigPMCZNClg, 20, expert, !image);
197   Add2DigitsList(hDigPMCZNAlg, 21, expert, !image);
198   Add2DigitsList(hDigPMCZPClg, 22, expert, !image);
199   Add2DigitsList(hDigPMCZPAlg, 23, expert, !image);
200   
201 }
202
203 //____________________________________________________________________________
204 void AliZDCQADataMakerRec::InitESDs()
205 {
206   //Booking ESDs histograms
207   //
208   const Bool_t expert   = kTRUE ; 
209   const Bool_t image    = kTRUE ; 
210   
211   TH2F * hZNC  = new TH2F("hZNC", "Centroid in ZNC", 100, -5.,5.,100,-5.,5.);
212   TH2F * hZNA  = new TH2F("hZNA", "Centroid in ZNA", 100, -5.,5.,100,-5.,5.);
213   Add2ESDsList(hZNC, 0, !expert, image);
214   Add2ESDsList(hZNA, 1, !expert, image);
215   //
216   // ------------------- HIGH GAIN CHAIN ---------------------------
217   TH1F * hESDZNCTot = new TH1F("hESDZNCTot", "Energy in ZNC", 100, 0., 6000.);
218   TH1F * hESDZNATot = new TH1F("hESDZNATot", "Energy in ZNA", 100, 0., 6000.);
219   TH1F * hESDZPCTot = new TH1F("hESDZPCTot", "Energy in ZPC", 100, 0., 10000.);
220   TH1F * hESDZPATot = new TH1F("hESDZPATot", "Energy in ZPA", 100, 0., 10000.);
221   Add2ESDsList(hESDZNCTot, 2, !expert, image);
222   Add2ESDsList(hESDZNATot, 3, !expert, image);
223   Add2ESDsList(hESDZPCTot, 4, !expert, image);
224   Add2ESDsList(hESDZPATot, 5, !expert, image);
225   //
226   TH1F * hESDSumQZNC = new TH1F("hESDSumQZNC", "Sum of 4 ZNC energy",100, 0., 4000.);
227   TH1F * hESDSumQZNA = new TH1F("hESDSumQZNA", "Sum of 4 ZNA energy",100, 0., 4000.);
228   TH1F * hESDSumQZPC = new TH1F("hESDSumQZPC", "Sum of 4 ZPC energy",100, 0., 4000.);
229   TH1F * hESDSumQZPA = new TH1F("hESDSumQZPA", "Sum of 4 ZPA energy",100, 0., 4000.);
230   Add2ESDsList(hESDSumQZNC, 6, expert, !image);
231   Add2ESDsList(hESDSumQZNA, 7, expert, !image);
232   Add2ESDsList(hESDSumQZPC, 8, expert, !image);
233   Add2ESDsList(hESDSumQZPA, 9, expert, !image);
234   //
235   TH1F * hESDPMCZNC = new TH1F("hESDPMCZNC", "Energy in common ZNC PMT",100, 0., 4000.);
236   TH1F * hESDPMCZNA = new TH1F("hESDPMCZNA", "Energy in common ZNA PMT",100, 0., 4000.);
237   TH1F * hESDPMCZPC = new TH1F("hESDPMCZPC", "Energy in common ZPC PMT",100, 0., 4000.);
238   TH1F * hESDPMCZPA = new TH1F("hESDPMCZPA", "Energy in common ZPA PMT",100, 0., 4000.);
239   Add2ESDsList(hESDPMCZNC, 10, expert, !image);
240   Add2ESDsList(hESDPMCZNA, 11, expert, !image);
241   Add2ESDsList(hESDPMCZPC, 12, expert, !image);
242   Add2ESDsList(hESDPMCZPA, 13, expert, !image);
243   // 
244   // ------------------- LOW GAIN CHAIN ---------------------------
245   TH1F * hESDZNCTotlg = new TH1F("hESDZNCTotlg", "ESD lg signal in ZNC", 100, 0., 6000.);
246   TH1F * hESDZNATotlg = new TH1F("hESDZNATotlg", "ESD lg signal in ZNA", 100, 0., 6000.);
247   TH1F * hESDZPCTotlg = new TH1F("hESDZPCTotlg", "ESD lg signal in ZPC", 100, 0., 10000.);
248   TH1F * hESDZPATotlg = new TH1F("hESDZPATotlg", "ESD lg signal in ZPA", 100, 0., 10000.);
249   Add2ESDsList(hESDZNCTotlg, !expert, image);
250   Add2ESDsList(hESDZNATotlg, !expert, image);
251   Add2ESDsList(hESDZPCTotlg, !expert, image);
252   Add2ESDsList(hESDZPATotlg, !expert, image);
253   //
254   TH1F * hESDSumQZNClg = new TH1F("hESDSumQZNClg", "Sum of 4 lg ZNC sectors",100, 0., 4000.);
255   TH1F * hESDSumQZNAlg = new TH1F("hESDSumQZNAlg", "Sum of 4 lg ZNA sectors",100, 0., 4000.);
256   TH1F * hESDSumQZPClg = new TH1F("hESDSumQZPClg", "Sum of 4 lg ZPC sectors",100, 0., 4000.);
257   TH1F * hESDSumQZPAlg = new TH1F("hESDSumQZPAlg", "Sum of 4 lg ZPA sectors",100, 0., 4000.);
258   Add2ESDsList(hESDSumQZNClg, 18, expert, !image);
259   Add2ESDsList(hESDSumQZNAlg, 19, expert, !image);
260   Add2ESDsList(hESDSumQZPClg, 20, expert, !image);
261   Add2ESDsList(hESDSumQZPAlg, 21, expert, !image);
262   //
263   TH1F * hESDPMCZNClg = new TH1F("hESDPMCZNClg", "Signal in common ZNC lg PMT",100, 0., 4000.);
264   TH1F * hESDPMCZNAlg = new TH1F("hESDPMCZNAlg", "Signal in common ZNA lg PMT",100, 0., 4000.);
265   TH1F * hESDPMCZPClg = new TH1F("hESDPMCZPClg", "Signal in common ZPC lg PMT",100, 0., 4000.);
266   TH1F * hESDPMCZPAlg = new TH1F("hESDPMCZPAlg", "Signal in common ZPA lg PMT",100, 0., 4000.);
267   Add2ESDsList(hESDPMCZNClg, 22, expert, !image);
268   Add2ESDsList(hESDPMCZNAlg, 23, expert, !image);
269   Add2ESDsList(hESDPMCZPClg, 24, expert, !image);
270   Add2ESDsList(hESDPMCZPAlg, 25, expert, !image);
271 }
272   
273 //____________________________________________________________________________
274
275 void AliZDCQADataMakerRec::MakeRaws(AliRawReader *rawReader)
276 {
277   // Filling Raws QA histos
278   //
279   // Check if histograms already created for this Event Specie
280   if ( ! GetRawsData(0) )
281     InitRaws();
282
283         rawReader->Reset() ; 
284   Float_t sum_ZNC=0., sum_ZNA=0., sum_ZPC=0., sum_ZPA=0.;
285   Float_t sumQ_ZNC=0., sumQ_ZNA=0., sumQ_ZPC=0., sumQ_ZPA=0.;
286   Float_t sum_ZNC_lg=0., sum_ZNA_lg=0., sum_ZPC_lg=0., sum_ZPA_lg=0.;
287   Float_t sumQ_ZNC_lg=0., sumQ_ZNA_lg=0., sumQ_ZPC_lg=0., sumQ_ZPA_lg=0.;
288   //
289   AliZDCRawStream stream(rawReader);
290   while(stream.Next()){
291     if(stream.IsADCDataWord() && 
292      (stream.GetADCModule()==0 || stream.GetADCModule()==1)){
293        if(stream.GetSector(0)==1){
294          if(stream.GetADCGain()==0){
295            sum_ZNC += stream.GetADCValue();
296            if(stream.GetSector(1)!=0) sumQ_ZNC += stream.GetADCValue();
297            else GetRawsData(8)->Fill(stream.GetADCValue());
298          }
299          else{
300            sum_ZNC_lg += stream.GetADCValue();
301            if(stream.GetSector(1)!=0) sumQ_ZNC_lg += stream.GetADCValue();
302            else GetRawsData(20)->Fill(stream.GetADCValue());
303          }
304        }
305        else if(stream.GetSector(0)==2){
306          if(stream.GetADCGain()==0){
307            sum_ZPC += stream.GetADCValue();
308            if(stream.GetSector(1)!=0) sumQ_ZPC += stream.GetADCValue();
309            else GetRawsData(10)->Fill(stream.GetADCValue());
310          }
311          else{
312            sum_ZPC_lg += stream.GetADCValue();
313            if(stream.GetSector(1)!=0) sumQ_ZPC_lg += stream.GetADCValue();
314            else GetRawsData(22)->Fill(stream.GetADCValue());
315          }
316        }
317        else if(stream.GetSector(0)==4){
318          if(stream.GetADCGain()==0){
319            sum_ZNA += stream.GetADCValue();
320            if(stream.GetSector(1)!=0) sumQ_ZNA += stream.GetADCValue();
321            else GetRawsData(9)->Fill(stream.GetADCValue());
322          }
323          else{
324            sum_ZNA_lg += stream.GetADCValue();
325            if(stream.GetSector(1)!=0) sumQ_ZNA_lg += stream.GetADCValue();
326            else GetRawsData(21)->Fill(stream.GetADCValue());
327          }
328        }
329        else if(stream.GetSector(0)==5){
330          if(stream.GetADCGain()==0){
331            sum_ZPA += stream.GetADCValue();
332            if(stream.GetSector(1)!=0) sumQ_ZPA += stream.GetADCValue();
333            else GetRawsData(11)->Fill(stream.GetADCValue());
334          }
335          else{
336            sum_ZPA_lg += stream.GetADCValue();
337            if(stream.GetSector(1)!=0) sumQ_ZPA_lg += stream.GetADCValue();
338            else GetRawsData(23)->Fill(stream.GetADCValue());
339          }
340        }
341     }
342   }
343   //
344   GetRawsData(0)->Fill(sum_ZNC);
345   GetRawsData(1)->Fill(sum_ZNA);
346   GetRawsData(2)->Fill(sum_ZPC);
347   GetRawsData(3)->Fill(sum_ZPA);
348   //
349   GetRawsData(4)->Fill(sumQ_ZNC);
350   GetRawsData(5)->Fill(sumQ_ZNA);
351   GetRawsData(6)->Fill(sumQ_ZPC);
352   GetRawsData(7)->Fill(sumQ_ZPA);
353   //
354   GetRawsData(12)->Fill(sum_ZNC_lg);
355   GetRawsData(13)->Fill(sum_ZNA_lg);
356   GetRawsData(14)->Fill(sum_ZPC_lg);
357   GetRawsData(15)->Fill(sum_ZPA_lg);
358   //
359   GetRawsData(16)->Fill(sumQ_ZNC_lg);
360   GetRawsData(17)->Fill(sumQ_ZNA_lg);
361   GetRawsData(18)->Fill(sumQ_ZPC_lg);
362   GetRawsData(19)->Fill(sumQ_ZPA_lg);
363   //
364 //   stream.Delete();
365 }
366
367 //___________________________________________________________________________
368 void AliZDCQADataMakerRec::MakeDigits(TTree *digitTree )
369 {
370   TBranch * branch = digitTree->GetBranch("ZDC");
371   if(!branch){
372     AliError("ZDC branch in Digit Tree not found"); 
373     return;
374   } 
375   
376   // Check id histograms already created for this Event Specie
377   if ( ! GetDigitsData(0) )
378     InitDigits() ;
379   
380   branch->SetAddress(&fDigit);
381   
382   Int_t ndig = digitTree->GetEntries();
383   
384   Float_t adcSum_ZNC=0., adcSum_ZNA=0., adcSum_ZPC=0., adcSum_ZPA=0.;
385   Float_t adcSumQ_ZNC=0., adcSumQ_ZNA=0., adcSumQ_ZPC=0., adcSumQ_ZPA=0.;
386   Float_t adcSum_ZNC_lg=0., adcSum_ZNA_lg=0., adcSum_ZPC_lg=0., adcSum_ZPA_lg=0.;
387   Float_t adcSumQ_ZNC_lg=0., adcSumQ_ZNA_lg=0., adcSumQ_ZPC_lg=0., adcSumQ_ZPA_lg=0.;
388   //
389   for(Int_t i = 0; i < ndig; i++){
390     digitTree->GetEntry(i);
391     if(fDigit->GetSector(0)==1){
392       adcSum_ZNC += fDigit->GetADCValue(0);
393       adcSum_ZNC_lg += fDigit->GetADCValue(1);
394       //
395       if(fDigit->GetSector(1)!=0){
396               adcSumQ_ZNC += fDigit->GetADCValue(0);
397               adcSumQ_ZNC_lg+= fDigit->GetADCValue(1);
398       }
399       else{
400               GetDigitsData(8)->Fill(fDigit->GetADCValue(0));
401               GetDigitsData(20)->Fill(fDigit->GetADCValue(1));
402       }
403     }
404     else if(fDigit->GetSector(0)==2){
405       adcSum_ZPC += fDigit->GetADCValue(0);
406       adcSum_ZPC_lg += fDigit->GetADCValue(1);
407       //
408       if(fDigit->GetSector(1)!=0){
409               adcSumQ_ZPC += fDigit->GetADCValue(0);
410               adcSumQ_ZPC_lg+= fDigit->GetADCValue(1);
411       }
412       else{
413               GetDigitsData(10)->Fill(fDigit->GetADCValue(0));
414               GetDigitsData(22)->Fill(fDigit->GetADCValue(1));
415       }
416     }
417     else if(fDigit->GetSector(0)==4){
418       adcSum_ZNA += fDigit->GetADCValue(0);
419       adcSum_ZNA_lg += fDigit->GetADCValue(1);
420       //
421       if(fDigit->GetSector(1)!=0){
422               adcSumQ_ZNA += fDigit->GetADCValue(0);
423               adcSumQ_ZNA_lg+= fDigit->GetADCValue(1);
424       }
425       else{
426               GetDigitsData(9)->Fill(fDigit->GetADCValue(0));
427               GetDigitsData(21)->Fill(fDigit->GetADCValue(1));
428       }
429     }
430     else if(fDigit->GetSector(0)==5){
431       adcSum_ZPA += fDigit->GetADCValue(0);
432       adcSum_ZPA_lg += fDigit->GetADCValue(1);
433       //
434       if(fDigit->GetSector(1)!=0){
435               adcSumQ_ZPA += fDigit->GetADCValue(0);
436               adcSumQ_ZPA_lg+= fDigit->GetADCValue(1);
437       }
438       else{
439               GetDigitsData(11)->Fill(fDigit->GetADCValue(0));
440               GetDigitsData(23)->Fill(fDigit->GetADCValue(1));
441       }
442     }
443   }
444   //
445   GetDigitsData(0)->Fill(adcSum_ZNC);
446   GetDigitsData(1)->Fill(adcSum_ZNA);
447   GetDigitsData(2)->Fill(adcSum_ZPC);
448   GetDigitsData(3)->Fill(adcSum_ZPA);
449   //
450   GetDigitsData(4)->Fill(adcSumQ_ZNC);
451   GetDigitsData(5)->Fill(adcSumQ_ZNA);
452   GetDigitsData(6)->Fill(adcSumQ_ZPC);
453   GetDigitsData(7)->Fill(adcSumQ_ZPA);
454   //
455   GetDigitsData(12)->Fill(adcSum_ZNC_lg);
456   GetDigitsData(13)->Fill(adcSum_ZNA_lg);
457   GetDigitsData(14)->Fill(adcSum_ZPC_lg);
458   GetDigitsData(15)->Fill(adcSum_ZPA_lg);
459   //
460   GetDigitsData(16)->Fill(adcSumQ_ZNC_lg);
461   GetDigitsData(17)->Fill(adcSumQ_ZNA_lg);
462   GetDigitsData(18)->Fill(adcSumQ_ZPC_lg);
463   GetDigitsData(19)->Fill(adcSumQ_ZPA_lg);
464 }
465
466 //____________________________________________________________________________
467 void AliZDCQADataMakerRec::MakeESDs(AliESDEvent * esd)
468 {
469   // make QA data from ESDs
470   //
471   
472   // Check id histograms already created for this Event Specie
473   if ( ! GetESDsData(0) )
474     InitESDs() ;
475
476   AliESDZDC * zdcESD =  esd->GetESDZDC();
477   //
478   Double32_t * centr_ZNC = zdcESD->GetZNCCentroid();
479   GetESDsData(0)->Fill(centr_ZNC[0], centr_ZNC[1]);
480
481   Double32_t * centr_ZNA = zdcESD->GetZNACentroid();
482   GetESDsData(1)->Fill(centr_ZNA[0], centr_ZNA[1]);
483
484   //
485   GetESDsData(2)->Fill(esd->GetZDCN1Energy());
486   GetESDsData(3)->Fill(esd->GetZDCN2Energy());
487   GetESDsData(4)->Fill(esd->GetZDCP1Energy());
488   GetESDsData(5)->Fill(esd->GetZDCP2Energy());
489   //
490   Double_t sumQZNC=0., sumQZPC=0., sumQZNA=0., sumQZPA=0.;
491   Double_t sumQZNC_lg=0., sumQZPC_lg=0., sumQZNA_lg=0., sumQZPA_lg=0.;
492   //
493   const Double_t *towZNC, *towZPC, *towZNA, *towZPA;
494   const Double_t *towZNC_lg, *towZPC_lg, *towZNA_lg, *towZPA_lg;
495   //
496   towZNC = zdcESD->GetZN1TowerEnergy();
497   towZPC = zdcESD->GetZP1TowerEnergy();
498   towZNA = zdcESD->GetZN2TowerEnergy();
499   towZPA = zdcESD->GetZP2TowerEnergy();
500   //
501   towZNC_lg = zdcESD->GetZN1TowerEnergyLR();
502   towZPC_lg = zdcESD->GetZP1TowerEnergyLR();
503   towZNA_lg = zdcESD->GetZN2TowerEnergyLR();
504   towZPA_lg = zdcESD->GetZP2TowerEnergyLR();
505   //
506   for(Int_t i=0; i<5; i++){
507      if(i==0){
508        GetESDsData(10)->Fill(towZNC[i]);
509        GetESDsData(11)->Fill(towZNA[i]);
510        GetESDsData(12)->Fill(towZPC[i]);
511        GetESDsData(13)->Fill(towZPA[i]);
512        //
513        GetESDsData(22)->Fill(towZNC_lg[i]);
514        GetESDsData(23)->Fill(towZNA_lg[i]);
515        GetESDsData(24)->Fill(towZPC_lg[i]);
516        GetESDsData(25)->Fill(towZPA_lg[i]);
517      }
518      else{
519        sumQZNC += towZNC[i];
520        sumQZPC += towZPC[i];
521        sumQZNA += towZNA[i];
522        sumQZPA += towZPA[i];
523        //
524        sumQZNC_lg += towZNC_lg[i];
525        sumQZPC_lg += towZPC_lg[i];
526        sumQZNA_lg += towZNA_lg[i];
527        sumQZPA_lg += towZPA_lg[i];
528      }
529   }
530   GetESDsData(6)->Fill(sumQZNC);
531   GetESDsData(7)->Fill(sumQZNA);
532   GetESDsData(8)->Fill(sumQZPC);
533   GetESDsData(9)->Fill(sumQZPA);
534   //
535   GetESDsData(18)->Fill(sumQZNC_lg);
536   GetESDsData(19)->Fill(sumQZNA_lg);
537   GetESDsData(20)->Fill(sumQZPC_lg);
538   GetESDsData(21)->Fill(sumQZPA_lg);
539 }
540
541 //____________________________________________________________________________
542 void AliZDCQADataMakerRec::StartOfDetectorCycle()
543 {
544   //Detector specific actions at start of cycle
545   
546 }
547
548 //____________________________________________________________________________ 
549 void AliZDCQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
550 {
551   //Detector specific actions at end of cycle
552   // do the QA checking
553   AliQAChecker::Instance()->Run(AliQAv1::kZDC, task, list) ;  
554 }
555