LDMX Software
LHEEvent.cxx
2
3#include "Framework/Exception/Exception.h"
4
5// Geant4
6#include "globals.hh"
7
8// STL
9#include <iostream>
10#include <sstream>
11
12namespace simcore::lhe {
13
14LHEEvent::LHEEvent(std::string& line) {
15 std::istringstream iss(line);
16 std::vector<std::string> tokens;
17 do {
18 std::string elem;
19 iss >> elem;
20 if (elem.size() != 0) {
21 tokens.push_back(elem);
22 }
23 } while (iss);
24
25 if (tokens.size() != 6) {
26 EXCEPTION_RAISE("TokenNum",
27 "Wrong number of tokens in LHE event information record.");
28 }
29
30 nup_ = atoi(tokens[0].c_str());
31 idprup_ = atoi(tokens[1].c_str());
32 xwgtup_ = atof(tokens[2].c_str());
33 scalup_ = atof(tokens[3].c_str());
34 aqedup_ = atof(tokens[4].c_str());
35 aqcdup_ = atof(tokens[5].c_str());
36
37 vtx_[0] = 0;
38 vtx_[1] = 0;
39 vtx_[2] = 0;
40}
41
43 for (std::vector<LHEParticle*>::iterator it = particles_.begin();
44 it != particles_.end(); it++) {
45 delete (*it);
46 }
47 particles_.clear();
48}
49
50int LHEEvent::getNUP() const { return nup_; }
51
52int LHEEvent::getIDPRUP() const { return idprup_; }
53
54double LHEEvent::getXWGTUP() const { return xwgtup_; }
55
56double LHEEvent::getSCALUP() const { return scalup_; }
57
58double LHEEvent::getAQEDUP() const { return aqedup_; }
59
60double LHEEvent::getAQCDUP() const { return aqcdup_; }
61
62const double* LHEEvent::getVertex() const { return vtx_; }
63
64double LHEEvent::getVertexTime() const { return vtxt_; }
65
67 particles_.push_back(particle);
68}
69
70const std::vector<LHEParticle*>& LHEEvent::getParticles() { return particles_; }
71
72void LHEEvent::setVertex(double x, double y, double z) {
73 vtx_[0] = x;
74 vtx_[1] = y;
75 vtx_[2] = z;
76}
77
82void LHEEvent::setVertex(const std::string& line) {
83 std::istringstream iss(line);
84 std::vector<std::string> tokens;
85 do {
86 std::string elem;
87 iss >> elem;
88 if (elem.size() != 0) {
89 tokens.push_back(elem);
90 }
91 } while (iss);
92
93 if (tokens.size() != 4 && tokens.size() != 5) {
94 EXCEPTION_RAISE("TokenNum",
95 "Wrong number of tokens or format in LHE event vertex "
96 "information record.");
97 }
98 vtx_[0] = atof(tokens[1].c_str());
99 vtx_[1] = atof(tokens[2].c_str());
100 vtx_[2] = atof(tokens[3].c_str());
101 if (tokens.size() > 4) {
102 vtxt_ = atof(tokens[4].c_str());
103 }
104}
105
106} // namespace simcore::lhe
Class defining an LHE event with a list of particles and information from the header block.
LHEEvent(std::string &data)
Class constructor.
Definition LHEEvent.cxx:14
double vtx_[3]
Vertex location.
Definition LHEEvent.h:146
double getXWGTUP() const
Get the event weight (XWGTUP).
Definition LHEEvent.cxx:54
void addParticle(LHEParticle *particle)
Add a particle to the event.
Definition LHEEvent.cxx:66
int nup_
Number of particles.
Definition LHEEvent.h:116
double getAQCDUP() const
Get the value of the QED coupling (AQCDUP).
Definition LHEEvent.cxx:60
int idprup_
The physics process ID.
Definition LHEEvent.h:121
double aqedup_
QCD coupling value.
Definition LHEEvent.h:136
double aqcdup_
QCD coupling value.
Definition LHEEvent.h:141
double getVertexTime() const
Get the vertex time.
Definition LHEEvent.cxx:64
double scalup_
Scale Q of parton distributions.
Definition LHEEvent.h:131
int getIDPRUP() const
Get the ID of the physics process (IDRUP).
Definition LHEEvent.cxx:52
const std::vector< LHEParticle * > & getParticles()
Get the list of particles in the event.
Definition LHEEvent.cxx:70
double getSCALUP() const
Get the scale Q of parton distributions (SCALUP).
Definition LHEEvent.cxx:56
double xwgtup_
The event weight.
Definition LHEEvent.h:126
int getNUP() const
Get the number of particles (NUP) in the event.
Definition LHEEvent.cxx:50
double getAQEDUP() const
Get the value of the QED coupling (AQEDUP).
Definition LHEEvent.cxx:58
const double * getVertex() const
Get the vertex location (careful to match units as expected!)
Definition LHEEvent.cxx:62
std::vector< LHEParticle * > particles_
The list of particles.
Definition LHEEvent.h:156
void setVertex(double x, double y, double z)
Set the vertex location (careful to match units as expected!)
Definition LHEEvent.cxx:72
double vtxt_
Vertex time.
Definition LHEEvent.h:151
virtual ~LHEEvent()
Class destructor.
Definition LHEEvent.cxx:42
Single particle record in an LHE event.
Definition LHEParticle.h:20