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