1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 #include <TGeoMatrix.h>
17 #include <TGeoGlobalMagField.h>
19 #include "AliESDRun.h"
20 #include "AliESDVertex.h"
24 //-------------------------------------------------------------------------
25 // Implementation Class AliESDRun
28 // Origin: Christian Klein-Boesing, CERN, Christian.Klein-Boesing@cern.ch
29 //-------------------------------------------------------------------------
33 //______________________________________________________________________________
34 AliESDRun::AliESDRun() :
46 fTriggerClasses(kNTriggerClasses),
51 for (Int_t i=0; i<2; i++) fDiamondXY[i]=0.;
52 fDiamondCovXY[0]=fDiamondCovXY[2]=3.*3.;
54 fTriggerClasses.SetOwner(kTRUE);
55 fMeanBeamInt[0][0]=fMeanBeamInt[0][1]=fMeanBeamInt[1][0]=fMeanBeamInt[1][1]=-1;
56 for (Int_t m=0; m<kNPHOSMatrix; m++) fPHOSMatrix[m]=NULL;
57 for (Int_t sm=0; sm<kNEMCALMatrix; sm++) fEMCALMatrix[sm]=NULL;
58 for (Int_t i=0; i<kT0spreadSize;i++) fT0spread[i]=0.;
61 //______________________________________________________________________________
62 AliESDRun::AliESDRun(const AliESDRun &esd) :
67 fMagneticField(esd.fMagneticField),
68 fDiamondZ(esd.fDiamondZ),
69 fDiamondSig2Z(esd.fDiamondSig2Z),
70 fPeriodNumber(esd.fPeriodNumber),
71 fRunNumber(esd.fRunNumber),
72 fRecoVersion(esd.fRecoVersion),
74 fTriggerClasses(TObjArray(kNTriggerClasses)),
79 for (Int_t i=0; i<2; i++) fDiamondXY[i]=esd.fDiamondXY[i];
80 for (Int_t i=0; i<3; i++) fDiamondCovXY[i]=esd.fDiamondCovXY[i];
82 for(Int_t i = 0; i < kNTriggerClasses; i++) {
83 TNamed *str = (TNamed *)((esd.fTriggerClasses).At(i));
84 if (str) fTriggerClasses.AddAt(new TNamed(*str),i);
87 for(Int_t m=0; m<kNPHOSMatrix; m++){
88 if(esd.fPHOSMatrix[m])
89 fPHOSMatrix[m]=new TGeoHMatrix(*(esd.fPHOSMatrix[m])) ;
94 for (int ib=2;ib--;) for (int it=2;it--;) fMeanBeamInt[ib][it] = esd.fMeanBeamInt[ib][it];
96 for(Int_t sm=0; sm<kNEMCALMatrix; sm++){
97 if(esd.fEMCALMatrix[sm])
98 fEMCALMatrix[sm]=new TGeoHMatrix(*(esd.fEMCALMatrix[sm])) ;
100 fEMCALMatrix[sm]=NULL;
102 for (Int_t i=0; i<kT0spreadSize;i++) fT0spread[i]=esd.fT0spread[i];
106 //______________________________________________________________________________
107 AliESDRun& AliESDRun::operator=(const AliESDRun &esd)
109 // assigment operator
111 TObject::operator=(esd);
112 fRunNumber=esd.fRunNumber;
113 fPeriodNumber=esd.fPeriodNumber;
114 fRecoVersion=esd.fRecoVersion;
115 fMagneticField=esd.fMagneticField;
116 fDiamondZ=esd.fDiamondZ;
117 fDiamondSig2Z=esd.fDiamondSig2Z;
118 fBeamType = esd.fBeamType;
119 fCurrentL3 = esd.fCurrentL3;
120 fCurrentDip = esd.fCurrentDip;
121 fBeamEnergy = esd.fBeamEnergy;
122 for (Int_t i=0; i<2; i++) fDiamondXY[i]=esd.fDiamondXY[i];
123 for (Int_t i=0; i<3; i++) fDiamondCovXY[i]=esd.fDiamondCovXY[i];
124 fTriggerClasses.Clear();
125 for(Int_t i = 0; i < kNTriggerClasses; i++) {
126 TNamed *str = (TNamed *)((esd.fTriggerClasses).At(i));
127 if (str) fTriggerClasses.AddAt(new TNamed(*str),i);
130 fDetInDAQ = esd.fDetInDAQ;
131 fDetInReco = esd.fDetInReco;
133 for (int ib=2;ib--;) for (int it=2;it--;) fMeanBeamInt[ib][it] = esd.fMeanBeamInt[ib][it];
135 for(Int_t m=0; m<kNPHOSMatrix; m++){
136 if(esd.fPHOSMatrix[m])
137 fPHOSMatrix[m]=new TGeoHMatrix(*(esd.fPHOSMatrix[m])) ;
142 for(Int_t sm=0; sm<kNEMCALMatrix; sm++){
143 if(esd.fEMCALMatrix[sm])
144 fEMCALMatrix[sm]=new TGeoHMatrix(*(esd.fEMCALMatrix[sm])) ;
149 for (Int_t i=0; i<kT0spreadSize;i++) fT0spread[i]=esd.fT0spread[i];
153 void AliESDRun::Copy(TObject &obj) const{
155 // this overwrites the virtual TOBject::Copy()
156 // to allow run time copying without casting
159 if(this==&obj)return;
160 AliESDRun *robj = dynamic_cast<AliESDRun*>(&obj);
161 if(!robj)return; // not an aliesdrun
166 //______________________________________________________________________________
167 AliESDRun::~AliESDRun() {
169 // Delete PHOS position matrices
170 for(Int_t m=0; m<kNPHOSMatrix; m++) {
171 if(fPHOSMatrix[m]) delete fPHOSMatrix[m] ;
172 fPHOSMatrix[m] = NULL;
174 // Delete PHOS position matrices
175 for(Int_t sm=0; sm<kNEMCALMatrix; sm++) {
176 if(fEMCALMatrix[sm]) delete fEMCALMatrix[sm] ;
177 fEMCALMatrix[sm] = NULL;
181 void AliESDRun::SetDiamond(const AliESDVertex *vertex) {
182 // set the interaction diamond
184 fDiamondXY[0]=vertex->GetXv();
185 fDiamondXY[1]=vertex->GetYv();
186 fDiamondZ=vertex->GetZv();
188 vertex->GetCovMatrix(cov);
189 fDiamondCovXY[0]=cov[0];
190 fDiamondCovXY[1]=cov[1];
191 fDiamondCovXY[2]=cov[2];
192 fDiamondSig2Z=cov[5];
197 //______________________________________________________________________________
198 void AliESDRun::Print(const Option_t *) const
200 // Print some data members
201 printf("Mean vertex in RUN %d: X=%.4f Y=%.4f Z=%.4f cm\n",
202 GetRunNumber(),GetDiamondX(),GetDiamondY(),GetDiamondZ());
203 printf("Beam Type: %s, Energy: %.1f GeV\n",fBeamType.IsNull() ? "N/A":fBeamType.Data(),fBeamEnergy);
204 printf("Magnetic field in IP= %f T | Currents: L3:%+.1f Dipole:%+.1f %s\n",
205 GetMagneticField(),fCurrentL3,fCurrentDip,TestBit(kUniformBMap) ? "(Uniform)":"");
206 printf("Event from reconstruction version %d \n",fRecoVersion);
208 printf("List of active trigger classes: ");
209 for(Int_t i = 0; i < kNTriggerClasses; i++) {
210 TNamed *str = (TNamed *)((fTriggerClasses).At(i));
211 if (str) printf("%s ",str->GetName());
213 printf("Mean intenstity for interacting : beam1:%+.3e beam2:%+.3e\n",fMeanBeamInt[0][0],fMeanBeamInt[1][0]);
214 printf("Mean intenstity for non-intecting : beam1:%+.3e beam2:%+.3e\n",fMeanBeamInt[0][1],fMeanBeamInt[1][1]);
218 void AliESDRun::Reset()
220 // reset data members
229 ResetBit(kBInfoStored|kUniformBMap|kConvSqrtSHalfGeV);
230 for (Int_t i=0; i<2; i++) fDiamondXY[i]=0.;
231 fDiamondCovXY[0]=fDiamondCovXY[2]=3.*3.;
234 fDiamondSig2Z=10.*10.;
235 fTriggerClasses.Clear();
240 //______________________________________________________________________________
241 void AliESDRun::SetTriggerClass(const char*name, Int_t index)
243 // Fill the trigger class name
244 // into the corresponding array
245 if (index >= kNTriggerClasses || index < 0) {
246 AliError(Form("Index (%d) is outside the allowed range (0,49)!",index));
250 fTriggerClasses.AddAt(new TNamed(name,NULL),index);
253 //______________________________________________________________________________
254 const char* AliESDRun::GetTriggerClass(Int_t index) const
256 // Get the trigger class name at
257 // specified position in the trigger mask
258 TNamed *trclass = (TNamed *)fTriggerClasses.At(index);
260 return trclass->GetName();
265 //______________________________________________________________________________
266 TString AliESDRun::GetActiveTriggerClasses() const
268 // Construct and return
269 // the list of trigger classes
270 // which are present in the run
272 for(Int_t i = 0; i < kNTriggerClasses; i++) {
273 TNamed *str = (TNamed *)((fTriggerClasses).At(i));
276 trclasses += str->GetName();
284 //______________________________________________________________________________
285 TString AliESDRun::GetFiredTriggerClasses(ULong64_t mask) const
287 // Constructs and returns the
288 // list of trigger classes that
289 // have been fired. Uses the trigger
290 // class mask as an argument.
292 for(Int_t i = 0; i < kNTriggerClasses; i++) {
293 if (mask & (1ull << i)) {
294 TNamed *str = (TNamed *)((fTriggerClasses).At(i));
297 trclasses += str->GetName();
306 //______________________________________________________________________________
307 Bool_t AliESDRun::IsTriggerClassFired(ULong64_t mask, const char *name) const
309 // Checks if the trigger class
310 // identified by 'name' has been
311 // fired. Uses the trigger class mask.
313 TNamed *trclass = (TNamed *)fTriggerClasses.FindObject(name);
314 if (!trclass) return kFALSE;
316 Int_t iclass = fTriggerClasses.IndexOf(trclass);
317 if (iclass < 0) return kFALSE;
319 if (mask & (1ull << iclass))
325 //_____________________________________________________________________________
326 Bool_t AliESDRun::InitMagneticField() const
328 // Create mag field from stored information
330 if (!TestBit(kBInfoStored)) {
331 AliError("No information on currents, cannot create field from run header");
335 if ( TGeoGlobalMagField::Instance()->IsLocked() ) {
336 if (TGeoGlobalMagField::Instance()->GetField()->TestBit(AliMagF::kOverrideGRP)) {
337 AliInfo("ExpertMode!!! Information on magnet currents will be ignored !");
338 AliInfo("ExpertMode!!! Running with the externally locked B field !");
342 AliInfo("Destroying existing B field instance!");
343 delete TGeoGlobalMagField::Instance();
347 AliMagF* fld = AliMagF::CreateFieldMap(fCurrentL3,fCurrentDip,AliMagF::kConvLHC,
348 TestBit(kUniformBMap), GetBeamEnergy(), GetBeamType());
350 TGeoGlobalMagField::Instance()->SetField( fld );
351 TGeoGlobalMagField::Instance()->Lock();
352 AliInfo("Running with the B field constructed out of the Run Header !");
356 AliError("Failed to create a B field map !");
362 //_____________________________________________________________________________
363 void AliESDRun::SetT0spread(Int_t i,Float_t t)
366 // Setting the T0 spread value at index i
369 if ( (i>=0) && (i<kT0spreadSize)) {
372 AliError(Form("Index %d out of bound",i));
377 //_____________________________________________________________________________
378 void AliESDRun::SetT0spread(Float_t *t)
381 // Setting the T0 spread values
384 AliError(Form("Null pointer passed"));
387 for (Int_t i=0;i<kT0spreadSize;i++) fT0spread[i]=t[i];