Processing SPD Mean Vertex only in PHYSICS runs.
[u/mrichter/AliRoot.git] / STEER / AliESDHeader.cxx
CommitLineData
d5ebf00e 1/**************************************************************************
2 * Copyright(c) 1998-1999, 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// Implementation of Class AliESDHeader
18// Header data
19// for the ESD
20// Origin: Christian Klein-Boesing, CERN, Christian.Klein-Boesing@cern.ch
21//-------------------------------------------------------------------------
22
23#include "AliESDHeader.h"
bf1f98c4 24#include "AliTriggerScalersESD.h"
25#include "AliTriggerScalersRecordESD.h"
8258ca76 26#include "AliTriggerIR.h"
b7b66e38 27#include "AliLog.h"
d5ebf00e 28
29ClassImp(AliESDHeader)
30
31//______________________________________________________________________________
32AliESDHeader::AliESDHeader() :
9ae2e5e6 33 AliVHeader(),
d5ebf00e 34 fTriggerMask(0),
35 fOrbitNumber(0),
36 fTimeStamp(0),
37 fEventType(0),
fd2e2210 38 fEventSpecie(0),
4f036e6e 39 fPeriodNumber(0),
d5ebf00e 40 fEventNumberInFile(0),
41 fBunchCrossNumber(0),
53eef471 42 fTriggerCluster(0),
43 fL0TriggerInputs(0),
44 fL1TriggerInputs(0),
bf1f98c4 45 fL2TriggerInputs(0),
99dd1587 46 fTriggerScalers()
d5ebf00e 47{
9ae2e5e6 48 // default constructor
49
50 SetName("AliESDHeader");
c47cda51 51 for(Int_t i = 0; i<kNMaxIR ; i++) fIRArray[i] = 0;
52
9ae2e5e6 53}
9ae2e5e6 54AliESDHeader::~AliESDHeader()
55{
56 // destructor
c47cda51 57 for(Int_t i=0;i<kNMaxIR;i++)if(fIRArray[i])delete fIRArray[i];
d5ebf00e 58}
59
60
61AliESDHeader::AliESDHeader(const AliESDHeader &header) :
9ae2e5e6 62 AliVHeader(header),
d5ebf00e 63 fTriggerMask(header.fTriggerMask),
64 fOrbitNumber(header.fOrbitNumber),
65 fTimeStamp(header.fTimeStamp),
66 fEventType(header.fEventType),
fd2e2210 67 fEventSpecie(header.fEventSpecie),
4f036e6e 68 fPeriodNumber(header.fPeriodNumber),
d5ebf00e 69 fEventNumberInFile(header.fEventNumberInFile),
70 fBunchCrossNumber(header.fBunchCrossNumber),
53eef471 71 fTriggerCluster(header.fTriggerCluster),
72 fL0TriggerInputs(header.fL0TriggerInputs),
73 fL1TriggerInputs(header.fL1TriggerInputs),
bf1f98c4 74 fL2TriggerInputs(header.fL2TriggerInputs),
99dd1587 75 fTriggerScalers(header.fTriggerScalers)
d5ebf00e 76{
77 // copy constructor
9ae2e5e6 78 SetName(header.fName);
79 SetTitle(header.fTitle);
c47cda51 80 for(Int_t i = 0; i<kNMaxIR ; i++) {
81 if(header.fIRArray[i])fIRArray[i] = new AliTriggerIR(*header.fIRArray[i]);
82 else fIRArray[i]=0;
83 }
d5ebf00e 84}
85
86AliESDHeader& AliESDHeader::operator=(const AliESDHeader &header)
87{
88 // assigment operator
89 if(this!=&header) {
9ae2e5e6 90 AliVHeader::operator=(header);
d5ebf00e 91 fTriggerMask = header.fTriggerMask;
92 fOrbitNumber = header.fOrbitNumber;
93 fTimeStamp = header.fTimeStamp;
94 fEventType = header.fEventType;
fd2e2210 95 fEventSpecie = header.fEventSpecie;
4f036e6e 96 fPeriodNumber = header.fPeriodNumber;
d5ebf00e 97 fEventNumberInFile = header.fEventNumberInFile;
98 fBunchCrossNumber = header.fBunchCrossNumber;
99 fTriggerCluster = header.fTriggerCluster;
53eef471 100 fL0TriggerInputs = header.fL0TriggerInputs;
101 fL1TriggerInputs = header.fL1TriggerInputs;
102 fL2TriggerInputs = header.fL2TriggerInputs;
bf1f98c4 103 fTriggerScalers = header.fTriggerScalers;
c47cda51 104 for(Int_t i = 0; i<kNMaxIR ; i++) {
105 if(header.fIRArray[i])fIRArray[i] = new AliTriggerIR(*header.fIRArray[i]);
106 else fIRArray[i]=0;
107 }
4f036e6e 108 SetName(header.fName);
109 SetTitle(header.fTitle);
110
d5ebf00e 111 }
112 return *this;
113}
114
bf1f98c4 115void AliESDHeader::Copy(TObject &obj) const
116{
732a24fe 117 // this overwrites the virtual TOBject::Copy()
118 // to allow run time copying without casting
119 // in AliESDEvent
120
121 if(this==&obj)return;
122 AliESDHeader *robj = dynamic_cast<AliESDHeader*>(&obj);
123 if(!robj)return; // not an AliESDHeader
124 *robj = *this;
125
126}
d5ebf00e 127//______________________________________________________________________________
128void AliESDHeader::Reset()
129{
130 // reset all data members
131 fTriggerMask = 0;
132 fOrbitNumber = 0;
133 fTimeStamp = 0;
134 fEventType = 0;
fd2e2210 135 fEventSpecie = 0;
4f036e6e 136 fPeriodNumber = 0;
d5ebf00e 137 fEventNumberInFile = 0;
138 fBunchCrossNumber = 0;
139 fTriggerCluster = 0;
53eef471 140 fL0TriggerInputs = 0;
141 fL1TriggerInputs = 0;
142 fL2TriggerInputs = 0;
bf1f98c4 143 fTriggerScalers.Reset();
c47cda51 144 for(Int_t i=0;i<kNMaxIR;i++)if(fIRArray[i]){
145 delete fIRArray[i];
146 fIRArray[i]=0;
147 }
d5ebf00e 148}
76a7c65b 149//______________________________________________________________________________
c47cda51 150Bool_t AliESDHeader::AddTriggerIR(const AliTriggerIR* ir)
76a7c65b 151{
152 // Adds trigger interaction record to array
c47cda51 153 for(Int_t i=0;i<kNMaxIR;i++){
b7b66e38 154 if(!fIRArray[i]){
8b44b965 155 fIRArray[i]=new AliTriggerIR(*ir);
b7b66e38 156 return 0;
157 }
c47cda51 158 }
b7b66e38 159 //AliErrorClass("Attempt to add # of IRs > kNMaxIR \n");
c47cda51 160 return 1;
76a7c65b 161}
d5ebf00e 162//______________________________________________________________________________
163void AliESDHeader::Print(const Option_t *) const
164{
165 // Print some data members
166 printf("Event # %d in file Bunch crossing # %d Orbit # %d Trigger %lld \n",
167 GetEventNumberInFile(),
168 GetBunchCrossNumber(),
169 GetOrbitNumber(),
170 GetTriggerMask());
171}
172