Applying some of the naming convention rules.
[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"
d5ebf00e 27
28ClassImp(AliESDHeader)
29
30//______________________________________________________________________________
31AliESDHeader::AliESDHeader() :
9ae2e5e6 32 AliVHeader(),
d5ebf00e 33 fTriggerMask(0),
34 fOrbitNumber(0),
35 fTimeStamp(0),
36 fEventType(0),
4f036e6e 37 fPeriodNumber(0),
d5ebf00e 38 fEventNumberInFile(0),
39 fBunchCrossNumber(0),
53eef471 40 fTriggerCluster(0),
41 fL0TriggerInputs(0),
42 fL1TriggerInputs(0),
bf1f98c4 43 fL2TriggerInputs(0),
8258ca76 44 fTriggerScalers(),
c47cda51 45 fIRArray(0)
d5ebf00e 46{
9ae2e5e6 47 // default constructor
48
49 SetName("AliESDHeader");
c47cda51 50 fIRArray = new AliTriggerIR *[kNMaxIR];
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),
4f036e6e 67 fPeriodNumber(header.fPeriodNumber),
d5ebf00e 68 fEventNumberInFile(header.fEventNumberInFile),
69 fBunchCrossNumber(header.fBunchCrossNumber),
53eef471 70 fTriggerCluster(header.fTriggerCluster),
71 fL0TriggerInputs(header.fL0TriggerInputs),
72 fL1TriggerInputs(header.fL1TriggerInputs),
bf1f98c4 73 fL2TriggerInputs(header.fL2TriggerInputs),
8258ca76 74 fTriggerScalers(header.fTriggerScalers),
c47cda51 75 fIRArray(0)
d5ebf00e 76{
77 // copy constructor
9ae2e5e6 78 SetName(header.fName);
79 SetTitle(header.fTitle);
c47cda51 80 fIRArray = new AliTriggerIR *[kNMaxIR];
81 for(Int_t i = 0; i<kNMaxIR ; i++) {
82 if(header.fIRArray[i])fIRArray[i] = new AliTriggerIR(*header.fIRArray[i]);
83 else fIRArray[i]=0;
84 }
d5ebf00e 85}
86
87AliESDHeader& AliESDHeader::operator=(const AliESDHeader &header)
88{
89 // assigment operator
90 if(this!=&header) {
9ae2e5e6 91 AliVHeader::operator=(header);
d5ebf00e 92 fTriggerMask = header.fTriggerMask;
93 fOrbitNumber = header.fOrbitNumber;
94 fTimeStamp = header.fTimeStamp;
95 fEventType = header.fEventType;
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 fIRArray = new AliTriggerIR *[kNMaxIR];
105 for(Int_t i = 0; i<kNMaxIR ; i++) {
106 if(header.fIRArray[i])fIRArray[i] = new AliTriggerIR(*header.fIRArray[i]);
107 else fIRArray[i]=0;
108 }
4f036e6e 109 SetName(header.fName);
110 SetTitle(header.fTitle);
111
d5ebf00e 112 }
113 return *this;
114}
115
bf1f98c4 116void AliESDHeader::Copy(TObject &obj) const
117{
732a24fe 118 // this overwrites the virtual TOBject::Copy()
119 // to allow run time copying without casting
120 // in AliESDEvent
121
122 if(this==&obj)return;
123 AliESDHeader *robj = dynamic_cast<AliESDHeader*>(&obj);
124 if(!robj)return; // not an AliESDHeader
125 *robj = *this;
126
127}
d5ebf00e 128//______________________________________________________________________________
129void AliESDHeader::Reset()
130{
131 // reset all data members
132 fTriggerMask = 0;
133 fOrbitNumber = 0;
134 fTimeStamp = 0;
135 fEventType = 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++){
154 if(!fIRArray[i])fIRArray[i]=const_cast<AliTriggerIR*>(ir);
155 return 0;
156 }
157 return 1;
76a7c65b 158}
d5ebf00e 159//______________________________________________________________________________
160void AliESDHeader::Print(const Option_t *) const
161{
162 // Print some data members
163 printf("Event # %d in file Bunch crossing # %d Orbit # %d Trigger %lld \n",
164 GetEventNumberInFile(),
165 GetBunchCrossNumber(),
166 GetOrbitNumber(),
167 GetTriggerMask());
168}
169