now ESDWriter reads track MC labels from TPCTrackMCMarker component
[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
fdc38bb2 15\r
3d2cda92 16// --- Standard library ---\r
17#include <Riostream.h>\r
18// --- ROOT system ---\r
19#include <TClonesArray.h>\r
7d297381 20#include <TFile.h> \r
3d2cda92 21#include <TH1F.h> \r
22#include <TH2F.h>\r
23#include <TBranch.h>\r
24#include <TTree.h>\r
25// --- AliRoot header files ---\r
26#include "AliLog.h"\r
27#include "AliQAChecker.h"\r
28#include "AliZDCQADataMakerSim.h"\r
29#include "AliZDCHit.h"\r
30#include "AliZDCDigit.h"\r
31#include "AliZDCRawStream.h"\r
32\r
33ClassImp(AliZDCQADataMakerSim)\r
34 \r
35//____________________________________________________________________________ \r
36 AliZDCQADataMakerSim::AliZDCQADataMakerSim() : \r
4e25ac79 37 AliQADataMakerSim(AliQAv1::GetDetName(AliQAv1::kZDC), "ZDC Quality Assurance Data Maker"),\r
66317fbe 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 fDigit(0) \r
3d2cda92 47{\r
48 //copy ctor \r
49 SetName((const char*)qadm.GetName()); \r
50 SetTitle((const char*)qadm.GetTitle()); \r
51}\r
52\r
53//__________________________________________________________________\r
54AliZDCQADataMakerSim& AliZDCQADataMakerSim::operator = (const AliZDCQADataMakerSim& qadm )\r
55{\r
56 // Equal operator.\r
57 this->~AliZDCQADataMakerSim();\r
58 new(this) AliZDCQADataMakerSim(qadm);\r
59 return *this;\r
60}\r
61 \r
62//____________________________________________________________________________ \r
63void AliZDCQADataMakerSim::InitHits()\r
64{\r
65 // create Hits histograms in Hits subdir\r
66 //\r
7d297381 67 const Bool_t expert = kTRUE ; \r
68 const Bool_t image = kTRUE ; \r
69 \r
db72ff3b 70 TH2F * hZNCh = new TH2F("hZNCh", "Hits centroid in ZNC;Centroid position [cm];Counts", 100, -5.,5.,100,-5.,5.);\r
71 TH2F * hZNAh = new TH2F("hZNAh", "Hits centroid in ZNA;Centroid position [cm];Counts", 100, -5.,5.,100,-5.,5.);\r
fdc38bb2 72 // NB -> For the moment no check is performesd on ZP centroids\r
73// TH2F * hZPCh = new TH2F("hZPCh", "Hits centroid in ZPC", 100,-12.,12.,100,-12.,12.); \r
74// TH2F * hZPAh = new TH2F("hZPAh", "Hits centroid in ZPA", 100,-12.,12.,100,-12.,12.); \r
7d297381 75 Add2HitsList(hZNCh, 0, !expert, image);\r
76 Add2HitsList(hZNAh, 1, !expert, image);\r
77// Add2HitsList(hZPCh, 2, !expert, image);\r
78// Add2HitsList(hZPAh, 3, !expert, image);\r
3d2cda92 79}\r
80\r
81\r
82//____________________________________________________________________________ \r
83void AliZDCQADataMakerSim::InitDigits()\r
84{\r
85 // create Digits histograms in Digits subdir\r
86 //\r
7d297381 87 const Bool_t expert = kTRUE ; \r
88 const Bool_t image = kTRUE ; \r
89 \r
fdc38bb2 90 // ------------------- HIGH GAIN CHAIN ---------------------------\r
db72ff3b 91 TH1F * hDigZNCTot = new TH1F("hDigZNCTot", "Signal in ZNC;Amplitude [ADC counts];Counts", 100, 0., 6000.);\r
92 TH1F * hDigZNATot = new TH1F("hDigZNATot", "Signal in ZNA;Amplitude [ADC counts];Counts", 100, 0., 6000.);\r
93 TH1F * hDigZPCTot = new TH1F("hDigZPCTot", "Signal in ZPC;Amplitude [ADC counts];Counts", 100, 0., 6000.);\r
94 TH1F * hDigZPATot = new TH1F("hDigZPATot", "Signal in ZPA;Amplitude [ADC counts];Counts", 100, 0., 6000.);\r
7d297381 95 Add2DigitsList(hDigZNCTot, 0, !expert, image);\r
96 Add2DigitsList(hDigZNATot, 1, !expert, image);\r
97 Add2DigitsList(hDigZPCTot, 2, !expert, image);\r
98 Add2DigitsList(hDigZPATot, 3, !expert, image);\r
3d2cda92 99 //\r
db72ff3b 100 TH1F * hDigSumQZNC = new TH1F("hDigSumQZNC", "Signal in 4 ZNC PMQ;Amplitude [ADC counts];Counts",100, 0., 4000.);\r
101 TH1F * hDigSumQZNA = new TH1F("hDigSumQZNA", "Signal in 4 ZNA PMQ;Amplitude [ADC counts];Counts",100, 0., 4000.);\r
102 TH1F * hDigSumQZPC = new TH1F("hDigSumQZPC", "Signal in 4 ZPC PMQ;Amplitude [ADC counts];Counts",100, 0., 4000.);\r
103 TH1F * hDigSumQZPA = new TH1F("hDigSumQZPA", "Signal in 4 ZPA PMQ;Amplitude [ADC counts];Counts",100, 0., 4000.);\r
7d297381 104 Add2DigitsList(hDigSumQZNC, 4, expert, !image);\r
105 Add2DigitsList(hDigSumQZNA, 5, expert, !image);\r
106 Add2DigitsList(hDigSumQZPC, 6, expert, !image);\r
107 Add2DigitsList(hDigSumQZPA, 7, expert, !image);\r
3d2cda92 108 //\r
db72ff3b 109 TH1F * hDigPMCZNC = new TH1F("hDigPMCZNC", "Signal in ZNC PMC;Amplitude [ADC counts];Counts",100, 0., 4000.);\r
110 TH1F * hDigPMCZNA = new TH1F("hDigPMCZNA", "Signal in ZNA PMC;Amplitude [ADC counts];Counts",100, 0., 4000.);\r
111 TH1F * hDigPMCZPC = new TH1F("hDigPMCZPC", "Signal in ZPC PMC;Amplitude [ADC counts];Counts",100, 0., 4000.);\r
112 TH1F * hDigPMCZPA = new TH1F("hDigPMCZPA", "Signal in ZPA PMC;Amplitude [ADC counts];Counts",100, 0., 4000.);\r
7d297381 113 Add2DigitsList(hDigPMCZNC, 8, expert, !image);\r
114 Add2DigitsList(hDigPMCZNA, 9, expert, !image);\r
115 Add2DigitsList(hDigPMCZPC, 10, expert, !image);\r
116 Add2DigitsList(hDigPMCZPA, 11, expert, !image);\r
3d2cda92 117 // \r
118 // ------------------- LOW GAIN CHAIN ---------------------------\r
fdc38bb2 119/* TH1F * hDigZNCTotlg = new TH1F("hDigZNCTotlg", "Digit lg signal in ZNC", 100, 0., 6000.);\r
3d2cda92 120 TH1F * hDigZNATotlg = new TH1F("hDigZNATotlg", "Digit lg signal in ZNA", 100, 0., 6000.);\r
fdc38bb2 121 TH1F * hDigZPCTotlg = new TH1F("hDigZPCTotlg", "Digit lg signal in ZPC", 100, 0., 6000.);\r
122 TH1F * hDigZPATotlg = new TH1F("hDigZPATotlg", "Digit lg signal in ZPA", 100, 0., 6000.);\r
7d297381 123 Add2DigitsList(hDigZNCTotlg, 12, !expert, image);\r
124 Add2DigitsList(hDigZNATotlg, 13, !expert, image);\r
125 Add2DigitsList(hDigZPCTotlg, 14, !expert, image);\r
126 Add2DigitsList(hDigZPATotlg, 15, !expert, image);\r
3d2cda92 127 //\r
fdc38bb2 128 TH1F * hDigSumQZNClg = new TH1F("hDigSumQZNClg", "Signal in 4 ZNC PMQlg",100, 0., 4000.);\r
129 TH1F * hDigSumQZNAlg = new TH1F("hDigSumQZNAlg", "Signal in 4 ZNA PMQlg",100, 0., 4000.);\r
130 TH1F * hDigSumQZPClg = new TH1F("hDigSumQZPClg", "Signal in 4 ZPC PMQlg",100, 0., 4000.);\r
131 TH1F * hDigSumQZPAlg = new TH1F("hDigSumQZPAlg", "Signal in 4 ZPA PMQlg",100, 0., 4000.);\r
7d297381 132 Add2DigitsList(hDigSumQZNClg, 16, expert, !image);\r
133 Add2DigitsList(hDigSumQZNAlg, 17, expert, !image);\r
134 Add2DigitsList(hDigSumQZPClg, 18, expert, !image);\r
135 Add2DigitsList(hDigSumQZPAlg, 19, expert, !image);\r
3d2cda92 136 //\r
fdc38bb2 137 TH1F * hDigPMCZNClg = new TH1F("hDigPMCZNClg", "Signal in ZNC PMClg",100, 0., 4000.);\r
138 TH1F * hDigPMCZNAlg = new TH1F("hDigPMCZNAlg", "Signal in ZNA PMClg",100, 0., 4000.);\r
139 TH1F * hDigPMCZPClg = new TH1F("hDigPMCZPClg", "Signal in ZPC PMClg",100, 0., 4000.);\r
140 TH1F * hDigPMCZPAlg = new TH1F("hDigPMCZPAlg", "Signal in ZPA PMClg",100, 0., 4000.);\r
7d297381 141 Add2DigitsList(hDigPMCZNClg, 20, expert, !image);\r
142 Add2DigitsList(hDigPMCZNAlg, 21, expert, !image);\r
143 Add2DigitsList(hDigPMCZPClg, 22, expert, !image);\r
144 Add2DigitsList(hDigPMCZPAlg, 23, expert, !image);\r
fdc38bb2 145*/\r
3d2cda92 146}\r
147\r
148//____________________________________________________________________________\r
6252ceeb 149void AliZDCQADataMakerSim::MakeHits()\r
3d2cda92 150{\r
151 //filling QA histos for Hits\r
152 //\r
eca4fa66 153\r
154 // Check id histograms already created for this Event Specie\r
155 if ( ! GetHitsData(0) )\r
156 InitHits() ;\r
157 \r
6252ceeb 158 TIter next(fHitsArray); \r
3d2cda92 159 AliZDCHit * hit; \r
160 while((hit = dynamic_cast<AliZDCHit *>(next()))){\r
161 if(hit->GetVolume(0)==1) GetHitsData(0)->Fill(hit->GetXImpact(),hit->GetYImpact());\r
fdc38bb2 162 else if(hit->GetVolume(0)==4) GetHitsData(1)->Fill(hit->GetXImpact(), hit->GetYImpact());\r
163// else if(hit->GetVolume(0)==2) GetHitsData(1)->Fill(hit->GetXImpact(), hit->GetYImpact());\r
164// else if(hit->GetVolume(0)==5) GetHitsData(3)->Fill(hit->GetXImpact(), hit->GetYImpact());\r
3d2cda92 165 }\r
166}\r
167\r
168//___________________________________________________________________________\r
169void AliZDCQADataMakerSim::MakeHits(TTree * hitTree)\r
170{\r
171 // make QA data from Hit Tree\r
172 //\r
173 if(!hitTree){\r
174 AliError("Hit Tree not found!"); \r
175 return;\r
176 }\r
177 //\r
178\r
179 TBranch * branch = hitTree->GetBranch("ZDC") ;\r
3d2cda92 180\r
181 if(!branch){\r
182 AliError("ZDC branch in Hit Tree not found!"); \r
183 return;\r
fdc38bb2 184 } \r
185 else{\r
6252ceeb 186 if (fHitsArray) \r
187 fHitsArray->Clear() ; \r
fdc38bb2 188 char** add = (char**) (branch->GetAddress());\r
189 if(add){\r
6252ceeb 190 fHitsArray = (TClonesArray*)(*add);\r
fdc38bb2 191 } \r
192 else{\r
6252ceeb 193 if(!fHitsArray) fHitsArray = new TClonesArray("AliZDCHit", 1000);\r
194 branch->SetAddress(&fHitsArray);\r
fdc38bb2 195 }\r
196 Int_t ntracks = (Int_t) hitTree->GetEntries();\r
197 //printf("\n\t *** no.track %d\n",ntracks);\r
198 if (ntracks<=0) return;\r
199 //\r
200 for(Int_t itrack=0; itrack<ntracks; itrack++){\r
201 \r
202 branch->GetEntry(itrack);\r
203 //\r
204 //printf("\t *** track %d",itrack);\r
205 //hits->Print("");\r
206 //printf("\n");\r
207 //\r
208 MakeHits(); \r
6252ceeb 209 fHitsArray->Clear();\r
fdc38bb2 210 } \r
3d2cda92 211 }\r
212}\r
213\r
66317fbe 214//___________________________________________________________________________\r
215void AliZDCQADataMakerSim::MakeDigits(TTree *digitTree )\r
216{\r
fdc38bb2 217 // makes data from Digit Tree\r
218 TBranch * branch = digitTree->GetBranch("ZDC");\r
219 if(!branch){\r
220 AliError("ZDC branch in Digit Tree not found"); \r
221 return;\r
222 } \r
eca4fa66 223 \r
224 // Check id histograms already created for this Event Specie\r
225 if ( ! GetDigitsData(0) )\r
226 InitDigits() ;\r
227 \r
228 branch->SetAddress(&fDigit);\r
fdc38bb2 229 \r
230 Int_t ndig = digitTree->GetEntries();\r
66317fbe 231 \r
fdc38bb2 232 Float_t adcSum_ZNC=0., adcSum_ZNA=0., adcSum_ZPC=0., adcSum_ZPA=0.;\r
233 Float_t adcSumQ_ZNC=0., adcSumQ_ZNA=0., adcSumQ_ZPC=0., adcSumQ_ZPA=0.;\r
234 //Float_t adcSum_ZNC_lg=0., adcSum_ZNA_lg=0., adcSum_ZPC_lg=0., adcSum_ZPA_lg=0.;\r
235 //Float_t adcSumQ_ZNC_lg=0., adcSumQ_ZNA_lg=0., adcSumQ_ZPC_lg=0., adcSumQ_ZPA_lg=0.;\r
3d2cda92 236 //\r
fdc38bb2 237 for(Int_t i = 0; i < ndig; i++){\r
66317fbe 238 digitTree->GetEntry(i);\r
239 if(fDigit->GetSector(0)==1){\r
fdc38bb2 240 adcSum_ZNC += fDigit->GetADCValue(0);\r
241 //adcSum_ZNC_lg += fDigit->GetADCValue(1);\r
66317fbe 242 //\r
243 if(fDigit->GetSector(1)!=0){\r
fdc38bb2 244 adcSumQ_ZNC += fDigit->GetADCValue(0);\r
245 //adcSumQ_ZNC_lg+= fDigit->GetADCValue(1);\r
66317fbe 246 }\r
247 else{\r
248 GetDigitsData(8)->Fill(fDigit->GetADCValue(0));\r
fdc38bb2 249 //GetDigitsData(20)->Fill(fDigit->GetADCValue(1));\r
66317fbe 250 }\r
3d2cda92 251 }\r
66317fbe 252 else if(fDigit->GetSector(0)==2){\r
fdc38bb2 253 adcSum_ZPC += fDigit->GetADCValue(0);\r
254 //adcSum_ZPC_lg += fDigit->GetADCValue(1);\r
66317fbe 255 //\r
256 if(fDigit->GetSector(1)!=0){\r
fdc38bb2 257 adcSumQ_ZPC += fDigit->GetADCValue(0);\r
258 //adcSumQ_ZPC_lg+= fDigit->GetADCValue(1);\r
66317fbe 259 }\r
260 else{\r
fdc38bb2 261 GetDigitsData(10)->Fill(fDigit->GetADCValue(0));\r
262 //GetDigitsData(22)->Fill(fDigit->GetADCValue(1));\r
66317fbe 263 }\r
3d2cda92 264 }\r
66317fbe 265 else if(fDigit->GetSector(0)==4){\r
fdc38bb2 266 adcSum_ZNA += fDigit->GetADCValue(0);\r
267 //adcSum_ZNA_lg += fDigit->GetADCValue(1);\r
66317fbe 268 //\r
269 if(fDigit->GetSector(1)!=0){\r
fdc38bb2 270 adcSumQ_ZNA += fDigit->GetADCValue(0);\r
271 //adcSumQ_ZNA_lg+= fDigit->GetADCValue(1);\r
66317fbe 272 }\r
273 else{\r
fdc38bb2 274 GetDigitsData(9)->Fill(fDigit->GetADCValue(0));\r
275 //GetDigitsData(21)->Fill(fDigit->GetADCValue(1));\r
66317fbe 276 }\r
3d2cda92 277 }\r
66317fbe 278 else if(fDigit->GetSector(0)==5){\r
fdc38bb2 279 adcSum_ZPA += fDigit->GetADCValue(0);\r
280 //adcSum_ZPA_lg += fDigit->GetADCValue(1);\r
66317fbe 281 //\r
282 if(fDigit->GetSector(1)!=0){\r
fdc38bb2 283 adcSumQ_ZPA += fDigit->GetADCValue(0);\r
284 //adcSumQ_ZPA_lg+= fDigit->GetADCValue(1);\r
66317fbe 285 }\r
286 else{\r
287 GetDigitsData(11)->Fill(fDigit->GetADCValue(0));\r
fdc38bb2 288 //GetDigitsData(23)->Fill(fDigit->GetADCValue(1));\r
66317fbe 289 }\r
3d2cda92 290 }\r
3d2cda92 291 }\r
292 //\r
fdc38bb2 293 GetDigitsData(0)->Fill(adcSum_ZNC);\r
294 GetDigitsData(1)->Fill(adcSum_ZNA);\r
295 GetDigitsData(2)->Fill(adcSum_ZPC);\r
296 GetDigitsData(3)->Fill(adcSum_ZPA);\r
3d2cda92 297 //\r
fdc38bb2 298 GetDigitsData(4)->Fill(adcSumQ_ZNC);\r
299 GetDigitsData(5)->Fill(adcSumQ_ZNA);\r
300 GetDigitsData(6)->Fill(adcSumQ_ZPC);\r
301 GetDigitsData(7)->Fill(adcSumQ_ZPA);\r
3d2cda92 302 //\r
fdc38bb2 303 /*GetDigitsData(12)->Fill(adcSum_ZNC_lg);\r
304 GetDigitsData(13)->Fill(adcSum_ZNA_lg);\r
305 GetDigitsData(14)->Fill(adcSum_ZPC_lg);\r
306 GetDigitsData(15)->Fill(adcSum_ZPA_lg);\r
3d2cda92 307 //\r
fdc38bb2 308 GetDigitsData(16)->Fill(adcSumQ_ZNC_lg);\r
309 GetDigitsData(17)->Fill(adcSumQ_ZNA_lg);\r
310 GetDigitsData(18)->Fill(adcSumQ_ZPC_lg);\r
311 GetDigitsData(19)->Fill(adcSumQ_ZPA_lg);*/\r
3d2cda92 312}\r
313\r
314//____________________________________________________________________________\r
315void AliZDCQADataMakerSim::StartOfDetectorCycle()\r
316{\r
317 //Detector specific actions at start of cycle\r
318 \r
319}\r
320\r
321//____________________________________________________________________________ \r
4e25ac79 322void AliZDCQADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)\r
3d2cda92 323{\r
fdc38bb2 324 // Detector specific actions at end of cycle\r
3d2cda92 325 // do the QA checking\r
4e25ac79 326 AliQAChecker::Instance()->Run(AliQAv1::kZDC, task, list); \r
3d2cda92 327}\r