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