EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EventPythia.cxx
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file EventPythia.cxx
1 
11 
12 #include <cmath>
13 #include <limits>
14 #include <sstream>
15 #include <string>
16 #include <vector>
17 
18 namespace erhic {
19 
20 EventPythia::EventPythia(const std::string& /* Unused */)
21 : nucleon(std::numeric_limits<Int_t>::max())
22 , tgtparton(std::numeric_limits<Int_t>::max())
23 , beamparton(std::numeric_limits<Int_t>::max())
24 , genevent(-1)
25 , xtgtparton(NAN)
26 , xbeamparton(NAN)
27 , thetabeamparton(NAN)
28 , leptonphi(NAN)
29 , F1(NAN)
30 , sigma_rad(NAN)
31 , t_hat(NAN)
32 , u_hat(NAN)
33 , Q2_hat(NAN)
34 , SigRadCor(NAN)
35 , EBrems(NAN)
36 , photonflux(NAN)
37 , trueY(NAN)
38 , trueQ2(NAN)
39 , trueX(NAN)
40 , trueW2(NAN)
41 , trueNu(NAN)
42 , F2(NAN)
43 , R(NAN)
44 , pt2_hat(NAN)
45 , sHat(NAN) {
46 }
47 
49 
50 bool EventPythia::Parse(const std::string& line) {
51  static std::stringstream ss;
52  ss.str("");
53  ss.clear();
54  ss << line;
55  ss >>
56  number >> number >> // Skip first int in the line
59  trueX >> trueW2 >> trueNu >> leptonphi >> sHat >> t_hat >> u_hat >>
60  pt2_hat >> Q2_hat >> F2 >> F1 >> R >> sigma_rad >> SigRadCor >> EBrems >>
62  // Protect against errors in the input file or the stream
63  return !ss.fail();
64 }
65 
66 // Look for the scattered lepton in the event record.
67 // This is the first (only?) particle that matches the following:
68 // 1) pdg code equals that of incident lepton beam.
69 // 2) status code is 1 i.e. it's a stable/final-state particle.
70 // 3) the parent is track three (counting from 1).
72  // Look for the lepton beam to get the species.
73  // If we don't get it we can't find the scattered
74  // lepton so return NULL.
75  const VirtualParticle* beam = BeamLepton();
76  if (!beam) {
77  return NULL;
78  } // if
79  const int species = beam->Id().Code();
80  // Get the final state particles and search them for
81  // the scattered lepton.
82  std::vector<const VirtualParticle*> final;
83  FinalState(final);
84  std::vector<const VirtualParticle*>::const_iterator iter;
85  for (iter = final.begin(); iter != final.end(); ++iter) {
86  // We already know the particle is final state, so
87  // check its species and parent index.
88  if ((*iter)->GetParentIndex() == 3 &&
89  (*iter)->Id().Code() == species) {
90  // Found it, cast to required particle type and return.
91  return static_cast<const ParticleMC*>(*iter);
92  } // if
93  } // for
94  // No luck, couldn't find the scattered lepton.
95  return NULL;
96 }
97 
98  EventBeagle::EventBeagle(const std::string& str/* Unused */):
99  EventPythia(str)
100  , lepton(std::numeric_limits<Int_t>::max())
101  , Atarg(std::numeric_limits<Int_t>::max())
102  , Ztarg(std::numeric_limits<Int_t>::max())
103  , pzlep(NAN)
104  , pztarg(NAN)
105  , pznucl(NAN)
106  , crang(NAN)
107  , crori(NAN)
108  , b(NAN)
109  , Phib(NAN)
110  , Thickness(NAN)
111  , ThickScl(NAN)
112  , Ncollt(std::numeric_limits<Int_t>::max())
113  , Ncolli(std::numeric_limits<Int_t>::max())
114  , Nwound(std::numeric_limits<Int_t>::max())
115  , Nwdch(std::numeric_limits<Int_t>::max())
116  , Nnevap(std::numeric_limits<Int_t>::max())
117  , Npevap(std::numeric_limits<Int_t>::max())
118  , Aremn(std::numeric_limits<Int_t>::max())
119  , NINC(std::numeric_limits<Int_t>::max())
120  , NINCch(std::numeric_limits<Int_t>::max())
121  , d1st(NAN)
122  , davg(NAN)
123  , pxf(NAN)
124  , pyf(NAN)
125  , pzf(NAN)
126  , Eexc(NAN)
127  , RAevt(NAN)
128  , User1(NAN)
129  , User2(NAN)
130  , User3(NAN)
131  {
132 
133  } // EventBeagle::EventBeagle()
134 
136 
137 bool EventBeagle::Parse(const std::string& line) {
138  static std::stringstream ss;
139  ss.str("");
140  ss.clear();
141  ss << line;
142  ss >>
143 // number >> number >> // Skip first int in the line
144 // genevent >> process >> nucleon >> tgtparton >> xtgtparton >>
145 // beamparton >> xbeamparton >> thetabeamparton >> trueY >> trueQ2 >>
146 // trueX >> trueW2 >> trueNu >> leptonphi >> sHat >> t_hat >> u_hat >>
147 // pt2_hat >> Q2_hat >> F2 >> F1 >> R >> sigma_rad >> SigRadCor >> EBrems >>
148 // photonflux >> nTracks;
149  number >> number >> // Skip first int in the line
150  genevent >>
151  lepton >> Atarg >> Ztarg >> pzlep >> pztarg >> pznucl >> crang >> crori >>//added variables
152  process >> nucleon >> tgtparton >> xtgtparton >>
154  trueX >> trueW2 >> trueNu >> leptonphi >> sHat >> t_hat >> u_hat >>
155  pt2_hat >> Q2_hat >> F2 >> F1 >> R >> sigma_rad >> SigRadCor >> EBrems >>
156  photonflux >>
157  b >> Phib >> Thickness >> ThickScl >> Ncollt >> Ncolli >> Nwound >> Nwdch >> Nnevap >> Npevap >> Aremn >> //added variables
158  NINC >> NINCch >> d1st >> davg >> pxf >> pyf >> pzf >> Eexc >> RAevt >> User1 >> User2 >> User3 >> //added variables
159  nTracks;
160  // Protect against errors in the input file or the stream
161  return !ss.fail();
162 }
163 } // namespace erhic