- minor corrections
[u/mrichter/AliRoot.git] / ZDC / AliZDCQADataMakerRec.cxx
CommitLineData
075a0e70 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 **************************************************************************/
fdc38bb2 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
075a0e70 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"
f5e4ee59 36#include "AliZDCReco.h"
78328afd 37#include "AliRawReader.h"
075a0e70 38#include "AliZDCQADataMakerRec.h"
796c8b58 39#include "AliZDCPedestals.h"
075a0e70 40#include "AliZDCRawStream.h"
44ed7a66 41#include "AliZDCDigit.h"
075a0e70 42#include "AliESDZDC.h"
43#include "AliESDEvent.h"
44
45ClassImp(AliZDCQADataMakerRec)
46
47//____________________________________________________________________________
48 AliZDCQADataMakerRec::AliZDCQADataMakerRec() :
eca4fa66 49 AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kZDC), "ZDC Quality Assurance Data Maker"),
796c8b58 50 fPedCalibData(0x0)
075a0e70 51{
52 // ctor
53}
54
55//____________________________________________________________________________
56AliZDCQADataMakerRec::AliZDCQADataMakerRec(const AliZDCQADataMakerRec& qadm) :
eca4fa66 57 AliQADataMakerRec(),
2537e870 58 fPedCalibData(qadm.fPedCalibData)
796c8b58 59
075a0e70 60{
61 //copy ctor
62 SetName((const char*)qadm.GetName());
63 SetTitle((const char*)qadm.GetTitle());
64}
65
66//__________________________________________________________________
67AliZDCQADataMakerRec& AliZDCQADataMakerRec::operator = (const AliZDCQADataMakerRec& qadm )
68{
69 // Equal operator.
70 this->~AliZDCQADataMakerRec();
71 new(this) AliZDCQADataMakerRec(qadm);
72 return *this;
73}
74
44ed7a66 75//____________________________________________________________________________
2537e870 76AliZDCQADataMakerRec::~AliZDCQADataMakerRec()
77{
78 if(fPedCalibData){
79 delete fPedCalibData;
80 fPedCalibData=0;
81 }
82}
83
84//____________________________________________________________________________
796c8b58 85AliZDCPedestals* AliZDCQADataMakerRec::GetPedCalibData() const
86{
87
88 // Retrieving pedestal calibration object from OCDB
89 AliCDBEntry *entry = AliCDBManager::Instance()->Get("ZDC/Calib/Pedestals");
90 if(!entry) AliWarning("No calibration data loaded!");
91
92 AliZDCPedestals *calibdata = (AliZDCPedestals*) (entry->GetObject());
93 if(!calibdata) AliFatal("Wrong calibration object in calibration file!");
94
95 return calibdata;
96
97}
98
2537e870 99//____________________________________________________________________________
100void AliZDCQADataMakerRec::InitDigits()
101{
102 // create Digits histograms in Digits subdir
103 //
104 const Bool_t expert = kTRUE ;
105 const Bool_t image = kTRUE ;
106
107 // ------------------- HIGH GAIN CHAIN ---------------------------
108 TH1F * hDigZNCTot = new TH1F("hDigZNCTot", "Signal in ZNC;Amplitude [ADC counts];Counts", 100, 0., 6000.);
109 TH1F * hDigZNATot = new TH1F("hDigZNATot", "Signal in ZNA;Amplitude [ADC counts];Counts", 100, 0., 6000.);
110 TH1F * hDigZPCTot = new TH1F("hDigZPCTot", "Signal in ZPC;Amplitude [ADC counts];Counts", 100, 0., 6000.);
111 TH1F * hDigZPATot = new TH1F("hDigZPATot", "Signal in ZPA;Amplitude [ADC counts];Counts", 100, 0., 6000.);
112 Add2DigitsList(hDigZNCTot, 0, !expert, image);
113 Add2DigitsList(hDigZNATot, 1, !expert, image);
114 Add2DigitsList(hDigZPCTot, 2, !expert, image);
115 Add2DigitsList(hDigZPATot, 3, !expert, image);
116 //
117 TH1F * hDigSumQZNC = new TH1F("hDigSumQZNC", "Signal in 4 ZNC PMQ;Amplitude [ADC counts];Counts",100, 0., 4000.);
118 TH1F * hDigSumQZNA = new TH1F("hDigSumQZNA", "Signal in 4 ZNA PMQ;Amplitude [ADC counts];Counts",100, 0., 4000.);
119 TH1F * hDigSumQZPC = new TH1F("hDigSumQZPC", "Signal in 4 ZPC PMQ;Amplitude [ADC counts];Counts",100, 0., 4000.);
120 TH1F * hDigSumQZPA = new TH1F("hDigSumQZPA", "Signal in 4 ZPA PMQ;Amplitude [ADC counts];Counts",100, 0., 4000.);
121 Add2DigitsList(hDigSumQZNC, 4, expert, !image);
122 Add2DigitsList(hDigSumQZNA, 5, expert, !image);
123 Add2DigitsList(hDigSumQZPC, 6, expert, !image);
124 Add2DigitsList(hDigSumQZPA, 7, expert, !image);
125 //
126 TH1F * hDigPMCZNC = new TH1F("hDigPMCZNC", "Signal in ZNC PMC;Amplitude [ADC counts];Counts",100, 0., 4000.);
127 TH1F * hDigPMCZNA = new TH1F("hDigPMCZNA", "Signal in ZNA PMC;Amplitude [ADC counts];Counts",100, 0., 4000.);
128 TH1F * hDigPMCZPC = new TH1F("hDigPMCZPC", "Signal in ZPC PMC;Amplitude [ADC counts];Counts",100, 0., 4000.);
129 TH1F * hDigPMCZPA = new TH1F("hDigPMCZPA", "Signal in ZPA PMC;Amplitude [ADC counts];Counts",100, 0., 4000.);
130 Add2DigitsList(hDigPMCZNC, 8, expert, !image);
131 Add2DigitsList(hDigPMCZNA, 9, expert, !image);
132 Add2DigitsList(hDigPMCZPC, 10, expert, !image);
133 Add2DigitsList(hDigPMCZPA, 11, expert, !image);
134 //
135 // ------------------- LOW GAIN CHAIN ---------------------------
136 TH1F * hDigZNCTotlg = new TH1F("hDigZNCTotlg", "Digit lg signal in ZNC", 100, 0., 6000.);
137 TH1F * hDigZNATotlg = new TH1F("hDigZNATotlg", "Digit lg signal in ZNA", 100, 0., 6000.);
138 TH1F * hDigZPCTotlg = new TH1F("hDigZPCTotlg", "Digit lg signal in ZPC", 100, 0., 6000.);
139 TH1F * hDigZPATotlg = new TH1F("hDigZPATotlg", "Digit lg signal in ZPA", 100, 0., 6000.);
140 Add2DigitsList(hDigZNCTotlg, 12, expert, !image);
141 Add2DigitsList(hDigZNATotlg, 13, expert, !image);
142 Add2DigitsList(hDigZPCTotlg, 14, expert, !image);
143 Add2DigitsList(hDigZPATotlg, 15, expert, !image);
144 //
145 TH1F * hDigSumQZNClg = new TH1F("hDigSumQZNClg", "Signal in 4 ZNC PMQlg",100, 0., 4000.);
146 TH1F * hDigSumQZNAlg = new TH1F("hDigSumQZNAlg", "Signal in 4 ZNA PMQlg",100, 0., 4000.);
147 TH1F * hDigSumQZPClg = new TH1F("hDigSumQZPClg", "Signal in 4 ZPC PMQlg",100, 0., 4000.);
148 TH1F * hDigSumQZPAlg = new TH1F("hDigSumQZPAlg", "Signal in 4 ZPA PMQlg",100, 0., 4000.);
149 Add2DigitsList(hDigSumQZNClg, 16, expert, !image);
150 Add2DigitsList(hDigSumQZNAlg, 17, expert, !image);
151 Add2DigitsList(hDigSumQZPClg, 18, expert, !image);
152 Add2DigitsList(hDigSumQZPAlg, 19, expert, !image);
153 //
154 TH1F * hDigPMCZNClg = new TH1F("hDigPMCZNClg", "Signal in ZNC PMClg",100, 0., 4000.);
155 TH1F * hDigPMCZNAlg = new TH1F("hDigPMCZNAlg", "Signal in ZNA PMClg",100, 0., 4000.);
156 TH1F * hDigPMCZPClg = new TH1F("hDigPMCZPClg", "Signal in ZPC PMClg",100, 0., 4000.);
157 TH1F * hDigPMCZPAlg = new TH1F("hDigPMCZPAlg", "Signal in ZPA PMClg",100, 0., 4000.);
158 Add2DigitsList(hDigPMCZNClg, 20, expert, !image);
159 Add2DigitsList(hDigPMCZNAlg, 21, expert, !image);
160 Add2DigitsList(hDigPMCZPClg, 22, expert, !image);
161 Add2DigitsList(hDigPMCZPAlg, 23, expert, !image);
162
163}
164
796c8b58 165//____________________________________________________________________________
166void AliZDCQADataMakerRec::InitRaws()
44ed7a66 167{
168 // create Digits histograms in Digits subdir
44ed7a66 169 const Bool_t expert = kTRUE ;
170 const Bool_t image = kTRUE ;
171
796c8b58 172 // **************************** NON EXPERT HISTOS ****************************
173 TH1F * hZNCSpectrum = new TH1F("hZNCSpectrum","ZNC spectrum;Amplitude [ADC counts];Counts",100,0.,3000.);
174 TH1F * hZPCSpectrum = new TH1F("hZPCSpectrum","ZPC spectrum;Amplitude [ADC counts];Counts",100,0.,3000.);
175 TH1F * hZNASpectrum = new TH1F("hZNASpectrum","ZNA spectrum;Amplitude [ADC counts];Counts",100,0.,3000.);
176 TH1F * hZPASpectrum = new TH1F("hZPASpectrum","ZPA spectrum;Amplitude [ADC counts];Counts",100,0.,3000.);
177 TH1F * hZEM1Spectrum = new TH1F("hZEM1Spectrum","ZEM1 spectrum;Amplitude [ADC counts];Counts",100,0.,2000.);
178 TH1F * hZEM2Spectrum = new TH1F("hZEM2Spectrum","ZEM2 spectrum;Amplitude [ADC counts];Counts",100,0.,2000.);
179 Add2RawsList(hZNCSpectrum, 0, !expert, image);
180 Add2RawsList(hZNASpectrum, 1, !expert, image);
181 Add2RawsList(hZPCSpectrum, 2, !expert, image);
182 Add2RawsList(hZPASpectrum, 3, !expert, image);
183 Add2RawsList(hZEM1Spectrum, 4, !expert, image);
184 Add2RawsList(hZEM2Spectrum, 5, !expert, image);
185
186 // **************************** EXPERT HISTOS ****************************
44ed7a66 187 // ------------------- HIGH GAIN CHAIN ---------------------------
796c8b58 188 TH1F * hRawSumQZNC = new TH1F("hRawSumQZNC", "Raw sumQ ZNC;Amplitude [ADC counts];Counts",100, 0., 1000.);
189 TH1F * hRawSumQZNA = new TH1F("hRawSumQZNA", "Raw sumQ ZNA;Amplitude [ADC counts];Counts",100, 0., 1000.);
190 TH1F * hRawSumQZPC = new TH1F("hRawSumQZPC", "Raw sumQ ZPC;Amplitude [ADC counts];Counts",100, 0., 1000.);
191 TH1F * hRawSumQZPA = new TH1F("hRawSumQZPA", "Raw sumQ ZPA;Amplitude [ADC counts];Counts",100, 0., 1000.);
192 Add2RawsList(hRawSumQZNC, 10, expert, !image);
193 Add2RawsList(hRawSumQZNA, 11, expert, !image);
194 Add2RawsList(hRawSumQZPC, 12, expert, !image);
195 Add2RawsList(hRawSumQZPA, 13, expert, !image);
44ed7a66 196 //
796c8b58 197 TH1F * hRawPMCZNC = new TH1F("hRawPMCZNC", "Raw ZNC PMC;Amplitude [ADC counts];Counts",100, 0., 1000.);
198 TH1F * hRawPMCZNA = new TH1F("hRawPMCZNA", "Raw ZNA PMC;Amplitude [ADC counts];Counts",100, 0., 1000.);
199 TH1F * hRawPMCZPC = new TH1F("hRawPMCZPC", "Raw ZPC PMC;Amplitude [ADC counts];Counts",100, 0., 1000.);
200 TH1F * hRawPMCZPA = new TH1F("hRawPMCZPA", "Raw ZPA PMC;Amplitude [ADC counts];Counts",100, 0., 1000.);
201 Add2RawsList(hRawPMCZNC, 6, expert, !image);
202 Add2RawsList(hRawPMCZNA, 7, expert, !image);
203 Add2RawsList(hRawPMCZPC, 8, expert, !image);
204 Add2RawsList(hRawPMCZPA, 9, expert, !image);
b72460a5 205 //
44ed7a66 206}
207
075a0e70 208//____________________________________________________________________________
f5e4ee59 209void AliZDCQADataMakerRec::InitRecPoints()
210{
211 // create Digits histograms in Digits subdir
212 const Bool_t expert = kTRUE ;
213 const Bool_t image = kTRUE ;
214 //
215 // ------------------- HIGH GAIN CHAIN ---------------------------
796c8b58 216 TH1F * hRecZNCTot = new TH1F("hRecZNCTot", "Rec signal in ZNC;Amplitude [ADC counts];Counts", 100, 0., 2000.);
217 TH1F * hRecZNATot = new TH1F("hRecZNATot", "Rec signal in ZNA;Amplitude [ADC counts];Counts", 100, 0., 2000.);
218 TH1F * hRecZPCTot = new TH1F("hRecZPCTot", "Rec signal in ZPC;Amplitude [ADC counts];Counts", 100, 0., 8000.);
219 TH1F * hRecZPATot = new TH1F("hRecZPATot", "Rec signal in ZPA;Amplitude [ADC counts];Counts", 100, 0., 8000.);
220 Add2RecPointsList(hRecZNCTot, 0, !expert, image);
221 Add2RecPointsList(hRecZNATot, 1, !expert, image);
222 Add2RecPointsList(hRecZPCTot, 2, !expert, image);
223 Add2RecPointsList(hRecZPATot, 3, !expert, image);
f5e4ee59 224 //
796c8b58 225 TH1F * hRecSumQZNC = new TH1F("hRecSumQZNC", "Rec summed 4 ZNC quadrants;Amplitude [ADC counts];Counts",100, 0., 2000.);
226 TH1F * hRecSumQZNA = new TH1F("hRecSumQZNA", "Rec summed 4 ZNA quadrants;Amplitude [ADC counts];Counts",100, 0., 2000.);
227 TH1F * hRecSumQZPC = new TH1F("hRecSumQZPC", "Rec summed 4 ZPC quadrants;Amplitude [ADC counts];Counts",100, 0., 2000.);
228 TH1F * hRecSumQZPA = new TH1F("hRecSumQZPA", "Rec summed 4 ZPA quadrants;Amplitude [ADC counts];Counts",100, 0., 2000.);
f5e4ee59 229 Add2RecPointsList(hRecSumQZNC, 4, expert, !image);
230 Add2RecPointsList(hRecSumQZNA, 5, expert, !image);
231 Add2RecPointsList(hRecSumQZPC, 6, expert, !image);
232 Add2RecPointsList(hRecSumQZPA, 7, expert, !image);
233 //
796c8b58 234 TH1F * hRecPMCZNC = new TH1F("hRecPMCZNC", "Rec common ZNC PMT;Amplitude [ADC counts];Counts",100, 0., 2000.);
235 TH1F * hRecPMCZNA = new TH1F("hRecPMCZNA", "Rec common ZNA PMT;Amplitude [ADC counts];Counts",100, 0., 2000.);
236 TH1F * hRecPMCZPC = new TH1F("hRecPMCZPC", "Rec common ZPC PMT;Amplitude [ADC counts];Counts",100, 0., 2000.);
237 TH1F * hRecPMCZPA = new TH1F("hRecPMCZPA", "Rec common ZPA PMT;Amplitude [ADC counts];Counts",100, 0., 2000.);
238 Add2RecPointsList(hRecPMCZNC, 8 , expert, !image);
239 Add2RecPointsList(hRecPMCZNA, 9 , expert, !image);
240 Add2RecPointsList(hRecPMCZPC, 10, expert, !image);
241 Add2RecPointsList(hRecPMCZPA, 11, expert, !image);
f5e4ee59 242}
243
244//____________________________________________________________________________
075a0e70 245void AliZDCQADataMakerRec::InitESDs()
246{
247 //Booking ESDs histograms
248 //
b72460a5 249 const Bool_t expert = kTRUE ;
250 const Bool_t image = kTRUE ;
7d297381 251
796c8b58 252 TH2F * hZNCcentr = new TH2F("hZNCcentr", "Centroid in ZNC;X [cm];Y[cm]", 100, -5.,5.,100,-5.,5.);
253 TH2F * hZNAcentr = new TH2F("hZNAcentr", "Centroid in ZNA;X [cm];Y[cm]", 100, -5.,5.,100,-5.,5.);
254 Add2ESDsList(hZNCcentr, 0, !expert, image);
255 Add2ESDsList(hZNAcentr, 1, !expert, image);
075a0e70 256 //
fdc38bb2 257 // ------------------- HIGH GAIN CHAIN ---------------------------
796c8b58 258 TH1F * hESDZNCTot = new TH1F("hESDZNCTot", "Energy in ZNC", 100, 0., 4000.);
259 TH1F * hESDZNATot = new TH1F("hESDZNATot", "Energy in ZNA", 100, 0., 4000.);
260 TH1F * hESDZPCTot = new TH1F("hESDZPCTot", "Energy in ZPC", 100, 0., 4000.);
261 TH1F * hESDZPATot = new TH1F("hESDZPATot", "Energy in ZPA", 100, 0., 4000.);
262 Add2ESDsList(hESDZNCTot, 2, !expert, image);
263 Add2ESDsList(hESDZNATot, 3, !expert, image);
264 Add2ESDsList(hESDZPCTot, 4, !expert, image);
265 Add2ESDsList(hESDZPATot, 5, !expert, image);
266 //
267 TH1F * hESDZEM1 = new TH1F("hESDZEM1", "Energy in ZEM1", 100, 0., 2000.);
268 TH1F * hESDZEM2 = new TH1F("hESDZEM2", "Energy in ZEM2", 100, 0., 2000.);
269 Add2ESDsList(hESDZEM1,6, !expert, image);
270 Add2ESDsList(hESDZEM2,7, !expert, image);
075a0e70 271 //
796c8b58 272 TH1F * hESDSumQZNC = new TH1F("hESDSumQZNC", "Sum of 4 ZNC energy",100, 0., 2000.);
273 TH1F * hESDSumQZNA = new TH1F("hESDSumQZNA", "Sum of 4 ZNA energy",100, 0., 2000.);
274 TH1F * hESDSumQZPC = new TH1F("hESDSumQZPC", "Sum of 4 ZPC energy",100, 0., 2000.);
275 TH1F * hESDSumQZPA = new TH1F("hESDSumQZPA", "Sum of 4 ZPA energy",100, 0., 2000.);
276 Add2ESDsList(hESDSumQZNC, 8, expert, !image);
277 Add2ESDsList(hESDSumQZNA, 9, expert, !image);
278 Add2ESDsList(hESDSumQZPC, 10, expert, !image);
279 Add2ESDsList(hESDSumQZPA, 11, expert, !image);
075a0e70 280 //
796c8b58 281 TH1F * hESDPMCZNC = new TH1F("hESDPMCZNC", "Energy in ZNC PMC",100, 0., 2000.);
282 TH1F * hESDPMCZNA = new TH1F("hESDPMCZNA", "Energy in ZNA PMC",100, 0., 2000.);
283 TH1F * hESDPMCZPC = new TH1F("hESDPMCZPC", "Energy in ZPC PMC",100, 0., 2000.);
284 TH1F * hESDPMCZPA = new TH1F("hESDPMCZPA", "Energy in ZPA PMC",100, 0., 2000.);
285 Add2ESDsList(hESDPMCZNC, 12, expert, !image);
286 Add2ESDsList(hESDPMCZNA, 13, expert, !image);
287 Add2ESDsList(hESDPMCZPC, 14, expert, !image);
288 Add2ESDsList(hESDPMCZPA, 15, expert, !image);
075a0e70 289 //
213a7d34 290 // ------------------- LOW GAIN CHAIN ---------------------------
3d26d59b 291 TH1F * hESDSumQZNClg = new TH1F("hESDSumQZNClg", "Sum of 4 lg ZNC sectors",100, 0., 4000.);
3d26d59b 292 TH1F * hESDSumQZNAlg = new TH1F("hESDSumQZNAlg", "Sum of 4 lg ZNA sectors",100, 0., 4000.);
fdc38bb2 293 TH1F * hESDSumQZPClg = new TH1F("hESDSumQZPClg", "Sum of 4 lg ZPC sectors",100, 0., 4000.);
3d26d59b 294 TH1F * hESDSumQZPAlg = new TH1F("hESDSumQZPAlg", "Sum of 4 lg ZPA sectors",100, 0., 4000.);
796c8b58 295 Add2ESDsList(hESDSumQZNClg, 16, expert, !image);
296 Add2ESDsList(hESDSumQZNAlg, 17, expert, !image);
297 Add2ESDsList(hESDSumQZPClg, 18, expert, !image);
298 Add2ESDsList(hESDSumQZPAlg, 19, expert, !image);
075a0e70 299 //
3d26d59b 300 TH1F * hESDPMCZNClg = new TH1F("hESDPMCZNClg", "Signal in common ZNC lg PMT",100, 0., 4000.);
3d26d59b 301 TH1F * hESDPMCZNAlg = new TH1F("hESDPMCZNAlg", "Signal in common ZNA lg PMT",100, 0., 4000.);
fdc38bb2 302 TH1F * hESDPMCZPClg = new TH1F("hESDPMCZPClg", "Signal in common ZPC lg PMT",100, 0., 4000.);
3d26d59b 303 TH1F * hESDPMCZPAlg = new TH1F("hESDPMCZPAlg", "Signal in common ZPA lg PMT",100, 0., 4000.);
796c8b58 304 Add2ESDsList(hESDPMCZNClg, 20, expert, !image);
305 Add2ESDsList(hESDPMCZNAlg, 21, expert, !image);
306 Add2ESDsList(hESDPMCZPClg, 22, expert, !image);
307 Add2ESDsList(hESDPMCZPAlg, 23, expert, !image);
075a0e70 308}
075a0e70 309
2537e870 310//___________________________________________________________________________
311void AliZDCQADataMakerRec::MakeDigits(TTree *digitTree)
312{
313 // makes data from Digit Tree
314 if(!GetDigitsData(0)) InitDigits();
315
316 if(!digitTree){
317 AliError("Can't get ZDC digit tree!!");
318 return;
319 }
320
321 TBranch * branch = digitTree->GetBranch("ZDC");
322 if(!branch){
323 AliError("ZDC branch in digit tree not found");
324 return;
325 }
326
327 AliZDCDigit *digit = 0x0;
328 branch->SetAddress(&digit);
329
330 Float_t adcSum_ZNC=0., adcSum_ZNA=0., adcSum_ZPC=0., adcSum_ZPA=0.;
331 Float_t adcSumQ_ZNC=0., adcSumQ_ZNA=0., adcSumQ_ZPC=0., adcSumQ_ZPA=0.;
332 Float_t adcSum_ZNC_lg=0., adcSum_ZNA_lg=0., adcSum_ZPC_lg=0., adcSum_ZPA_lg=0.;
333 Float_t adcSumQ_ZNC_lg=0., adcSumQ_ZNA_lg=0., adcSumQ_ZPC_lg=0., adcSumQ_ZPA_lg=0.;
334
335 Int_t ndig = digitTree->GetEntries();
336 for(Int_t i=0; i<ndig; i++){
337 branch->GetEntry(i);
338
339 if(digit->GetSector(0)==1 && digit->GetSector(1)!=5){
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(10)->Fill(digit->GetADCValue(0));
362 GetDigitsData(22)->Fill(digit->GetADCValue(1));
363 }
364 }
365 else if(digit->GetSector(0)==4 && digit->GetSector(1)!=5){
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(9)->Fill(digit->GetADCValue(0));
375 GetDigitsData(21)->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_ZNA);
395 GetDigitsData(2)->Fill(adcSum_ZPC);
396 GetDigitsData(3)->Fill(adcSum_ZPA);
397 //
398 GetDigitsData(4)->Fill(adcSumQ_ZNC);
399 GetDigitsData(5)->Fill(adcSumQ_ZNA);
400 GetDigitsData(6)->Fill(adcSumQ_ZPC);
401 GetDigitsData(7)->Fill(adcSumQ_ZPA);
402 //
403 GetDigitsData(12)->Fill(adcSum_ZNC_lg);
404 GetDigitsData(13)->Fill(adcSum_ZNA_lg);
405 GetDigitsData(14)->Fill(adcSum_ZPC_lg);
406 GetDigitsData(15)->Fill(adcSum_ZPA_lg);
407 //
408 GetDigitsData(16)->Fill(adcSumQ_ZNC_lg);
409 GetDigitsData(17)->Fill(adcSumQ_ZNA_lg);
410 GetDigitsData(18)->Fill(adcSumQ_ZPC_lg);
411 GetDigitsData(19)->Fill(adcSumQ_ZPA_lg);
412
413 delete digit;
414 digit=0;
415
416}
417
418
796c8b58 419//____________________________________________________________________________
420void AliZDCQADataMakerRec::MakeRaws(AliRawReader *rawReader)
44ed7a66 421{
796c8b58 422 // Filling Raws QA histos
423 //
424 // Check if histograms already created for this Event Specie
425 if(!GetRawsData(0)) InitRaws();
eca4fa66 426
796c8b58 427 // Parameters for mean value pedestal subtraction
428 int const kNch = 24;
429 Float_t meanPed[2*kNch];
430 for(Int_t jj=0; jj<2*kNch; jj++) meanPed[jj] = fPedCalibData->GetMeanPed(jj);
eca4fa66 431
796c8b58 432 AliZDCRawStream stream(rawReader);
433 while(stream.Next()){
44ed7a66 434
796c8b58 435 Float_t zncSignal=0., znaSignal=0., zpcSignal=0., zpaSignal=0.;
436 Float_t zncSumQ=0., znaSumQ=0., zpcSumQ=0., zpaSumQ=0.;
437 Bool_t isZNCFired=kFALSE, isZPCFired=kFALSE, isZNAFired=kFALSE, isZPAFired=kFALSE;
438
439 if(stream.IsADCDataWord() &&
440 (stream.GetADCModule()==0 || stream.GetADCModule()==1)){
441
442 Int_t det = stream.GetSector(0);
443 Int_t quad = stream.GetSector(1);
444 Int_t gain = stream.GetADCGain();
445 Int_t pedindex=0;
446
447 // Stuff for pedestal subtraction
448 if(quad != 5){ // ZDCs (not reference PTMs)
449 if(det == 1){
450 pedindex = quad;
451 if(gain == 0){
452 Float_t pedSubVal = (Float_t) (stream.GetADCValue()-meanPed[pedindex]);
453 zncSignal += pedSubVal;
454 isZNCFired = kTRUE;
455 if(quad!=0) zncSumQ += pedSubVal;
456 else GetRawsData(10)->Fill(pedSubVal);
457 }
458 }
459 else if(det == 2){
460 pedindex = quad+5;
461 if(gain == 0){
462 Float_t pedSubVal = (Float_t) (stream.GetADCValue()-meanPed[pedindex]);
463 zpcSignal += pedSubVal;
464 isZPCFired = kTRUE;
465 if(quad!=0) zpcSumQ += pedSubVal;
466 else GetRawsData(12)->Fill(pedSubVal);
467 }
468 }
469 else if(det == 3){
470 pedindex = quad+9;
471 if(quad==1){
472 if(gain == 0){
473 Float_t pedSubVal = (Float_t) (stream.GetADCValue()-meanPed[pedindex]);
474 GetRawsData(4)->Fill(pedSubVal);
475 }
476 }
477 else if(quad==2){
478 if(gain == 0){
479 Float_t pedSubVal = (Float_t) (stream.GetADCValue()-meanPed[pedindex]);
480 GetRawsData(5)->Fill(pedSubVal);
481 }
482 }
483 }
484 else if(det == 4){
485 pedindex = quad+12;
486 if(gain == 0){
487 Float_t pedSubVal = (Float_t) (stream.GetADCValue()-meanPed[pedindex]);
488 znaSignal += (Float_t) (stream.GetADCValue()-meanPed[pedindex]);
489 isZNAFired = kTRUE;
490 if(quad!=0) znaSumQ += pedSubVal;
491 else GetRawsData(11)->Fill(pedSubVal);
492 }
493 }
494 else if(det == 5){
495 pedindex = quad+17;
496 if(gain == 0){
497 Float_t pedSubVal = (Float_t) (stream.GetADCValue()-meanPed[pedindex]);
498 zpaSignal += (Float_t) (stream.GetADCValue()-meanPed[pedindex]);
499 isZPAFired = kTRUE;
500 if(quad!=0) zpaSumQ += pedSubVal;
501 else GetRawsData(13)->Fill(pedSubVal);
502 }
503 }
504 }
505
506 } //IsADCDataWord
507 //
508 if(isZNCFired){
509 GetRawsData(0)->Fill(zncSignal);
510 GetRawsData(6)->Fill(zncSumQ);
44ed7a66 511 }
796c8b58 512 if(isZPCFired){
513 GetRawsData(2)->Fill(zpcSignal);
514 GetRawsData(8)->Fill(zncSumQ);
b72460a5 515 }
796c8b58 516 if(isZNAFired){
517 GetRawsData(1)->Fill(znaSignal);
518 GetRawsData(7)->Fill(znaSumQ);
44ed7a66 519 }
796c8b58 520 if(isZPAFired){
521 GetRawsData(3)->Fill(zpaSignal);
522 GetRawsData(9)->Fill(znaSumQ);
44ed7a66 523 }
796c8b58 524
525 } //stream.Next()
526
527// stream.Delete();
44ed7a66 528}
529
075a0e70 530//____________________________________________________________________________
f5e4ee59 531void AliZDCQADataMakerRec::MakeRecPoints(TTree * clustersTree)
532{
533 // Filling QA histos from RecPoints
534
535 TBranch *branch = clustersTree->GetBranch("ZDC");
536 if(!branch){
537 AliError("Can't get the ZDC branch for rec points!");
538 return;
539 }
540
541 if(!GetRecPointsData(0)) InitRecPoints() ;
542
543 Float_t sum_ZNC=0., sum_ZNA=0., sum_ZPC=0., sum_ZPA=0.;
544 Float_t sumQ_ZNC=0., sumQ_ZNA=0., sumQ_ZPC=0., sumQ_ZPA=0.;
545
546 AliZDCReco reco;
547 AliZDCReco* preco = &reco;
548 clustersTree->SetBranchAddress("ZDC", &preco);
549
550 clustersTree->GetEntry(0);
551 for(Int_t i=0; i<5; i++){
552 sum_ZNC += reco.GetZN1HREnTow(i);
553 sum_ZPC += reco.GetZN2HREnTow(i);
554 sum_ZNA += reco.GetZP1HREnTow(i);
555 sum_ZPA += reco.GetZP2HREnTow(i);
556 if(i==0){
557 GetRecPointsData(8)->Fill(reco.GetZN1HREnTow(i));
558 GetRecPointsData(9)->Fill(reco.GetZN2HREnTow(i));
559 GetRecPointsData(10)->Fill(reco.GetZP1HREnTow(i));
560 GetRecPointsData(11)->Fill(reco.GetZP2HREnTow(i));
561 }
562 else{
563 sumQ_ZNC += reco.GetZN1HREnTow(i);
564 sumQ_ZPC += reco.GetZN2HREnTow(i);
565 sumQ_ZNA += reco.GetZP1HREnTow(i);
566 sumQ_ZPA += reco.GetZP2HREnTow(i);
567 }
568 }
569
570 GetRecPointsData(0)->Fill(sum_ZNC);
796c8b58 571 GetRecPointsData(1)->Fill(sum_ZNA);
572 GetRecPointsData(2)->Fill(sum_ZPC);
f5e4ee59 573 GetRecPointsData(3)->Fill(sum_ZPA);
574 //
575 GetRecPointsData(4)->Fill(sumQ_ZNC);
796c8b58 576 GetRecPointsData(5)->Fill(sumQ_ZNA);
577 GetRecPointsData(6)->Fill(sumQ_ZPC);
f5e4ee59 578 GetRecPointsData(7)->Fill(sumQ_ZPA);
579
580}
581
582//____________________________________________________________________________
075a0e70 583void AliZDCQADataMakerRec::MakeESDs(AliESDEvent * esd)
584{
585 // make QA data from ESDs
586 //
eca4fa66 587
588 // Check id histograms already created for this Event Specie
796c8b58 589 if(!GetESDsData(0)) InitESDs() ;
eca4fa66 590
075a0e70 591 AliESDZDC * zdcESD = esd->GetESDZDC();
592 //
b72460a5 593 TString beamType = esd->GetBeamType();
789b8a8d 594 Double_t centr_ZNC[2]={999.,999}, centr_ZNA[2]={999.,999};
b72460a5 595 if(((beamType.CompareTo("pp"))==0) || ((beamType.CompareTo("p-p"))==0)
596 ||((beamType.CompareTo("PP"))==0) || ((beamType.CompareTo("P-P"))==0)){
789b8a8d 597 zdcESD->GetZNCentroidInpp(centr_ZNC, centr_ZNA);
b72460a5 598 }
599 else if((beamType.CompareTo("A-A")) == 0){
789b8a8d 600 Float_t beamEne = esd->GetBeamEnergy();
601 zdcESD->GetZNCentroidInPbPb(beamEne, centr_ZNC, centr_ZNA);
b72460a5 602 }
2537e870 603 else printf(" AliZDCQADataMakerRec::MakeESDs: can't calculate centroids for beam type: %s\n\n",beamType.Data());
789b8a8d 604 GetESDsData(0)->Fill(centr_ZNC[0], centr_ZNC[1]);
605 GetESDsData(1)->Fill(centr_ZNA[0], centr_ZNA[1]);
2b6cdc43 606
075a0e70 607 //
608 GetESDsData(2)->Fill(esd->GetZDCN1Energy());
fdc38bb2 609 GetESDsData(3)->Fill(esd->GetZDCN2Energy());
610 GetESDsData(4)->Fill(esd->GetZDCP1Energy());
075a0e70 611 GetESDsData(5)->Fill(esd->GetZDCP2Energy());
796c8b58 612 GetESDsData(6)->Fill(esd->GetZDCEMEnergy(0));
613 GetESDsData(7)->Fill(esd->GetZDCEMEnergy(1));
075a0e70 614 //
fdc38bb2 615 Double_t sumQZNC=0., sumQZPC=0., sumQZNA=0., sumQZPA=0.;
213a7d34 616 Double_t sumQZNC_lg=0., sumQZPC_lg=0., sumQZNA_lg=0., sumQZPA_lg=0.;
075a0e70 617 //
fdc38bb2 618 const Double_t *towZNC, *towZPC, *towZNA, *towZPA;
213a7d34 619 const Double_t *towZNC_lg, *towZPC_lg, *towZNA_lg, *towZPA_lg;
075a0e70 620 //
fdc38bb2 621 towZNC = zdcESD->GetZN1TowerEnergy();
622 towZPC = zdcESD->GetZP1TowerEnergy();
623 towZNA = zdcESD->GetZN2TowerEnergy();
624 towZPA = zdcESD->GetZP2TowerEnergy();
075a0e70 625 //
213a7d34 626 towZNC_lg = zdcESD->GetZN1TowerEnergyLR();
fdc38bb2 627 towZPC_lg = zdcESD->GetZP1TowerEnergyLR();
628 towZNA_lg = zdcESD->GetZN2TowerEnergyLR();
213a7d34 629 towZPA_lg = zdcESD->GetZP2TowerEnergyLR();
075a0e70 630 //
631 for(Int_t i=0; i<5; i++){
632 if(i==0){
796c8b58 633 GetESDsData(12)->Fill(towZNC[i]);
634 GetESDsData(13)->Fill(towZNA[i]);
635 GetESDsData(14)->Fill(towZPC[i]);
636 GetESDsData(15)->Fill(towZPA[i]);
075a0e70 637 //
796c8b58 638 GetESDsData(20)->Fill(towZNC_lg[i]);
639 GetESDsData(21)->Fill(towZNA_lg[i]);
640 GetESDsData(22)->Fill(towZPC_lg[i]);
641 GetESDsData(23)->Fill(towZPA_lg[i]);
075a0e70 642 }
643 else{
fdc38bb2 644 sumQZNC += towZNC[i];
645 sumQZPC += towZPC[i];
646 sumQZNA += towZNA[i];
647 sumQZPA += towZPA[i];
075a0e70 648 //
213a7d34 649 sumQZNC_lg += towZNC_lg[i];
fdc38bb2 650 sumQZPC_lg += towZPC_lg[i];
651 sumQZNA_lg += towZNA_lg[i];
213a7d34 652 sumQZPA_lg += towZPA_lg[i];
075a0e70 653 }
654 }
796c8b58 655 GetESDsData(8)->Fill(sumQZNC);
656 GetESDsData(9)->Fill(sumQZNA);
657 GetESDsData(10)->Fill(sumQZPC);
658 GetESDsData(11)->Fill(sumQZPA);
075a0e70 659 //
796c8b58 660 GetESDsData(16)->Fill(sumQZNC_lg);
661 GetESDsData(17)->Fill(sumQZNA_lg);
662 GetESDsData(18)->Fill(sumQZPC_lg);
663 GetESDsData(19)->Fill(sumQZPA_lg);
075a0e70 664}
665
666//____________________________________________________________________________
667void AliZDCQADataMakerRec::StartOfDetectorCycle()
668{
669 //Detector specific actions at start of cycle
796c8b58 670
671 fPedCalibData = GetPedCalibData();
075a0e70 672
673}
674
675//____________________________________________________________________________
4e25ac79 676void AliZDCQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
075a0e70 677{
678 //Detector specific actions at end of cycle
679 // do the QA checking
4e25ac79 680 AliQAChecker::Instance()->Run(AliQAv1::kZDC, task, list) ;
075a0e70 681}
682