eic-smear  1.0.3
A collection of ROOT classes for Monte Carlo events and a fast-smearing code simulating detector effects for the Electron-Ion Collider task force
smear/EventSmear.cxx
Go to the documentation of this file.
1 
11 
12 #include <iostream>
13 #include <vector>
14 
15 namespace Smear {
16 
18 : nTracks(0)
19 , mScatteredIndex(-1) {
20 }
21 
24 }
25 
27  for (unsigned i(0); i < particles.size(); ++i) {
28  if (GetTrack(i)) {
29  delete GetTrack(i);
30  } // if
31  } // for
32 }
33 
34 void Event::Reset() {
36  *this = Event();
37 }
38 
40  particles.push_back(track);
41 }
42 
43 // The scattered lepton should be the first non-NULL entry in the track list
45  if (mScatteredIndex > -1 &&
46  mScatteredIndex < static_cast<int>(GetNTracks())) {
47  return GetTrack(mScatteredIndex);
48  } // if
49  return NULL;
50 }
51 
52 // Get the particles that belong to the hadronic final state.
53 // The stored Particle* are pointers to the original particles in the event
54 // so don't delete them!
56  // Skip the first two entries, as these are the incident beams
57  for (unsigned i(2); i < GetNTracks(); ++i) {
58  if (!GetTrack(i)) {
59  continue;
60  } // if
61  if (GetTrack(i) != ScatteredLepton()) {
62  final.push_back(GetTrack(i));
63  } // if
64  } // for
65 }
66 
67 std::vector<const erhic::VirtualParticle*> Event::GetTracks() const {
68  std::vector<const erhic::VirtualParticle*> tracks;
69  for (unsigned i(0); i < GetNTracks(); ++i) {
70  tracks.push_back(GetTrack(i));
71  } // for
72  return tracks;
73 }
74 
75 void Event::SetScattered(int index) {
76  if (index >= 0) {
77  mScatteredIndex = index;
78  } // if
79 }
80 void Event::Print(Option_t* /* unused */) const {
81  std::cout <<
82  "x: " << GetX() << std::endl <<
83  "Q2: " << GetQ2() << std::endl <<
84  "y: " << GetY() << std::endl;
85  for (unsigned i(0); i < GetNTracks(); ++i) {
86  if (GetTrack(i)) {
87  GetTrack(i)->Print();
88  } // if
89  } // for
90 }
91 
92 } // namespace Smear
Smear::Event::GetNTracks
virtual UInt_t GetNTracks() const
Returns the number of tracks in the event.
Definition: smear/EventSmear.h:161
Smear
Definition: Acceptance.cxx:16
Smear::Event::AddLast
virtual void AddLast(ParticleMCS *particle)
Add a new track to the end of the track list.
Definition: smear/EventSmear.cxx:39
erhic::VirtualEvent::ParticlePtrList
std::vector< const erhic::VirtualParticle * > ParticlePtrList
typedef for a track pointer collection.
Definition: VirtualEvent.h:52
Smear::Event::Event
Event()
Default constructor.
Definition: smear/EventSmear.cxx:17
Smear::Event::SetScattered
virtual void SetScattered(int index)
Set which particle is the scattered lepton.
Definition: smear/EventSmear.cxx:75
Smear::Event::GetTrack
virtual const ParticleMCS * GetTrack(UInt_t) const
Returns the nth track.
Definition: smear/EventSmear.h:165
Smear::Event::~Event
virtual ~Event()
Destructor.
Definition: smear/EventSmear.cxx:22
Smear::Event::particles
std::vector< ParticleMCS * > particles
The smeared particle list.
Definition: smear/EventSmear.h:155
Smear::Event::Print
virtual void Print(Option_t *="") const
Prints the attributes of this event to standard output.
Definition: smear/EventSmear.cxx:80
Smear::Event::GetTracks
std::vector< const erhic::VirtualParticle * > GetTracks() const
Returns a vector of pointers to all tracks in the event.
Definition: smear/EventSmear.cxx:67
EventSmear.h
Smear::Event::mScatteredIndex
Int_t mScatteredIndex
Definition: smear/EventSmear.h:156
Smear::ParticleMCS
A smeared Monte Carlo particle.
Definition: ParticleMCS.h:27
erhic::EventDis::GetX
virtual Double_t GetX() const
Returns Bjorken-x of the event.
Definition: EventDis.h:198
Smear::Event::HadronicFinalState
void HadronicFinalState(ParticlePtrList &) const
Yields all particles that belong to the hadronic final state.
Definition: smear/EventSmear.cxx:55
Smear::ParticleMCS::Print
virtual void Print(Option_t *="") const
Prints the attributes of this particle to standard output.
Definition: ParticleMCS.cxx:52
Smear::Event::Reset
virtual void Reset()
Clear the particle list, sets event properties to default values.
Definition: smear/EventSmear.cxx:34
Smear::Event::ScatteredLepton
virtual const ParticleMCS * ScatteredLepton() const
Returns a pointer to the lepton beam particle after scattering.
Definition: smear/EventSmear.cxx:44
Smear::Event::ClearParticles
virtual void ClearParticles()
Clears particle array, leaves event variables unchanged.
Definition: smear/EventSmear.cxx:26
erhic::EventDis::GetQ2
virtual Double_t GetQ2() const
Returns the four-momentum transfer (exchange boson mass) Q2.
Definition: EventDis.h:206
erhic::EventDis::GetY
virtual Double_t GetY() const
Returns the event inelasticity.
Definition: EventDis.h:214