StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StGammaEvent.cxx
1 #include "StMuDSTMaker/COMMON/StMuTrack.h"
2 #include "StGammaPythiaEvent.h"
3 
4 #include "StGammaEvent.h"
5 
6 ClassImp(StGammaEvent);
7 
9 // Constructor //
11 StGammaEvent::StGammaEvent()
12  : mFlags(0x0000)
13  , mRunNumber(0)
14  , mEventNumber(0)
15  , mVertex(0,0,0)
16  , mMagneticField(1956)
17  , mPythia(0)
18 
19  , mSpinDbValid(false)
20  , mSpin4(kUnknownSpin4)
21  , mBunchCrossing7bit(255)
22  , mBunchCrossing48bit(255)
23  , mBunchCrossingStar(255)
24  , mPolarizationType(kUnknownPol)
25 
26  , mDsmVertex(255)
27  , mTracks(0) //-> array of all tracks
28  , mTowers(0) //-> array of all towers
29  , mPreshower1(0) //-> array of all preshower1
30  , mPreshower2(0) //-> array of all preshower2
31  , mPostshower(0) //-> array of all postshower
32  , mStrips(0) //-> array of all strips
33  , mCandidates(0) //-> array of all candidates
34 {
35  InitArrays(); // initialize tclones arrays
36  Clear();
37 }
38 
40 // Destructor //
42 StGammaEvent::~StGammaEvent()
43 {
44  delete mTracks; mTracks = 0;
45  delete mTowers; mTowers = 0; //-> array of all towers
46  delete mPreshower1; mPreshower1 = 0; //-> array of all preshower1
47  delete mPreshower2; mPreshower2 = 0;//-> array of all preshower2
48  delete mPostshower; mPostshower = 0;//-> array of all postshower
49  delete mStrips; mStrips = 0; //-> array of all strips
50  delete mCandidates; mCandidates = 0; //-> array of all candidates
51 }
52 
54 // Clear the event //
56 void StGammaEvent::Clear(Option_t *opts)
57 {
58  mRunNumber = 0;
59  mEventNumber = 0;
60  mTriggerIds.clear();
61  mSimuTriggerIds.clear();
62  mVertex = TVector3(0.,0.,0.);
63 
64  mTracks->Clear();
65  mTowers->Clear();
66  mPreshower1->Clear();
67  mPreshower2->Clear();
68  mPostshower->Clear();
69  mStrips->Clear();
70  mCandidates->Clear();
71 
72  mFlags = 0x0000;
73 
74  mSpinDbValid = false;
75  mSpin4 = kUnknownSpin4;
76  mBunchCrossing7bit = 255;
77  mBunchCrossing48bit = 255;
78  mBunchCrossingStar = 255;
79  mPolarizationType = kUnknownPol;
80  mDsmVertex = 255;
81 
82  if(mPythia) mPythia->Clear(opts);
83 
84 }
85 
87 // Initialize the internal TClonesArrays //
89 Int_t StGammaEvent::InitArrays()
90 {
91  if (!mTracks) mTracks = new TClonesArray("StGammaTrack", 1000);
92  if (!mTowers) mTowers = new TClonesArray("StGammaTower", 4800 + 720);
93  if (!mPreshower1)mPreshower1 = new TClonesArray("StGammaTower", 4800 + 720);
94  if (!mPreshower2)mPreshower2 = new TClonesArray("StGammaTower", 720);
95  if (!mPostshower)mPostshower = new TClonesArray("StGammaTower", 720);
96  if (!mStrips) mStrips = new TClonesArray("StGammaStrip", 10000);
97  if (!mCandidates)mCandidates = new TClonesArray("StGammaCandidate", 10);
98  return 1;
99 }
100 
102 // Add detector objects //
103 // and candidates to the event //
106 {
107 
108  TClonesArray &tracks = *mTracks;
109  StGammaTrack *track = 0;
110 
111  if(mutr) track = new( tracks[tracks.GetEntriesFast()] ) StGammaTrack(mutr);
112  else track = new( tracks[tracks.GetEntriesFast()] ) StGammaTrack;
113 
114  return track;
115 
116 }
117 
119 {
120  TClonesArray &towers = *mTowers;
121  StGammaTower *tower = new( towers[towers.GetEntriesFast()] ) StGammaTower;
122  return tower;
123 }
124 
126 {
127  TClonesArray &preshower1 = *mPreshower1;
128  StGammaTower *tower = new( preshower1[preshower1.GetEntriesFast()] ) StGammaTower;
129  return tower;
130 }
131 
133 {
134  TClonesArray &preshower2 = *mPreshower2;
135  StGammaTower *tower = new( preshower2[preshower2.GetEntriesFast()] ) StGammaTower;
136  return tower;
137 }
138 
140 {
141  TClonesArray &postshower = *mPostshower;
142  StGammaTower *tower = new( postshower[postshower.GetEntriesFast()] ) StGammaTower;
143  return tower;
144 }
145 
147 {
148  TClonesArray &strips = *mStrips;
149  StGammaStrip *strip = new( strips[strips.GetEntriesFast()] ) StGammaStrip;
150  return strip;
151 }
152 
154 {
155  TClonesArray &candidates = *mCandidates;
156  StGammaCandidate *candidate = new( candidates[candidates.GetEntriesFast()] ) StGammaCandidate;
157  return candidate;
158 }
159 
161 // Sum the total track pT and tower eT //
162 // within the given eta ring //
164 Float_t StGammaEvent::sumPt(Float_t eta_min, Float_t eta_max) const
165 {
166  return sumTrackPt(eta_min,eta_max) + sumTowerPt(eta_min,eta_max);
167 }
168 
170 // Sum the total track pT //
171 // within the given eta ring //
173 Float_t StGammaEvent::sumTrackPt(Float_t eta_min, Float_t eta_max) const
174 {
175 
176  Float_t sum = 0.0;
177  for(Int_t i = 0; i < numberOfTracks(); i++)
178  {
179  StGammaTrack *t = track(i);
180  if(t->eta() < eta_min || t->eta() > eta_max) continue;
181  sum += t->pt();
182  }
183 
184  return sum;
185 
186 }
187 
189 // Sum the total tower eT //
190 // within the given eta ring //
192 Float_t StGammaEvent::sumTowerPt(Float_t eta_min, Float_t eta_max) const
193 {
194 
195  Float_t sum = 0.0;
196  for (Int_t i = 0; i < numberOfTowers(); i++)
197  {
198  StGammaTower *t = tower(i);
199  if(t->fail) continue;
200  if(t->eta < eta_min || t->eta > eta_max) continue;
201  sum += t->pt();
202  }
203 
204  return sum;
205 
206 }
Float_t sumTrackPt(Float_t eta_min=-2.5, Float_t eta_max=+2.5) const
Returns track+tower pT in eta range.
StGammaPythiaEvent * mPythia
Magnetic field (kG)
Definition: StGammaEvent.h:135
Float_t sumTowerPt(Float_t eta_min=-2.5, Float_t eta_max=+2.5) const
Returns track pT in eta range.
StGammaTower * newPostshower()
Add a new preshower2 element.
StGammaTower * tower(Int_t i) const
Return ith track.
Definition: StGammaEvent.h:66
StGammaTower * preshower1(Int_t i) const
Return ith tower.
Definition: StGammaEvent.h:67
StGammaTower * newPreshower1()
Add a new tower.
StGammaTower * newTower()
Add a new track.
StGammaStrip * strip(Int_t i) const
Return ith post.
Definition: StGammaEvent.h:70
StGammaTower * newPreshower2()
Add a new preshower1 (bprs) element.
StGammaTrack * newTrack(StMuTrack *mutr=0)
Returns tower pT in eta range.
StGammaCandidate * newCandidate()
Add a new SMD strip.
StGammaStrip * newStrip()
Add a new postshower element.
set< int > mSimuTriggerIds
Trigger ID&#39;s.
Definition: StGammaEvent.h:130
set< int > mTriggerIds
Event number.
Definition: StGammaEvent.h:129
StGammaTrack * track(Int_t i) const
Return number of candidates.
Definition: StGammaEvent.h:65
Float_t pt() const
Referencing candidates.
Definition: StGammaTrack.h:62
TVector3 mVertex
File from which StGammaEvent originatedt.
Definition: StGammaEvent.h:132
StGammaTower * preshower2(Int_t i) const
Return ith pre1.
Definition: StGammaEvent.h:68
StGammaTower * postshower(Int_t i) const
Return ith pre2.
Definition: StGammaEvent.h:69
Int_t mEventNumber
Run number.
Definition: StGammaEvent.h:128
Int_t numberOfTowers() const
Return number of tracks.
Definition: StGammaEvent.h:58
StGammaCandidate * candidate(Int_t i) const
Return ith strip.
Definition: StGammaEvent.h:71
Float_t eta() const
pz at vertex
Definition: StGammaTrack.h:64