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