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.;
59 for (Int_t it=0; it<8; it++) fCaloTriggerType[it]=0;
60 for (Int_t j=0; j<64; ++j) fVZEROEqFactors[j]=-1;
63 //______________________________________________________________________________
64 AliESDRun::AliESDRun(const AliESDRun &esd) :
69 fMagneticField(esd.fMagneticField),
70 fDiamondZ(esd.fDiamondZ),
71 fDiamondSig2Z(esd.fDiamondSig2Z),
72 fPeriodNumber(esd.fPeriodNumber),
73 fRunNumber(esd.fRunNumber),
74 fRecoVersion(esd.fRecoVersion),
76 fTriggerClasses(TObjArray(kNTriggerClasses)),
81 for (Int_t i=0; i<2; i++) fDiamondXY[i]=esd.fDiamondXY[i];
82 for (Int_t i=0; i<3; i++) fDiamondCovXY[i]=esd.fDiamondCovXY[i];
84 for(Int_t i = 0; i < kNTriggerClasses; i++) {
85 TNamed *str = (TNamed *)((esd.fTriggerClasses).At(i));
86 if (str) fTriggerClasses.AddAt(new TNamed(*str),i);
89 for(Int_t m=0; m<kNPHOSMatrix; m++){
90 if(esd.fPHOSMatrix[m])
91 fPHOSMatrix[m]=new TGeoHMatrix(*(esd.fPHOSMatrix[m])) ;
96 for (int ib=2;ib--;) for (int it=2;it--;) fMeanBeamInt[ib][it] = esd.fMeanBeamInt[ib][it];
98 for(Int_t sm=0; sm<kNEMCALMatrix; sm++){
99 if(esd.fEMCALMatrix[sm])
100 fEMCALMatrix[sm]=new TGeoHMatrix(*(esd.fEMCALMatrix[sm])) ;
102 fEMCALMatrix[sm]=NULL;
104 for (Int_t i=0; i<kT0spreadSize;i++) fT0spread[i]=esd.fT0spread[i];
105 for (Int_t it=0; it<8; it++) fCaloTriggerType[it]=esd.fCaloTriggerType[it];
106 for (Int_t j=0; j<64; ++j) fVZEROEqFactors[j]=esd.fVZEROEqFactors[j];
110 //______________________________________________________________________________
111 AliESDRun& AliESDRun::operator=(const AliESDRun &esd)
113 // assigment operator
115 TObject::operator=(esd);
116 fRunNumber=esd.fRunNumber;
117 fPeriodNumber=esd.fPeriodNumber;
118 fRecoVersion=esd.fRecoVersion;
119 fMagneticField=esd.fMagneticField;
120 fDiamondZ=esd.fDiamondZ;
121 fDiamondSig2Z=esd.fDiamondSig2Z;
122 fBeamType = esd.fBeamType;
123 fCurrentL3 = esd.fCurrentL3;
124 fCurrentDip = esd.fCurrentDip;
125 fBeamEnergy = esd.fBeamEnergy;
126 for (Int_t i=0; i<2; i++) fDiamondXY[i]=esd.fDiamondXY[i];
127 for (Int_t i=0; i<3; i++) fDiamondCovXY[i]=esd.fDiamondCovXY[i];
128 fTriggerClasses.Clear();
129 for(Int_t i = 0; i < kNTriggerClasses; i++) {
130 TNamed *str = (TNamed *)((esd.fTriggerClasses).At(i));
131 if (str) fTriggerClasses.AddAt(new TNamed(*str),i);
134 fDetInDAQ = esd.fDetInDAQ;
135 fDetInReco = esd.fDetInReco;
137 for (int ib=2;ib--;) for (int it=2;it--;) fMeanBeamInt[ib][it] = esd.fMeanBeamInt[ib][it];
139 for(Int_t m=0; m<kNPHOSMatrix; m++){
140 if(esd.fPHOSMatrix[m])
141 fPHOSMatrix[m]=new TGeoHMatrix(*(esd.fPHOSMatrix[m])) ;
146 for(Int_t sm=0; sm<kNEMCALMatrix; sm++){
147 if(esd.fEMCALMatrix[sm])
148 fEMCALMatrix[sm]=new TGeoHMatrix(*(esd.fEMCALMatrix[sm])) ;
153 for (Int_t i=0; i<kT0spreadSize;i++) fT0spread[i]=esd.fT0spread[i];
154 for (Int_t it=0; it<8; it++) fCaloTriggerType[it]=esd.fCaloTriggerType[it];
155 for (Int_t j=0; j<64; ++j) fVZEROEqFactors[j]=esd.fVZEROEqFactors[j];
159 void AliESDRun::Copy(TObject &obj) const{
161 // this overwrites the virtual TOBject::Copy()
162 // to allow run time copying without casting
165 if(this==&obj)return;
166 AliESDRun *robj = dynamic_cast<AliESDRun*>(&obj);
167 if(!robj)return; // not an aliesdrun
172 //______________________________________________________________________________
173 AliESDRun::~AliESDRun() {
175 // Delete PHOS position matrices
176 for(Int_t m=0; m<kNPHOSMatrix; m++) {
177 if(fPHOSMatrix[m]) delete fPHOSMatrix[m] ;
178 fPHOSMatrix[m] = NULL;
180 // Delete PHOS position matrices
181 for(Int_t sm=0; sm<kNEMCALMatrix; sm++) {
182 if(fEMCALMatrix[sm]) delete fEMCALMatrix[sm] ;
183 fEMCALMatrix[sm] = NULL;
187 void AliESDRun::SetDiamond(const AliESDVertex *vertex) {
188 // set the interaction diamond
190 fDiamondXY[0]=vertex->GetXv();
191 fDiamondXY[1]=vertex->GetYv();
192 fDiamondZ=vertex->GetZv();
194 vertex->GetCovMatrix(cov);
195 fDiamondCovXY[0]=cov[0];
196 fDiamondCovXY[1]=cov[1];
197 fDiamondCovXY[2]=cov[2];
198 fDiamondSig2Z=cov[5];
203 //______________________________________________________________________________
204 void AliESDRun::Print(const Option_t *) const
206 // Print some data members
207 printf("Mean vertex in RUN %d: X=%.4f Y=%.4f Z=%.4f cm\n",
208 GetRunNumber(),GetDiamondX(),GetDiamondY(),GetDiamondZ());
209 printf("Beam Type: %s, Energy: %.1f GeV\n",fBeamType.IsNull() ? "N/A":fBeamType.Data(),fBeamEnergy);
210 printf("Magnetic field in IP= %f T | Currents: L3:%+.1f Dipole:%+.1f %s\n",
211 GetMagneticField(),fCurrentL3,fCurrentDip,TestBit(kUniformBMap) ? "(Uniform)":"");
212 printf("Event from reconstruction version %d \n",fRecoVersion);
214 printf("List of active trigger classes: ");
215 for(Int_t i = 0; i < kNTriggerClasses; i++) {
216 TNamed *str = (TNamed *)((fTriggerClasses).At(i));
217 if (str) printf("%s ",str->GetName());
219 printf("Mean intenstity for interacting : beam1:%+.3e beam2:%+.3e\n",fMeanBeamInt[0][0],fMeanBeamInt[1][0]);
220 printf("Mean intenstity for non-intecting : beam1:%+.3e beam2:%+.3e\n",fMeanBeamInt[0][1],fMeanBeamInt[1][1]);
224 void AliESDRun::Reset()
226 // reset data members
235 ResetBit(kBInfoStored|kUniformBMap|kConvSqrtSHalfGeV);
236 for (Int_t i=0; i<2; i++) fDiamondXY[i]=0.;
237 fDiamondCovXY[0]=fDiamondCovXY[2]=3.*3.;
240 fDiamondSig2Z=10.*10.;
241 fTriggerClasses.Clear();
246 //______________________________________________________________________________
247 void AliESDRun::SetTriggerClass(const char*name, Int_t index)
249 // Fill the trigger class name
250 // into the corresponding array
251 if (index >= kNTriggerClasses || index < 0) {
252 AliError(Form("Index (%d) is outside the allowed range (0,49)!",index));
256 fTriggerClasses.AddAt(new TNamed(name,NULL),index);
259 //______________________________________________________________________________
260 const char* AliESDRun::GetTriggerClass(Int_t index) const
262 // Get the trigger class name at
263 // specified position in the trigger mask
264 TNamed *trclass = (TNamed *)fTriggerClasses.At(index);
266 return trclass->GetName();
271 //______________________________________________________________________________
272 TString AliESDRun::GetActiveTriggerClasses() const
274 // Construct and return
275 // the list of trigger classes
276 // which are present in the run
278 for(Int_t i = 0; i < kNTriggerClasses; i++) {
279 TNamed *str = (TNamed *)((fTriggerClasses).At(i));
282 trclasses += str->GetName();
290 //______________________________________________________________________________
291 TString AliESDRun::GetFiredTriggerClasses(ULong64_t mask) const
293 // Constructs and returns the
294 // list of trigger classes that
295 // have been fired. Uses the trigger
296 // class mask as an argument.
298 for(Int_t i = 0; i < kNTriggerClasses; i++) {
299 if (mask & (1ull << i)) {
300 TNamed *str = (TNamed *)((fTriggerClasses).At(i));
303 trclasses += str->GetName();
312 //______________________________________________________________________________
313 Bool_t AliESDRun::IsTriggerClassFired(ULong64_t mask, const char *name) const
315 // Checks if the trigger class
316 // identified by 'name' has been
317 // fired. Uses the trigger class mask.
319 TNamed *trclass = (TNamed *)fTriggerClasses.FindObject(name);
320 if (!trclass) return kFALSE;
322 Int_t iclass = fTriggerClasses.IndexOf(trclass);
323 if (iclass < 0) return kFALSE;
325 if (mask & (1ull << iclass))
331 //_____________________________________________________________________________
332 Bool_t AliESDRun::InitMagneticField() const
334 // Create mag field from stored information
336 if (!TestBit(kBInfoStored)) {
337 AliError("No information on currents, cannot create field from run header");
341 if ( TGeoGlobalMagField::Instance()->IsLocked() ) {
342 if (TGeoGlobalMagField::Instance()->GetField()->TestBit(AliMagF::kOverrideGRP)) {
343 AliInfo("ExpertMode!!! Information on magnet currents will be ignored !");
344 AliInfo("ExpertMode!!! Running with the externally locked B field !");
348 AliInfo("Destroying existing B field instance!");
349 delete TGeoGlobalMagField::Instance();
353 AliMagF* fld = AliMagF::CreateFieldMap(fCurrentL3,fCurrentDip,AliMagF::kConvLHC,
354 TestBit(kUniformBMap), GetBeamEnergy(), GetBeamType());
356 TGeoGlobalMagField::Instance()->SetField( fld );
357 TGeoGlobalMagField::Instance()->Lock();
358 AliInfo("Running with the B field constructed out of the Run Header !");
362 AliError("Failed to create a B field map !");
368 //_____________________________________________________________________________
369 void AliESDRun::SetT0spread(Int_t i,Float_t t)
372 // Setting the T0 spread value at index i
375 if ( (i>=0) && (i<kT0spreadSize)) {
378 AliError(Form("Index %d out of bound",i));
383 //_____________________________________________________________________________
384 void AliESDRun::SetT0spread(Float_t *t)
387 // Setting the T0 spread values
390 AliError(Form("Null pointer passed"));
393 for (Int_t i=0;i<kT0spreadSize;i++) fT0spread[i]=t[i];