AlcapDAQ  1
Public Member Functions | Private Attributes | Static Private Attributes
JetEvent Class Reference

#include <JetEvent.h>

Inheritance diagram for JetEvent:

Public Member Functions

 JetEvent ()
 
virtual ~JetEvent ()
 
void Build (Int_t jetm=3, Int_t trackm=10, Int_t hitam=100, Int_t hitbm=10)
 
void Clear (Option_t *option="")
 
void Reset (Option_t *option="")
 
Int_t GetNjet () const
 
Int_t GetNtrack () const
 
Int_t GetNhitA () const
 
Int_t GetNhitB () const
 
JetAddJet ()
 
TrackAddTrack ()
 
HitAddHitA ()
 
HitAddHitB ()
 
TClonesArray * GetJets () const
 

Private Attributes

TVector3 fVertex
 
Int_t fNjet
 
Int_t fNtrack
 
Int_t fNhitA
 
Int_t fNhitB
 
TClonesArray * fJets
 
TClonesArray * fTracks
 
TClonesArray * fHitsA
 
TClonesArray * fHitsB
 

Static Private Attributes

static TClonesArray * fgJets
 
static TClonesArray * fgTracks
 
static TClonesArray * fgHitsA = 0
 
static TClonesArray * fgHitsB = 0
 

Detailed Description

Definition at line 64 of file JetEvent.h.

Constructor & Destructor Documentation

JetEvent::JetEvent ( )

Definition at line 24 of file JetEvent.cxx.

25 {
26  // Create a JetEvent object.
27  // When the constructor is invoked for the first time, the class static
28  // variables fgxxx are 0 and the TClonesArray fgxxx are created.
29 
30  if (!fgTracks) fgTracks = new TClonesArray("Track", 100);
31  if (!fgJets) fgJets = new TClonesArray("Jet", 10);
32  if (!fgHitsA) fgHitsA = new TClonesArray("Hit", 10000);
33  if (!fgHitsB) fgHitsB = new TClonesArray("Hit", 1000);
34  fJets = fgJets;
35  fTracks = fgTracks;
36  fHitsA = fgHitsA;
37  fHitsB = fgHitsB;
38 }
JetEvent::~JetEvent ( )
virtual

Definition at line 41 of file JetEvent.cxx.

References Reset().

42 {
43  Reset();
44 }

Member Function Documentation

Hit * JetEvent::AddHitA ( )

Definition at line 125 of file JetEvent.cxx.

References fHitsA, and fNhitA.

Referenced by Build().

126 {
127  // Add a new hit to the list of hits in detector A
128 
129  TClonesArray &hitsA = *fHitsA;
130  Hit *hit = new(hitsA[fNhitA++]) Hit();
131  return hit;
132 }
Hit * JetEvent::AddHitB ( )

Definition at line 135 of file JetEvent.cxx.

References fHitsB, and fNhitB.

Referenced by Build().

136 {
137  // Add a new hit to the list of hits in detector B
138 
139  TClonesArray &hitsB = *fHitsB;
140  Hit *hit = new(hitsB[fNhitB++]) Hit();
141  return hit;
142 }
Jet * JetEvent::AddJet ( )

Definition at line 103 of file JetEvent.cxx.

References fJets, and fNjet.

Referenced by Build().

104 {
105  // Add a new Jet to the list of tracks for this event.
106 
107  TClonesArray &jets = *fJets;
108  Jet *jet = new(jets[fNjet++]) Jet();
109  return jet;
110 }
Track * JetEvent::AddTrack ( )

Definition at line 114 of file JetEvent.cxx.

References fNtrack, and fTracks.

Referenced by Build().

115 {
116  // Add a new track to the list of tracks for this event.
117 
118  TClonesArray &tracks = *fTracks;
119  Track *track = new(tracks[fNtrack++]) Track();
120  return track;
121 }
void JetEvent::Build ( Int_t  jetm = 3,
Int_t  trackm = 10,
Int_t  hitam = 100,
Int_t  hitbm = 10 
)

Definition at line 47 of file JetEvent.cxx.

References AddHitA(), AddHitB(), AddJet(), AddTrack(), Clear(), Track::fHits, Track::fNhit, fNhitA, fNhitB, fNjet, fNtrack, Jet::fPhi, Jet::fPt, Track::fPx, Track::fPy, Track::fPz, Jet::fTracks, fVertex, Hit::fX, Hit::fY, and Hit::fZ.

47  {
48  //Build one event
49 
50  //Save current Object count
51  Int_t ObjectNumber = TProcessID::GetObjectCount();
52  Clear();
53 
54  Hit *hit;
55  Track *track;
56  Jet *jet;
57  fNjet = fNtrack = fNhitA = fNhitB = 0;
58 
59  fVertex.SetXYZ(gRandom->Gaus(0,0.1),
60  gRandom->Gaus(0,0.2),
61  gRandom->Gaus(0,10));
62 
63  Int_t njets = (Int_t)gRandom->Gaus(jetm,1); if (njets < 1) njets = 1;
64  for (Int_t j=0;j<njets;j++) {
65  jet = AddJet();
66  jet->fPt = gRandom->Gaus(0,10);
67  jet->fPhi = 2*TMath::Pi()*gRandom->Rndm();
68  Int_t ntracks = (Int_t)gRandom->Gaus(trackm,3); if (ntracks < 1) ntracks = 1;
69  for (Int_t t=0;t<ntracks;t++) {
70  track = AddTrack();
71  track->fPx = gRandom->Gaus(0,1);
72  track->fPy = gRandom->Gaus(0,1);
73  track->fPz = gRandom->Gaus(0,5);
74  jet->fTracks.Add(track);
75  Int_t nhitsA = (Int_t)gRandom->Gaus(hitam,5);
76  for (Int_t ha=0;ha<nhitsA;ha++) {
77  hit = AddHitA();
78  hit->fX = 10000*j + 100*t +ha;
79  hit->fY = 10000*j + 100*t +ha+0.1;
80  hit->fZ = 10000*j + 100*t +ha+0.2;
81  track->fHits.Add(hit);
82  }
83  Int_t nhitsB = (Int_t)gRandom->Gaus(hitbm,2);
84  for (Int_t hb=0;hb<nhitsB;hb++) {
85  hit = AddHitB();
86  hit->fX = 20000*j + 100*t +hb+0.3;
87  hit->fY = 20000*j + 100*t +hb+0.4;
88  hit->fZ = 20000*j + 100*t +hb+0.5;
89  track->fHits.Add(hit);
90  }
91  track->fNhit = nhitsA + nhitsB;
92  }
93  }
94  //Restore Object count
95  //To save space in the table keeping track of all referenced objects
96  //we assume that our events do not address each other. We reset the
97  //object count to what it was at the beginning of the event.
98  TProcessID::SetObjectCount(ObjectNumber);
99 }
void JetEvent::Clear ( Option_t *  option = "")

Definition at line 145 of file JetEvent.cxx.

References fHitsA, fHitsB, fJets, and fTracks.

Referenced by Build().

146 {
147  fJets->Clear(option);
148  fTracks->Clear(option);
149  fHitsA->Clear(option);
150  fHitsB->Clear(option);
151 }
TClonesArray* JetEvent::GetJets ( ) const
inline

Definition at line 96 of file JetEvent.h.

References fJets.

96 { return fJets; }
Int_t JetEvent::GetNhitA ( ) const
inline

Definition at line 90 of file JetEvent.h.

References fNhitA.

90 { return fNhitA; }
Int_t JetEvent::GetNhitB ( ) const
inline

Definition at line 91 of file JetEvent.h.

References fNhitB.

91 { return fNhitB; }
Int_t JetEvent::GetNjet ( ) const
inline

Definition at line 88 of file JetEvent.h.

References fNjet.

88 { return fNjet; }
Int_t JetEvent::GetNtrack ( ) const
inline

Definition at line 89 of file JetEvent.h.

References fNtrack.

89 { return fNtrack; }
void JetEvent::Reset ( Option_t *  option = "")

Definition at line 154 of file JetEvent.cxx.

References fgHitsA, fgHitsB, fgJets, and fgTracks.

Referenced by ~JetEvent().

155 {
156 // Static function to reset all static objects for this event
157 
158  delete fgJets; fgJets = 0;
159  delete fgTracks; fgTracks = 0;
160  delete fgHitsA; fgHitsA = 0;
161  delete fgHitsB; fgHitsB = 0;
162 }

Field Documentation

TClonesArray * JetEvent::fgHitsA = 0
staticprivate

Definition at line 79 of file JetEvent.h.

Referenced by Reset().

TClonesArray * JetEvent::fgHitsB = 0
staticprivate

Definition at line 80 of file JetEvent.h.

Referenced by Reset().

TClonesArray* JetEvent::fgJets
staticprivate

Definition at line 77 of file JetEvent.h.

Referenced by Reset().

TClonesArray* JetEvent::fgTracks
staticprivate

Definition at line 78 of file JetEvent.h.

Referenced by Reset().

TClonesArray* JetEvent::fHitsA
private

Definition at line 74 of file JetEvent.h.

Referenced by AddHitA(), and Clear().

TClonesArray* JetEvent::fHitsB
private

Definition at line 75 of file JetEvent.h.

Referenced by AddHitB(), and Clear().

TClonesArray* JetEvent::fJets
private

Definition at line 72 of file JetEvent.h.

Referenced by AddJet(), Clear(), and GetJets().

Int_t JetEvent::fNhitA
private

Definition at line 70 of file JetEvent.h.

Referenced by AddHitA(), Build(), and GetNhitA().

Int_t JetEvent::fNhitB
private

Definition at line 71 of file JetEvent.h.

Referenced by AddHitB(), Build(), and GetNhitB().

Int_t JetEvent::fNjet
private

Definition at line 68 of file JetEvent.h.

Referenced by AddJet(), Build(), and GetNjet().

Int_t JetEvent::fNtrack
private

Definition at line 69 of file JetEvent.h.

Referenced by AddTrack(), Build(), and GetNtrack().

TClonesArray* JetEvent::fTracks
private

Definition at line 73 of file JetEvent.h.

Referenced by AddTrack(), and Clear().

TVector3 JetEvent::fVertex
private

Definition at line 67 of file JetEvent.h.

Referenced by Build().


The documentation for this class was generated from the following files: