StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StJetEvent.cxx
1 //
2 // Pibero Djawotho <pibero@tamu.edu>
3 // Texas A&M University
4 // 1 september 2009
5 //
6 
7 #include "TClonesArray.h"
8 #include "TVector3.h"
9 #include "TLorentzVector.h"
10 #include "StJetEventTypes.h"
11 
12 ClassImp(StJetEvent);
13 
14 StJetEvent::StJetEvent()
15  : mRunId(0)
16  , mEventId(0)
17  , mVertices(new TClonesArray("StJetVertex",10))
18  , mJets(new TClonesArray("StJetCandidate",10))
19  , mTracks(new TClonesArray("StJetTrack",50))
20  , mTowers(new TClonesArray("StJetTower",50))
21  , mParticles(new TClonesArray("StJetParticle",50))
22 {
23 }
24 
25 StJetEvent::~StJetEvent()
26 {
27  mVertices->Delete(); delete mVertices; mVertices = 0;
28  mJets->Delete(); delete mJets; mJets = 0;
29  mTracks->Delete(); delete mTracks; mTracks = 0;
30  mTowers->Delete(); delete mTowers; mTowers = 0;
31  mParticles->Delete(); delete mParticles; mParticles = 0;
32 }
33 
34 void StJetEvent::Clear(Option_t* option)
35 {
36  mVertices->Clear(option);
37  mJets->Clear(option);
38  mTracks->Clear(option);
39  mTowers->Clear(option);
40  mParticles->Clear(option);
41 }
42 
43 int StJetEvent::numberOfVertices () const { return mVertices->GetEntriesFast(); }
44 int StJetEvent::numberOfJets () const { return mJets->GetEntriesFast(); }
45 int StJetEvent::numberOfTracks () const { return mTracks->GetEntriesFast(); }
46 int StJetEvent::numberOfTowers () const { return mTowers->GetEntriesFast(); }
47 int StJetEvent::numberOfParticles() const { return mParticles->GetEntriesFast(); }
48 
49 StJetVertex* StJetEvent::vertex (int i) const { return (StJetVertex*)mVertices->At(i); }
50 StJetCandidate* StJetEvent::jet (int i) const { return (StJetCandidate*)mJets->At(i); }
51 StJetTrack* StJetEvent::track (int i) const { return (StJetTrack*)mTracks->At(i); }
52 StJetTower* StJetEvent::tower (int i) const { return (StJetTower*)mTowers->At(i); }
53 StJetParticle* StJetEvent::particle(int i) const { return (StJetParticle*)mParticles->At(i); }
54 
55 StJetVertex* StJetEvent::newVertex() { return new ((*mVertices)[mVertices->GetEntriesFast()]) StJetVertex; }
56 StJetCandidate* StJetEvent::newJet(const TVector3& vertex, const TLorentzVector& fourMomentum, float area, float area_error) { return new ((*mJets)[mJets->GetEntriesFast()]) StJetCandidate(vertex,fourMomentum, area, area_error); }
57 StJetTrack* StJetEvent::newTrack() { return new ((*mTracks)[mTracks->GetEntriesFast()]) StJetTrack; }
58 StJetTower* StJetEvent::newTower() { return new ((*mTowers)[mTowers->GetEntriesFast()]) StJetTower; }
59 StJetParticle* StJetEvent::newParticle() { return new ((*mParticles)[mParticles->GetEntriesFast()]) StJetParticle; }