LDMX Software
LHEEvent.cxx
2
3namespace simcore {
4namespace lhe {
5
6LHEEvent::LHEEvent(std::string& line) {
7 std::istringstream iss(line);
8 std::vector<std::string> tokens;
9 do {
10 std::string elem;
11 iss >> elem;
12 if (elem.size() != 0) {
13 tokens.push_back(elem);
14 }
15 } while (iss);
16
17 if (tokens.size() != 6) {
18 EXCEPTION_RAISE("TokenNum",
19 "Wrong number of tokens in LHE event information record.");
20 }
21
22 num_particles_ = atoi(tokens[0].c_str());
23 // The physics process ID
24 process_id_ = atoi(tokens[1].c_str());
25 // The event weight
26 event_weight_ = atof(tokens[2].c_str());
27 // Scale Q of parton distributions
28 scale_q_ = atof(tokens[3].c_str());
29 // QED coupling value
30 coupling_qed_ = atof(tokens[4].c_str());
31 // QCD coupling value
32 coupling_qcd_ = atof(tokens[5].c_str());
33
34 vtx_[0] = 0;
35 vtx_[1] = 0;
36 vtx_[2] = 0;
37}
38
40
41int LHEEvent::getProcessID() const { return process_id_; }
42
43double LHEEvent::getEventWeight() const { return event_weight_; }
44
45double LHEEvent::getScaleQ() const { return scale_q_; }
46
47double LHEEvent::getCouplingQed() const { return coupling_qed_; }
48
49double LHEEvent::getCouplingQcd() const { return coupling_qcd_; }
50
51const double* LHEEvent::getVertex() const { return vtx_; }
52
53double LHEEvent::getVertexTime() const { return vtxt_; }
54
55void LHEEvent::addParticle(std::unique_ptr<LHEParticle> particle) {
56 particles_.push_back(std::move(particle));
57}
58
59const std::vector<std::unique_ptr<LHEParticle>>& LHEEvent::getParticles()
60 const {
61 return particles_;
62}
63
64void LHEEvent::setVertex(double x_, double y_, double z_) {
65 vtx_[0] = x_;
66 vtx_[1] = y_;
67 vtx_[2] = z_;
68}
69
74void LHEEvent::setVertex(const std::string& line) {
75 std::istringstream iss(line);
76 std::vector<std::string> tokens;
77 do {
78 std::string elem;
79 iss >> elem;
80 if (elem.size() != 0) {
81 tokens.push_back(elem);
82 }
83 } while (iss);
84
85 if (tokens.size() != 4 && tokens.size() != 5) {
86 EXCEPTION_RAISE("TokenNum",
87 "Wrong number of tokens or format in LHE event vertex "
88 "information record.");
89 }
90 vtx_[0] = atof(tokens[1].c_str());
91 vtx_[1] = atof(tokens[2].c_str());
92 vtx_[2] = atof(tokens[3].c_str());
93 if (tokens.size() > 4) {
94 vtxt_ = atof(tokens[4].c_str());
95 }
96}
97
98} // namespace lhe
99} // namespace simcore
Class defining an LHE event with a list of particles and information from the header block.
double getEventWeight() const
Get the event weight (XWGTUP).
Definition LHEEvent.cxx:43
LHEEvent(std::string &data)
Class constructor.
Definition LHEEvent.cxx:6
double vtx_[3]
Vertex location.
Definition LHEEvent.h:154
int getProcessID() const
Get the ID of the physics process (IDRUP).
Definition LHEEvent.cxx:41
void addParticle(std::unique_ptr< LHEParticle > particle)
Add a particle to the event.
Definition LHEEvent.cxx:55
double getCouplingQed() const
Get the value of the QED coupling (AQEDUP).
Definition LHEEvent.cxx:47
int num_particles_
Number of particles.
Definition LHEEvent.h:124
double getVertexTime() const
Get the vertex time.
Definition LHEEvent.cxx:53
void setVertex(double x_, double y_, double z_)
Set the vertex location (careful to match units as expected!)
Definition LHEEvent.cxx:64
double getCouplingQcd() const
Get the value of the QCD coupling (AQCDUP).
Definition LHEEvent.cxx:49
double event_weight_
The event weight.
Definition LHEEvent.h:134
double getScaleQ() const
Get the scale Q of parton distributions (SCALUP).
Definition LHEEvent.cxx:45
double coupling_qcd_
QCD coupling value.
Definition LHEEvent.h:149
int getNumParticles() const
Get the number of particles (NUP) in the event.
Definition LHEEvent.cxx:39
const double * getVertex() const
Get the vertex location (careful to match units as expected!)
Definition LHEEvent.cxx:51
std::vector< std::unique_ptr< LHEParticle > > particles_
The list of particles.
Definition LHEEvent.h:164
const std::vector< std::unique_ptr< LHEParticle > > & getParticles() const
Get the list of particles in the event.
Definition LHEEvent.cxx:59
double scale_q_
Scale Q of parton distributions.
Definition LHEEvent.h:139
double vtxt_
Vertex time.
Definition LHEEvent.h:159
int process_id_
The physics process ID.
Definition LHEEvent.h:129
double coupling_qed_
QED coupling value.
Definition LHEEvent.h:144
Dynamically loadable photonuclear models either from SimCore or external libraries implementing this ...