]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliESDVZERO.cxx
Bug fix in copy constructor and assignment operator.
[u/mrichter/AliRoot.git] / STEER / AliESDVZERO.cxx
CommitLineData
b734abbe 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 **************************************************************************/
15
16//-------------------------------------------------------------------------
17// Container class for ESD VZERO data
18// Author: Brigitte Cheynis & Cvetan Cheshkov
19//-------------------------------------------------------------------------
20
dd735cf0 21#include "AliESDVZERO.h"
28fdf12c 22#include "AliLog.h"
dd735cf0 23
24ClassImp(AliESDVZERO)
25
d0502ab2 26//__________________________________________________________________________
a055ee24 27AliESDVZERO::AliESDVZERO()
b734abbe 28 :AliVVZERO(),
a055ee24 29 fBBtriggerV0A(0),
30 fBGtriggerV0A(0),
31 fBBtriggerV0C(0),
b44c933e 32 fBGtriggerV0C(0),
33 fV0ATime(-1024),
34 fV0CTime(-1024),
35 fV0ATimeError(0),
36 fV0CTimeError(0),
37 fV0ADecision(kV0Invalid),
38 fV0CDecision(kV0Invalid)
dd735cf0 39{
40 // Default constructor
a055ee24 41 for(Int_t j=0; j<64; j++){
6c6d6114 42 fMultiplicity[j] = 0.0;
db0db003 43 fAdc[j] = 0.0;
44 fTime[j] = 0.0;
45 fWidth[j] = 0.0;
d0502ab2 46 fBBFlag[j]= kFALSE;
47 fBGFlag[j]= kFALSE;
cd888a89 48 }
dd735cf0 49}
50
d0502ab2 51//__________________________________________________________________________
cd888a89 52AliESDVZERO::AliESDVZERO(const AliESDVZERO &o)
b734abbe 53 :AliVVZERO(o),
a055ee24 54 fBBtriggerV0A(o.fBBtriggerV0A),
55 fBGtriggerV0A(o.fBGtriggerV0A),
56 fBBtriggerV0C(o.fBBtriggerV0C),
b44c933e 57 fBGtriggerV0C(o.fBGtriggerV0C),
58 fV0ATime(o.fV0ATime),
59 fV0CTime(o.fV0CTime),
60 fV0ATimeError(o.fV0ATimeError),
61 fV0CTimeError(o.fV0CTimeError),
62 fV0ADecision(o.fV0ADecision),
63 fV0CDecision(o.fV0CDecision)
dd735cf0 64{
65 // Default constructor
28fdf12c 66 for(Int_t j=0; j<64; j++) {
a055ee24 67 fMultiplicity[j] = o.fMultiplicity[j];
d0502ab2 68 fAdc[j] = o.fAdc[j];
69 fTime[j] = o.fTime[j];
70 fWidth[j] = o.fWidth[j];
71 fBBFlag[j] = o.fBBFlag[j];
72 fBGFlag[j] = o.fBGFlag[j];
28fdf12c 73 }
dd735cf0 74}
75
d0502ab2 76//__________________________________________________________________________
a055ee24 77AliESDVZERO::AliESDVZERO(UInt_t BBtriggerV0A, UInt_t BGtriggerV0A,
78 UInt_t BBtriggerV0C, UInt_t BGtriggerV0C,
db0db003 79 Float_t *Multiplicity, Float_t *Adc,
80 Float_t *Time, Float_t *Width, Bool_t *BBFlag, Bool_t *BGFlag)
b734abbe 81 :AliVVZERO(),
a055ee24 82 fBBtriggerV0A(BBtriggerV0A),
83 fBGtriggerV0A(BGtriggerV0A),
84 fBBtriggerV0C(BBtriggerV0C),
b44c933e 85 fBGtriggerV0C(BGtriggerV0C),
86 fV0ATime(-1024),
87 fV0CTime(-1024),
88 fV0ATimeError(0),
89 fV0CTimeError(0),
90 fV0ADecision(kV0Invalid),
91 fV0CDecision(kV0Invalid)
dd735cf0 92{
93 // Constructor
28fdf12c 94 for(Int_t j=0; j<64; j++) {
a055ee24 95 fMultiplicity[j] = Multiplicity[j];
d0502ab2 96 fAdc[j] = Adc[j];
97 fTime[j] = Time[j];
98 fWidth[j] = Width[j];
99 fBBFlag[j] = BBFlag[j];
100 fBGFlag[j] = BGFlag[j];
28fdf12c 101 }
dd735cf0 102}
103
d0502ab2 104//__________________________________________________________________________
dd735cf0 105AliESDVZERO& AliESDVZERO::operator=(const AliESDVZERO& o)
106{
cd888a89 107
a055ee24 108 if(this==&o) return *this;
b734abbe 109 AliVVZERO::operator=(o);
dd735cf0 110 // Assignment operator
a055ee24 111 fBBtriggerV0A=o.fBBtriggerV0A;
112 fBGtriggerV0A=o.fBGtriggerV0A;
113 fBBtriggerV0C=o.fBBtriggerV0C;
114 fBGtriggerV0C=o.fBGtriggerV0C;
b44c933e 115
116 fV0ATime = o.fV0ATime;
117 fV0CTime = o.fV0CTime;
118 fV0ATimeError = o.fV0ATimeError;
119 fV0CTimeError = o.fV0CTimeError;
120 fV0ADecision = o.fV0ADecision;
121 fV0CDecision = o.fV0CDecision;
122
28fdf12c 123 for(Int_t j=0; j<64; j++) {
a055ee24 124 fMultiplicity[j] = o.fMultiplicity[j];
d0502ab2 125 fAdc[j] = o.fAdc[j];
126 fTime[j] = o.fTime[j];
127 fWidth[j] = o.fWidth[j];
128 fBBFlag[j] = o.fBBFlag[j];
129 fBGFlag[j] = o.fBGFlag[j];
28fdf12c 130 }
a055ee24 131 return *this;
132}
cd888a89 133
4ca09433 134//______________________________________________________________________________
135void AliESDVZERO::Copy(TObject &obj) const {
136
137 // this overwrites the virtual TOBject::Copy()
138 // to allow run time copying without casting
139 // in AliESDEvent
140
141 if(this==&obj)return;
142 AliESDVZERO *robj = dynamic_cast<AliESDVZERO*>(&obj);
143 if(!robj)return; // not an AliESDVZERO
144 *robj = *this;
145
146}
147
d0502ab2 148//__________________________________________________________________________
5fc205b9 149Short_t AliESDVZERO::GetNbPMV0A() const
a055ee24 150{
5fc205b9 151 // Returns the number of
152 // fired PM in V0A
a055ee24 153 Short_t n=0;
154 for(Int_t i=32;i<64;i++)
155 if (fMultiplicity[i]>0) n++;
156 return n;
157}
dd735cf0 158
d0502ab2 159//__________________________________________________________________________
5fc205b9 160Short_t AliESDVZERO::GetNbPMV0C() const
a055ee24 161{
5fc205b9 162 // Returns the number of
163 // fired PM in V0C
a055ee24 164 Short_t n=0;
165 for(Int_t i=0;i<32;i++)
166 if (fMultiplicity[i]>0) n++;
167 return n;
168}
dd735cf0 169
d0502ab2 170//__________________________________________________________________________
5fc205b9 171Float_t AliESDVZERO::GetMTotV0A() const
a055ee24 172{
5fc205b9 173 // returns total multiplicity
174 // in V0A
6c6d6114 175 Float_t mul=0.0;
a055ee24 176 for(Int_t i=32;i<64;i++)
db0db003 177 mul+= fMultiplicity[i];
6c6d6114 178 return mul;
a055ee24 179}
180
d0502ab2 181//__________________________________________________________________________
5fc205b9 182Float_t AliESDVZERO::GetMTotV0C() const
a055ee24 183{
5fc205b9 184 // returns total multiplicity
185 // in V0C
6c6d6114 186 Float_t mul=0.0;
a055ee24 187 for(Int_t i=0;i<32;i++)
db0db003 188 mul+= fMultiplicity[i];
6c6d6114 189 return mul;
a055ee24 190}
191
d0502ab2 192//__________________________________________________________________________
5fc205b9 193Float_t AliESDVZERO::GetMRingV0A(Int_t ring) const
a055ee24 194{
5fc205b9 195 // returns multiplicity in a
196 // given ring of V0A
a055ee24 197 if (OutOfRange(ring, "AliESDVZERO:::GetMRingV0A",4)) return -1;
6c6d6114 198 Float_t mul =0.0;
732a24fe 199
db0db003 200 if (ring == 0) for(Int_t i=32;i<40;i++) mul += fMultiplicity[i];
201 if (ring == 1) for(Int_t i=40;i<48;i++) mul += fMultiplicity[i];
202 if (ring == 2) for(Int_t i=48;i<56;i++) mul += fMultiplicity[i];
203 if (ring == 3) for(Int_t i=56;i<64;i++) mul += fMultiplicity[i];
6c6d6114 204 return mul ;
a055ee24 205}
732a24fe 206
d0502ab2 207//__________________________________________________________________________
5fc205b9 208Float_t AliESDVZERO::GetMRingV0C(Int_t ring) const
a055ee24 209{
5fc205b9 210 // returns multiplicity in a
211 // given ring of V0C
a055ee24 212 if (OutOfRange(ring, "AliESDVZERO:::GetMRingV0C",4)) return -1;
6c6d6114 213 Float_t mul =0.0;
732a24fe 214
db0db003 215 if (ring == 0) for(Int_t i=0;i<8;i++) mul += fMultiplicity[i];
216 if (ring == 1) for(Int_t i=8;i<16;i++) mul += fMultiplicity[i];
217 if (ring == 2) for(Int_t i=16;i<24;i++) mul += fMultiplicity[i];
218 if (ring == 3) for(Int_t i=24;i<32;i++) mul += fMultiplicity[i];
6c6d6114 219 return mul ;
732a24fe 220}
221
d0502ab2 222//__________________________________________________________________________
5fc205b9 223Float_t AliESDVZERO::GetMultiplicity(Int_t i) const
a055ee24 224
225{
5fc205b9 226 // returns multiplicity in a
227 // given cell of V0
a055ee24 228 if (OutOfRange(i, "AliESDVZERO::GetMultiplicity:",64)) return -1;
229 return fMultiplicity[i];
230}
231
d0502ab2 232//__________________________________________________________________________
5fc205b9 233Float_t AliESDVZERO::GetMultiplicityV0A(Int_t i) const
28fdf12c 234
235{
5fc205b9 236 // returns multiplicity in a
237 // given cell of V0A
28fdf12c 238 if (OutOfRange(i, "AliESDVZERO::GetMultiplicityV0A:",32)) return -1;
239 return fMultiplicity[32+i];
240}
241
d0502ab2 242//__________________________________________________________________________
5fc205b9 243Float_t AliESDVZERO::GetMultiplicityV0C(Int_t i) const
28fdf12c 244
245{
5fc205b9 246 // returns multiplicity in a
247 // given cell of V0C
28fdf12c 248 if (OutOfRange(i, "AliESDVZERO::GetMultiplicityV0C:",32)) return -1;
249 return fMultiplicity[i];
250}
251
d0502ab2 252//__________________________________________________________________________
5fc205b9 253Float_t AliESDVZERO::GetAdc(Int_t i) const
28fdf12c 254
255{
5fc205b9 256 // returns ADC charge in a
257 // given cell of V0
28fdf12c 258 if (OutOfRange(i, "AliESDVZERO::GetAdc:",64)) return -1;
259 return fAdc[i];
260}
261
d0502ab2 262//__________________________________________________________________________
5fc205b9 263Float_t AliESDVZERO::GetAdcV0A(Int_t i) const
28fdf12c 264
265{
5fc205b9 266 // returns ADC charge in a
267 // given cell of V0A
d0502ab2 268 if (OutOfRange(i, "AliESDVZERO::GetAdcV0A:",32)) return -1;
269 return fAdc[32+i];
28fdf12c 270}
271
d0502ab2 272//__________________________________________________________________________
5fc205b9 273Float_t AliESDVZERO::GetAdcV0C(Int_t i) const
28fdf12c 274
275{
5fc205b9 276 // returns ADC charge in a
277 // given cell of V0C
d0502ab2 278 if (OutOfRange(i, "AliESDVZERO::GetAdcV0C:",32)) return -1;
279 return fAdc[i];
28fdf12c 280}
281
d0502ab2 282//__________________________________________________________________________
5fc205b9 283Float_t AliESDVZERO::GetTime(Int_t i) const
28fdf12c 284
285{
5fc205b9 286 // returns leading time measured by TDC
287 // in a given cell of V0
28fdf12c 288 if (OutOfRange(i, "AliESDVZERO::GetTime:",64)) return -1;
289 return fTime[i];
290}
291
d0502ab2 292//__________________________________________________________________________
5fc205b9 293Float_t AliESDVZERO::GetTimeV0A(Int_t i) const
d0502ab2 294
295{
5fc205b9 296 // returns leading time measured by TDC
297 // in a given cell of V0A
d0502ab2 298 if (OutOfRange(i, "AliESDVZERO::GetTimeV0A:",32)) return -1;
299 return fTime[32+i];
300}
301
302//__________________________________________________________________________
5fc205b9 303Float_t AliESDVZERO::GetTimeV0C(Int_t i) const
28fdf12c 304
305{
5fc205b9 306 // returns leading time measured by TDC
307 // in a given cell of V0C
28fdf12c 308 if (OutOfRange(i, "AliESDVZERO::GetTimeV0C:",32)) return -1;
309 return fTime[i];
310}
311
d0502ab2 312//__________________________________________________________________________
5fc205b9 313Float_t AliESDVZERO::GetWidth(Int_t i) const
28fdf12c 314
315{
5fc205b9 316 // returns time signal width
317 // in a given cell of V0
d0502ab2 318 if (OutOfRange(i, "AliESDVZERO::GetWidth:",64)) return -1;
319 return fWidth[i];
320}
321
322//__________________________________________________________________________
5fc205b9 323Float_t AliESDVZERO::GetWidthV0A(Int_t i) const
d0502ab2 324
325{
5fc205b9 326 // returns time signal width
327 // in a given cell of V0A
d0502ab2 328 if (OutOfRange(i, "AliESDVZERO::GetWidthV0A:",32)) return -1;
329 return fWidth[32+i];
330}
331
332//__________________________________________________________________________
5fc205b9 333Float_t AliESDVZERO::GetWidthV0C(Int_t i) const
d0502ab2 334
335{
5fc205b9 336 // returns time signal width
337 // in a given cell of V0C
d0502ab2 338 if (OutOfRange(i, "AliESDVZERO::GetWidthV0C:",32)) return -1;
339 return fWidth[i];
28fdf12c 340}
341
d0502ab2 342//__________________________________________________________________________
5fc205b9 343Bool_t AliESDVZERO::BBTriggerV0A(Int_t i) const
a055ee24 344{
5fc205b9 345 // returns offline beam-beam flags in V0A
346 // one bit per cell
a055ee24 347 if (OutOfRange(i, "AliESDVZERO:::BBTriggerV0A",32)) return kFALSE;
348 UInt_t test = 1;
349 return ( fBBtriggerV0A & (test << i) ? kTRUE : kFALSE );
350}
351
d0502ab2 352//__________________________________________________________________________
5fc205b9 353Bool_t AliESDVZERO::BGTriggerV0A(Int_t i) const
a055ee24 354{
5fc205b9 355 // returns offline beam-gas flags in V0A
356 // one bit per cell
a055ee24 357 if (OutOfRange(i, "AliESDVZERO:::BGTriggerV0A",32)) return kFALSE;
358 UInt_t test = 1;
359 return ( fBGtriggerV0A & (test << i) ? kTRUE : kFALSE );
360}
361
d0502ab2 362//__________________________________________________________________________
5fc205b9 363Bool_t AliESDVZERO::BBTriggerV0C(Int_t i) const
a055ee24 364{
5fc205b9 365 // returns offline beam-beam flags in V0C
366 // one bit per cell
a055ee24 367 if (OutOfRange(i, "AliESDVZERO:::BBTriggerV0C",32)) return kFALSE;
368 UInt_t test = 1;
369 return ( fBBtriggerV0C & (test << i) ? kTRUE : kFALSE );
370}
371
d0502ab2 372//__________________________________________________________________________
5fc205b9 373Bool_t AliESDVZERO::BGTriggerV0C(Int_t i) const
a055ee24 374{
5fc205b9 375 // returns offline beam-gasflags in V0C
376 // one bit per cell
a055ee24 377 if (OutOfRange(i, "AliESDVZERO:::BGTriggerV0C",32)) return kFALSE;
378 UInt_t test = 1;
379 return ( fBGtriggerV0C & (test << i) ? kTRUE : kFALSE );
380}
381
d0502ab2 382//__________________________________________________________________________
5fc205b9 383Bool_t AliESDVZERO::GetBBFlag(Int_t i) const
d0502ab2 384
385{
5fc205b9 386 // returns online beam-beam flag in V0
387 // one boolean per cell
d0502ab2 388 if (OutOfRange(i, "AliESDVZERO::GetBBFlag:",64)) return kFALSE;
389 return fBBFlag[i];
390}
391
392//__________________________________________________________________________
5fc205b9 393Bool_t AliESDVZERO::GetBGFlag(Int_t i) const
d0502ab2 394
395{
5fc205b9 396 // returns online beam-gas flag in V0
397 // one boolean per cell
d0502ab2 398 if (OutOfRange(i, "AliESDVZERO::GetBGFlag:",64)) return kFALSE;
399 return fBGFlag[i];
400}