Update master to aliroot
[u/mrichter/AliRoot.git] / STEER / ESD / AliESDAD.cxx
CommitLineData
11c03f22 1/**************************************************************************
2 * Copyright(c) 1998-2007, 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 **************************************************************************/
5e319bd5 15
11c03f22 16//-------------------------------------------------------------------------
17// Container class for ESD AD data
18// Author: Brigitte Cheynis & Cvetan Cheshkov
19//-------------------------------------------------------------------------
5e319bd5 20
21#include "AliESDAD.h"
11c03f22 22#include "AliLog.h"
5e319bd5 23
24ClassImp(AliESDAD)
25
11c03f22 26//__________________________________________________________________________
27AliESDAD::AliESDAD()
28 :AliVAD(),
29 fBBtriggerADA(0),
30 fBGtriggerADA(0),
31 fBBtriggerADC(0),
32 fBGtriggerADC(0),
33 fADATime(-1024),
34 fADCTime(-1024),
35 fADATimeError(0),
36 fADCTimeError(0),
37 fADADecision(kADInvalid),
38 fADCDecision(kADInvalid),
39 fTriggerChargeA(0),
40 fTriggerChargeC(0),
41 fTriggerBits(0)
42{
43 // Default constructor
44 for(Int_t j=0; j<16; j++){
45 fMultiplicity[j] = 0.0;
46 fAdc[j] = 0.0;
47 fTime[j] = 0.0;
48 fWidth[j] = 0.0;
49 fBBFlag[j]= kFALSE;
50 fBGFlag[j]= kFALSE;
51 }
5e319bd5 52}
53
11c03f22 54//__________________________________________________________________________
5e319bd5 55AliESDAD::AliESDAD(const AliESDAD &o)
11c03f22 56 :AliVAD(o),
57 fBBtriggerADA(o.fBBtriggerADA),
58 fBGtriggerADA(o.fBGtriggerADA),
59 fBBtriggerADC(o.fBBtriggerADC),
60 fBGtriggerADC(o.fBGtriggerADC),
61 fADATime(o.fADATime),
62 fADCTime(o.fADCTime),
63 fADATimeError(o.fADATimeError),
64 fADCTimeError(o.fADCTimeError),
65 fADADecision(o.fADADecision),
66 fADCDecision(o.fADCDecision),
67 fTriggerChargeA(o.fTriggerChargeA),
68 fTriggerChargeC(o.fTriggerChargeC),
69 fTriggerBits(o.fTriggerBits)
70{
71 // Default constructor
72 for(Int_t j=0; j<16; j++) {
73 fMultiplicity[j] = o.fMultiplicity[j];
74 fAdc[j] = o.fAdc[j];
75 fTime[j] = o.fTime[j];
76 fWidth[j] = o.fWidth[j];
77 fBBFlag[j] = o.fBBFlag[j];
78 fBGFlag[j] = o.fBGFlag[j];
79 }
5e319bd5 80}
81
11c03f22 82//__________________________________________________________________________
83AliESDAD::AliESDAD(UInt_t BBtriggerADA, UInt_t BGtriggerADA,
84 UInt_t BBtriggerADC, UInt_t BGtriggerADC,
85 Float_t *Multiplicity, Float_t *Adc,
86 Float_t *Time, Float_t *Width, Bool_t *BBFlag, Bool_t *BGFlag)
87 :AliVAD(),
88 fBBtriggerADA(BBtriggerADA),
89 fBGtriggerADA(BGtriggerADA),
90 fBBtriggerADC(BBtriggerADC),
91 fBGtriggerADC(BGtriggerADC),
92 fADATime(-1024),
93 fADCTime(-1024),
94 fADATimeError(0),
95 fADCTimeError(0),
96 fADADecision(kADInvalid),
97 fADCDecision(kADInvalid),
98 fTriggerChargeA(0),
99 fTriggerChargeC(0),
100 fTriggerBits(0)
5e319bd5 101{
11c03f22 102 // Constructor
103 for(Int_t j=0; j<16; j++) {
104 fMultiplicity[j] = Multiplicity[j];
105 fAdc[j] = Adc[j];
106 fTime[j] = Time[j];
107 fWidth[j] = Width[j];
108 fBBFlag[j] = BBFlag[j];
109 fBGFlag[j] = BGFlag[j];
110 }
5e319bd5 111}
112
11c03f22 113//__________________________________________________________________________
5e319bd5 114AliESDAD& AliESDAD::operator=(const AliESDAD& o)
115{
5e319bd5 116
11c03f22 117 if(this==&o) return *this;
118 AliVAD::operator=(o);
119 // Assignment operator
120 fBBtriggerADA=o.fBBtriggerADA;
121 fBGtriggerADA=o.fBGtriggerADA;
122 fBBtriggerADC=o.fBBtriggerADC;
123 fBGtriggerADC=o.fBGtriggerADC;
5e319bd5 124
11c03f22 125 fADATime = o.fADATime;
126 fADCTime = o.fADCTime;
127 fADATimeError = o.fADATimeError;
128 fADCTimeError = o.fADCTimeError;
129 fADADecision = o.fADADecision;
130 fADCDecision = o.fADCDecision;
131 fTriggerChargeA = o.fTriggerChargeA;
132 fTriggerChargeC = o.fTriggerChargeC;
133 fTriggerBits = o.fTriggerBits;
5e319bd5 134
11c03f22 135 for(Int_t j=0; j<16; j++) {
136 fMultiplicity[j] = o.fMultiplicity[j];
137 fAdc[j] = o.fAdc[j];
138 fTime[j] = o.fTime[j];
139 fWidth[j] = o.fWidth[j];
140 fBBFlag[j] = o.fBBFlag[j];
141 fBGFlag[j] = o.fBGFlag[j];
142 }
143 return *this;
5e319bd5 144}
145
11c03f22 146//______________________________________________________________________________
5e319bd5 147void AliESDAD::Copy(TObject &obj) const {
148
149 // this overwrites the virtual TOBject::Copy()
150 // to allow run time copying without casting
151 // in AliESDEvent
152
153 if(this==&obj)return;
154 AliESDAD *robj = dynamic_cast<AliESDAD*>(&obj);
155 if(!robj)return; // not an AliESDAD
156 *robj = *this;
157
158}
159
11c03f22 160//__________________________________________________________________________
161Short_t AliESDAD::GetNbPMADA() const
162{
163 // Returns the number of
164 // fired PM in ADA
165 Short_t n=0;
166 for(Int_t i=8;i<16;i++)
167 if (fMultiplicity[i]>0) n++;
168 return n;
169}
170
171//__________________________________________________________________________
172Short_t AliESDAD::GetNbPMADC() const
173{
174 // Returns the number of
175 // fired PM in ADC
176 Short_t n=0;
177 for(Int_t i=0;i<8;i++)
178 if (fMultiplicity[i]>0) n++;
179 return n;
180}
181
182//__________________________________________________________________________
183Float_t AliESDAD::GetMTotADA() const
184{
185 // returns total multiplicity
186 // in ADA
187 Float_t mul=0.0;
188 for(Int_t i=8;i<16;i++)
189 mul+= fMultiplicity[i];
190 return mul;
191}
192
193//__________________________________________________________________________
194Float_t AliESDAD::GetMTotADC() const
195{
196 // returns total multiplicity
197 // in ADC
198 Float_t mul=0.0;
199 for(Int_t i=0;i<8;i++)
200 mul+= fMultiplicity[i];
201 return mul;
202}
203
204
205//__________________________________________________________________________
206Float_t AliESDAD::GetMultiplicity(Int_t i) const
207
208{
209 // returns multiplicity in a
210 // given cell of AD
211 if (OutOfRange(i, "AliESDAD::GetMultiplicity:",16)) return -1;
212 return fMultiplicity[i];
213}
214
215//__________________________________________________________________________
216Float_t AliESDAD::GetMultiplicityADA(Int_t i) const
217
218{
219 // returns multiplicity in a
220 // given cell of ADA
221 if (OutOfRange(i, "AliESDAD::GetMultiplicityADA:",8)) return -1;
222 return fMultiplicity[8+i];
223}
224
225//__________________________________________________________________________
226Float_t AliESDAD::GetMultiplicityADC(Int_t i) const
227
228{
229 // returns multiplicity in a
230 // given cell of ADC
231 if (OutOfRange(i, "AliESDAD::GetMultiplicityADC:",8)) return -1;
232 return fMultiplicity[i];
233}
234
235//__________________________________________________________________________
236Float_t AliESDAD::GetAdc(Int_t i) const
237
238{
239 // returns ADC charge in a
240 // given cell of AD
241 if (OutOfRange(i, "AliESDAD::GetAdc:",16)) return -1;
242 return fAdc[i];
243}
244
245//__________________________________________________________________________
246Float_t AliESDAD::GetAdcADA(Int_t i) const
247
248{
249 // returns ADC charge in a
250 // given cell of ADA
251 if (OutOfRange(i, "AliESDAD::GetAdcADA:",8)) return -1;
252 return fAdc[8+i];
253}
254
255//__________________________________________________________________________
256Float_t AliESDAD::GetAdcADC(Int_t i) const
257
258{
259 // returns ADC charge in a
260 // given cell of ADC
261 if (OutOfRange(i, "AliESDAD::GetAdcADC:",8)) return -1;
262 return fAdc[i];
263}
264
265//__________________________________________________________________________
266Float_t AliESDAD::GetTime(Int_t i) const
267
268{
269 // returns leading time measured by TDC
270 // in a given cell of AD
271 if (OutOfRange(i, "AliESDAD::GetTime:",16)) return -1;
272 return fTime[i];
273}
274
275//__________________________________________________________________________
276Float_t AliESDAD::GetTimeADA(Int_t i) const
277
278{
279 // returns leading time measured by TDC
280 // in a given cell of ADA
281 if (OutOfRange(i, "AliESDAD::GetTimeADA:",8)) return -1;
282 return fTime[8+i];
283}
284
285//__________________________________________________________________________
286Float_t AliESDAD::GetTimeADC(Int_t i) const
287
288{
289 // returns leading time measured by TDC
290 // in a given cell of ADC
291 if (OutOfRange(i, "AliESDAD::GetTimeADC:",8)) return -1;
292 return fTime[i];
293}
294
295//__________________________________________________________________________
296Float_t AliESDAD::GetWidth(Int_t i) const
297
298{
299 // returns time signal width
300 // in a given cell of AD
301 if (OutOfRange(i, "AliESDAD::GetWidth:",16)) return -1;
302 return fWidth[i];
303}
304
305//__________________________________________________________________________
306Float_t AliESDAD::GetWidthADA(Int_t i) const
307
308{
309 // returns time signal width
310 // in a given cell of ADA
311 if (OutOfRange(i, "AliESDAD::GetWidthADA:",8)) return -1;
312 return fWidth[8+i];
313}
314
315//__________________________________________________________________________
316Float_t AliESDAD::GetWidthADC(Int_t i) const
5e319bd5 317
11c03f22 318{
319 // returns time signal width
320 // in a given cell of ADC
321 if (OutOfRange(i, "AliESDAD::GetWidthADC:",8)) return -1;
322 return fWidth[i];
323}
324
325//__________________________________________________________________________
326Bool_t AliESDAD::BBTriggerADA(Int_t i) const
327{
328 // returns offline beam-beam flags in ADA
329 // one bit per cell
330 if (OutOfRange(i, "AliESDAD:::BBTriggerADA",8)) return kFALSE;
331 UInt_t test = 1;
332 return ( fBBtriggerADA & (test << i) ? kTRUE : kFALSE );
333}
334
335//__________________________________________________________________________
336Bool_t AliESDAD::BGTriggerADA(Int_t i) const
337{
338 // returns offline beam-gas flags in ADA
339 // one bit per cell
340 if (OutOfRange(i, "AliESDAD:::BGTriggerADA",8)) return kFALSE;
341 UInt_t test = 1;
342 return ( fBGtriggerADA & (test << i) ? kTRUE : kFALSE );
343}
344
345//__________________________________________________________________________
346Bool_t AliESDAD::BBTriggerADC(Int_t i) const
347{
348 // returns offline beam-beam flags in ADC
349 // one bit per cell
350 if (OutOfRange(i, "AliESDAD:::BBTriggerADC",8)) return kFALSE;
351 UInt_t test = 1;
352 return ( fBBtriggerADC & (test << i) ? kTRUE : kFALSE );
353}
354
355//__________________________________________________________________________
356Bool_t AliESDAD::BGTriggerADC(Int_t i) const
357{
358 // returns offline beam-gasflags in ADC
359 // one bit per cell
360 if (OutOfRange(i, "AliESDAD:::BGTriggerADC",8)) return kFALSE;
361 UInt_t test = 1;
362 return ( fBGtriggerADC & (test << i) ? kTRUE : kFALSE );
363}
364
365//__________________________________________________________________________
366Bool_t AliESDAD::GetBBFlag(Int_t i) const
367
368{
369 // returns online beam-beam flag in AD
370 // one boolean per cell
371 if (OutOfRange(i, "AliESDAD::GetBBFlag:",16)) return kFALSE;
372 return fBBFlag[i];
373}
374
375//__________________________________________________________________________
376Bool_t AliESDAD::GetBGFlag(Int_t i) const
377
378{
379 // returns online beam-gas flag in AD
380 // one boolean per cell
381 if (OutOfRange(i, "AliESDAD::GetBGFlag:",16)) return kFALSE;
382 return fBGFlag[i];
383}