EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EventSmear.cxx
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file EventSmear.cxx
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 // (i.e. including leptons and bosons except for the scattered lepton).
54 // The stored Particle* are pointers to the original particles in the event
55 // so don't delete them!
57  // Skip the first two entries, as these are the incident beams
58  for (unsigned i(2); i < GetNTracks(); ++i) {
59  if (!GetTrack(i)) {
60  continue;
61  } // if
62  if (GetTrack(i) != ScatteredLepton()) {
63  final.push_back(GetTrack(i));
64  } // if
65  } // for
66 }
67 
68 std::vector<const erhic::VirtualParticle*> Event::GetTracks() const {
69  std::vector<const erhic::VirtualParticle*> tracks;
70  for (unsigned i(0); i < GetNTracks(); ++i) {
71  tracks.push_back(GetTrack(i));
72  } // for
73  return tracks;
74 }
75 
76 void Event::SetScattered(int index) {
77  if (index >= 0) {
78  mScatteredIndex = index;
79  } // if
80 }
81 void Event::Print(Option_t* /* unused */) const {
82  std::cout <<
83  "x: " << GetX() << std::endl <<
84  "Q2: " << GetQ2() << std::endl <<
85  "y: " << GetY() << std::endl;
86  for (unsigned i(0); i < GetNTracks(); ++i) {
87  if (GetTrack(i)) {
88  GetTrack(i)->Print();
89  } // if
90  } // for
91 }
92 
93 } // namespace Smear