]>
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> |
33fe5eb1 | 17 | #include <TGeoGlobalMagField.h> |
d5ebf00e | 18 | |
19 | #include "AliESDRun.h" | |
20 | #include "AliESDVertex.h" | |
f009b5c1 | 21 | #include "AliLog.h" |
33fe5eb1 | 22 | #include "AliMagF.h" |
d5ebf00e | 23 | |
24 | //------------------------------------------------------------------------- | |
25 | // Implementation Class AliESDRun | |
26 | // Run by run data | |
27 | // for the ESD | |
28 | // Origin: Christian Klein-Boesing, CERN, Christian.Klein-Boesing@cern.ch | |
29 | //------------------------------------------------------------------------- | |
30 | ||
31 | ClassImp(AliESDRun) | |
32 | ||
33 | //______________________________________________________________________________ | |
34 | AliESDRun::AliESDRun() : | |
694aad0c | 35 | TObject(), |
33fe5eb1 | 36 | fCurrentL3(0), |
37 | fCurrentDip(0), | |
38 | fBeamEnergy(0), | |
694aad0c | 39 | fMagneticField(0), |
1c7554f9 | 40 | fDiamondZ(0), |
41 | fDiamondSig2Z(0), | |
d5ebf00e | 42 | fPeriodNumber(0), |
694aad0c | 43 | fRunNumber(0), |
f009b5c1 | 44 | fRecoVersion(0), |
33fe5eb1 | 45 | fBeamType(""), |
7b649c02 | 46 | fTriggerClasses(kNTriggerClasses), |
47 | fDetInDAQ(0), | |
48 | fDetInReco(0) | |
d5ebf00e | 49 | { |
50 | for (Int_t i=0; i<2; i++) fDiamondXY[i]=0.; | |
a2dedd16 | 51 | fDiamondCovXY[0]=fDiamondCovXY[2]=3.*3.; |
52 | fDiamondCovXY[1]=0.; | |
f009b5c1 | 53 | fTriggerClasses.SetOwner(kTRUE); |
b671618d | 54 | fMeanBeamInt[0][0]=fMeanBeamInt[0][1]=fMeanBeamInt[1][0]=fMeanBeamInt[1][1]=-1; |
8d218603 | 55 | for (Int_t m=0; m<kNPHOSMatrix; m++) fPHOSMatrix[m]=NULL; |
428557af | 56 | for (Int_t sm=0; sm<kNEMCALMatrix; sm++) fEMCALMatrix[sm]=NULL; |
d5ebf00e | 57 | } |
58 | ||
59 | //______________________________________________________________________________ | |
60 | AliESDRun::AliESDRun(const AliESDRun &esd) : | |
61 | TObject(esd), | |
33fe5eb1 | 62 | fCurrentL3(0), |
63 | fCurrentDip(0), | |
64 | fBeamEnergy(0), | |
694aad0c | 65 | fMagneticField(esd.fMagneticField), |
1c7554f9 | 66 | fDiamondZ(esd.fDiamondZ), |
67 | fDiamondSig2Z(esd.fDiamondSig2Z), | |
d5ebf00e | 68 | fPeriodNumber(esd.fPeriodNumber), |
694aad0c | 69 | fRunNumber(esd.fRunNumber), |
f009b5c1 | 70 | fRecoVersion(esd.fRecoVersion), |
33fe5eb1 | 71 | fBeamType(""), |
7b649c02 | 72 | fTriggerClasses(TObjArray(kNTriggerClasses)), |
73 | fDetInDAQ(0), | |
74 | fDetInReco(0) | |
d5ebf00e | 75 | { |
76 | // Copy constructor | |
77 | for (Int_t i=0; i<2; i++) fDiamondXY[i]=esd.fDiamondXY[i]; | |
78 | for (Int_t i=0; i<3; i++) fDiamondCovXY[i]=esd.fDiamondCovXY[i]; | |
f009b5c1 | 79 | |
80 | for(Int_t i = 0; i < kNTriggerClasses; i++) { | |
81 | TNamed *str = (TNamed *)((esd.fTriggerClasses).At(i)); | |
82 | if (str) fTriggerClasses.AddAt(new TNamed(*str),i); | |
83 | } | |
8d218603 | 84 | |
85 | for(Int_t m=0; m<kNPHOSMatrix; m++){ | |
86 | if(esd.fPHOSMatrix[m]) | |
87 | fPHOSMatrix[m]=new TGeoHMatrix(*(esd.fPHOSMatrix[m])) ; | |
88 | else | |
89 | fPHOSMatrix[m]=NULL; | |
90 | } | |
b671618d | 91 | |
92 | for (int ib=2;ib--;) for (int it=2;it--;) fMeanBeamInt[ib][it] = esd.fMeanBeamInt[ib][it]; | |
93 | ||
428557af | 94 | for(Int_t sm=0; sm<kNEMCALMatrix; sm++){ |
95 | if(esd.fEMCALMatrix[sm]) | |
96 | fEMCALMatrix[sm]=new TGeoHMatrix(*(esd.fEMCALMatrix[sm])) ; | |
97 | else | |
98 | fEMCALMatrix[sm]=NULL; | |
99 | } | |
d5ebf00e | 100 | } |
101 | ||
102 | //______________________________________________________________________________ | |
103 | AliESDRun& AliESDRun::operator=(const AliESDRun &esd) | |
104 | { | |
105 | // assigment operator | |
106 | if(this!=&esd) { | |
107 | TObject::operator=(esd); | |
108 | fRunNumber=esd.fRunNumber; | |
8d218603 | 109 | fPeriodNumber=esd.fPeriodNumber; |
110 | fRecoVersion=esd.fRecoVersion; | |
111 | fMagneticField=esd.fMagneticField; | |
1c7554f9 | 112 | fDiamondZ=esd.fDiamondZ; |
113 | fDiamondSig2Z=esd.fDiamondSig2Z; | |
33fe5eb1 | 114 | fBeamType = esd.fBeamType; |
115 | fCurrentL3 = esd.fCurrentL3; | |
116 | fCurrentDip = esd.fCurrentDip; | |
117 | fBeamEnergy = esd.fBeamEnergy; | |
8d218603 | 118 | for (Int_t i=0; i<2; i++) fDiamondXY[i]=esd.fDiamondXY[i]; |
119 | for (Int_t i=0; i<3; i++) fDiamondCovXY[i]=esd.fDiamondCovXY[i]; | |
120 | fTriggerClasses.Clear(); | |
121 | for(Int_t i = 0; i < kNTriggerClasses; i++) { | |
122 | TNamed *str = (TNamed *)((esd.fTriggerClasses).At(i)); | |
123 | if (str) fTriggerClasses.AddAt(new TNamed(*str),i); | |
124 | } | |
125 | ||
7b649c02 | 126 | fDetInDAQ = esd.fDetInDAQ; |
127 | fDetInReco = esd.fDetInReco; | |
128 | ||
b671618d | 129 | for (int ib=2;ib--;) for (int it=2;it--;) fMeanBeamInt[ib][it] = esd.fMeanBeamInt[ib][it]; |
130 | ||
8d218603 | 131 | for(Int_t m=0; m<kNPHOSMatrix; m++){ |
132 | if(esd.fPHOSMatrix[m]) | |
133 | fPHOSMatrix[m]=new TGeoHMatrix(*(esd.fPHOSMatrix[m])) ; | |
134 | else | |
135 | fPHOSMatrix[m]=0; | |
136 | } | |
428557af | 137 | |
138 | for(Int_t sm=0; sm<kNEMCALMatrix; sm++){ | |
139 | if(esd.fEMCALMatrix[sm]) | |
140 | fEMCALMatrix[sm]=new TGeoHMatrix(*(esd.fEMCALMatrix[sm])) ; | |
141 | else | |
142 | fEMCALMatrix[sm]=0; | |
143 | } | |
d5ebf00e | 144 | } |
145 | return *this; | |
146 | } | |
147 | ||
732a24fe | 148 | void AliESDRun::Copy(TObject &obj) const{ |
149 | ||
150 | // this overwrites the virtual TOBject::Copy() | |
151 | // to allow run time copying without casting | |
152 | // in AliESDEvent | |
153 | ||
154 | if(this==&obj)return; | |
155 | AliESDRun *robj = dynamic_cast<AliESDRun*>(&obj); | |
156 | if(!robj)return; // not an aliesdrun | |
157 | *robj = *this; | |
158 | ||
159 | } | |
160 | ||
8d218603 | 161 | //______________________________________________________________________________ |
162 | AliESDRun::~AliESDRun() { | |
163 | // Destructor | |
164 | // Delete PHOS position matrices | |
165 | for(Int_t m=0; m<kNPHOSMatrix; m++) { | |
166 | if(fPHOSMatrix[m]) delete fPHOSMatrix[m] ; | |
167 | fPHOSMatrix[m] = NULL; | |
168 | } | |
428557af | 169 | // Delete PHOS position matrices |
170 | for(Int_t sm=0; sm<kNEMCALMatrix; sm++) { | |
171 | if(fEMCALMatrix[sm]) delete fEMCALMatrix[sm] ; | |
172 | fEMCALMatrix[sm] = NULL; | |
173 | } | |
8d218603 | 174 | } |
175 | ||
d5ebf00e | 176 | void AliESDRun::SetDiamond(const AliESDVertex *vertex) { |
177 | // set the interaction diamond | |
178 | fDiamondXY[0]=vertex->GetXv(); | |
179 | fDiamondXY[1]=vertex->GetYv(); | |
1c7554f9 | 180 | fDiamondZ=vertex->GetZv(); |
d5ebf00e | 181 | Double32_t cov[6]; |
182 | vertex->GetCovMatrix(cov); | |
183 | fDiamondCovXY[0]=cov[0]; | |
184 | fDiamondCovXY[1]=cov[1]; | |
185 | fDiamondCovXY[2]=cov[2]; | |
1c7554f9 | 186 | fDiamondSig2Z=cov[5]; |
d5ebf00e | 187 | } |
188 | ||
189 | ||
190 | //______________________________________________________________________________ | |
191 | void AliESDRun::Print(const Option_t *) const | |
192 | { | |
193 | // Print some data members | |
1c7554f9 | 194 | printf("Mean vertex in RUN %d: X=%.4f Y=%.4f Z=%.4f cm\n", |
195 | GetRunNumber(),GetDiamondX(),GetDiamondY(),GetDiamondZ()); | |
33fe5eb1 | 196 | printf("Beam Type: %s, Energy: %.1f GeV\n",fBeamType.IsNull() ? "N/A":fBeamType.Data(),fBeamEnergy); |
197 | printf("Magnetic field in IP= %f T | Currents: L3:%+.1f Dipole:%+.1f %s\n", | |
198 | GetMagneticField(),fCurrentL3,fCurrentDip,TestBit(kUniformBMap) ? "(Uniform)":""); | |
d5ebf00e | 199 | printf("Event from reconstruction version %d \n",fRecoVersion); |
f009b5c1 | 200 | |
201 | printf("List of active trigger classes: "); | |
202 | for(Int_t i = 0; i < kNTriggerClasses; i++) { | |
203 | TNamed *str = (TNamed *)((fTriggerClasses).At(i)); | |
384e7a60 | 204 | if (str) printf("%s ",str->GetName()); |
f009b5c1 | 205 | } |
b671618d | 206 | printf("Mean intenstity for interacting : beam1:%+.3e beam2:%+.3e\n",fMeanBeamInt[0][0],fMeanBeamInt[1][0]); |
207 | printf("Mean intenstity for non-intecting : beam1:%+.3e beam2:%+.3e\n",fMeanBeamInt[0][1],fMeanBeamInt[1][1]); | |
f009b5c1 | 208 | printf("\n"); |
d5ebf00e | 209 | } |
210 | ||
211 | void AliESDRun::Reset() | |
212 | { | |
213 | // reset data members | |
214 | fRunNumber = 0; | |
215 | fPeriodNumber = 0; | |
216 | fRecoVersion = 0; | |
217 | fMagneticField = 0; | |
11be4f1c | 218 | fCurrentL3 = 0; |
219 | fCurrentDip = 0; | |
220 | fBeamEnergy = 0; | |
221 | fBeamType = ""; | |
5cf76849 | 222 | ResetBit(kBInfoStored|kUniformBMap|kConvSqrtSHalfGeV); |
d5ebf00e | 223 | for (Int_t i=0; i<2; i++) fDiamondXY[i]=0.; |
a2dedd16 | 224 | fDiamondCovXY[0]=fDiamondCovXY[2]=3.*3.; |
225 | fDiamondCovXY[1]=0.; | |
1c7554f9 | 226 | fDiamondZ=0.; |
227 | fDiamondSig2Z=10.*10.; | |
f009b5c1 | 228 | fTriggerClasses.Clear(); |
7b649c02 | 229 | fDetInDAQ = 0; |
230 | fDetInReco = 0; | |
f009b5c1 | 231 | } |
232 | ||
233 | //______________________________________________________________________________ | |
234 | void AliESDRun::SetTriggerClass(const char*name, Int_t index) | |
235 | { | |
236 | // Fill the trigger class name | |
237 | // into the corresponding array | |
238 | if (index >= kNTriggerClasses || index < 0) { | |
239 | AliError(Form("Index (%d) is outside the allowed range (0,49)!",index)); | |
240 | return; | |
241 | } | |
242 | ||
243 | fTriggerClasses.AddAt(new TNamed(name,NULL),index); | |
244 | } | |
245 | ||
246 | //______________________________________________________________________________ | |
247 | const char* AliESDRun::GetTriggerClass(Int_t index) const | |
248 | { | |
249 | // Get the trigger class name at | |
250 | // specified position in the trigger mask | |
251 | TNamed *trclass = (TNamed *)fTriggerClasses.At(index); | |
252 | if (trclass) | |
253 | return trclass->GetName(); | |
254 | else | |
255 | return ""; | |
256 | } | |
257 | ||
258 | //______________________________________________________________________________ | |
259 | TString AliESDRun::GetActiveTriggerClasses() const | |
260 | { | |
261 | // Construct and return | |
262 | // the list of trigger classes | |
263 | // which are present in the run | |
264 | TString trclasses; | |
265 | for(Int_t i = 0; i < kNTriggerClasses; i++) { | |
266 | TNamed *str = (TNamed *)((fTriggerClasses).At(i)); | |
267 | if (str) { | |
268 | trclasses += " "; | |
269 | trclasses += str->GetName(); | |
270 | trclasses += " "; | |
271 | } | |
272 | } | |
273 | ||
274 | return trclasses; | |
275 | } | |
276 | ||
277 | //______________________________________________________________________________ | |
278 | TString AliESDRun::GetFiredTriggerClasses(ULong64_t mask) const | |
279 | { | |
280 | // Constructs and returns the | |
281 | // list of trigger classes that | |
282 | // have been fired. Uses the trigger | |
283 | // class mask as an argument. | |
284 | TString trclasses; | |
285 | for(Int_t i = 0; i < kNTriggerClasses; i++) { | |
a62d86d6 | 286 | if (mask & (1ull << i)) { |
f009b5c1 | 287 | TNamed *str = (TNamed *)((fTriggerClasses).At(i)); |
288 | if (str) { | |
289 | trclasses += " "; | |
290 | trclasses += str->GetName(); | |
291 | trclasses += " "; | |
292 | } | |
293 | } | |
294 | } | |
295 | ||
296 | return trclasses; | |
d5ebf00e | 297 | } |
298 | ||
f009b5c1 | 299 | //______________________________________________________________________________ |
300 | Bool_t AliESDRun::IsTriggerClassFired(ULong64_t mask, const char *name) const | |
301 | { | |
302 | // Checks if the trigger class | |
303 | // identified by 'name' has been | |
304 | // fired. Uses the trigger class mask. | |
305 | ||
306 | TNamed *trclass = (TNamed *)fTriggerClasses.FindObject(name); | |
307 | if (!trclass) return kFALSE; | |
308 | ||
309 | Int_t iclass = fTriggerClasses.IndexOf(trclass); | |
310 | if (iclass < 0) return kFALSE; | |
311 | ||
a62d86d6 | 312 | if (mask & (1ull << iclass)) |
f009b5c1 | 313 | return kTRUE; |
314 | else | |
315 | return kFALSE; | |
316 | } | |
33fe5eb1 | 317 | |
318 | //_____________________________________________________________________________ | |
319 | Bool_t AliESDRun::InitMagneticField() const | |
320 | { | |
321 | // Create mag field from stored information | |
322 | // | |
323 | if (!TestBit(kBInfoStored)) { | |
324 | AliError("No information on currents, cannot create field from run header"); | |
325 | return kFALSE; | |
326 | } | |
327 | // | |
328 | if ( TGeoGlobalMagField::Instance()->IsLocked() ) { | |
329 | if (TGeoGlobalMagField::Instance()->GetField()->TestBit(AliMagF::kOverrideGRP)) { | |
330 | AliInfo("ExpertMode!!! Information on magnet currents will be ignored !"); | |
331 | AliInfo("ExpertMode!!! Running with the externally locked B field !"); | |
332 | return kTRUE; | |
333 | } | |
334 | else { | |
335 | AliInfo("Destroying existing B field instance!"); | |
336 | delete TGeoGlobalMagField::Instance(); | |
337 | } | |
338 | } | |
339 | // | |
340 | AliMagF* fld = AliMagF::CreateFieldMap(fCurrentL3,fCurrentDip,AliMagF::kConvLHC, | |
5cf76849 | 341 | TestBit(kUniformBMap), GetBeamEnergy(), GetBeamType()); |
33fe5eb1 | 342 | if (fld) { |
343 | TGeoGlobalMagField::Instance()->SetField( fld ); | |
344 | TGeoGlobalMagField::Instance()->Lock(); | |
345 | AliInfo("Running with the B field constructed out of the Run Header !"); | |
346 | return kTRUE; | |
347 | } | |
348 | else { | |
349 | AliError("Failed to create a B field map !"); | |
350 | return kFALSE; | |
351 | } | |
352 | // | |
353 | } |