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