Extending the functionality of the physics selection. Instead of providing a yes...
[u/mrichter/AliRoot.git] / STEER / AliAODHeader.cxx
CommitLineData
df9db588 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/* $Id$ */
17
18//-------------------------------------------------------------------------
19// AOD event base class
20// Author: Markus Oldenburg, CERN
21//-------------------------------------------------------------------------
22
23#include "AliAODHeader.h"
1aa76f71 24#include <TGeoMatrix.h>
27346f69 25#include <TObjString.h>
df9db588 26
27ClassImp(AliAODHeader)
28
29//______________________________________________________________________________
30AliAODHeader::AliAODHeader() :
9ae2e5e6 31 AliVHeader(),
df9db588 32 fMagneticField(-999.),
6b6f8d32 33 fMuonMagFieldScale(-999.),
df9db588 34 fCentrality(-999.),
6b6f8d32 35 fZDCN1Energy(-999.),
36 fZDCP1Energy(-999.),
37 fZDCN2Energy(-999.),
38 fZDCP2Energy(-999.),
ff254193 39 fNQTheta(0),
40 fQTheta(0x0),
df9db588 41 fTriggerMask(0),
27346f69 42 fFiredTriggers(),
df9db588 43 fRunNumber(-999),
44 fRefMult(-999),
45 fRefMultPos(-999),
46 fRefMultNeg(-999),
dba4ebde 47 fNMuons(0),
48 fNDimuons(0),
9333290e 49 fEventType(0),
50 fOrbitNumber(0),
51 fPeriodNumber(0),
52 fBunchCrossNumber(0),
65b25288 53 fTriggerCluster(0),
54 fDiamondZ(0.),
0c6c629b 55 fDiamondSig2Z(0.),
56 fOfflineTrigger(0)
df9db588 57{
58 // default constructor
9ae2e5e6 59
60 SetName("header");
a85132e7 61 for(int j=0; j<2; j++) fZDCEMEnergy[j] = -999.;
613fc341 62 for(Int_t i=0; i<2; i++) fDiamondXY[i]=0.;
63 fDiamondCovXY[0]=fDiamondCovXY[2]=3.*3.;
64 fDiamondCovXY[1]=0.;
1aa76f71 65 for (Int_t m=0; m<kNPHOSMatrix; m++) fPHOSMatrix[m]=NULL;
66 for (Int_t sm=0; sm<kNEMCALMatrix; sm++) fEMCALMatrix[sm]=NULL;
df9db588 67}
68
69//______________________________________________________________________________
31fd97b2 70AliAODHeader::AliAODHeader(Int_t nRun,
71 UShort_t nBunchX,
72 UInt_t nOrbit,
89cf15db 73 UInt_t nPeriod,
abfce367 74 const Char_t *title) :
9ae2e5e6 75 AliVHeader(),
df9db588 76 fMagneticField(-999.),
6b6f8d32 77 fMuonMagFieldScale(-999.),
df9db588 78 fCentrality(-999.),
6b6f8d32 79 fZDCN1Energy(-999.),
80 fZDCP1Energy(-999.),
81 fZDCN2Energy(-999.),
82 fZDCP2Energy(-999.),
ff254193 83 fNQTheta(0),
84 fQTheta(0x0),
df9db588 85 fTriggerMask(0),
27346f69 86 fFiredTriggers(),
ff254193 87 fRunNumber(nRun),
df9db588 88 fRefMult(-999),
89 fRefMultPos(-999),
90 fRefMultNeg(-999),
dba4ebde 91 fNMuons(0),
92 fNDimuons(0),
9333290e 93 fEventType(0),
94 fOrbitNumber(nOrbit),
95 fPeriodNumber(nPeriod),
96 fBunchCrossNumber(nBunchX),
65b25288 97 fTriggerCluster(0),
98 fDiamondZ(0.),
0c6c629b 99 fDiamondSig2Z(0.),
100 fOfflineTrigger(0)
df9db588 101{
102 // constructor
9ae2e5e6 103
104 SetName("header");
105 SetTitle(title);
a85132e7 106 for(int j=0; j<2; j++) fZDCEMEnergy[j] = -999.;
613fc341 107 for(Int_t i=0; i<2; i++) fDiamondXY[i]=0.;
108 fDiamondCovXY[0]=fDiamondCovXY[2]=3.*3.;
109 fDiamondCovXY[1]=0.;
1aa76f71 110 for (Int_t m=0; m<kNPHOSMatrix; m++) fPHOSMatrix[m]=NULL;
111 for (Int_t sm=0; sm<kNEMCALMatrix; sm++) fEMCALMatrix[sm]=NULL;
df9db588 112}
113
114//______________________________________________________________________________
31fd97b2 115AliAODHeader::AliAODHeader(Int_t nRun,
116 UShort_t nBunchX,
117 UInt_t nOrbit,
89cf15db 118 UInt_t nPeriod,
df9db588 119 Int_t refMult,
120 Int_t refMultPos,
121 Int_t refMultNeg,
122 Double_t magField,
6b6f8d32 123 Double_t muonMagFieldScale,
df9db588 124 Double_t cent,
6b6f8d32 125 Double_t n1Energy,
126 Double_t p1Energy,
127 Double_t n2Energy,
128 Double_t p2Energy,
a85132e7 129 Double_t *emEnergy,
6b6f8d32 130 ULong64_t trigMask,
df9db588 131 UChar_t trigClus,
132 UInt_t evttype,
fa8b0e56 133 const Char_t *title,
134 Int_t nMuons,
135 Int_t nDimuons) :
9ae2e5e6 136 AliVHeader(),
df9db588 137 fMagneticField(magField),
6b6f8d32 138 fMuonMagFieldScale(muonMagFieldScale),
df9db588 139 fCentrality(cent),
6b6f8d32 140 fZDCN1Energy(n1Energy),
141 fZDCP1Energy(p1Energy),
142 fZDCN2Energy(n2Energy),
143 fZDCP2Energy(p2Energy),
ff254193 144 fNQTheta(0),
145 fQTheta(0x0),
df9db588 146 fTriggerMask(trigMask),
27346f69 147 fFiredTriggers(),
df9db588 148 fRunNumber(nRun),
149 fRefMult(refMult),
150 fRefMultPos(refMultPos),
151 fRefMultNeg(refMultNeg),
dba4ebde 152 fNMuons(nMuons),
153 fNDimuons(nDimuons),
9333290e 154 fEventType(evttype),
155 fOrbitNumber(nOrbit),
156 fPeriodNumber(nPeriod),
157 fBunchCrossNumber(nBunchX),
0c6c629b 158 fTriggerCluster(trigClus),
65b25288 159 fDiamondZ(0.),
0c6c629b 160 fDiamondSig2Z(0.),
161 fOfflineTrigger(0)
df9db588 162{
163 // constructor
9ae2e5e6 164
165 SetName("header");
166 SetTitle(title);
a85132e7 167 for(int j=0; j<2; j++) fZDCEMEnergy[j] = emEnergy[j];
613fc341 168 for(Int_t i=0; i<2; i++) fDiamondXY[i]=0.;
169 fDiamondCovXY[0]=fDiamondCovXY[2]=3.*3.;
170 fDiamondCovXY[1]=0.;
1aa76f71 171 for (Int_t m=0; m<kNPHOSMatrix; m++) fPHOSMatrix[m]=NULL;
172 for (Int_t sm=0; sm<kNEMCALMatrix; sm++) fEMCALMatrix[sm]=NULL;
df9db588 173}
174
175//______________________________________________________________________________
176AliAODHeader::~AliAODHeader()
177{
178 // destructor
ff254193 179
180 RemoveQTheta();
df9db588 181}
182
183//______________________________________________________________________________
184AliAODHeader::AliAODHeader(const AliAODHeader& hdr) :
9ae2e5e6 185 AliVHeader(hdr),
df9db588 186 fMagneticField(hdr.fMagneticField),
6b6f8d32 187 fMuonMagFieldScale(hdr.fMuonMagFieldScale),
df9db588 188 fCentrality(hdr.fCentrality),
6b6f8d32 189 fZDCN1Energy(hdr.fZDCN1Energy),
190 fZDCP1Energy(hdr.fZDCP1Energy),
191 fZDCN2Energy(hdr.fZDCN2Energy),
192 fZDCP2Energy(hdr.fZDCP2Energy),
ff254193 193 fNQTheta(0),
194 fQTheta(0x0),
df9db588 195 fTriggerMask(hdr.fTriggerMask),
27346f69 196 fFiredTriggers(hdr.fFiredTriggers),
df9db588 197 fRunNumber(hdr.fRunNumber),
198 fRefMult(hdr.fRefMult),
199 fRefMultPos(hdr.fRefMultPos),
200 fRefMultNeg(hdr.fRefMultNeg),
dba4ebde 201 fNMuons(hdr.fNMuons),
202 fNDimuons(hdr.fNDimuons),
9333290e 203 fEventType(hdr.fEventType),
204 fOrbitNumber(hdr.fOrbitNumber),
205 fPeriodNumber(hdr.fPeriodNumber),
206 fBunchCrossNumber(hdr.fBunchCrossNumber),
80a3f83f 207 fTriggerCluster(hdr.fTriggerCluster),
208 fDiamondZ(hdr.fDiamondZ),
0c6c629b 209 fDiamondSig2Z(hdr.fDiamondSig2Z),
210 fOfflineTrigger(hdr.fOfflineTrigger)
df9db588 211{
212 // Copy constructor.
9ae2e5e6 213
214 SetName(hdr.fName);
215 SetTitle(hdr.fTitle);
ff254193 216 SetQTheta(hdr.fQTheta, hdr.fNQTheta);
a85132e7 217 SetZDCEMEnergy(hdr.fZDCEMEnergy[0], hdr.fZDCEMEnergy[1]);
613fc341 218 for(Int_t i=0; i<2; i++) fDiamondXY[i]=hdr.fDiamondXY[i];
219 for(Int_t i=0; i<3; i++) fDiamondCovXY[i]=hdr.fDiamondCovXY[i];
1aa76f71 220
221
222 for(Int_t m=0; m<kNPHOSMatrix; m++){
223 if(hdr.fPHOSMatrix[m])
224 fPHOSMatrix[m]=new TGeoHMatrix(*(hdr.fPHOSMatrix[m])) ;
225 else
226 fPHOSMatrix[m]=0;
227 }
228
229 for(Int_t sm=0; sm<kNEMCALMatrix; sm++){
230 if(hdr.fEMCALMatrix[sm])
231 fEMCALMatrix[sm]=new TGeoHMatrix(*(hdr.fEMCALMatrix[sm])) ;
232 else
233 fEMCALMatrix[sm]=0;
234 }
235
df9db588 236}
237
238//______________________________________________________________________________
239AliAODHeader& AliAODHeader::operator=(const AliAODHeader& hdr)
240{
241 // Assignment operator
242 if(this!=&hdr) {
6b6f8d32 243
9ae2e5e6 244 AliVHeader::operator=(hdr);
df9db588 245
31fd97b2 246 fMagneticField = hdr.fMagneticField;
6b6f8d32 247 fMuonMagFieldScale= hdr.fMuonMagFieldScale;
31fd97b2 248 fCentrality = hdr.fCentrality;
6b6f8d32 249 fZDCN1Energy = hdr.fZDCN1Energy;
250 fZDCP1Energy = hdr.fZDCP1Energy;
251 fZDCN2Energy = hdr.fZDCN2Energy;
252 fZDCP2Energy = hdr.fZDCP2Energy;
31fd97b2 253 fTriggerMask = hdr.fTriggerMask;
27346f69 254 fFiredTriggers = hdr.fFiredTriggers;
31fd97b2 255 fRunNumber = hdr.fRunNumber;
256 fRefMult = hdr.fRefMult;
257 fRefMultPos = hdr.fRefMultPos;
258 fRefMultNeg = hdr.fRefMultNeg;
9333290e 259 fEventType = hdr.fEventType;
260 fOrbitNumber = hdr.fOrbitNumber;
261 fPeriodNumber = hdr.fPeriodNumber;
262 fBunchCrossNumber = hdr.fBunchCrossNumber;
31fd97b2 263 fTriggerCluster = hdr.fTriggerCluster;
fa8b0e56 264 fNMuons = hdr.fNMuons;
265 fNDimuons = hdr.fNDimuons;
0c6c629b 266 fDiamondZ = hdr.fDiamondZ;
267 fDiamondSig2Z = hdr.fDiamondSig2Z;
268 fOfflineTrigger = hdr.fOfflineTrigger;
fa8b0e56 269
ff254193 270
271 SetName(hdr.fName);
272 SetTitle(hdr.fTitle);
273 SetQTheta(hdr.fQTheta, hdr.fNQTheta);
a85132e7 274 SetZDCEMEnergy(hdr.fZDCEMEnergy[0], hdr.fZDCEMEnergy[1]);
613fc341 275 for(Int_t i=0; i<2; i++) fDiamondXY[i]=hdr.fDiamondXY[i];
276 for(Int_t i=0; i<3; i++) fDiamondCovXY[i]=hdr.fDiamondCovXY[i];
1aa76f71 277
278 for(Int_t m=0; m<kNPHOSMatrix; m++){
279 if(hdr.fPHOSMatrix[m])
280 fPHOSMatrix[m]=new TGeoHMatrix(*(hdr.fPHOSMatrix[m])) ;
281 else
282 fPHOSMatrix[m]=0;
283 }
284
285 for(Int_t sm=0; sm<kNEMCALMatrix; sm++){
286 if(hdr.fEMCALMatrix[sm])
287 fEMCALMatrix[sm]=new TGeoHMatrix(*(hdr.fEMCALMatrix[sm])) ;
288 else
289 fEMCALMatrix[sm]=0;
290 }
291
df9db588 292 }
293
9ae2e5e6 294
df9db588 295 return *this;
296}
297
ff254193 298//______________________________________________________________________________
299void AliAODHeader::SetQTheta(Double_t *QTheta, UInt_t size)
300{
301 if (QTheta && size>0) {
302 if (size != (UInt_t)fNQTheta) {
303 RemoveQTheta();
304 fNQTheta = size;
305 fQTheta = new Double_t[fNQTheta];
306 }
307
308 for (Int_t i = 0; i < fNQTheta; i++) {
309 fQTheta[i] = QTheta[i];
310 }
311 } else {
312 RemoveQTheta();
313 }
314
315 return;
316}
317
318//______________________________________________________________________________
319Double_t AliAODHeader::GetQTheta(UInt_t i) const
320{
321 if (fQTheta && i < (UInt_t)fNQTheta) {
322 return fQTheta[i];
323 } else {
324 return -999.;
325 }
326}
327
328//______________________________________________________________________________
329void AliAODHeader::RemoveQTheta()
330{
331 delete[] fQTheta;
332 fQTheta = 0x0;
333 fNQTheta = 0;
334
335 return;
336}
337
df9db588 338//______________________________________________________________________________
339void AliAODHeader::Print(Option_t* /*option*/) const
340{
341 // prints event information
342
df9db588 343 printf("Run # : %d\n", fRunNumber);
31fd97b2 344 printf("Bunch Crossing # : %d\n", fBunchCrossNumber);
345 printf("Orbit Number # : %d\n", fOrbitNumber);
89cf15db 346 printf("Period Number # : %d\n", fPeriodNumber);
df9db588 347 printf("Trigger mask : %lld\n", fTriggerMask);
348 printf("Trigger cluster : %d\n", fTriggerCluster);
349 printf("Event Type : %d\n", fEventType);
350 printf("Magnetic field : %f\n", fMagneticField);
6b6f8d32 351 printf("Muon mag. field scale : %f\n", fMuonMagFieldScale);
df9db588 352
353 printf("Centrality : %f\n", fCentrality);
6b6f8d32 354 printf("ZDC N1 Energy : %f\n", fZDCN1Energy);
355 printf("ZDC P1 Energy : %f\n", fZDCP1Energy);
356 printf("ZDC N2 Energy : %f\n", fZDCN2Energy);
357 printf("ZDC P2 Energy : %f\n", fZDCP2Energy);
a85132e7 358 printf("ZDC EM1 Energy : %f\n", fZDCEMEnergy[0]);
359 printf("ZDC EM2 Energy : %f\n", fZDCEMEnergy[1]);
df9db588 360 printf("ref. Multiplicity : %d\n", fRefMult);
361 printf("ref. Multiplicity (pos) : %d\n", fRefMultPos);
362 printf("ref. Multiplicity (neg) : %d\n", fRefMultNeg);
fa8b0e56 363 printf("number of muons : %d\n", fNMuons);
364 printf("number of dimuons : %d\n", fNDimuons);
0c6c629b 365 printf("offline trigger : %u\n", fOfflineTrigger);
df9db588 366
ff254193 367 if (fQTheta) {
368 for (UInt_t i = 0; i<(UInt_t)fNQTheta; i++) {
d067f357 369 printf("QTheta[%d] : %13.3e\n", i, GetQTheta(i));
ff254193 370 }
371 }
372
373 return;
df9db588 374}