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
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
void HadronicFinalState(ParticlePtrList &) const
Definition: EventSmear.cxx:55
std::vector< ParticleMCS * > particles
The smeared particle list.
Definition: EventSmear.h:155
std::vector< const erhic::VirtualParticle * > ParticlePtrList
Definition: VirtualEvent.h:52
std::vector< const erhic::VirtualParticle * > GetTracks() const
Definition: EventSmear.cxx:67
virtual UInt_t GetNTracks() const
Definition: EventSmear.h:161
virtual void Reset()
Definition: EventSmear.cxx:34
virtual void Print(Option_t *="") const
Definition: ParticleMCS.cxx:52
virtual void ClearParticles()
Definition: EventSmear.cxx:26
virtual Double_t GetQ2() const
Definition: EventDis.h:206
virtual Double_t GetX() const
Definition: EventDis.h:198
virtual Double_t GetY() const
Definition: EventDis.h:214
virtual void AddLast(ParticleMCS *particle)
Definition: EventSmear.cxx:39
virtual const ParticleMCS * ScatteredLepton() const
Definition: EventSmear.cxx:44
virtual void SetScattered(int index)
Definition: EventSmear.cxx:75
virtual void Print(Option_t *="") const
Definition: EventSmear.cxx:80
virtual const ParticleMCS * GetTrack(UInt_t) const
Definition: EventSmear.h:165
virtual ~Event()
Definition: EventSmear.cxx:22