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 **************************************************************************/
17 #include "AliESDRun.h"
18 #include "AliESDVertex.h"
21 //-------------------------------------------------------------------------
22 // Implementation Class AliESDRun
25 // Origin: Christian Klein-Boesing, CERN, Christian.Klein-Boesing@cern.ch
26 //-------------------------------------------------------------------------
30 //______________________________________________________________________________
31 AliESDRun::AliESDRun() :
37 fTriggerClasses(kNTriggerClasses)
39 for (Int_t i=0; i<2; i++) fDiamondXY[i]=0.;
40 fDiamondCovXY[0]=fDiamondCovXY[2]=3.*3.;
42 fTriggerClasses.SetOwner(kTRUE);
45 //______________________________________________________________________________
46 AliESDRun::AliESDRun(const AliESDRun &esd) :
48 fMagneticField(esd.fMagneticField),
49 fPeriodNumber(esd.fPeriodNumber),
50 fRunNumber(esd.fRunNumber),
51 fRecoVersion(esd.fRecoVersion),
52 fTriggerClasses(TObjArray(kNTriggerClasses))
55 for (Int_t i=0; i<2; i++) fDiamondXY[i]=esd.fDiamondXY[i];
56 for (Int_t i=0; i<3; i++) fDiamondCovXY[i]=esd.fDiamondCovXY[i];
58 for(Int_t i = 0; i < kNTriggerClasses; i++) {
59 TNamed *str = (TNamed *)((esd.fTriggerClasses).At(i));
60 if (str) fTriggerClasses.AddAt(new TNamed(*str),i);
64 //______________________________________________________________________________
65 AliESDRun& AliESDRun::operator=(const AliESDRun &esd)
69 TObject::operator=(esd);
70 fRunNumber=esd.fRunNumber;
71 fPeriodNumber=esd.fPeriodNumber;
72 fRecoVersion=esd.fRecoVersion;
73 fMagneticField=esd.fMagneticField;
74 for (Int_t i=0; i<2; i++) fDiamondXY[i]=esd.fDiamondXY[i];
75 for (Int_t i=0; i<3; i++) fDiamondCovXY[i]=esd.fDiamondCovXY[i];
76 fTriggerClasses.Clear();
77 for(Int_t i = 0; i < kNTriggerClasses; i++) {
78 TNamed *str = (TNamed *)((esd.fTriggerClasses).At(i));
79 if (str) fTriggerClasses.AddAt(new TNamed(*str),i);
86 void AliESDRun::Copy(TObject &obj) const{
88 // this overwrites the virtual TOBject::Copy()
89 // to allow run time copying without casting
93 AliESDRun *robj = dynamic_cast<AliESDRun*>(&obj);
94 if(!robj)return; // not an aliesdrun
99 void AliESDRun::SetDiamond(const AliESDVertex *vertex) {
100 // set the interaction diamond
101 fDiamondXY[0]=vertex->GetXv();
102 fDiamondXY[1]=vertex->GetYv();
104 vertex->GetCovMatrix(cov);
105 fDiamondCovXY[0]=cov[0];
106 fDiamondCovXY[1]=cov[1];
107 fDiamondCovXY[2]=cov[2];
111 //______________________________________________________________________________
112 void AliESDRun::Print(const Option_t *) const
114 // Print some data members
115 printf("Mean vertex in RUN %d: X=%.4f Y=%.4f cm\n",
116 GetRunNumber(),GetDiamondX(),GetDiamondY());
117 printf("Magnetic field = %f T\n",
119 printf("Event from reconstruction version %d \n",fRecoVersion);
121 printf("List of active trigger classes: ");
122 for(Int_t i = 0; i < kNTriggerClasses; i++) {
123 TNamed *str = (TNamed *)((fTriggerClasses).At(i));
124 printf("%s ",str->GetName());
129 void AliESDRun::Reset()
131 // reset data members
136 for (Int_t i=0; i<2; i++) fDiamondXY[i]=0.;
137 fDiamondCovXY[0]=fDiamondCovXY[2]=3.*3.;
139 fTriggerClasses.Clear();
142 //______________________________________________________________________________
143 void AliESDRun::SetTriggerClass(const char*name, Int_t index)
145 // Fill the trigger class name
146 // into the corresponding array
147 if (index >= kNTriggerClasses || index < 0) {
148 AliError(Form("Index (%d) is outside the allowed range (0,49)!",index));
152 fTriggerClasses.AddAt(new TNamed(name,NULL),index);
155 //______________________________________________________________________________
156 const char* AliESDRun::GetTriggerClass(Int_t index) const
158 // Get the trigger class name at
159 // specified position in the trigger mask
160 TNamed *trclass = (TNamed *)fTriggerClasses.At(index);
162 return trclass->GetName();
167 //______________________________________________________________________________
168 TString AliESDRun::GetActiveTriggerClasses() const
170 // Construct and return
171 // the list of trigger classes
172 // which are present in the run
174 for(Int_t i = 0; i < kNTriggerClasses; i++) {
175 TNamed *str = (TNamed *)((fTriggerClasses).At(i));
178 trclasses += str->GetName();
186 //______________________________________________________________________________
187 TString AliESDRun::GetFiredTriggerClasses(ULong64_t mask) const
189 // Constructs and returns the
190 // list of trigger classes that
191 // have been fired. Uses the trigger
192 // class mask as an argument.
194 for(Int_t i = 0; i < kNTriggerClasses; i++) {
195 if (mask & (1 << i)) {
196 TNamed *str = (TNamed *)((fTriggerClasses).At(i));
199 trclasses += str->GetName();
208 //______________________________________________________________________________
209 Bool_t AliESDRun::IsTriggerClassFired(ULong64_t mask, const char *name) const
211 // Checks if the trigger class
212 // identified by 'name' has been
213 // fired. Uses the trigger class mask.
215 TNamed *trclass = (TNamed *)fTriggerClasses.FindObject(name);
216 if (!trclass) return kFALSE;
218 Int_t iclass = fTriggerClasses.IndexOf(trclass);
219 if (iclass < 0) return kFALSE;
221 if (mask & (1 << iclass))