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 for (Int_t i=0; i<3; i++) fDiamondCovXY[i]=0.;
41 fTriggerClasses.SetOwner(kTRUE);
44 //______________________________________________________________________________
45 AliESDRun::AliESDRun(const AliESDRun &esd) :
47 fMagneticField(esd.fMagneticField),
48 fPeriodNumber(esd.fPeriodNumber),
49 fRunNumber(esd.fRunNumber),
50 fRecoVersion(esd.fRecoVersion),
51 fTriggerClasses(TObjArray(kNTriggerClasses))
54 for (Int_t i=0; i<2; i++) fDiamondXY[i]=esd.fDiamondXY[i];
55 for (Int_t i=0; i<3; i++) fDiamondCovXY[i]=esd.fDiamondCovXY[i];
57 for(Int_t i = 0; i < kNTriggerClasses; i++) {
58 TNamed *str = (TNamed *)((esd.fTriggerClasses).At(i));
59 if (str) fTriggerClasses.AddAt(new TNamed(*str),i);
63 //______________________________________________________________________________
64 AliESDRun& AliESDRun::operator=(const AliESDRun &esd)
68 TObject::operator=(esd);
69 fRunNumber=esd.fRunNumber;
70 fPeriodNumber=esd.fPeriodNumber;
71 fRecoVersion=esd.fRecoVersion;
72 fMagneticField=esd.fMagneticField;
73 for (Int_t i=0; i<2; i++) fDiamondXY[i]=esd.fDiamondXY[i];
74 for (Int_t i=0; i<3; i++) fDiamondCovXY[i]=esd.fDiamondCovXY[i];
75 fTriggerClasses.Clear();
76 for(Int_t i = 0; i < kNTriggerClasses; i++) {
77 TNamed *str = (TNamed *)((esd.fTriggerClasses).At(i));
78 if (str) fTriggerClasses.AddAt(new TNamed(*str),i);
85 void AliESDRun::Copy(TObject &obj) const{
87 // this overwrites the virtual TOBject::Copy()
88 // to allow run time copying without casting
92 AliESDRun *robj = dynamic_cast<AliESDRun*>(&obj);
93 if(!robj)return; // not an aliesdrun
98 void AliESDRun::SetDiamond(const AliESDVertex *vertex) {
99 // set the interaction diamond
100 fDiamondXY[0]=vertex->GetXv();
101 fDiamondXY[1]=vertex->GetYv();
103 vertex->GetCovMatrix(cov);
104 fDiamondCovXY[0]=cov[0];
105 fDiamondCovXY[1]=cov[1];
106 fDiamondCovXY[2]=cov[2];
110 //______________________________________________________________________________
111 void AliESDRun::Print(const Option_t *) const
113 // Print some data members
114 printf("Mean vertex in RUN %d: X=%.4f Y=%.4f cm\n",
115 GetRunNumber(),GetDiamondX(),GetDiamondY());
116 printf("Magnetic field = %f T\n",
118 printf("Event from reconstruction version %d \n",fRecoVersion);
120 printf("List of active trigger classes: ");
121 for(Int_t i = 0; i < kNTriggerClasses; i++) {
122 TNamed *str = (TNamed *)((fTriggerClasses).At(i));
123 printf("%s ",str->GetName());
128 void AliESDRun::Reset()
130 // reset data members
135 for (Int_t i=0; i<2; i++) fDiamondXY[i]=0.;
136 for (Int_t i=0; i<3; i++) fDiamondCovXY[i]=0.;
137 fTriggerClasses.Clear();
140 //______________________________________________________________________________
141 void AliESDRun::SetTriggerClass(const char*name, Int_t index)
143 // Fill the trigger class name
144 // into the corresponding array
145 if (index >= kNTriggerClasses || index < 0) {
146 AliError(Form("Index (%d) is outside the allowed range (0,49)!",index));
150 fTriggerClasses.AddAt(new TNamed(name,NULL),index);
153 //______________________________________________________________________________
154 const char* AliESDRun::GetTriggerClass(Int_t index) const
156 // Get the trigger class name at
157 // specified position in the trigger mask
158 TNamed *trclass = (TNamed *)fTriggerClasses.At(index);
160 return trclass->GetName();
165 //______________________________________________________________________________
166 TString AliESDRun::GetActiveTriggerClasses() const
168 // Construct and return
169 // the list of trigger classes
170 // which are present in the run
172 for(Int_t i = 0; i < kNTriggerClasses; i++) {
173 TNamed *str = (TNamed *)((fTriggerClasses).At(i));
176 trclasses += str->GetName();
184 //______________________________________________________________________________
185 TString AliESDRun::GetFiredTriggerClasses(ULong64_t mask) const
187 // Constructs and returns the
188 // list of trigger classes that
189 // have been fired. Uses the trigger
190 // class mask as an argument.
192 for(Int_t i = 0; i < kNTriggerClasses; i++) {
193 if (mask & (1 << i)) {
194 TNamed *str = (TNamed *)((fTriggerClasses).At(i));
197 trclasses += str->GetName();
206 //______________________________________________________________________________
207 Bool_t AliESDRun::IsTriggerClassFired(ULong64_t mask, const char *name) const
209 // Checks if the trigger class
210 // identified by 'name' has been
211 // fired. Uses the trigger class mask.
213 TNamed *trclass = (TNamed *)fTriggerClasses.FindObject(name);
214 if (!trclass) return kFALSE;
216 Int_t iclass = fTriggerClasses.IndexOf(trclass);
217 if (iclass < 0) return kFALSE;
219 if (mask & (1 << iclass))