]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ZDC/AliZDCQADataMakerSim.cxx
Changes for report #76227: ZDC TDC info in ESD and physics selection (for release...
[u/mrichter/AliRoot.git] / ZDC / AliZDCQADataMakerSim.cxx
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 \r
16 // --- Standard library ---\r
17 #include <Riostream.h>\r
18 // --- ROOT system ---\r
19 #include <TClonesArray.h>\r
20 #include <TFile.h>     \r
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 \r
32 ClassImp(AliZDCQADataMakerSim)\r
33            \r
34 //____________________________________________________________________________ \r
35   AliZDCQADataMakerSim::AliZDCQADataMakerSim() : \r
36       AliQADataMakerSim(AliQAv1::GetDetName(AliQAv1::kZDC), "ZDC Quality Assurance Data Maker")\r
37 {\r
38   // ctor\r
39 }\r
40 \r
41 //____________________________________________________________________________ \r
42 AliZDCQADataMakerSim::AliZDCQADataMakerSim(const AliZDCQADataMakerSim& qadm) :\r
43     AliQADataMakerSim()\r
44 {\r
45   //copy ctor \r
46   SetName((const char*)qadm.GetName()); \r
47   SetTitle((const char*)qadm.GetTitle()); \r
48 }\r
49 \r
50 //__________________________________________________________________\r
51 AliZDCQADataMakerSim& AliZDCQADataMakerSim::operator = (const AliZDCQADataMakerSim& qadm )\r
52 {\r
53   // Equal operator.\r
54   this->~AliZDCQADataMakerSim();\r
55   new(this) AliZDCQADataMakerSim(qadm);\r
56   return *this;\r
57 }\r
58  \r
59 //____________________________________________________________________________ \r
60 void AliZDCQADataMakerSim::InitHits()\r
61 {\r
62   // create Hits histograms in Hits subdir\r
63   //\r
64   const Bool_t expert   = kTRUE ; \r
65   const Bool_t image    = kTRUE ; \r
66 \r
67   TH1F * hHitsZNCTot = new TH1F("hHitsZNCTot", "Signal in ZNC; N_{phe}", 100, 0., 6000.);\r
68   TH1F * hHitsZNATot = new TH1F("hHitsZNATot", "Signal in ZNA; N_{phe}", 100, 0., 6000.);\r
69   TH1F * hHitsZPCTot = new TH1F("hHitsZPCTot", "Signal in ZPC; N_{phe}", 100, 0., 6000.);\r
70   TH1F * hHitsZPATot = new TH1F("hHitsZPATot", "Signal in ZPA; N_{phe}", 100, 0., 6000.);\r
71   Add2HitsList(hHitsZNCTot, 0, !expert, image);\r
72   Add2HitsList(hHitsZNATot, 1, !expert, image);\r
73   Add2HitsList(hHitsZPCTot, 2, !expert, image);\r
74   Add2HitsList(hHitsZPATot, 3, !expert, image);\r
75   //\r
76   TH1F * hHitsSumQZNC = new TH1F("hHitsSumQZNC", "Signal in 4 ZNC PMQ; N_{phe}",100, 0., 4000.);\r
77   TH1F * hHitsSumQZNA = new TH1F("hHitsSumQZNA", "Signal in 4 ZNA PMQ; N_{phe}",100, 0., 4000.);\r
78   TH1F * hHitsSumQZPC = new TH1F("hHitsSumQZPC", "Signal in 4 ZPC PMQ; N_{phe}",100, 0., 4000.);\r
79   TH1F * hHitsSumQZPA = new TH1F("hHitsSumQZPA", "Signal in 4 ZPA PMQ; N_{phe}",100, 0., 4000.);\r
80   Add2HitsList(hHitsSumQZNC, 4, expert, !image);\r
81   Add2HitsList(hHitsSumQZNA, 5, expert, !image);\r
82   Add2HitsList(hHitsSumQZPC, 6, expert, !image);\r
83   Add2HitsList(hHitsSumQZPA, 7, expert, !image);\r
84   //\r
85   TH1F * hHitsPMCZNC = new TH1F("hHitsPMCZNC", "Signal in ZNC PMC; N_{phe}",100, 0., 4000.);\r
86   TH1F * hHitsPMCZNA = new TH1F("hHitsPMCZNA", "Signal in ZNA PMC; N_{phe}",100, 0., 4000.);\r
87   TH1F * hHitsPMCZPC = new TH1F("hHitsPMCZPC", "Signal in ZPC PMC; N_{phe}",100, 0., 4000.);\r
88   TH1F * hHitsPMCZPA = new TH1F("hHitsPMCZPA", "Signal in ZPA PMC; N_{phe}",100, 0., 4000.);\r
89   Add2HitsList(hHitsPMCZNC, 8, expert, !image);\r
90   Add2HitsList(hHitsPMCZNA, 9, expert, !image);\r
91   Add2HitsList(hHitsPMCZPC, 10, expert, !image);\r
92   Add2HitsList(hHitsPMCZPA, 11, expert, !image);\r
93   \r
94   TH2F * hHitsZNCh  = new TH2F("hHitsZNCh", "Hits centroid in ZNC;Centroid position [cm];Counts", 100, -5.,5.,100,-5.,5.);\r
95   TH2F * hHitsZNAh  = new TH2F("hHitsZNAh", "Hits centroid in ZNA;Centroid position [cm];Counts", 100, -5.,5.,100,-5.,5.);\r
96   Add2HitsList(hHitsZNCh, 12, !expert, image);\r
97   Add2HitsList(hHitsZNAh, 13, !expert, image);\r
98   // NB -> For the moment no check is performesd on ZP centroids\r
99   TH2F * hHitsZPCh  = new TH2F("hHitsZPCh", "Hits centroid in ZPC;Centroid position [cm];Counts", 100,-12.,12.,100,-12.,12.); \r
100   TH2F * hHitsZPAh  = new TH2F("hHitsZPAh", "Hits centroid in ZPA;Centroid position [cm];Counts", 100,-12.,12.,100,-12.,12.); \r
101   Add2HitsList(hHitsZPCh, 14, !expert, image);\r
102   Add2HitsList(hHitsZPAh, 15, !expert, image);\r
103 }\r
104 \r
105 \r
106 //____________________________________________________________________________ \r
107 void AliZDCQADataMakerSim::InitDigits()\r
108 {\r
109   // create Digits histograms in Digits subdir\r
110   //\r
111   const Bool_t expert   = kTRUE ; \r
112   const Bool_t image    = kTRUE ; \r
113   \r
114   // ------------------- HIGH GAIN CHAIN ---------------------------\r
115   TH1F * hDigZNCTot = new TH1F("hDigZNCTot", "Signal in ZNC;Amplitude [ADC counts];Counts", 100, 0., 6000.);\r
116   TH1F * hDigZNATot = new TH1F("hDigZNATot", "Signal in ZNA;Amplitude [ADC counts];Counts", 100, 0., 6000.);\r
117   TH1F * hDigZPCTot = new TH1F("hDigZPCTot", "Signal in ZPC;Amplitude [ADC counts];Counts", 100, 0., 6000.);\r
118   TH1F * hDigZPATot = new TH1F("hDigZPATot", "Signal in ZPA;Amplitude [ADC counts];Counts", 100, 0., 6000.);\r
119   Add2DigitsList(hDigZNCTot, 0, !expert, image);\r
120   Add2DigitsList(hDigZNATot, 1, !expert, image);\r
121   Add2DigitsList(hDigZPCTot, 2, !expert, image);\r
122   Add2DigitsList(hDigZPATot, 3, !expert, image);\r
123   //\r
124   TH1F * hDigSumQZNC = new TH1F("hDigSumQZNC", "Signal in 4 ZNC PMQ;Amplitude [ADC counts];Counts",100, 0., 4000.);\r
125   TH1F * hDigSumQZNA = new TH1F("hDigSumQZNA", "Signal in 4 ZNA PMQ;Amplitude [ADC counts];Counts",100, 0., 4000.);\r
126   TH1F * hDigSumQZPC = new TH1F("hDigSumQZPC", "Signal in 4 ZPC PMQ;Amplitude [ADC counts];Counts",100, 0., 4000.);\r
127   TH1F * hDigSumQZPA = new TH1F("hDigSumQZPA", "Signal in 4 ZPA PMQ;Amplitude [ADC counts];Counts",100, 0., 4000.);\r
128   Add2DigitsList(hDigSumQZNC, 4, expert, !image);\r
129   Add2DigitsList(hDigSumQZNA, 5, expert, !image);\r
130   Add2DigitsList(hDigSumQZPC, 6, expert, !image);\r
131   Add2DigitsList(hDigSumQZPA, 7, expert, !image);\r
132   //\r
133   TH1F * hDigPMCZNC = new TH1F("hDigPMCZNC", "Signal in ZNC PMC;Amplitude [ADC counts];Counts",100, 0., 4000.);\r
134   TH1F * hDigPMCZNA = new TH1F("hDigPMCZNA", "Signal in ZNA PMC;Amplitude [ADC counts];Counts",100, 0., 4000.);\r
135   TH1F * hDigPMCZPC = new TH1F("hDigPMCZPC", "Signal in ZPC PMC;Amplitude [ADC counts];Counts",100, 0., 4000.);\r
136   TH1F * hDigPMCZPA = new TH1F("hDigPMCZPA", "Signal in ZPA PMC;Amplitude [ADC counts];Counts",100, 0., 4000.);\r
137   Add2DigitsList(hDigPMCZNC, 8, expert, !image);\r
138   Add2DigitsList(hDigPMCZNA, 9, expert, !image);\r
139   Add2DigitsList(hDigPMCZPC, 10, expert, !image);\r
140   Add2DigitsList(hDigPMCZPA, 11, expert, !image);\r
141   // \r
142   // ------------------- LOW GAIN CHAIN ---------------------------\r
143   TH1F * hDigZNCTotlg = new TH1F("hDigZNCTotlg", "Digit lg signal in ZNC", 100, 0., 6000.);\r
144   TH1F * hDigZNATotlg = new TH1F("hDigZNATotlg", "Digit lg signal in ZNA", 100, 0., 6000.);\r
145   TH1F * hDigZPCTotlg = new TH1F("hDigZPCTotlg", "Digit lg signal in ZPC", 100, 0., 6000.);\r
146   TH1F * hDigZPATotlg = new TH1F("hDigZPATotlg", "Digit lg signal in ZPA", 100, 0., 6000.);\r
147   Add2DigitsList(hDigZNCTotlg, 12, expert, !image);\r
148   Add2DigitsList(hDigZNATotlg, 13, expert, !image);\r
149   Add2DigitsList(hDigZPCTotlg, 14, expert, !image);\r
150   Add2DigitsList(hDigZPATotlg, 15, expert, !image);\r
151   //\r
152   TH1F * hDigSumQZNClg = new TH1F("hDigSumQZNClg", "Signal in 4 ZNC PMQlg",100, 0., 4000.);\r
153   TH1F * hDigSumQZNAlg = new TH1F("hDigSumQZNAlg", "Signal in 4 ZNA PMQlg",100, 0., 4000.);\r
154   TH1F * hDigSumQZPClg = new TH1F("hDigSumQZPClg", "Signal in 4 ZPC PMQlg",100, 0., 4000.);\r
155   TH1F * hDigSumQZPAlg = new TH1F("hDigSumQZPAlg", "Signal in 4 ZPA PMQlg",100, 0., 4000.);\r
156   Add2DigitsList(hDigSumQZNClg, 16, expert, !image);\r
157   Add2DigitsList(hDigSumQZNAlg, 17, expert, !image);\r
158   Add2DigitsList(hDigSumQZPClg, 18, expert, !image);\r
159   Add2DigitsList(hDigSumQZPAlg, 19, expert, !image);\r
160   //\r
161   TH1F * hDigPMCZNClg = new TH1F("hDigPMCZNClg", "Signal in ZNC PMClg",100, 0., 4000.);\r
162   TH1F * hDigPMCZNAlg = new TH1F("hDigPMCZNAlg", "Signal in ZNA PMClg",100, 0., 4000.);\r
163   TH1F * hDigPMCZPClg = new TH1F("hDigPMCZPClg", "Signal in ZPC PMClg",100, 0., 4000.);\r
164   TH1F * hDigPMCZPAlg = new TH1F("hDigPMCZPAlg", "Signal in ZPA PMClg",100, 0., 4000.);\r
165   Add2DigitsList(hDigPMCZNClg, 20, expert, !image);\r
166   Add2DigitsList(hDigPMCZNAlg, 21, expert, !image);\r
167   Add2DigitsList(hDigPMCZPClg, 22, expert, !image);\r
168   Add2DigitsList(hDigPMCZPAlg, 23, expert, !image);\r
169 \r
170 }\r
171 \r
172 //____________________________________________________________________________\r
173 void AliZDCQADataMakerSim::MakeHits()\r
174 {\r
175   //filling QA histos for Hits\r
176 \r
177   // Check id histograms already created for this Event Specie\r
178   if( !GetHitsData(0) ) InitHits();\r
179   \r
180   TIter next(fHitsArray); \r
181   AliZDCHit * hit; \r
182   Float_t adcSum_ZNC=0., adcSum_ZNA=0., adcSum_ZPC=0., adcSum_ZPA=0.;\r
183   Float_t adcSumQ_ZNC=0., adcSumQ_ZNA=0., adcSumQ_ZPC=0., adcSumQ_ZPA=0.;\r
184   while((hit = dynamic_cast<AliZDCHit *>(next()))){\r
185     if(hit->GetVolume(0)==1){\r
186        adcSumQ_ZNC += hit->GetLightPMQ();\r
187        adcSum_ZNC  += hit->GetLightPMC() + hit->GetLightPMQ();\r
188        //\r
189        GetHitsData(8)->Fill(hit->GetLightPMQ());\r
190        //\r
191        GetHitsData(12)->Fill(hit->GetXImpact(),hit->GetYImpact());        \r
192     }\r
193     else if(hit->GetVolume(0)==4){\r
194        adcSumQ_ZNA += hit->GetLightPMQ();\r
195        adcSum_ZNA  += hit->GetLightPMC() + hit->GetLightPMQ();\r
196        //\r
197        GetHitsData(9)->Fill(hit->GetLightPMQ());\r
198        //\r
199        GetHitsData(13)->Fill(hit->GetXImpact(), hit->GetYImpact());\r
200     }\r
201     else if(hit->GetVolume(0)==2){\r
202        adcSumQ_ZNC += hit->GetLightPMQ();\r
203        adcSum_ZNC  += hit->GetLightPMC() + hit->GetLightPMQ();\r
204        //\r
205        GetHitsData(10)->Fill(hit->GetLightPMQ());\r
206        //\r
207        GetHitsData(14)->Fill(hit->GetXImpact(), hit->GetYImpact());\r
208     }\r
209     else if(hit->GetVolume(0)==5){\r
210        adcSumQ_ZNC += hit->GetLightPMQ();\r
211        adcSum_ZNC  += hit->GetLightPMC() + hit->GetLightPMQ();\r
212        //\r
213        GetHitsData(11)->Fill(hit->GetLightPMQ());\r
214        //\r
215        GetHitsData(15)->Fill(hit->GetXImpact(), hit->GetYImpact());\r
216     }\r
217     //\r
218     GetHitsData(0)->Fill(adcSum_ZNC);\r
219     GetHitsData(1)->Fill(adcSum_ZNA);\r
220     GetHitsData(2)->Fill(adcSum_ZPC);\r
221     GetHitsData(3)->Fill(adcSum_ZPA);\r
222     //\r
223     GetHitsData(4)->Fill(adcSumQ_ZNC);\r
224     GetHitsData(5)->Fill(adcSumQ_ZNA);\r
225     GetHitsData(6)->Fill(adcSumQ_ZPC);\r
226     GetHitsData(7)->Fill(adcSumQ_ZPA);\r
227   }\r
228 }\r
229 \r
230 //___________________________________________________________________________\r
231 void AliZDCQADataMakerSim::MakeHits(TTree * hitTree)\r
232 {\r
233   // make QA data from Hit Tree\r
234   if(!hitTree){\r
235     AliError("Can't get ZDC hit tree!!");\r
236     return; \r
237   }     \r
238 \r
239   TBranch * branch = hitTree->GetBranch("ZDC") ;\r
240 \r
241   if(!branch){\r
242     AliError("ZDC branch in Hit Tree not found!"); \r
243     return;\r
244   } \r
245   \r
246   if(fHitsArray) fHitsArray->Clear() ; \r
247   else fHitsArray = new TClonesArray("AliZDCHit", 1000);\r
248  \r
249   branch->SetAddress(&fHitsArray) ;\r
250   for (Int_t ientry = 0 ; ientry < branch->GetEntries() ; ientry++) {\r
251     branch->GetEntry(ientry) ;\r
252     MakeHits() ; \r
253     fHitsArray->Clear() ; \r
254   }   \r
255 \r
256 }\r
257 \r
258 //___________________________________________________________________________\r
259 void AliZDCQADataMakerSim::MakeDigits(TTree *digitTree)\r
260 {\r
261   // makes data from Digit Tree\r
262   if( !GetDigitsData(0) ) InitDigits();\r
263 \r
264   if(!digitTree){\r
265     AliError("Can't get ZDC digit tree!!");\r
266     return; \r
267   }     \r
268    \r
269   TBranch * branch = digitTree->GetBranch("ZDC");\r
270   if(!branch){\r
271     AliError("ZDC branch in digit tree not found"); \r
272     return;\r
273   } \r
274     \r
275   AliZDCDigit *digit = 0x0;\r
276   branch->SetAddress(&digit);\r
277      \r
278   Float_t adcSum_ZNC=0., adcSum_ZNA=0., adcSum_ZPC=0., adcSum_ZPA=0.;\r
279   Float_t adcSumQ_ZNC=0., adcSumQ_ZNA=0., adcSumQ_ZPC=0., adcSumQ_ZPA=0.;\r
280   Float_t adcSum_ZNC_lg=0., adcSum_ZNA_lg=0., adcSum_ZPC_lg=0., adcSum_ZPA_lg=0.;\r
281   Float_t adcSumQ_ZNC_lg=0., adcSumQ_ZNA_lg=0., adcSumQ_ZPC_lg=0., adcSumQ_ZPA_lg=0.;\r
282   \r
283   Int_t ndig = digitTree->GetEntries();\r
284   for(Int_t i=0; i<ndig; i++){\r
285       branch->GetEntry(i);\r
286       \r
287       if(digit->GetSector(0)==1 && digit->GetSector(1)!=5){\r
288           adcSum_ZNC += digit->GetADCValue(0);\r
289           adcSum_ZNC_lg += digit->GetADCValue(1);\r
290           //\r
291           if(digit->GetSector(1)!=0){\r
292               adcSumQ_ZNC += digit->GetADCValue(0);\r
293               adcSumQ_ZNC_lg+= digit->GetADCValue(1);\r
294           }\r
295           else{\r
296               GetDigitsData(8)->Fill(digit->GetADCValue(0));\r
297               GetDigitsData(20)->Fill(digit->GetADCValue(1));\r
298           }\r
299       }\r
300       else if(digit->GetSector(0)==2){\r
301           adcSum_ZPC += digit->GetADCValue(0);\r
302           adcSum_ZPC_lg += digit->GetADCValue(1);\r
303           //\r
304           if(digit->GetSector(1)!=0){\r
305               adcSumQ_ZPC += digit->GetADCValue(0);\r
306               adcSumQ_ZPC_lg+= digit->GetADCValue(1);\r
307           }\r
308           else{\r
309               GetDigitsData(10)->Fill(digit->GetADCValue(0));\r
310               GetDigitsData(22)->Fill(digit->GetADCValue(1));\r
311           }\r
312       }\r
313       else if(digit->GetSector(0)==4 && digit->GetSector(1)!=5){\r
314           adcSum_ZNA += digit->GetADCValue(0);\r
315           adcSum_ZNA_lg += digit->GetADCValue(1);\r
316           //\r
317           if(digit->GetSector(1)!=0){\r
318               adcSumQ_ZNA += digit->GetADCValue(0);\r
319               adcSumQ_ZNA_lg+= digit->GetADCValue(1);\r
320           }\r
321           else{\r
322               GetDigitsData(9)->Fill(digit->GetADCValue(0));\r
323               GetDigitsData(21)->Fill(digit->GetADCValue(1));\r
324           }\r
325       }\r
326       else if(digit->GetSector(0)==5){\r
327           adcSum_ZPA += digit->GetADCValue(0);\r
328           adcSum_ZPA_lg += digit->GetADCValue(1);\r
329           //\r
330           if(digit->GetSector(1)!=0){\r
331               adcSumQ_ZPA += digit->GetADCValue(0);\r
332               adcSumQ_ZPA_lg+= digit->GetADCValue(1);\r
333           }\r
334           else{\r
335               GetDigitsData(11)->Fill(digit->GetADCValue(0));\r
336               GetDigitsData(23)->Fill(digit->GetADCValue(1));\r
337           }\r
338       }\r
339   }\r
340   //\r
341   GetDigitsData(0)->Fill(adcSum_ZNC);\r
342   GetDigitsData(1)->Fill(adcSum_ZNA);\r
343   GetDigitsData(2)->Fill(adcSum_ZPC);\r
344   GetDigitsData(3)->Fill(adcSum_ZPA);\r
345   //\r
346   GetDigitsData(4)->Fill(adcSumQ_ZNC);\r
347   GetDigitsData(5)->Fill(adcSumQ_ZNA);\r
348   GetDigitsData(6)->Fill(adcSumQ_ZPC);\r
349   GetDigitsData(7)->Fill(adcSumQ_ZPA);\r
350   //\r
351   GetDigitsData(12)->Fill(adcSum_ZNC_lg);\r
352   GetDigitsData(13)->Fill(adcSum_ZNA_lg);\r
353   GetDigitsData(14)->Fill(adcSum_ZPC_lg);\r
354   GetDigitsData(15)->Fill(adcSum_ZPA_lg);\r
355   //\r
356   GetDigitsData(16)->Fill(adcSumQ_ZNC_lg);\r
357   GetDigitsData(17)->Fill(adcSumQ_ZNA_lg);\r
358   GetDigitsData(18)->Fill(adcSumQ_ZPC_lg);\r
359   GetDigitsData(19)->Fill(adcSumQ_ZPA_lg);\r
360 \r
361 }\r
362 \r
363 //____________________________________________________________________________\r
364 void AliZDCQADataMakerSim::StartOfDetectorCycle()\r
365 {\r
366   //Detector specific actions at start of cycle\r
367   \r
368 }\r
369 \r
370 //____________________________________________________________________________ \r
371 void AliZDCQADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)\r
372 {\r
373   // Detector specific actions at end of cycle\r
374   // do the QA checking\r
375   AliQAChecker::Instance()->Run(AliQAv1::kZDC, task, list);  \r
376 }\r