Coverity 16571
[u/mrichter/AliRoot.git] / STEER / AliAODVZERO.cxx
CommitLineData
aa2494a4 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 AOD VZERO data
18// Author: Cvetan Cheshkov
19// cvetan.cheshkov@cern.ch 2/02/2011
20//-------------------------------------------------------------------------
21
22#include "AliAODVZERO.h"
23#include "AliLog.h"
24
25ClassImp(AliAODVZERO)
26
27//__________________________________________________________________________
28AliAODVZERO::AliAODVZERO()
29 :AliVVZERO(),
30 fBBtriggerV0A(0),
31 fBGtriggerV0A(0),
32 fBBtriggerV0C(0),
33 fBGtriggerV0C(0),
34 fV0ATime(-1024),
35 fV0CTime(-1024),
36 fV0ADecision(kV0Invalid),
37 fV0CDecision(kV0Invalid)
38{
39 // Default constructor
40 for(Int_t j=0; j<64; j++){
41 fMultiplicity[j] = 0.0;
42 fBBFlag[j]= kFALSE;
43 fBGFlag[j]= kFALSE;
44 }
45}
46
47//__________________________________________________________________________
48AliAODVZERO::AliAODVZERO(const AliAODVZERO &source)
49 :AliVVZERO(source),
50 fBBtriggerV0A(source.fBBtriggerV0A),
51 fBGtriggerV0A(source.fBGtriggerV0A),
52 fBBtriggerV0C(source.fBBtriggerV0C),
53 fBGtriggerV0C(source.fBGtriggerV0C),
54 fV0ATime(source.fV0ATime),
55 fV0CTime(source.fV0CTime),
56 fV0ADecision(source.fV0ADecision),
57 fV0CDecision(source.fV0CDecision)
58{
59 // Default constructor
60 for(Int_t j=0; j<64; j++) {
61 fMultiplicity[j] = source.fMultiplicity[j];
62 fBBFlag[j] = source.fBBFlag[j];
63 fBGFlag[j] = source.fBGFlag[j];
64 }
65}
66
67//__________________________________________________________________________
68AliAODVZERO::AliAODVZERO(const AliVVZERO &source)
69 :AliVVZERO(source),
70 fBBtriggerV0A(0),
71 fBGtriggerV0A(0),
72 fBBtriggerV0C(0),
73 fBGtriggerV0C(0),
74 fV0ATime(source.GetV0ATime()),
75 fV0CTime(source.GetV0CTime()),
76 fV0ADecision(source.GetV0ADecision()),
77 fV0CDecision(source.GetV0CDecision())
78{
79 // Default constructor
80 for(Int_t j=0; j<64; j++) {
81 fMultiplicity[j] = source.GetMultiplicity(j);
82 fBBFlag[j] = source.GetBBFlag(j);
83 fBGFlag[j] = source.GetBGFlag(j);
84 }
85
86 for(Int_t j=0; j<32; j++) {
87 if (source.BBTriggerV0A(j)) fBBtriggerV0A |= (1 << j);
88 if (source.BGTriggerV0A(j)) fBGtriggerV0A |= (1 << j);
89 if (source.BBTriggerV0C(j)) fBBtriggerV0C |= (1 << j);
90 if (source.BGTriggerV0C(j)) fBGtriggerV0C |= (1 << j);
91 }
92}
93
94//__________________________________________________________________________
95AliAODVZERO& AliAODVZERO::operator=(const AliAODVZERO& source)
96{
97 // Assignment operator
98 //
99 if(this==&source) return *this;
100 AliVVZERO::operator=(source);
101 // Assignment operator
102 fBBtriggerV0A=source.fBBtriggerV0A;
103 fBGtriggerV0A=source.fBGtriggerV0A;
104 fBBtriggerV0C=source.fBBtriggerV0C;
105 fBGtriggerV0C=source.fBGtriggerV0C;
106
107 fV0ATime = source.fV0ATime;
108 fV0CTime = source.fV0CTime;
109 fV0ADecision = source.fV0ADecision;
110 fV0CDecision = source.fV0CDecision;
111
112 for(Int_t j=0; j<64; j++) {
113 fMultiplicity[j] = source.fMultiplicity[j];
114 fBBFlag[j] = source.fBBFlag[j];
115 fBGFlag[j] = source.fBGFlag[j];
116 }
117 return *this;
118}
119
120//__________________________________________________________________________
ae2bccf1 121AliAODVZERO& AliAODVZERO::operator=(const AliVVZERO& source)
122{
123 // Assignment operator
124 // used in esd->aod filter
125 if(this==&source) return *this;
126 AliVVZERO::operator=(source);
127
128 fV0ATime = source.GetV0ATime();
129 fV0CTime = source.GetV0CTime();
130 fV0ADecision = source.GetV0ADecision();
131 fV0CDecision = source.GetV0CDecision();
132
133 for(Int_t j=0; j<64; j++) {
134 fMultiplicity[j] = source.GetMultiplicity(j);
135 fBBFlag[j] = source.GetBBFlag(j);
136 fBGFlag[j] = source.GetBGFlag(j);
137 }
138
139 fBBtriggerV0A = fBGtriggerV0A = fBBtriggerV0C = fBGtriggerV0C = 0;
140 for(Int_t j=0; j<32; j++) {
141 if (source.BBTriggerV0A(j)) fBBtriggerV0A |= (1 << j);
142 if (source.BGTriggerV0A(j)) fBGtriggerV0A |= (1 << j);
143 if (source.BBTriggerV0C(j)) fBBtriggerV0C |= (1 << j);
144 if (source.BGTriggerV0C(j)) fBGtriggerV0C |= (1 << j);
145 }
146
147 return *this;
148
149}
150
151//__________________________________________________________________________
aa2494a4 152Short_t AliAODVZERO::GetNbPMV0A() const
153{
154 // Returns the number of
155 // fired PM in V0A
156 Short_t n=0;
157 for(Int_t i=32;i<64;i++)
158 if (fMultiplicity[i]>0) n++;
159 return n;
160}
161
162//__________________________________________________________________________
163Short_t AliAODVZERO::GetNbPMV0C() const
164{
165 // Returns the number of
166 // fired PM in V0C
167 Short_t n=0;
168 for(Int_t i=0;i<32;i++)
169 if (fMultiplicity[i]>0) n++;
170 return n;
171}
172
173//__________________________________________________________________________
174Float_t AliAODVZERO::GetMTotV0A() const
175{
176 // returns total multiplicity
177 // in V0A
178 Float_t mul=0.0;
179 for(Int_t i=32;i<64;i++)
180 mul+= fMultiplicity[i];
181 return mul;
182}
183
184//__________________________________________________________________________
185Float_t AliAODVZERO::GetMTotV0C() const
186{
187 // returns total multiplicity
188 // in V0C
189 Float_t mul=0.0;
190 for(Int_t i=0;i<32;i++)
191 mul+= fMultiplicity[i];
192 return mul;
193}
194
195//__________________________________________________________________________
196Float_t AliAODVZERO::GetMRingV0A(Int_t ring) const
197{
198 // returns multiplicity in a
199 // given ring of V0A
200 if (OutOfRange(ring, "AliAODVZERO:::GetMRingV0A",4)) return -1;
201 Float_t mul =0.0;
202
203 if (ring == 0) for(Int_t i=32;i<40;i++) mul += fMultiplicity[i];
204 if (ring == 1) for(Int_t i=40;i<48;i++) mul += fMultiplicity[i];
205 if (ring == 2) for(Int_t i=48;i<56;i++) mul += fMultiplicity[i];
206 if (ring == 3) for(Int_t i=56;i<64;i++) mul += fMultiplicity[i];
207 return mul ;
208}
209
210//__________________________________________________________________________
211Float_t AliAODVZERO::GetMRingV0C(Int_t ring) const
212{
213 // returns multiplicity in a
214 // given ring of V0C
215 if (OutOfRange(ring, "AliAODVZERO:::GetMRingV0C",4)) return -1;
216 Float_t mul =0.0;
217
218 if (ring == 0) for(Int_t i=0;i<8;i++) mul += fMultiplicity[i];
219 if (ring == 1) for(Int_t i=8;i<16;i++) mul += fMultiplicity[i];
220 if (ring == 2) for(Int_t i=16;i<24;i++) mul += fMultiplicity[i];
221 if (ring == 3) for(Int_t i=24;i<32;i++) mul += fMultiplicity[i];
222 return mul ;
223}
224
225//__________________________________________________________________________
226Float_t AliAODVZERO::GetMultiplicity(Int_t i) const
227
228{
229 // returns multiplicity in a
230 // given cell of V0
231 if (OutOfRange(i, "AliAODVZERO::GetMultiplicity:",64)) return -1;
232 return fMultiplicity[i];
233}
234
235//__________________________________________________________________________
236Float_t AliAODVZERO::GetMultiplicityV0A(Int_t i) const
237
238{
239 // returns multiplicity in a
240 // given cell of V0A
241 if (OutOfRange(i, "AliAODVZERO::GetMultiplicityV0A:",32)) return -1;
242 return fMultiplicity[32+i];
243}
244
245//__________________________________________________________________________
246Float_t AliAODVZERO::GetMultiplicityV0C(Int_t i) const
247
248{
249 // returns multiplicity in a
250 // given cell of V0C
251 if (OutOfRange(i, "AliAODVZERO::GetMultiplicityV0C:",32)) return -1;
252 return fMultiplicity[i];
253}
254
255//__________________________________________________________________________
256Bool_t AliAODVZERO::BBTriggerV0A(Int_t i) const
257{
258 // returns offline beam-beam flags in V0A
259 // one bit per cell
260 if (OutOfRange(i, "AliAODVZERO:::BBTriggerV0A",32)) return kFALSE;
261 UInt_t test = 1;
262 return ( fBBtriggerV0A & (test << i) ? kTRUE : kFALSE );
263}
264
265//__________________________________________________________________________
266Bool_t AliAODVZERO::BGTriggerV0A(Int_t i) const
267{
268 // returns offline beam-gas flags in V0A
269 // one bit per cell
270 if (OutOfRange(i, "AliAODVZERO:::BGTriggerV0A",32)) return kFALSE;
271 UInt_t test = 1;
272 return ( fBGtriggerV0A & (test << i) ? kTRUE : kFALSE );
273}
274
275//__________________________________________________________________________
276Bool_t AliAODVZERO::BBTriggerV0C(Int_t i) const
277{
278 // returns offline beam-beam flags in V0C
279 // one bit per cell
280 if (OutOfRange(i, "AliAODVZERO:::BBTriggerV0C",32)) return kFALSE;
281 UInt_t test = 1;
282 return ( fBBtriggerV0C & (test << i) ? kTRUE : kFALSE );
283}
284
285//__________________________________________________________________________
286Bool_t AliAODVZERO::BGTriggerV0C(Int_t i) const
287{
288 // returns offline beam-gasflags in V0C
289 // one bit per cell
290 if (OutOfRange(i, "AliAODVZERO:::BGTriggerV0C",32)) return kFALSE;
291 UInt_t test = 1;
292 return ( fBGtriggerV0C & (test << i) ? kTRUE : kFALSE );
293}
294
295//__________________________________________________________________________
296Bool_t AliAODVZERO::GetBBFlag(Int_t i) const
297
298{
299 // returns online beam-beam flag in V0
300 // one boolean per cell
301 if (OutOfRange(i, "AliAODVZERO::GetBBFlag:",64)) return kFALSE;
302 return fBBFlag[i];
303}
304
305//__________________________________________________________________________
306Bool_t AliAODVZERO::GetBGFlag(Int_t i) const
307
308{
309 // returns online beam-gas flag in V0
310 // one boolean per cell
311 if (OutOfRange(i, "AliAODVZERO::GetBGFlag:",64)) return kFALSE;
312 return fBGFlag[i];
313}