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