]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ZDC/AliZDCQADataMaker.cxx
TClonesArray for hits e digits cleared after use
[u/mrichter/AliRoot.git] / ZDC / AliZDCQADataMaker.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 // --- Standard library ---
16 #include <Riostream.h>
17 // --- ROOT system ---
18 #include <TClonesArray.h>
19 #include <TFile.h> 
20 #include <TH1F.h> 
21 #include <TH2F.h>
22 #include <TBranch.h>
23 #include <TTree.h>
24 // --- AliRoot header files ---
25 #include "AliLog.h"
26 #include "AliQAChecker.h"
27 #include "AliZDCQADataMaker.h"
28 #include "AliZDCHit.h"
29 #include "AliZDCDigit.h"
30 #include "AliZDCRawStream.h"
31 #include "AliESDZDC.h"
32 #include "AliESDEvent.h"
33
34 ClassImp(AliZDCQADataMaker)
35            
36 //____________________________________________________________________________ 
37   AliZDCQADataMaker::AliZDCQADataMaker() : 
38   AliQADataMaker(AliQA::GetDetName(AliQA::kZDC), "ZDC Quality Assurance Data Maker")
39 {
40   // ctor
41 }
42
43 //____________________________________________________________________________ 
44 AliZDCQADataMaker::AliZDCQADataMaker(const AliZDCQADataMaker& qadm) :
45   AliQADataMaker() 
46 {
47   //copy ctor 
48   SetName((const char*)qadm.GetName()); 
49   SetTitle((const char*)qadm.GetTitle()); 
50 }
51
52 //__________________________________________________________________
53 AliZDCQADataMaker& AliZDCQADataMaker::operator = (const AliZDCQADataMaker& qadm )
54 {
55   // Equal operator.
56   this->~AliZDCQADataMaker();
57   new(this) AliZDCQADataMaker(qadm);
58   return *this;
59 }
60  
61 //____________________________________________________________________________ 
62 void AliZDCQADataMaker::InitHits()
63 {
64   // create Hits histograms in Hits subdir
65   //
66   TH2F * hZNCh  = new TH2F("hZNCh", "Hits centroid in ZNC", 100, -5.,5.,100,-5.,5.);
67   TH2F * hZNAh  = new TH2F("hZNAh", "Hits centroid in ZNA", 100, -5.,5.,100,-5.,5.);
68   TH2F * hZPCh  = new TH2F("hZPCh", "Hits centroid in ZPC", 100,-12.,12.,100,-12.,12.) 
69   TH2F * hZPAh  = new TH2F("hZPAh", "Hits centroid in ZPA", 100,-12.,12.,100,-12.,12.) 
70   Add2HitsList(hZNCh, 0);
71   Add2HitsList(hZPCh, 1);
72   Add2HitsList(hZNAh, 2);
73   Add2HitsList(hZPAh, 3);
74 }
75
76 //____________________________________________________________________________ 
77 void AliZDCQADataMaker::InitDigits()
78 {
79   // create Digits histograms in Digits subdir
80   //
81   TH1F * hDigZNCTot = new TH1F("hDigZNCTot", "Digit signal in ZNC", 100, 0., 6000.);
82   TH1F * hDigZNATot = new TH1F("hDigZNATot", "Digit signal in ZNA", 100, 0., 6000.);
83   TH1F * hDigZPCTot = new TH1F("hDigZPCTot", "Digit signal in ZPC", 100, 0., 10000.);
84   TH1F * hDigZPATot = new TH1F("hDigZPATot", "Digit signal in ZPA", 100, 0., 10000.);
85   Add2DigitsList(hDigZNCTot, 0);
86   Add2DigitsList(hDigZPCTot, 1);
87   Add2DigitsList(hDigZNATot, 2);
88   Add2DigitsList(hDigZPATot, 3);
89   //
90   TH1F * hDigSumQZNC = new TH1F("hDigSumQZNC", "Signal in 4 ZNC PMQ[i]",100, 0., 4000.);
91   TH1F * hDigSumQZPC = new TH1F("hDigSumQZPC", "Signal in 4 ZPC PMQ[i]",100, 0., 4000.);
92   TH1F * hDigSumQZNA = new TH1F("hDigSumQZNA", "Signal in 4 ZNA PMQ[i]",100, 0., 4000.);
93   TH1F * hDigSumQZPA = new TH1F("hDigSumQZPA", "Signal in 4 ZPA PMQ[i]",100, 0., 4000.);
94   Add2DigitsList(hDigSumQZNC, 4);
95   Add2DigitsList(hDigSumQZPC, 5);
96   Add2DigitsList(hDigSumQZNA, 6);
97   Add2DigitsList(hDigSumQZPA, 7);
98   //
99   TH1F * hDigPMCZNC = new TH1F("hDigPMCZNC", "Signal in 4 ZNC PMQ[i]",100, 0., 4000.);
100   TH1F * hDigPMCZPC = new TH1F("hDigPMCZPC", "Signal in 4 ZPC PMQ[i]",100, 0., 4000.);
101   TH1F * hDigPMCZNA = new TH1F("hDigPMCZNA", "Signal in 4 ZNA PMQ[i]",100, 0., 4000.);
102   TH1F * hDigPMCZPA = new TH1F("hDigPMCZPA", "Signal in 4 ZPA PMQ[i]",100, 0., 4000.);
103   Add2DigitsList(hDigPMCZNC, 8);
104   Add2DigitsList(hDigPMCZPC, 9);
105   Add2DigitsList(hDigPMCZNA, 10);
106   Add2DigitsList(hDigPMCZPA, 11);
107   // 
108   // ------------------- LOW GAIN CHAIN ---------------------------
109   TH1F * hDigZNCTotlg = new TH1F("hDigZNCTotlg", "Digit lg signal in ZNC", 100, 0., 6000.);
110   TH1F * hDigZNATotlg = new TH1F("hDigZNATotlg", "Digit lg signal in ZNA", 100, 0., 6000.);
111   TH1F * hDigZPCTotlg = new TH1F("hDigZPCTotlg", "Digit lg signal in ZPC", 100, 0., 10000.);
112   TH1F * hDigZPATotlg = new TH1F("hDigZPATotlg", "Digit lg signal in ZPA", 100, 0., 10000.);
113   Add2DigitsList(hDigZNCTotlg, 12);
114   Add2DigitsList(hDigZPCTotlg, 13);
115   Add2DigitsList(hDigZNATotlg, 14);
116   Add2DigitsList(hDigZPATotlg, 15);
117   //
118   TH1F * hDigSumQZNClg = new TH1F("hDigSumQZNClg", "Signal in 4 ZNC PMQlg[i]",100, 0., 4000.);
119   TH1F * hDigSumQZPClg = new TH1F("hDigSumQZPClg", "Signal in 4 ZPC PMQlg[i]",100, 0., 4000.);
120   TH1F * hDigSumQZNAlg = new TH1F("hDigSumQZNAlg", "Signal in 4 ZNA PMQlg[i]",100, 0., 4000.);
121   TH1F * hDigSumQZPAlg = new TH1F("hDigSumQZPAlg", "Signal in 4 ZPA PMQlg[i]",100, 0., 4000.);
122   Add2DigitsList(hDigSumQZNClg, 16);
123   Add2DigitsList(hDigSumQZPClg, 17);
124   Add2DigitsList(hDigSumQZNAlg, 18);
125   Add2DigitsList(hDigSumQZPAlg, 19);
126   //
127   TH1F * hDigPMCZNClg = new TH1F("hDigPMCZNClg", "Signal in 4 ZNC PMQlg[i]",100, 0., 4000.);
128   TH1F * hDigPMCZPClg = new TH1F("hDigPMCZPClg", "Signal in 4 ZPC PMQlg[i]",100, 0., 4000.);
129   TH1F * hDigPMCZNAlg = new TH1F("hDigPMCZNAlg", "Signal in 4 ZNA PMQlg[i]",100, 0., 4000.);
130   TH1F * hDigPMCZPAlg = new TH1F("hDigPMCZPAlg", "Signal in 4 ZPA PMQlg[i]",100, 0., 4000.);
131   Add2DigitsList(hDigPMCZNClg, 20);
132   Add2DigitsList(hDigPMCZPClg, 21);
133   Add2DigitsList(hDigPMCZNAlg, 22);
134   Add2DigitsList(hDigPMCZPAlg, 23);
135 }
136
137
138 //____________________________________________________________________________
139
140 void AliZDCQADataMakerRec::InitRaws()
141 {
142   // create Digits histograms in Digits subdir
143   //
144   TH1F * hRawZNCTot = new TH1F("hRawZNCTot", "Raw signal in ZNC", 100, 0., 6000.);
145   TH1F * hRawZNATot = new TH1F("hRawZNATot", "Raw signal in ZNA", 100, 0., 6000.);
146   TH1F * hRawZPCTot = new TH1F("hRawZPCTot", "Raw signal in ZPC", 100, 0., 10000.);
147   TH1F * hRawZPATot = new TH1F("hRawZPATot", "Raw signal in ZPA", 100, 0., 10000.);
148   Add2RawsList(hRawZNCTot, 0);
149   Add2RawsList(hRawZPCTot, 1);
150   Add2RawsList(hRawZNATot, 2);
151   Add2RawsList(hRawZPATot, 3);
152   //
153   TH1F * hRawSumQZNC = new TH1F("hRawSumQZNC", "Raw summed 4 ZNC quadrants",100, 0., 4000.);
154   TH1F * hRawSumQZPC = new TH1F("hRawSumQZPC", "Raw summed 4 ZPC quadrants",100, 0., 4000.);
155   TH1F * hRawSumQZNA = new TH1F("hRawSumQZNA", "Raw summed 4 ZNA quadrants",100, 0., 4000.);
156   TH1F * hRawSumQZPA = new TH1F("hRawSumQZPA", "Raw summed 4 ZPA quadrants",100, 0., 4000.);
157   Add2RawsList(hRawSumQZNC, 4);
158   Add2RawsList(hRawSumQZPC, 5);
159   Add2RawsList(hRawSumQZNA, 6);
160   Add2RawsList(hRawSumQZPA, 7);
161   //
162   TH1F * hRawPMCZNC = new TH1F("hRawPMCZNC", "Raw common ZNC PMT",100, 0., 4000.);
163   TH1F * hRawPMCZPC = new TH1F("hRawPMCZPC", "Raw common ZPC PMT",100, 0., 4000.);
164   TH1F * hRawPMCZNA = new TH1F("hRawPMCZNA", "Raw common ZNA PMT",100, 0., 4000.);
165   TH1F * hRawPMCZPA = new TH1F("hRawPMCZPA", "Raw common ZPA PMT",100, 0., 4000.);
166   Add2RawsList(hRawPMCZNC, 8);
167   Add2RawsList(hRawPMCZPC, 9);
168   Add2RawsList(hRawPMCZNA, 10);
169   Add2RawsList(hRawPMCZPA, 11);
170   // 
171   // ------------------- LOW GAIN CHAIN ---------------------------
172   TH1F * hRawZNCTotlg = new TH1F("hRawZNCTotlg", "Rawit lg signal in ZNC", 100, 0., 6000.);
173   TH1F * hRawZNATotlg = new TH1F("hRawZNATotlg", "Rawit lg signal in ZNA", 100, 0., 6000.);
174   TH1F * hRawZPCTotlg = new TH1F("hRawZPCTotlg", "Rawit lg signal in ZPC", 100, 0., 10000.);
175   TH1F * hRawZPATotlg = new TH1F("hRawZPATotlg", "Rawit lg signal in ZPA", 100, 0., 10000.);
176   Add2RawsList(hRawZNCTotlg, 12);
177   Add2RawsList(hRawZPCTotlg, 13);
178   Add2RawsList(hRawZNATotlg, 14);
179   Add2RawsList(hRawZPATotlg, 15);
180   //
181   TH1F * hRawSumQZNClg = new TH1F("hRawSumQZNClg", "Raw summed 4 lg ZNC quadrants",100, 0., 4000.);
182   TH1F * hRawSumQZPClg = new TH1F("hRawSumQZPClg", "Raw summed 4 lg ZPC quadrants",100, 0., 4000.);
183   TH1F * hRawSumQZNAlg = new TH1F("hRawSumQZNAlg", "Raw summed 4 lg ZNA quadrants",100, 0., 4000.);
184   TH1F * hRawSumQZPAlg = new TH1F("hRawSumQZPAlg", "Raw summed 4 lg ZPA quadrants",100, 0., 4000.);
185   Add2RawsList(hRawSumQZNClg, 16);
186   Add2RawsList(hRawSumQZPClg, 17);
187   Add2RawsList(hRawSumQZNAlg, 18);
188   Add2RawsList(hRawSumQZPAlg, 19);
189   //
190   TH1F * hRawPMCZNClg = new TH1F("hRawPMCZNClg", "Raw common lg ZNC PMT",100, 0., 4000.);
191   TH1F * hRawPMCZPClg = new TH1F("hRawPMCZPClg", "Raw common lg ZPC PMT",100, 0., 4000.);
192   TH1F * hRawPMCZNAlg = new TH1F("hRawPMCZNAlg", "Raw common lg ZNA PMT",100, 0., 4000.);
193   TH1F * hRawPMCZPAlg = new TH1F("hRawPMCZPAlg", "Raw common lg ZPA PMT",100, 0., 4000.);
194   Add2RawsList(hRawPMCZNClg, 20);
195   Add2RawsList(hRawPMCZPClg, 21);
196   Add2RawsList(hRawPMCZNAlg, 22);
197   Add2RawsList(hRawPMCZPAlg, 23);
198 }
199
200 //____________________________________________________________________________
201 void AliZDCQADataMakerRec::InitESDs()
202 {
203   //Booking ESDs histograms
204   //
205   TH2F * hZNC  = new TH2F("hZNC", "Centroid in ZNC", 100, -5.,5.,100,-5.,5.);
206   TH2F * hZNA  = new TH2F("hZNA", "Centroid in ZNA", 100, -5.,5.,100,-5.,5.);
207   Add2DigitsList(hZNC, 0);
208   Add2DigitsList(hZNA, 1);
209   //
210   TH1F * hESDZNCTot = new TH1F("hESDZNCTot", "ESD signal in ZNC", 100, 0., 6000.);
211   TH1F * hESDZPCTot = new TH1F("hESDZPCTot", "ESD signal in ZPC", 100, 0., 10000.);
212   TH1F * hESDZNATot = new TH1F("hESDZNATot", "ESD signal in ZNA", 100, 0., 6000.);
213   TH1F * hESDZPATot = new TH1F("hESDZPATot", "ESD signal in ZPA", 100, 0., 10000.);
214   Add2ESDsList(hESDZNCTot, 2);
215   Add2ESDsList(hESDZPCTot, 3);
216   Add2ESDsList(hESDZNATot, 4);
217   Add2ESDsList(hESDZPATot, 5);
218   //
219   TH1F * hESDSumQZNC = new TH1F("hESDSumQZNC", "Sum of 4 ZNC sectors",100, 0., 4000.);
220   TH1F * hESDSumQZPC = new TH1F("hESDSumQZPC", "Sum of 4 ZPC sectors",100, 0., 4000.);
221   TH1F * hESDSumQZNA = new TH1F("hESDSumQZNA", "Sum of 4 ZNA sectors",100, 0., 4000.);
222   TH1F * hESDSumQZPA = new TH1F("hESDSumQZPA", "Sum of 4 ZPA sectors",100, 0., 4000.);
223   Add2ESDsList(hESDSumQZNC, 6);
224   Add2ESDsList(hESDSumQZPC, 7);
225   Add2ESDsList(hESDSumQZNA, 8);
226   Add2ESDsList(hESDSumQZPA, 9);
227   //
228   TH1F * hESDPMCZNC = new TH1F("hESDPMCZNC", "Signal in common ZNC PMT",100, 0., 4000.);
229   TH1F * hESDPMCZPC = new TH1F("hESDPMCZPC", "Signal in common ZPC PMT",100, 0., 4000.);
230   TH1F * hESDPMCZNA = new TH1F("hESDPMCZNA", "Signal in common ZNA PMT",100, 0., 4000.);
231   TH1F * hESDPMCZPA = new TH1F("hESDPMCZPA", "Signal in common ZPA PMT",100, 0., 4000.);
232   Add2ESDsList(hESDPMCZNC, 10);
233   Add2ESDsList(hESDPMCZPC, 11);
234   Add2ESDsList(hESDPMCZNA, 12);
235   Add2ESDsList(hESDPMCZPA, 13);
236   // 
237   // ------------------- LOW GAIN CHAIN ---------------------------
238   TH1F * hESDZNCTotlg = new TH1F("hESDZNCTotlg", "ESD lg signal in ZNC", 100, 0., 6000.);
239   TH1F * hESDZNATotlg = new TH1F("hESDZNATotlg", "ESD lg signal in ZNA", 100, 0., 6000.);
240   TH1F * hESDZPCTotlg = new TH1F("hESDZPCTotlg", "ESD lg signal in ZPC", 100, 0., 10000.);
241   TH1F * hESDZPATotlg = new TH1F("hESDZPATotlg", "ESD lg signal in ZPA", 100, 0., 10000.);
242   Add2ESDsList(hESDZNCTotlg, 14);
243   Add2ESDsList(hESDZPCTotlg, 15);
244   Add2ESDsList(hESDZNATotlg, 16);
245   Add2ESDsList(hESDZPATotlg, 17);
246   //
247   TH1F * hESDSumQZNClg = new TH1F("hESDSumQZNClg", "Sum of 4 lg ZNC sectors",100, 0., 4000.);
248   TH1F * hESDSumQZPClg = new TH1F("hESDSumQZPClg", "Sum of 4 lg ZPC sectors",100, 0., 4000.);
249   TH1F * hESDSumQZNAlg = new TH1F("hESDSumQZNAlg", "Sum of 4 lg ZNA sectors",100, 0., 4000.);
250   TH1F * hESDSumQZPAlg = new TH1F("hESDSumQZPAlg", "Sum of 4 lg ZPA sectors",100, 0., 4000.);
251   Add2ESDsList(hESDSumQZNClg, 18);
252   Add2ESDsList(hESDSumQZPClg, 19);
253   Add2ESDsList(hESDSumQZNAlg, 20);
254   Add2ESDsList(hESDSumQZPAlg, 21);
255   //
256   TH1F * hESDPMCZNClg = new TH1F("hESDPMCZNClg", "Signal in common ZNC lg PMT",100, 0., 4000.);
257   TH1F * hESDPMCZPClg = new TH1F("hESDPMCZPClg", "Signal in common ZPC lg PMT",100, 0., 4000.);
258   TH1F * hESDPMCZNAlg = new TH1F("hESDPMCZNAlg", "Signal in common ZNA lg PMT",100, 0., 4000.);
259   TH1F * hESDPMCZPAlg = new TH1F("hESDPMCZPAlg", "Signal in common ZPA lg PMT",100, 0., 4000.);
260   Add2ESDsList(hESDPMCZNClg, 22);
261   Add2ESDsList(hESDPMCZPClg, 23);
262   Add2ESDsList(hESDPMCZNAlg, 24);
263   Add2ESDsList(hESDPMCZPAlg, 25);
264 }
265   
266
267 //____________________________________________________________________________
268 void AliZDCQADataMakerSim::MakeHits(TClonesArray * data)
269 {
270   //filling QA histos for Hits
271   //
272   fHits = dynamic_cast<TClonesArray *>(data); 
273   if(!fHits){
274     AliError("Wrong type of hits container"); 
275   } 
276   else {
277     TIter next(fHits); 
278     AliZDCHit * hit; 
279     while((hit = dynamic_cast<AliZDCHit *>(next()))){
280       if(hit->GetVolume(0)==1) GetHitsData(0)->Fill(hit->GetXImpact(),hit->GetYImpact());
281       else if(hit->GetVolume(0)==2) GetHitsData(1)->Fill(hit->GetXImpact(), hit->GetYImpact());
282       else if(hit->GetVolume(0)==4) GetHitsData(2)->Fill(hit->GetXImpact(), hit->GetYImpact());
283       else if(hit->GetVolume(0)==5) GetHitsData(3)->Fill(hit->GetXImpact(), hit->GetYImpact());
284     }
285   } 
286
287 }
288
289 //___________________________________________________________________________
290 void AliZDCQADataMakerSim::MakeHits(TTree * hitTree)
291 {
292   // make QA data from Hit Tree
293   //
294   if(!hitTree){
295     AliError("Hit Tree not found!"); 
296     return;
297   }
298   //
299   TBranch * branch = hitTree->GetBranch("ZDC") ;
300   if(!branch){
301     AliError("ZDC branch in Hit Tree not found!"); 
302     return;
303   }
304   else{
305     Int_t ntracks = (Int_t) hitTree->GetEntries();
306     //printf("\n\t *** no.track %d\n",ntracks);
307     if (ntracks<=0) return;
308     //
309     for(Int_t itrack=0; itrack<ntracks; itrack++){
310       fHits = new TClonesArray("AliZDCHit", 1000);
311       //
312       branch->SetAddress(&fHits) ;
313       branch->GetEntry(itrack);
314       //
315       //printf("\t *** track %d",itrack);
316       //hits->Print("");
317       //printf("\n");
318       //
319       MakeHits(fHits); 
320       fHits->Clear();
321     }     
322   }
323 }
324
325 //____________________________________________________________________________
326 void AliZDCQADataMakerSim::MakeDigits(TClonesArray * digits)
327 {
328   // makes data from Digits
329   //
330   TIter next(digits) ; 
331   AliZDCDigit * digit ; 
332   //
333   Float_t ADCSum_ZNC=0., ADCSum_ZNA=0., ADCSum_ZPC=0., ADCSum_ZPA=0.;
334   Float_t ADCSumQ_ZNC=0., ADCSumQ_ZNA=0., ADCSumQ_ZPC=0., ADCSumQ_ZPA=0.;
335   Float_t ADCSum_ZNC_lg=0., ADCSum_ZNA_lg=0., ADCSum_ZPC_lg=0., ADCSum_ZPA_lg=0.;
336   Float_t ADCSumQ_ZNC_lg=0., ADCSumQ_ZNA_lg=0., ADCSumQ_ZPC_lg=0., ADCSumQ_ZPA_lg=0.;
337   //
338   while((digit = dynamic_cast<AliZDCDigit *>(next()))){
339     if(digit->GetSector(0)==1){
340       ADCSum_ZNC += digit->GetADCValue(0);
341       ADCSum_ZNC_lg += digit->GetADCValue(1);
342       //
343       if(digit->GetSector(1)!=0){
344         ADCSumQ_ZNC += digit->GetADCValue(0);
345         ADCSumQ_ZNC_lg+= digit->GetADCValue(1);
346       }
347       else{
348         GetDigitsData(8)->Fill(digit->GetADCValue(0));
349         GetDigitsData(20)->Fill(digit->GetADCValue(1));
350       }
351     }
352     else if(digit->GetSector(0)==2){
353       ADCSum_ZPC += digit->GetADCValue(0);
354       ADCSum_ZPC_lg += digit->GetADCValue(1);
355       //
356       if(digit->GetSector(1)!=0){
357         ADCSumQ_ZPC += digit->GetADCValue(0);
358         ADCSumQ_ZPC_lg+= digit->GetADCValue(1);
359       }
360       else{
361         GetDigitsData(9)->Fill(digit->GetADCValue(0));
362         GetDigitsData(21)->Fill(digit->GetADCValue(1));
363       }
364     }
365     else if(digit->GetSector(0)==4){
366       ADCSum_ZNA += digit->GetADCValue(0);
367       ADCSum_ZNA_lg += digit->GetADCValue(1);
368       //
369       if(digit->GetSector(1)!=0){
370         ADCSumQ_ZNA += digit->GetADCValue(0);
371         ADCSumQ_ZNA_lg+= digit->GetADCValue(1);
372       }
373       else{
374         GetDigitsData(10)->Fill(digit->GetADCValue(0));
375         GetDigitsData(22)->Fill(digit->GetADCValue(1));
376       }
377     }
378     else if(digit->GetSector(0)==5){
379       ADCSum_ZPA += digit->GetADCValue(0);
380       ADCSum_ZPA_lg += digit->GetADCValue(1);
381       //
382       if(digit->GetSector(1)!=0){
383         ADCSumQ_ZPA += digit->GetADCValue(0);
384         ADCSumQ_ZPA_lg+= digit->GetADCValue(1);
385       }
386       else{
387         GetDigitsData(11)->Fill(digit->GetADCValue(0));
388         GetDigitsData(23)->Fill(digit->GetADCValue(1));
389       }
390     }
391   }
392   //
393   GetDigitsData(0)->Fill(ADCSum_ZNC);
394   GetDigitsData(1)->Fill(ADCSum_ZPC);
395   GetDigitsData(2)->Fill(ADCSum_ZNA);
396   GetDigitsData(3)->Fill(ADCSum_ZPA);
397   //
398   GetDigitsData(4)->Fill(ADCSumQ_ZNC);
399   GetDigitsData(5)->Fill(ADCSumQ_ZPC);
400   GetDigitsData(6)->Fill(ADCSumQ_ZNA);
401   GetDigitsData(7)->Fill(ADCSumQ_ZPA);
402   //
403   GetDigitsData(12)->Fill(ADCSum_ZNC_lg);
404   GetDigitsData(13)->Fill(ADCSum_ZPC_lg);
405   GetDigitsData(14)->Fill(ADCSum_ZNA_lg);
406   GetDigitsData(15)->Fill(ADCSum_ZPA_lg);
407   //
408   GetDigitsData(16)->Fill(ADCSumQ_ZNC_lg);
409   GetDigitsData(17)->Fill(ADCSumQ_ZPC_lg);
410   GetDigitsData(18)->Fill(ADCSumQ_ZNA_lg);
411   GetDigitsData(19)->Fill(ADCSumQ_ZPA_lg);
412    
413 }
414 //___________________________________________________________________________
415 void AliZDCQADataMakerSim::MakeDigits(TTree *digitTree )
416 {
417    // makes data from Digit Tree
418    fDigits = new TClonesArray("AliZDCDigit", 1000); 
419    //
420    TBranch * branch = digitTree->GetBranch("ZDC");
421    if(!branch){
422       AliError("ZDC branch in Digit Tree not found"); 
423       return;
424    } 
425    branch->SetAddress(&fDigits);
426    branch->GetEntry(0); 
427    MakeDigits(fDigits); 
428    fDigits->Clear();
429 }
430
431 //____________________________________________________________________________
432
433 void AliZDCQADataMakerRec::MakeRaws(AliRawReader *rawReader)
434 {
435   // Filling Raws QA histos
436   //
437   Float_t Sum_ZNC=0., Sum_ZNA=0., Sum_ZPC=0., Sum_ZPA=0.;
438   Float_t SumQ_ZNC=0., SumQ_ZNA=0., SumQ_ZPC=0., SumQ_ZPA=0.;
439   Float_t Sum_ZNC_lg=0., Sum_ZNA_lg=0., Sum_ZPC_lg=0., Sum_ZPA_lg=0.;
440   Float_t SumQ_ZNC_lg=0., SumQ_ZNA_lg=0., SumQ_ZPC_lg=0., SumQ_ZPA_lg=0.;
441   //
442   AliZDCRawStream stream(rawReader);
443   while(stream.Next()){
444     if(stream.IsADCDataWord() && 
445      (stream.GetADCModule()==0 || stream.GetADCModule()==1)){
446        if(stream.GetSector(0)==1){
447          if(stream.GetADCGain()==0){
448            Sum_ZNC += stream.GetADCValue();
449            if(stream.GetSector(1)!=0) SumQ_ZNC += stream.GetADCValue();
450            else GetRawsData(8)->Fill(stream.GetADCValue());
451          }
452          else{
453            Sum_ZNC_lg += stream.GetADCValue();
454            if(stream.GetSector(1)!=0) SumQ_ZNC_lg += stream.GetADCValue();
455            else GetRawsData(20)->Fill(stream.GetADCValue());
456          }
457        }
458        else if(stream.GetSector(0)==2){
459          if(stream.GetADCGain()==0){
460            Sum_ZPC += stream.GetADCValue();
461            if(stream.GetSector(1)!=0) SumQ_ZPC += stream.GetADCValue();
462            else GetRawsData(9)->Fill(stream.GetADCValue());
463          }
464          else{
465            Sum_ZPC_lg += stream.GetADCValue();
466            if(stream.GetSector(1)!=0) SumQ_ZPC_lg += stream.GetADCValue();
467            else GetRawsData(21)->Fill(stream.GetADCValue());
468          }
469        }
470        else if(stream.GetSector(0)==4){
471          if(stream.GetADCGain()==0){
472            Sum_ZNA += stream.GetADCValue();
473            if(stream.GetSector(1)!=0) SumQ_ZNA += stream.GetADCValue();
474            else GetRawsData(10)->Fill(stream.GetADCValue());
475          }
476          else{
477            Sum_ZNA_lg += stream.GetADCValue();
478            if(stream.GetSector(1)!=0) SumQ_ZNA_lg += stream.GetADCValue();
479            else GetRawsData(22)->Fill(stream.GetADCValue());
480          }
481        }
482        else if(stream.GetSector(0)==5){
483          if(stream.GetADCGain()==0){
484            Sum_ZPA += stream.GetADCValue();
485            if(stream.GetSector(1)!=0) SumQ_ZPA += stream.GetADCValue();
486            else GetRawsData(11)->Fill(stream.GetADCValue());
487          }
488          else{
489            Sum_ZPA_lg += stream.GetADCValue();
490            if(stream.GetSector(1)!=0) SumQ_ZPA_lg += stream.GetADCValue();
491            else GetRawsData(23)->Fill(stream.GetADCValue());
492          }
493        }
494     }
495   }
496   //
497   GetRawsData(0)->Fill(Sum_ZNC);
498   GetRawsData(1)->Fill(Sum_ZPC);
499   GetRawsData(2)->Fill(Sum_ZNA);
500   GetRawsData(3)->Fill(Sum_ZPA);
501   //
502   GetRawsData(4)->Fill(SumQ_ZNC);
503   GetRawsData(5)->Fill(SumQ_ZPC);
504   GetRawsData(6)->Fill(SumQ_ZNA);
505   GetRawsData(7)->Fill(SumQ_ZPA);
506   //
507   GetRawsData(12)->Fill(Sum_ZNC_lg);
508   GetRawsData(13)->Fill(Sum_ZPC_lg);
509   GetRawsData(14)->Fill(Sum_ZNA_lg);
510   GetRawsData(15)->Fill(Sum_ZPA_lg);
511   //
512   GetRawsData(16)->Fill(SumQ_ZNC_lg);
513   GetRawsData(17)->Fill(SumQ_ZPC_lg);
514   GetRawsData(18)->Fill(SumQ_ZNA_lg);
515   GetRawsData(19)->Fill(SumQ_ZPA_lg);
516   //
517   stream.Delete();
518 }
519
520 //____________________________________________________________________________
521 void AliZDCQADataMakerRec::MakeESDs(AliESDEvent * esd)
522 {
523   // make QA data from ESDs
524   //
525   AliESDZDC * zdcESD =  esd->GetESDZDC();
526   //
527   const Float_t * Centr_ZNC, * Centr_ZNA;
528   Int_t NSpecnC = (Int_t) (esd->GetZDCN1Energy()/2.7);
529   Int_t NSpecnA = (Int_t) (esd->GetZDCN2Energy()/2.7);
530   Centr_ZNC = zdcESD->GetZNCCentroid(NSpecnC);
531   Centr_ZNA = zdcESD->GetZNACentroid(NSpecnA);
532   GetESDsData(0)->Fill(Centr_ZNC[0], Centr_ZNC[1]);
533   GetESDsData(1)->Fill(Centr_ZNA[0], Centr_ZNA[1]);
534   //
535   GetESDsData(2)->Fill(esd->GetZDCN1Energy());
536   GetESDsData(3)->Fill(esd->GetZDCP1Energy());
537   GetESDsData(4)->Fill(esd->GetZDCN2Energy());
538   GetESDsData(5)->Fill(esd->GetZDCP2Energy());
539   //
540   Double_t ZNCSumQ=0., ZPCSumQ=0., ZNASumQ=0., ZPASumQ=0.;
541   Double_t ZNCSumQ_lg=0., ZPCSumQ_lg=0., ZNASumQ_lg=0., ZPASumQ_lg=0.;
542   //
543   const Double_t *ZNCTow, *ZPCTow, *ZNATow, *ZPATow;
544   const Double_t *ZNCTow_lg, *ZPCTow_lg, *ZNATow_lg, *ZPATow_lg;
545   //
546   ZNCTow = zdcESD->GetZN1TowerEnergy();
547   ZPCTow = zdcESD->GetZP1TowerEnergy();
548   ZNATow = zdcESD->GetZN2TowerEnergy();
549   ZPATow = zdcESD->GetZP2TowerEnergy();
550   //
551   ZNCTow_lg = zdcESD->GetZN1TowerEnergyLR();
552   ZPCTow_lg = zdcESD->GetZP1TowerEnergyLR();
553   ZNATow_lg = zdcESD->GetZN2TowerEnergyLR();
554   ZPATow_lg = zdcESD->GetZP2TowerEnergyLR();
555   //
556   for(Int_t i=0; i<5; i++){
557      if(i==0){
558        GetESDsData(10)->Fill(ZNCTow[i]);
559        GetESDsData(11)->Fill(ZPCTow[i]);
560        GetESDsData(12)->Fill(ZNATow[i]);
561        GetESDsData(13)->Fill(ZPATow[i]);
562        //
563        GetESDsData(22)->Fill(ZNCTow_lg[i]);
564        GetESDsData(23)->Fill(ZPCTow_lg[i]);
565        GetESDsData(24)->Fill(ZNATow_lg[i]);
566        GetESDsData(25)->Fill(ZPATow_lg[i]);
567      }
568      else{
569        ZNCSumQ += ZNCTow[i];
570        ZPCSumQ += ZPCTow[i];
571        ZNASumQ += ZNATow[i];
572        ZPASumQ += ZPATow[i];
573        //
574        ZNCSumQ_lg += ZNCTow_lg[i];
575        ZPCSumQ_lg += ZPCTow_lg[i];
576        ZNASumQ_lg += ZNATow_lg[i];
577        ZPASumQ_lg += ZPATow_lg[i];
578      }
579   }
580   GetESDsData(6)->Fill(ZNCSumQ);
581   GetESDsData(7)->Fill(ZPCSumQ);
582   GetESDsData(8)->Fill(ZNASumQ);
583   GetESDsData(9)->Fill(ZPASumQ);
584   //
585   GetESDsData(18)->Fill(ZNCSumQ_lg);
586   GetESDsData(19)->Fill(ZPCSumQ_lg);
587   GetESDsData(20)->Fill(ZNASumQ_lg);
588   GetESDsData(21)->Fill(ZPASumQ_lg);
589 }
590
591 //____________________________________________________________________________
592 void AliZDCQADataMakerRec::StartOfDetectorCycle()
593 {
594   //Detector specific actions at start of cycle
595   
596 }
597
598 //____________________________________________________________________________ 
599 void AliZDCQADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray * list)
600 {
601   //Detector specific actions at end of cycle
602   // do the QA checking
603   AliQAChecker::Instance()->Run(AliQA::kZDC, task, list) ;