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
EventPythia.cxx
Go to the documentation of this file.
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 } // namespace erhic
virtual const ParticleMC * ScatteredLepton() const
Definition: EventPythia.cxx:71
Double32_t Q2_hat
Definition: EventPythia.h:334
Double32_t SigRadCor
Value used for radiative corrections.
Definition: EventPythia.h:336
Int_t Code() const
Definition: Pid.h:105
Double32_t u_hat
Definition: EventPythia.h:332
Double32_t trueW2
Generated W2 of the event.
Definition: EventPythia.h:345
Double32_t leptonphi
Definition: EventPythia.h:326
Int_t nTracks
Number of Particles in the event (intermediate + final)
Definition: EventMC.h:203
Double32_t t_hat
Definition: EventPythia.h:330
Double32_t thetabeamparton
Definition: EventPythia.h:323
EventPythia(const std::string &str="")
Definition: EventPythia.cxx:20
Int_t number
Event number.
Definition: EventMC.h:201
Double32_t trueQ2
Definition: EventPythia.h:342
Int_t process
PYTHIA code for the physics process producing the event.
Definition: EventMC.h:202
Double32_t xbeamparton
Definition: EventPythia.h:321
Double32_t trueNu
Generated nu of the event.
Definition: EventPythia.h:346
Double32_t trueX
Generated x of the event.
Definition: EventPythia.h:344
virtual bool Parse(const std::string &)
Definition: EventPythia.cxx:50
Double32_t R
Value used for radiative corrections.
Definition: EventPythia.h:348
Double32_t EBrems
Definition: EventPythia.h:337
Int_t genevent
Trials required for this event.
Definition: EventPythia.h:318
virtual Pid Id() const =0
virtual const ParticleMC * BeamLepton() const
Definition: EventMC.cxx:122
virtual ~EventPythia()
Definition: EventPythia.cxx:48
Double32_t F2
Value used for radiative corrections.
Definition: EventPythia.h:347
Double32_t sigma_rad
Value used for radiative corrections.
Definition: EventPythia.h:329
Double32_t trueY
Definition: EventPythia.h:340
Double32_t pt2_hat
Definition: EventPythia.h:349
Double32_t photonflux
Flux factor, see VINT(319)
Definition: EventPythia.h:339
Abstract base class for a general particle.
void FinalState(ParticlePtrList &particles) const
Definition: EventMC.cxx:73
Double32_t F1
Value used for radiative corrections.
Definition: EventPythia.h:328
Double32_t xtgtparton
Definition: EventPythia.h:319