]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliESDRun.cxx
- Three classes by MinJung Kweon AliHFEpriVtx, AliHFEsecVtx and AliHFEmcQA for primar...
[u/mrichter/AliRoot.git] / STEER / AliESDRun.cxx
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  **************************************************************************/
15 #include <TNamed.h>
16
17 #include "AliESDRun.h"
18 #include "AliESDVertex.h"
19 #include "AliLog.h"
20
21 //-------------------------------------------------------------------------
22 //                     Implementation Class AliESDRun
23 //   Run by run data
24 //   for the ESD   
25 //   Origin: Christian Klein-Boesing, CERN, Christian.Klein-Boesing@cern.ch 
26 //-------------------------------------------------------------------------
27
28 ClassImp(AliESDRun)  
29  
30 //______________________________________________________________________________
31 AliESDRun::AliESDRun() :
32   TObject(),
33   fMagneticField(0),
34   fPeriodNumber(0),
35   fRunNumber(0),
36   fRecoVersion(0),
37   fTriggerClasses(kNTriggerClasses)
38 {
39   for (Int_t i=0; i<2; i++) fDiamondXY[i]=0.;
40   fDiamondCovXY[0]=fDiamondCovXY[2]=3.*3.;
41   fDiamondCovXY[1]=0.;
42   fTriggerClasses.SetOwner(kTRUE);
43 }
44
45 //______________________________________________________________________________
46 AliESDRun::AliESDRun(const AliESDRun &esd) :
47   TObject(esd),
48   fMagneticField(esd.fMagneticField),
49   fPeriodNumber(esd.fPeriodNumber),
50   fRunNumber(esd.fRunNumber),
51   fRecoVersion(esd.fRecoVersion),
52   fTriggerClasses(TObjArray(kNTriggerClasses))
53
54   // Copy constructor
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];
57
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);
61   }
62 }
63
64 //______________________________________________________________________________
65 AliESDRun& AliESDRun::operator=(const AliESDRun &esd)
66
67   // assigment operator
68   if(this!=&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);
80   }
81     
82   } 
83   return *this;
84 }
85
86 void AliESDRun::Copy(TObject &obj) const{
87
88   // this overwrites the virtual TOBject::Copy()
89   // to allow run time copying without casting
90   // in AliESDEvent
91
92   if(this==&obj)return;
93   AliESDRun *robj = dynamic_cast<AliESDRun*>(&obj);
94   if(!robj)return; // not an aliesdrun
95   *robj = *this;
96
97 }
98
99 void AliESDRun::SetDiamond(const AliESDVertex *vertex) {
100   // set the interaction diamond
101   fDiamondXY[0]=vertex->GetXv();
102   fDiamondXY[1]=vertex->GetYv();
103   Double32_t cov[6];
104   vertex->GetCovMatrix(cov);
105   fDiamondCovXY[0]=cov[0];
106   fDiamondCovXY[1]=cov[1];
107   fDiamondCovXY[2]=cov[2];
108 }
109
110
111 //______________________________________________________________________________
112 void AliESDRun::Print(const Option_t *) const
113 {
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",
118          GetMagneticField());
119   printf("Event from reconstruction version %d \n",fRecoVersion);
120   
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());
125   }
126   printf("\n");
127 }
128
129 void AliESDRun::Reset() 
130 {
131   // reset data members
132   fRunNumber = 0;
133   fPeriodNumber = 0;
134   fRecoVersion = 0;
135   fMagneticField = 0;
136   for (Int_t i=0; i<2; i++) fDiamondXY[i]=0.;
137   fDiamondCovXY[0]=fDiamondCovXY[2]=3.*3.;
138   fDiamondCovXY[1]=0.;
139   fTriggerClasses.Clear();
140 }
141
142 //______________________________________________________________________________
143 void AliESDRun::SetTriggerClass(const char*name, Int_t index)
144 {
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));
149     return;
150   }
151
152   fTriggerClasses.AddAt(new TNamed(name,NULL),index);
153 }
154
155 //______________________________________________________________________________
156 const char* AliESDRun::GetTriggerClass(Int_t index) const
157 {
158   // Get the trigger class name at
159   // specified position in the trigger mask
160   TNamed *trclass = (TNamed *)fTriggerClasses.At(index);
161   if (trclass)
162     return trclass->GetName();
163   else
164     return "";
165 }
166
167 //______________________________________________________________________________
168 TString AliESDRun::GetActiveTriggerClasses() const
169 {
170   // Construct and return
171   // the list of trigger classes
172   // which are present in the run
173   TString trclasses;
174   for(Int_t i = 0; i < kNTriggerClasses; i++) {
175     TNamed *str = (TNamed *)((fTriggerClasses).At(i));
176     if (str) {
177       trclasses += " ";
178       trclasses += str->GetName();
179       trclasses += " ";
180     }
181   }
182
183   return trclasses;
184 }
185
186 //______________________________________________________________________________
187 TString AliESDRun::GetFiredTriggerClasses(ULong64_t mask) const
188 {
189   // Constructs and returns the
190   // list of trigger classes that
191   // have been fired. Uses the trigger
192   // class mask as an argument.
193   TString trclasses;
194   for(Int_t i = 0; i < kNTriggerClasses; i++) {
195     if (mask & (1 << i)) {
196       TNamed *str = (TNamed *)((fTriggerClasses).At(i));
197       if (str) {
198         trclasses += " ";
199         trclasses += str->GetName();
200       trclasses += " ";
201       }
202     }
203   }
204
205   return trclasses;
206 }
207
208 //______________________________________________________________________________
209 Bool_t AliESDRun::IsTriggerClassFired(ULong64_t mask, const char *name) const
210 {
211   // Checks if the trigger class
212   // identified by 'name' has been
213   // fired. Uses the trigger class mask.
214
215   TNamed *trclass = (TNamed *)fTriggerClasses.FindObject(name);
216   if (!trclass) return kFALSE;
217
218   Int_t iclass = fTriggerClasses.IndexOf(trclass);
219   if (iclass < 0) return kFALSE;
220
221   if (mask & (1 << iclass))
222     return kTRUE;
223   else
224     return kFALSE;
225 }