Bug fix. Removed delete statement
[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),
4f036e6e 38 fPeriodNumber(0),
d5ebf00e 39 fEventNumberInFile(0),
40 fBunchCrossNumber(0),
53eef471 41 fTriggerCluster(0),
42 fL0TriggerInputs(0),
43 fL1TriggerInputs(0),
bf1f98c4 44 fL2TriggerInputs(0),
99dd1587 45 fTriggerScalers()
d5ebf00e 46{
9ae2e5e6 47 // default constructor
48
49 SetName("AliESDHeader");
c47cda51 50 for(Int_t i = 0; i<kNMaxIR ; i++) fIRArray[i] = 0;
51
9ae2e5e6 52}
9ae2e5e6 53AliESDHeader::~AliESDHeader()
54{
55 // destructor
c47cda51 56 for(Int_t i=0;i<kNMaxIR;i++)if(fIRArray[i])delete fIRArray[i];
d5ebf00e 57}
58
59
60AliESDHeader::AliESDHeader(const AliESDHeader &header) :
9ae2e5e6 61 AliVHeader(header),
d5ebf00e 62 fTriggerMask(header.fTriggerMask),
63 fOrbitNumber(header.fOrbitNumber),
64 fTimeStamp(header.fTimeStamp),
65 fEventType(header.fEventType),
4f036e6e 66 fPeriodNumber(header.fPeriodNumber),
d5ebf00e 67 fEventNumberInFile(header.fEventNumberInFile),
68 fBunchCrossNumber(header.fBunchCrossNumber),
53eef471 69 fTriggerCluster(header.fTriggerCluster),
70 fL0TriggerInputs(header.fL0TriggerInputs),
71 fL1TriggerInputs(header.fL1TriggerInputs),
bf1f98c4 72 fL2TriggerInputs(header.fL2TriggerInputs),
99dd1587 73 fTriggerScalers(header.fTriggerScalers)
d5ebf00e 74{
75 // copy constructor
9ae2e5e6 76 SetName(header.fName);
77 SetTitle(header.fTitle);
c47cda51 78 for(Int_t i = 0; i<kNMaxIR ; i++) {
79 if(header.fIRArray[i])fIRArray[i] = new AliTriggerIR(*header.fIRArray[i]);
80 else fIRArray[i]=0;
81 }
d5ebf00e 82}
83
84AliESDHeader& AliESDHeader::operator=(const AliESDHeader &header)
85{
86 // assigment operator
87 if(this!=&header) {
9ae2e5e6 88 AliVHeader::operator=(header);
d5ebf00e 89 fTriggerMask = header.fTriggerMask;
90 fOrbitNumber = header.fOrbitNumber;
91 fTimeStamp = header.fTimeStamp;
92 fEventType = header.fEventType;
4f036e6e 93 fPeriodNumber = header.fPeriodNumber;
d5ebf00e 94 fEventNumberInFile = header.fEventNumberInFile;
95 fBunchCrossNumber = header.fBunchCrossNumber;
96 fTriggerCluster = header.fTriggerCluster;
53eef471 97 fL0TriggerInputs = header.fL0TriggerInputs;
98 fL1TriggerInputs = header.fL1TriggerInputs;
99 fL2TriggerInputs = header.fL2TriggerInputs;
bf1f98c4 100 fTriggerScalers = header.fTriggerScalers;
c47cda51 101 for(Int_t i = 0; i<kNMaxIR ; i++) {
102 if(header.fIRArray[i])fIRArray[i] = new AliTriggerIR(*header.fIRArray[i]);
103 else fIRArray[i]=0;
104 }
4f036e6e 105 SetName(header.fName);
106 SetTitle(header.fTitle);
107
d5ebf00e 108 }
109 return *this;
110}
111
bf1f98c4 112void AliESDHeader::Copy(TObject &obj) const
113{
732a24fe 114 // this overwrites the virtual TOBject::Copy()
115 // to allow run time copying without casting
116 // in AliESDEvent
117
118 if(this==&obj)return;
119 AliESDHeader *robj = dynamic_cast<AliESDHeader*>(&obj);
120 if(!robj)return; // not an AliESDHeader
121 *robj = *this;
122
123}
d5ebf00e 124//______________________________________________________________________________
125void AliESDHeader::Reset()
126{
127 // reset all data members
128 fTriggerMask = 0;
129 fOrbitNumber = 0;
130 fTimeStamp = 0;
131 fEventType = 0;
4f036e6e 132 fPeriodNumber = 0;
d5ebf00e 133 fEventNumberInFile = 0;
134 fBunchCrossNumber = 0;
135 fTriggerCluster = 0;
53eef471 136 fL0TriggerInputs = 0;
137 fL1TriggerInputs = 0;
138 fL2TriggerInputs = 0;
bf1f98c4 139 fTriggerScalers.Reset();
c47cda51 140 for(Int_t i=0;i<kNMaxIR;i++)if(fIRArray[i]){
141 delete fIRArray[i];
142 fIRArray[i]=0;
143 }
d5ebf00e 144}
76a7c65b 145//______________________________________________________________________________
c47cda51 146Bool_t AliESDHeader::AddTriggerIR(const AliTriggerIR* ir)
76a7c65b 147{
148 // Adds trigger interaction record to array
c47cda51 149 for(Int_t i=0;i<kNMaxIR;i++){
b7b66e38 150 if(!fIRArray[i]){
151 fIRArray[i]=const_cast<AliTriggerIR*>(ir);
152 return 0;
153 }
c47cda51 154 }
b7b66e38 155 //AliErrorClass("Attempt to add # of IRs > kNMaxIR \n");
c47cda51 156 return 1;
76a7c65b 157}
d5ebf00e 158//______________________________________________________________________________
159void AliESDHeader::Print(const Option_t *) const
160{
161 // Print some data members
162 printf("Event # %d in file Bunch crossing # %d Orbit # %d Trigger %lld \n",
163 GetEventNumberInFile(),
164 GetBunchCrossNumber(),
165 GetOrbitNumber(),
166 GetTriggerMask());
167}
168