]>
Commit | Line | Data |
---|---|---|
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 | **************************************************************************/ | |
f009b5c1 | 15 | #include <TNamed.h> |
8d218603 | 16 | #include <TGeoMatrix.h> |
d5ebf00e | 17 | |
18 | #include "AliESDRun.h" | |
19 | #include "AliESDVertex.h" | |
f009b5c1 | 20 | #include "AliLog.h" |
d5ebf00e | 21 | |
22 | //------------------------------------------------------------------------- | |
23 | // Implementation Class AliESDRun | |
24 | // Run by run data | |
25 | // for the ESD | |
26 | // Origin: Christian Klein-Boesing, CERN, Christian.Klein-Boesing@cern.ch | |
27 | //------------------------------------------------------------------------- | |
28 | ||
29 | ClassImp(AliESDRun) | |
30 | ||
31 | //______________________________________________________________________________ | |
32 | AliESDRun::AliESDRun() : | |
694aad0c | 33 | TObject(), |
34 | fMagneticField(0), | |
d5ebf00e | 35 | fPeriodNumber(0), |
694aad0c | 36 | fRunNumber(0), |
f009b5c1 | 37 | fRecoVersion(0), |
38 | fTriggerClasses(kNTriggerClasses) | |
d5ebf00e | 39 | { |
40 | for (Int_t i=0; i<2; i++) fDiamondXY[i]=0.; | |
a2dedd16 | 41 | fDiamondCovXY[0]=fDiamondCovXY[2]=3.*3.; |
42 | fDiamondCovXY[1]=0.; | |
f009b5c1 | 43 | fTriggerClasses.SetOwner(kTRUE); |
8d218603 | 44 | for (Int_t m=0; m<kNPHOSMatrix; m++) fPHOSMatrix[m]=NULL; |
d5ebf00e | 45 | } |
46 | ||
47 | //______________________________________________________________________________ | |
48 | AliESDRun::AliESDRun(const AliESDRun &esd) : | |
49 | TObject(esd), | |
694aad0c | 50 | fMagneticField(esd.fMagneticField), |
d5ebf00e | 51 | fPeriodNumber(esd.fPeriodNumber), |
694aad0c | 52 | fRunNumber(esd.fRunNumber), |
f009b5c1 | 53 | fRecoVersion(esd.fRecoVersion), |
54 | fTriggerClasses(TObjArray(kNTriggerClasses)) | |
d5ebf00e | 55 | { |
56 | // Copy constructor | |
57 | for (Int_t i=0; i<2; i++) fDiamondXY[i]=esd.fDiamondXY[i]; | |
58 | for (Int_t i=0; i<3; i++) fDiamondCovXY[i]=esd.fDiamondCovXY[i]; | |
f009b5c1 | 59 | |
60 | for(Int_t i = 0; i < kNTriggerClasses; i++) { | |
61 | TNamed *str = (TNamed *)((esd.fTriggerClasses).At(i)); | |
62 | if (str) fTriggerClasses.AddAt(new TNamed(*str),i); | |
63 | } | |
8d218603 | 64 | |
65 | for(Int_t m=0; m<kNPHOSMatrix; m++){ | |
66 | if(esd.fPHOSMatrix[m]) | |
67 | fPHOSMatrix[m]=new TGeoHMatrix(*(esd.fPHOSMatrix[m])) ; | |
68 | else | |
69 | fPHOSMatrix[m]=NULL; | |
70 | } | |
d5ebf00e | 71 | } |
72 | ||
73 | //______________________________________________________________________________ | |
74 | AliESDRun& AliESDRun::operator=(const AliESDRun &esd) | |
75 | { | |
76 | // assigment operator | |
77 | if(this!=&esd) { | |
78 | TObject::operator=(esd); | |
79 | fRunNumber=esd.fRunNumber; | |
8d218603 | 80 | fPeriodNumber=esd.fPeriodNumber; |
81 | fRecoVersion=esd.fRecoVersion; | |
82 | fMagneticField=esd.fMagneticField; | |
83 | for (Int_t i=0; i<2; i++) fDiamondXY[i]=esd.fDiamondXY[i]; | |
84 | for (Int_t i=0; i<3; i++) fDiamondCovXY[i]=esd.fDiamondCovXY[i]; | |
85 | fTriggerClasses.Clear(); | |
86 | for(Int_t i = 0; i < kNTriggerClasses; i++) { | |
87 | TNamed *str = (TNamed *)((esd.fTriggerClasses).At(i)); | |
88 | if (str) fTriggerClasses.AddAt(new TNamed(*str),i); | |
89 | } | |
90 | ||
91 | for(Int_t m=0; m<kNPHOSMatrix; m++){ | |
92 | if(esd.fPHOSMatrix[m]) | |
93 | fPHOSMatrix[m]=new TGeoHMatrix(*(esd.fPHOSMatrix[m])) ; | |
94 | else | |
95 | fPHOSMatrix[m]=0; | |
96 | } | |
d5ebf00e | 97 | } |
98 | return *this; | |
99 | } | |
100 | ||
732a24fe | 101 | void AliESDRun::Copy(TObject &obj) const{ |
102 | ||
103 | // this overwrites the virtual TOBject::Copy() | |
104 | // to allow run time copying without casting | |
105 | // in AliESDEvent | |
106 | ||
107 | if(this==&obj)return; | |
108 | AliESDRun *robj = dynamic_cast<AliESDRun*>(&obj); | |
109 | if(!robj)return; // not an aliesdrun | |
110 | *robj = *this; | |
111 | ||
112 | } | |
113 | ||
8d218603 | 114 | //______________________________________________________________________________ |
115 | AliESDRun::~AliESDRun() { | |
116 | // Destructor | |
117 | // Delete PHOS position matrices | |
118 | for(Int_t m=0; m<kNPHOSMatrix; m++) { | |
119 | if(fPHOSMatrix[m]) delete fPHOSMatrix[m] ; | |
120 | fPHOSMatrix[m] = NULL; | |
121 | } | |
122 | } | |
123 | ||
d5ebf00e | 124 | void AliESDRun::SetDiamond(const AliESDVertex *vertex) { |
125 | // set the interaction diamond | |
126 | fDiamondXY[0]=vertex->GetXv(); | |
127 | fDiamondXY[1]=vertex->GetYv(); | |
128 | Double32_t cov[6]; | |
129 | vertex->GetCovMatrix(cov); | |
130 | fDiamondCovXY[0]=cov[0]; | |
131 | fDiamondCovXY[1]=cov[1]; | |
132 | fDiamondCovXY[2]=cov[2]; | |
133 | } | |
134 | ||
135 | ||
136 | //______________________________________________________________________________ | |
137 | void AliESDRun::Print(const Option_t *) const | |
138 | { | |
139 | // Print some data members | |
140 | printf("Mean vertex in RUN %d: X=%.4f Y=%.4f cm\n", | |
141 | GetRunNumber(),GetDiamondX(),GetDiamondY()); | |
142 | printf("Magnetic field = %f T\n", | |
143 | GetMagneticField()); | |
144 | printf("Event from reconstruction version %d \n",fRecoVersion); | |
f009b5c1 | 145 | |
146 | printf("List of active trigger classes: "); | |
147 | for(Int_t i = 0; i < kNTriggerClasses; i++) { | |
148 | TNamed *str = (TNamed *)((fTriggerClasses).At(i)); | |
149 | printf("%s ",str->GetName()); | |
150 | } | |
151 | printf("\n"); | |
d5ebf00e | 152 | } |
153 | ||
154 | void AliESDRun::Reset() | |
155 | { | |
156 | // reset data members | |
157 | fRunNumber = 0; | |
158 | fPeriodNumber = 0; | |
159 | fRecoVersion = 0; | |
160 | fMagneticField = 0; | |
161 | for (Int_t i=0; i<2; i++) fDiamondXY[i]=0.; | |
a2dedd16 | 162 | fDiamondCovXY[0]=fDiamondCovXY[2]=3.*3.; |
163 | fDiamondCovXY[1]=0.; | |
f009b5c1 | 164 | fTriggerClasses.Clear(); |
165 | } | |
166 | ||
167 | //______________________________________________________________________________ | |
168 | void AliESDRun::SetTriggerClass(const char*name, Int_t index) | |
169 | { | |
170 | // Fill the trigger class name | |
171 | // into the corresponding array | |
172 | if (index >= kNTriggerClasses || index < 0) { | |
173 | AliError(Form("Index (%d) is outside the allowed range (0,49)!",index)); | |
174 | return; | |
175 | } | |
176 | ||
177 | fTriggerClasses.AddAt(new TNamed(name,NULL),index); | |
178 | } | |
179 | ||
180 | //______________________________________________________________________________ | |
181 | const char* AliESDRun::GetTriggerClass(Int_t index) const | |
182 | { | |
183 | // Get the trigger class name at | |
184 | // specified position in the trigger mask | |
185 | TNamed *trclass = (TNamed *)fTriggerClasses.At(index); | |
186 | if (trclass) | |
187 | return trclass->GetName(); | |
188 | else | |
189 | return ""; | |
190 | } | |
191 | ||
192 | //______________________________________________________________________________ | |
193 | TString AliESDRun::GetActiveTriggerClasses() const | |
194 | { | |
195 | // Construct and return | |
196 | // the list of trigger classes | |
197 | // which are present in the run | |
198 | TString trclasses; | |
199 | for(Int_t i = 0; i < kNTriggerClasses; i++) { | |
200 | TNamed *str = (TNamed *)((fTriggerClasses).At(i)); | |
201 | if (str) { | |
202 | trclasses += " "; | |
203 | trclasses += str->GetName(); | |
204 | trclasses += " "; | |
205 | } | |
206 | } | |
207 | ||
208 | return trclasses; | |
209 | } | |
210 | ||
211 | //______________________________________________________________________________ | |
212 | TString AliESDRun::GetFiredTriggerClasses(ULong64_t mask) const | |
213 | { | |
214 | // Constructs and returns the | |
215 | // list of trigger classes that | |
216 | // have been fired. Uses the trigger | |
217 | // class mask as an argument. | |
218 | TString trclasses; | |
219 | for(Int_t i = 0; i < kNTriggerClasses; i++) { | |
2c736180 | 220 | if (mask & (1 << i)) { |
f009b5c1 | 221 | TNamed *str = (TNamed *)((fTriggerClasses).At(i)); |
222 | if (str) { | |
223 | trclasses += " "; | |
224 | trclasses += str->GetName(); | |
225 | trclasses += " "; | |
226 | } | |
227 | } | |
228 | } | |
229 | ||
230 | return trclasses; | |
d5ebf00e | 231 | } |
232 | ||
f009b5c1 | 233 | //______________________________________________________________________________ |
234 | Bool_t AliESDRun::IsTriggerClassFired(ULong64_t mask, const char *name) const | |
235 | { | |
236 | // Checks if the trigger class | |
237 | // identified by 'name' has been | |
238 | // fired. Uses the trigger class mask. | |
239 | ||
240 | TNamed *trclass = (TNamed *)fTriggerClasses.FindObject(name); | |
241 | if (!trclass) return kFALSE; | |
242 | ||
243 | Int_t iclass = fTriggerClasses.IndexOf(trclass); | |
244 | if (iclass < 0) return kFALSE; | |
245 | ||
2c736180 | 246 | if (mask & (1 << iclass)) |
f009b5c1 | 247 | return kTRUE; |
248 | else | |
249 | return kFALSE; | |
250 | } |