SLIC  6.1.1
Simulation for the Linear Collider (SLIC) - Geant4 simulation application
LHEParticle.cc
Go to the documentation of this file.
1 #include "LHEParticle.hh"
2 
3 // STL
4 #include <iostream>
5 #include <vector>
6 #include <sstream>
7 #include <stdexcept>
8 #include <stdlib.h>
9 
10 // Geant4
11 #include "globals.hh"
12 
13 namespace slic {
14 
15  LHEParticle::LHEParticle(std::string& line) {
16 
17  std::istringstream iss(line);
18  std::vector<std::string> tokens;
19  do {
20  std::string elem;
21  iss >> elem;
22  if (elem.size() != 0) {
23  tokens.push_back(elem);
24  }
25  } while (iss);
26 
27  if (tokens.size() != 13) {
28  std::cerr << "ERROR: Bad particle record in LHE file ..." << std::endl;
29  std::cerr << " " << line << std::endl;
30  G4Exception("LHEParticle::LHEParticle", "LHEParticleError", FatalException, "Wrong number of tokens in LHE particle record.");
31  }
32 
33  idup_ = atof(tokens[0].c_str());
34  istup_ = atoi(tokens[1].c_str());
35  mothup_[0] = atoi(tokens[2].c_str());
36  mothup_[1] = atoi(tokens[3].c_str());
37  icolup_[0] = atoi(tokens[4].c_str());
38  icolup_[1] = atoi(tokens[5].c_str());
39  pup_[0] = atof(tokens[6].c_str());
40  pup_[1] = atof(tokens[7].c_str());
41  pup_[2] = atof(tokens[8].c_str());
42  pup_[3] = atof(tokens[9].c_str());
43  pup_[4] = atof(tokens[10].c_str());
44  vtimup_ = atof(tokens[11].c_str());
45  spinup_ = atof(tokens[12].c_str());
46 
47  mothers_[0] = NULL;
48  mothers_[1] = NULL;
49  }
50 
51  int LHEParticle::getIDUP() const {
52  return idup_;
53  }
54 
55  int LHEParticle::getISTUP() const {
56  return istup_;
57  }
58 
59  int LHEParticle::getMOTHUP(int i) const {
60  return mothup_[i];
61  }
62 
63  int LHEParticle::getICOLUP(int i) const {
64  return icolup_[i];
65  }
66 
67  double LHEParticle::getPUP(int i) const {
68  return pup_[i];
69  }
70 
71  double LHEParticle::getVTIMUP() const {
72  return vtimup_;
73  }
74 
75  double LHEParticle::getSPINUP() const {
76  return spinup_;
77  }
78 
79  void LHEParticle::setMother(int i, LHEParticle* mother) {
80  mothers_[i] = mother;
81  }
82 
84  return mothers_[i];
85  }
86 
87  void LHEParticle::print(std::ostream& stream) const {
88  stream << "LHEParticle { " << "IDUP: " << getIDUP() << ", ISTUP: " << getISTUP() << ", MOTHUP[0]: " << getMOTHUP(0) << ", MOTHUP[1]: " << getMOTHUP(1) << ", ICOLUP[0]: " << getICOLUP(0) << ", ICOLUP[1]: " << getICOLUP(1) << ", PUP[0]: " << getPUP(0) << ", PUP[1]: " << getPUP(1) << ", PUP[2]: " << getPUP(2) << ", PUP[3]: " << getPUP(3) << ", PUP[4]: " << getPUP(4) << ", VTIMUP: " << getVTIMUP() << ", SPINUP: " << getSPINUP() << " }" << std::endl;
89  }
90 
91  std::ostream& operator <<(std::ostream& stream, const LHEParticle& particle) {
92  particle.print(stream);
93  return stream;
94  }
95 
96 }
Single particle record in an LHE event.
Definition: LHEParticle.hh:20
double getSPINUP() const
Definition: LHEParticle.cc:75
int getICOLUP(int) const
Definition: LHEParticle.cc:63
int getMOTHUP(int) const
Definition: LHEParticle.cc:59
LHEParticle * mothers_[2]
Definition: LHEParticle.hh:104
int getIDUP() const
Definition: LHEParticle.cc:51
LHEParticle(std::string &data)
Definition: LHEParticle.cc:15
double getVTIMUP() const
Definition: LHEParticle.cc:71
double getPUP(int) const
Definition: LHEParticle.cc:67
LHEParticle * getMother(int) const
Definition: LHEParticle.cc:83
void print(std::ostream &stream) const
Definition: LHEParticle.cc:87
int getISTUP() const
Definition: LHEParticle.cc:55
void setMother(int i, LHEParticle *particle)
Definition: LHEParticle.cc:79
@ endl
Definition: LogStream.hh:26
std::ostream & operator<<(std::ostream &stream, const LHEParticle &particle)
Definition: LHEParticle.cc:91