- Three classes by MinJung Kweon AliHFEpriVtx, AliHFEsecVtx and AliHFEmcQA for primar...
[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"
24
25ClassImp(AliAODHeader)
26
27//______________________________________________________________________________
28AliAODHeader::AliAODHeader() :
9ae2e5e6 29 AliVHeader(),
df9db588 30 fMagneticField(-999.),
6b6f8d32 31 fMuonMagFieldScale(-999.),
df9db588 32 fCentrality(-999.),
6b6f8d32 33 fZDCN1Energy(-999.),
34 fZDCP1Energy(-999.),
35 fZDCN2Energy(-999.),
36 fZDCP2Energy(-999.),
ff254193 37 fNQTheta(0),
38 fQTheta(0x0),
df9db588 39 fTriggerMask(0),
df9db588 40 fRunNumber(-999),
41 fRefMult(-999),
42 fRefMultPos(-999),
43 fRefMultNeg(-999),
9333290e 44 fEventType(0),
45 fOrbitNumber(0),
46 fPeriodNumber(0),
47 fBunchCrossNumber(0),
df9db588 48 fTriggerCluster(0)
49{
50 // default constructor
9ae2e5e6 51
52 SetName("header");
a85132e7 53 for(int j=0; j<2; j++) fZDCEMEnergy[j] = -999.;
613fc341 54 for(Int_t i=0; i<2; i++) fDiamondXY[i]=0.;
55 fDiamondCovXY[0]=fDiamondCovXY[2]=3.*3.;
56 fDiamondCovXY[1]=0.;
df9db588 57}
58
59//______________________________________________________________________________
31fd97b2 60AliAODHeader::AliAODHeader(Int_t nRun,
61 UShort_t nBunchX,
62 UInt_t nOrbit,
89cf15db 63 UInt_t nPeriod,
abfce367 64 const Char_t *title) :
9ae2e5e6 65 AliVHeader(),
df9db588 66 fMagneticField(-999.),
6b6f8d32 67 fMuonMagFieldScale(-999.),
df9db588 68 fCentrality(-999.),
6b6f8d32 69 fZDCN1Energy(-999.),
70 fZDCP1Energy(-999.),
71 fZDCN2Energy(-999.),
72 fZDCP2Energy(-999.),
ff254193 73 fNQTheta(0),
74 fQTheta(0x0),
df9db588 75 fTriggerMask(0),
ff254193 76 fRunNumber(nRun),
df9db588 77 fRefMult(-999),
78 fRefMultPos(-999),
79 fRefMultNeg(-999),
9333290e 80 fEventType(0),
81 fOrbitNumber(nOrbit),
82 fPeriodNumber(nPeriod),
83 fBunchCrossNumber(nBunchX),
df9db588 84 fTriggerCluster(0)
85{
86 // constructor
9ae2e5e6 87
88 SetName("header");
89 SetTitle(title);
a85132e7 90 for(int j=0; j<2; j++) fZDCEMEnergy[j] = -999.;
613fc341 91 for(Int_t i=0; i<2; i++) fDiamondXY[i]=0.;
92 fDiamondCovXY[0]=fDiamondCovXY[2]=3.*3.;
93 fDiamondCovXY[1]=0.;
df9db588 94}
95
96//______________________________________________________________________________
31fd97b2 97AliAODHeader::AliAODHeader(Int_t nRun,
98 UShort_t nBunchX,
99 UInt_t nOrbit,
89cf15db 100 UInt_t nPeriod,
df9db588 101 Int_t refMult,
102 Int_t refMultPos,
103 Int_t refMultNeg,
104 Double_t magField,
6b6f8d32 105 Double_t muonMagFieldScale,
df9db588 106 Double_t cent,
6b6f8d32 107 Double_t n1Energy,
108 Double_t p1Energy,
109 Double_t n2Energy,
110 Double_t p2Energy,
a85132e7 111 Double_t *emEnergy,
6b6f8d32 112 ULong64_t trigMask,
df9db588 113 UChar_t trigClus,
114 UInt_t evttype,
abfce367 115 const Char_t *title) :
9ae2e5e6 116 AliVHeader(),
df9db588 117 fMagneticField(magField),
6b6f8d32 118 fMuonMagFieldScale(muonMagFieldScale),
df9db588 119 fCentrality(cent),
6b6f8d32 120 fZDCN1Energy(n1Energy),
121 fZDCP1Energy(p1Energy),
122 fZDCN2Energy(n2Energy),
123 fZDCP2Energy(p2Energy),
ff254193 124 fNQTheta(0),
125 fQTheta(0x0),
df9db588 126 fTriggerMask(trigMask),
df9db588 127 fRunNumber(nRun),
128 fRefMult(refMult),
129 fRefMultPos(refMultPos),
130 fRefMultNeg(refMultNeg),
9333290e 131 fEventType(evttype),
132 fOrbitNumber(nOrbit),
133 fPeriodNumber(nPeriod),
134 fBunchCrossNumber(nBunchX),
df9db588 135 fTriggerCluster(trigClus)
136{
137 // constructor
9ae2e5e6 138
139 SetName("header");
140 SetTitle(title);
a85132e7 141 for(int j=0; j<2; j++) fZDCEMEnergy[j] = emEnergy[j];
613fc341 142 for(Int_t i=0; i<2; i++) fDiamondXY[i]=0.;
143 fDiamondCovXY[0]=fDiamondCovXY[2]=3.*3.;
144 fDiamondCovXY[1]=0.;
df9db588 145}
146
147//______________________________________________________________________________
148AliAODHeader::~AliAODHeader()
149{
150 // destructor
ff254193 151
152 RemoveQTheta();
df9db588 153}
154
155//______________________________________________________________________________
156AliAODHeader::AliAODHeader(const AliAODHeader& hdr) :
9ae2e5e6 157 AliVHeader(hdr),
df9db588 158 fMagneticField(hdr.fMagneticField),
6b6f8d32 159 fMuonMagFieldScale(hdr.fMuonMagFieldScale),
df9db588 160 fCentrality(hdr.fCentrality),
6b6f8d32 161 fZDCN1Energy(hdr.fZDCN1Energy),
162 fZDCP1Energy(hdr.fZDCP1Energy),
163 fZDCN2Energy(hdr.fZDCN2Energy),
164 fZDCP2Energy(hdr.fZDCP2Energy),
ff254193 165 fNQTheta(0),
166 fQTheta(0x0),
df9db588 167 fTriggerMask(hdr.fTriggerMask),
df9db588 168 fRunNumber(hdr.fRunNumber),
169 fRefMult(hdr.fRefMult),
170 fRefMultPos(hdr.fRefMultPos),
171 fRefMultNeg(hdr.fRefMultNeg),
9333290e 172 fEventType(hdr.fEventType),
173 fOrbitNumber(hdr.fOrbitNumber),
174 fPeriodNumber(hdr.fPeriodNumber),
175 fBunchCrossNumber(hdr.fBunchCrossNumber),
df9db588 176 fTriggerCluster(hdr.fTriggerCluster)
177{
178 // Copy constructor.
9ae2e5e6 179
180 SetName(hdr.fName);
181 SetTitle(hdr.fTitle);
ff254193 182 SetQTheta(hdr.fQTheta, hdr.fNQTheta);
a85132e7 183 SetZDCEMEnergy(hdr.fZDCEMEnergy[0], hdr.fZDCEMEnergy[1]);
613fc341 184 for(Int_t i=0; i<2; i++) fDiamondXY[i]=hdr.fDiamondXY[i];
185 for(Int_t i=0; i<3; i++) fDiamondCovXY[i]=hdr.fDiamondCovXY[i];
df9db588 186}
187
188//______________________________________________________________________________
189AliAODHeader& AliAODHeader::operator=(const AliAODHeader& hdr)
190{
191 // Assignment operator
192 if(this!=&hdr) {
6b6f8d32 193
9ae2e5e6 194 AliVHeader::operator=(hdr);
df9db588 195
31fd97b2 196 fMagneticField = hdr.fMagneticField;
6b6f8d32 197 fMuonMagFieldScale= hdr.fMuonMagFieldScale;
31fd97b2 198 fCentrality = hdr.fCentrality;
6b6f8d32 199 fZDCN1Energy = hdr.fZDCN1Energy;
200 fZDCP1Energy = hdr.fZDCP1Energy;
201 fZDCN2Energy = hdr.fZDCN2Energy;
202 fZDCP2Energy = hdr.fZDCP2Energy;
31fd97b2 203 fTriggerMask = hdr.fTriggerMask;
31fd97b2 204 fRunNumber = hdr.fRunNumber;
205 fRefMult = hdr.fRefMult;
206 fRefMultPos = hdr.fRefMultPos;
207 fRefMultNeg = hdr.fRefMultNeg;
9333290e 208 fEventType = hdr.fEventType;
209 fOrbitNumber = hdr.fOrbitNumber;
210 fPeriodNumber = hdr.fPeriodNumber;
211 fBunchCrossNumber = hdr.fBunchCrossNumber;
31fd97b2 212 fTriggerCluster = hdr.fTriggerCluster;
ff254193 213
214 SetName(hdr.fName);
215 SetTitle(hdr.fTitle);
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];
df9db588 220 }
221
9ae2e5e6 222
df9db588 223 return *this;
224}
225
226//______________________________________________________________________________
ff254193 227void AliAODHeader::SetQTheta(Double_t *QTheta, UInt_t size)
228{
229 if (QTheta && size>0) {
230 if (size != (UInt_t)fNQTheta) {
231 RemoveQTheta();
232 fNQTheta = size;
233 fQTheta = new Double_t[fNQTheta];
234 }
235
236 for (Int_t i = 0; i < fNQTheta; i++) {
237 fQTheta[i] = QTheta[i];
238 }
239 } else {
240 RemoveQTheta();
241 }
242
243 return;
244}
245
246//______________________________________________________________________________
247Double_t AliAODHeader::GetQTheta(UInt_t i) const
248{
249 if (fQTheta && i < (UInt_t)fNQTheta) {
250 return fQTheta[i];
251 } else {
252 return -999.;
253 }
254}
255
256//______________________________________________________________________________
257void AliAODHeader::RemoveQTheta()
258{
259 delete[] fQTheta;
260 fQTheta = 0x0;
261 fNQTheta = 0;
262
263 return;
264}
265
266//______________________________________________________________________________
df9db588 267void AliAODHeader::Print(Option_t* /*option*/) const
268{
269 // prints event information
270
df9db588 271 printf("Run # : %d\n", fRunNumber);
31fd97b2 272 printf("Bunch Crossing # : %d\n", fBunchCrossNumber);
273 printf("Orbit Number # : %d\n", fOrbitNumber);
89cf15db 274 printf("Period Number # : %d\n", fPeriodNumber);
df9db588 275 printf("Trigger mask : %lld\n", fTriggerMask);
276 printf("Trigger cluster : %d\n", fTriggerCluster);
277 printf("Event Type : %d\n", fEventType);
278 printf("Magnetic field : %f\n", fMagneticField);
6b6f8d32 279 printf("Muon mag. field scale : %f\n", fMuonMagFieldScale);
df9db588 280
281 printf("Centrality : %f\n", fCentrality);
6b6f8d32 282 printf("ZDC N1 Energy : %f\n", fZDCN1Energy);
283 printf("ZDC P1 Energy : %f\n", fZDCP1Energy);
284 printf("ZDC N2 Energy : %f\n", fZDCN2Energy);
285 printf("ZDC P2 Energy : %f\n", fZDCP2Energy);
a85132e7 286 printf("ZDC EM1 Energy : %f\n", fZDCEMEnergy[0]);
287 printf("ZDC EM2 Energy : %f\n", fZDCEMEnergy[1]);
df9db588 288 printf("ref. Multiplicity : %d\n", fRefMult);
289 printf("ref. Multiplicity (pos) : %d\n", fRefMultPos);
290 printf("ref. Multiplicity (neg) : %d\n", fRefMultNeg);
291
ff254193 292 if (fQTheta) {
293 for (UInt_t i = 0; i<(UInt_t)fNQTheta; i++) {
d067f357 294 printf("QTheta[%d] : %13.3e\n", i, GetQTheta(i));
ff254193 295 }
296 }
297
298 return;
df9db588 299}