More volume overlaps corrected
[u/mrichter/AliRoot.git] / ZDC / AliZDCQADataMakerSim.cxx
CommitLineData
3d2cda92 1/**************************************************************************\r
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
3 * *\r
4 * Author: The ALICE Off-line Project. *\r
5 * Contributors are mentioned in the code where appropriate. *\r
6 * *\r
7 * Permission to use, copy, modify and distribute this software and its *\r
8 * documentation strictly for non-commercial purposes is hereby granted *\r
9 * without fee, provided that the above copyright notice appears in all *\r
10 * copies and that both the copyright notice and this permission notice *\r
11 * appear in the supporting documentation. The authors make no claims *\r
12 * about the suitability of this software for any purpose. It is *\r
13 * provided "as is" without express or implied warranty. *\r
14 **************************************************************************/\r
15// --- Standard library ---\r
16#include <Riostream.h>\r
17// --- ROOT system ---\r
18#include <TClonesArray.h>\r
19#include <TFile.h> \r
20#include <TH1F.h> \r
21#include <TH2F.h>\r
22#include <TBranch.h>\r
23#include <TTree.h>\r
24// --- AliRoot header files ---\r
25#include "AliLog.h"\r
26#include "AliQAChecker.h"\r
27#include "AliZDCQADataMakerSim.h"\r
28#include "AliZDCHit.h"\r
29#include "AliZDCDigit.h"\r
30#include "AliZDCRawStream.h"\r
31\r
32ClassImp(AliZDCQADataMakerSim)\r
33 \r
34//____________________________________________________________________________ \r
35 AliZDCQADataMakerSim::AliZDCQADataMakerSim() : \r
36 AliQADataMakerSim(AliQA::GetDetName(AliQA::kZDC), "ZDC Quality Assurance Data Maker"),\r
66317fbe 37 fHits(0),\r
38 fDigit(0)\r
3d2cda92 39{\r
40 // ctor\r
41}\r
42\r
43//____________________________________________________________________________ \r
44AliZDCQADataMakerSim::AliZDCQADataMakerSim(const AliZDCQADataMakerSim& qadm) :\r
45 AliQADataMakerSim(), \r
66317fbe 46 fHits(0),\r
47 fDigit(0) \r
3d2cda92 48{\r
49 //copy ctor \r
50 SetName((const char*)qadm.GetName()); \r
51 SetTitle((const char*)qadm.GetTitle()); \r
52}\r
53\r
54//__________________________________________________________________\r
55AliZDCQADataMakerSim& AliZDCQADataMakerSim::operator = (const AliZDCQADataMakerSim& qadm )\r
56{\r
57 // Equal operator.\r
58 this->~AliZDCQADataMakerSim();\r
59 new(this) AliZDCQADataMakerSim(qadm);\r
60 return *this;\r
61}\r
62 \r
63//____________________________________________________________________________ \r
64void AliZDCQADataMakerSim::InitHits()\r
65{\r
66 // create Hits histograms in Hits subdir\r
67 //\r
68 TH2F * hZNCh = new TH2F("hZNCh", "Hits centroid in ZNC", 100, -5.,5.,100,-5.,5.);\r
69 TH2F * hZNAh = new TH2F("hZNAh", "Hits centroid in ZNA", 100, -5.,5.,100,-5.,5.);\r
70 TH2F * hZPCh = new TH2F("hZPCh", "Hits centroid in ZPC", 100,-12.,12.,100,-12.,12.); \r
71 TH2F * hZPAh = new TH2F("hZPAh", "Hits centroid in ZPA", 100,-12.,12.,100,-12.,12.); \r
72 Add2HitsList(hZNCh, 0);\r
73 Add2HitsList(hZPCh, 1);\r
74 Add2HitsList(hZNAh, 2);\r
75 Add2HitsList(hZPAh, 3);\r
76}\r
77\r
78\r
79//____________________________________________________________________________ \r
80void AliZDCQADataMakerSim::InitDigits()\r
81{\r
82 // create Digits histograms in Digits subdir\r
83 //\r
84 TH1F * hDigZNCTot = new TH1F("hDigZNCTot", "Digit signal in ZNC", 100, 0., 6000.);\r
85 TH1F * hDigZNATot = new TH1F("hDigZNATot", "Digit signal in ZNA", 100, 0., 6000.);\r
86 TH1F * hDigZPCTot = new TH1F("hDigZPCTot", "Digit signal in ZPC", 100, 0., 10000.);\r
87 TH1F * hDigZPATot = new TH1F("hDigZPATot", "Digit signal in ZPA", 100, 0., 10000.);\r
88 Add2DigitsList(hDigZNCTot, 0);\r
89 Add2DigitsList(hDigZPCTot, 1);\r
90 Add2DigitsList(hDigZNATot, 2);\r
91 Add2DigitsList(hDigZPATot, 3);\r
92 //\r
93 TH1F * hDigSumQZNC = new TH1F("hDigSumQZNC", "Signal in 4 ZNC PMQ[i]",100, 0., 4000.);\r
94 TH1F * hDigSumQZPC = new TH1F("hDigSumQZPC", "Signal in 4 ZPC PMQ[i]",100, 0., 4000.);\r
95 TH1F * hDigSumQZNA = new TH1F("hDigSumQZNA", "Signal in 4 ZNA PMQ[i]",100, 0., 4000.);\r
96 TH1F * hDigSumQZPA = new TH1F("hDigSumQZPA", "Signal in 4 ZPA PMQ[i]",100, 0., 4000.);\r
97 Add2DigitsList(hDigSumQZNC, 4);\r
98 Add2DigitsList(hDigSumQZPC, 5);\r
99 Add2DigitsList(hDigSumQZNA, 6);\r
100 Add2DigitsList(hDigSumQZPA, 7);\r
101 //\r
102 TH1F * hDigPMCZNC = new TH1F("hDigPMCZNC", "Signal in 4 ZNC PMQ[i]",100, 0., 4000.);\r
103 TH1F * hDigPMCZPC = new TH1F("hDigPMCZPC", "Signal in 4 ZPC PMQ[i]",100, 0., 4000.);\r
104 TH1F * hDigPMCZNA = new TH1F("hDigPMCZNA", "Signal in 4 ZNA PMQ[i]",100, 0., 4000.);\r
105 TH1F * hDigPMCZPA = new TH1F("hDigPMCZPA", "Signal in 4 ZPA PMQ[i]",100, 0., 4000.);\r
106 Add2DigitsList(hDigPMCZNC, 8);\r
107 Add2DigitsList(hDigPMCZPC, 9);\r
108 Add2DigitsList(hDigPMCZNA, 10);\r
109 Add2DigitsList(hDigPMCZPA, 11);\r
110 // \r
111 // ------------------- LOW GAIN CHAIN ---------------------------\r
112 TH1F * hDigZNCTotlg = new TH1F("hDigZNCTotlg", "Digit lg signal in ZNC", 100, 0., 6000.);\r
113 TH1F * hDigZNATotlg = new TH1F("hDigZNATotlg", "Digit lg signal in ZNA", 100, 0., 6000.);\r
114 TH1F * hDigZPCTotlg = new TH1F("hDigZPCTotlg", "Digit lg signal in ZPC", 100, 0., 10000.);\r
115 TH1F * hDigZPATotlg = new TH1F("hDigZPATotlg", "Digit lg signal in ZPA", 100, 0., 10000.);\r
116 Add2DigitsList(hDigZNCTotlg, 12);\r
117 Add2DigitsList(hDigZPCTotlg, 13);\r
118 Add2DigitsList(hDigZNATotlg, 14);\r
119 Add2DigitsList(hDigZPATotlg, 15);\r
120 //\r
121 TH1F * hDigSumQZNClg = new TH1F("hDigSumQZNClg", "Signal in 4 ZNC PMQlg[i]",100, 0., 4000.);\r
122 TH1F * hDigSumQZPClg = new TH1F("hDigSumQZPClg", "Signal in 4 ZPC PMQlg[i]",100, 0., 4000.);\r
123 TH1F * hDigSumQZNAlg = new TH1F("hDigSumQZNAlg", "Signal in 4 ZNA PMQlg[i]",100, 0., 4000.);\r
124 TH1F * hDigSumQZPAlg = new TH1F("hDigSumQZPAlg", "Signal in 4 ZPA PMQlg[i]",100, 0., 4000.);\r
125 Add2DigitsList(hDigSumQZNClg, 16);\r
126 Add2DigitsList(hDigSumQZPClg, 17);\r
127 Add2DigitsList(hDigSumQZNAlg, 18);\r
128 Add2DigitsList(hDigSumQZPAlg, 19);\r
129 //\r
130 TH1F * hDigPMCZNClg = new TH1F("hDigPMCZNClg", "Signal in 4 ZNC PMQlg[i]",100, 0., 4000.);\r
131 TH1F * hDigPMCZPClg = new TH1F("hDigPMCZPClg", "Signal in 4 ZPC PMQlg[i]",100, 0., 4000.);\r
132 TH1F * hDigPMCZNAlg = new TH1F("hDigPMCZNAlg", "Signal in 4 ZNA PMQlg[i]",100, 0., 4000.);\r
133 TH1F * hDigPMCZPAlg = new TH1F("hDigPMCZPAlg", "Signal in 4 ZPA PMQlg[i]",100, 0., 4000.);\r
134 Add2DigitsList(hDigPMCZNClg, 20);\r
135 Add2DigitsList(hDigPMCZPClg, 21);\r
136 Add2DigitsList(hDigPMCZNAlg, 22);\r
137 Add2DigitsList(hDigPMCZPAlg, 23);\r
138}\r
139\r
140//____________________________________________________________________________\r
141void AliZDCQADataMakerSim::MakeHits(TClonesArray * /*data*/)\r
142{\r
143 //filling QA histos for Hits\r
144 //\r
66317fbe 145 TIter next(fHits); \r
3d2cda92 146 AliZDCHit * hit; \r
147 while((hit = dynamic_cast<AliZDCHit *>(next()))){\r
148 if(hit->GetVolume(0)==1) GetHitsData(0)->Fill(hit->GetXImpact(),hit->GetYImpact());\r
149 else if(hit->GetVolume(0)==2) GetHitsData(1)->Fill(hit->GetXImpact(), hit->GetYImpact());\r
150 else if(hit->GetVolume(0)==4) GetHitsData(2)->Fill(hit->GetXImpact(), hit->GetYImpact());\r
151 else if(hit->GetVolume(0)==5) GetHitsData(3)->Fill(hit->GetXImpact(), hit->GetYImpact());\r
152 }\r
153}\r
154\r
155//___________________________________________________________________________\r
156void AliZDCQADataMakerSim::MakeHits(TTree * hitTree)\r
157{\r
158 // make QA data from Hit Tree\r
159 //\r
160 if(!hitTree){\r
161 AliError("Hit Tree not found!"); \r
162 return;\r
163 }\r
164 //\r
165\r
166 TBranch * branch = hitTree->GetBranch("ZDC") ;\r
3d2cda92 167\r
168 if(!branch){\r
169 AliError("ZDC branch in Hit Tree not found!"); \r
170 return;\r
66317fbe 171 } else {\r
172 char** add = (char**) (branch->GetAddress());\r
7278dd5e 173 if (add) {\r
174 fHits = (TClonesArray*)(*add);\r
175 } else {\r
176 if (!fHits) fHits = new TClonesArray("AliZDCHit", 1000);\r
177 branch->SetAddress(&fHits);\r
178 }\r
179 Int_t ntracks = (Int_t) hitTree->GetEntries();\r
180 //printf("\n\t *** no.track %d\n",ntracks);\r
181 if (ntracks<=0) return;\r
3d2cda92 182 //\r
7278dd5e 183 for(Int_t itrack=0; itrack<ntracks; itrack++){\r
184 \r
185 branch->GetEntry(itrack);\r
186 //\r
187 //printf("\t *** track %d",itrack);\r
188 //hits->Print("");\r
189 //printf("\n");\r
190 //\r
191 MakeHits(); \r
192 fHits->Clear();\r
193 } \r
3d2cda92 194 }\r
195}\r
196\r
197//____________________________________________________________________________\r
198void AliZDCQADataMakerSim::MakeDigits(TClonesArray * /*digits*/)\r
199{\r
200 // makes data from Digits\r
201 //\r
66317fbe 202 \r
203}\r
204//___________________________________________________________________________\r
205void AliZDCQADataMakerSim::MakeDigits(TTree *digitTree )\r
206{\r
207 // makes data from Digit Tree\r
208 TBranch * branch = digitTree->GetBranch("ZDC");\r
209 if(!branch){\r
210 AliError("ZDC branch in Digit Tree not found"); \r
211 return;\r
212 } \r
213 char** add = (char**) (branch->GetAddress());\r
7278dd5e 214 if (add) {\r
215 fDigit = (AliZDCDigit*)(*add);\r
216 } else {\r
217 if (!fDigit) fDigit = new AliZDCDigit();\r
218 branch->SetAddress(&fDigit);\r
219 }\r
66317fbe 220 \r
221 Int_t ndig = digitTree->GetEntries();\r
222 \r
3d2cda92 223 //\r
224 Float_t ADCSum_ZNC=0., ADCSum_ZNA=0., ADCSum_ZPC=0., ADCSum_ZPA=0.;\r
225 Float_t ADCSumQ_ZNC=0., ADCSumQ_ZNA=0., ADCSumQ_ZPC=0., ADCSumQ_ZPA=0.;\r
226 Float_t ADCSum_ZNC_lg=0., ADCSum_ZNA_lg=0., ADCSum_ZPC_lg=0., ADCSum_ZPA_lg=0.;\r
227 Float_t ADCSumQ_ZNC_lg=0., ADCSumQ_ZNA_lg=0., ADCSumQ_ZPC_lg=0., ADCSumQ_ZPA_lg=0.;\r
228 //\r
66317fbe 229 for (Int_t i = 0; i < ndig; i++) {\r
230 digitTree->GetEntry(i);\r
231 if(fDigit->GetSector(0)==1){\r
232 ADCSum_ZNC += fDigit->GetADCValue(0);\r
233 ADCSum_ZNC_lg += fDigit->GetADCValue(1);\r
234 //\r
235 if(fDigit->GetSector(1)!=0){\r
236 ADCSumQ_ZNC += fDigit->GetADCValue(0);\r
237 ADCSumQ_ZNC_lg+= fDigit->GetADCValue(1);\r
238 }\r
239 else{\r
240 GetDigitsData(8)->Fill(fDigit->GetADCValue(0));\r
241 GetDigitsData(20)->Fill(fDigit->GetADCValue(1));\r
242 }\r
3d2cda92 243 }\r
66317fbe 244 else if(fDigit->GetSector(0)==2){\r
245 ADCSum_ZPC += fDigit->GetADCValue(0);\r
246 ADCSum_ZPC_lg += fDigit->GetADCValue(1);\r
247 //\r
248 if(fDigit->GetSector(1)!=0){\r
249 ADCSumQ_ZPC += fDigit->GetADCValue(0);\r
250 ADCSumQ_ZPC_lg+= fDigit->GetADCValue(1);\r
251 }\r
252 else{\r
253 GetDigitsData(9)->Fill(fDigit->GetADCValue(0));\r
254 GetDigitsData(21)->Fill(fDigit->GetADCValue(1));\r
255 }\r
3d2cda92 256 }\r
66317fbe 257 else if(fDigit->GetSector(0)==4){\r
258 ADCSum_ZNA += fDigit->GetADCValue(0);\r
259 ADCSum_ZNA_lg += fDigit->GetADCValue(1);\r
260 //\r
261 if(fDigit->GetSector(1)!=0){\r
262 ADCSumQ_ZNA += fDigit->GetADCValue(0);\r
263 ADCSumQ_ZNA_lg+= fDigit->GetADCValue(1);\r
264 }\r
265 else{\r
266 GetDigitsData(10)->Fill(fDigit->GetADCValue(0));\r
267 GetDigitsData(22)->Fill(fDigit->GetADCValue(1));\r
268 }\r
3d2cda92 269 }\r
66317fbe 270 else if(fDigit->GetSector(0)==5){\r
271 ADCSum_ZPA += fDigit->GetADCValue(0);\r
272 ADCSum_ZPA_lg += fDigit->GetADCValue(1);\r
273 //\r
274 if(fDigit->GetSector(1)!=0){\r
275 ADCSumQ_ZPA += fDigit->GetADCValue(0);\r
276 ADCSumQ_ZPA_lg+= fDigit->GetADCValue(1);\r
277 }\r
278 else{\r
279 GetDigitsData(11)->Fill(fDigit->GetADCValue(0));\r
280 GetDigitsData(23)->Fill(fDigit->GetADCValue(1));\r
281 }\r
3d2cda92 282 }\r
3d2cda92 283 }\r
284 //\r
285 GetDigitsData(0)->Fill(ADCSum_ZNC);\r
286 GetDigitsData(1)->Fill(ADCSum_ZPC);\r
287 GetDigitsData(2)->Fill(ADCSum_ZNA);\r
288 GetDigitsData(3)->Fill(ADCSum_ZPA);\r
289 //\r
290 GetDigitsData(4)->Fill(ADCSumQ_ZNC);\r
291 GetDigitsData(5)->Fill(ADCSumQ_ZPC);\r
292 GetDigitsData(6)->Fill(ADCSumQ_ZNA);\r
293 GetDigitsData(7)->Fill(ADCSumQ_ZPA);\r
294 //\r
295 GetDigitsData(12)->Fill(ADCSum_ZNC_lg);\r
296 GetDigitsData(13)->Fill(ADCSum_ZPC_lg);\r
297 GetDigitsData(14)->Fill(ADCSum_ZNA_lg);\r
298 GetDigitsData(15)->Fill(ADCSum_ZPA_lg);\r
299 //\r
300 GetDigitsData(16)->Fill(ADCSumQ_ZNC_lg);\r
301 GetDigitsData(17)->Fill(ADCSumQ_ZPC_lg);\r
302 GetDigitsData(18)->Fill(ADCSumQ_ZNA_lg);\r
303 GetDigitsData(19)->Fill(ADCSumQ_ZPA_lg);\r
3d2cda92 304}\r
305\r
306//____________________________________________________________________________\r
307void AliZDCQADataMakerSim::StartOfDetectorCycle()\r
308{\r
309 //Detector specific actions at start of cycle\r
310 \r
311}\r
312\r
313//____________________________________________________________________________ \r
314void AliZDCQADataMakerSim::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray * list)\r
315{\r
316 //Detector specific actions at end of cycle\r
317 // do the QA checking\r
318 AliQAChecker::Instance()->Run(AliQA::kZDC, task, list); \r
319}\r