ATLAS Offline Software
Loading...
Searching...
No Matches
HepMC::ShortEventAttribute Class Reference

#include <GenEvent.h>

Inheritance diagram for HepMC::ShortEventAttribute:
Collaboration diagram for HepMC::ShortEventAttribute:

Public Member Functions

 ShortEventAttribute ()
 ShortEventAttribute (const HepMC3::GenEvent *e)
bool from_event (const HepMC3::GenEvent *e)
bool from_string (const std::string &att) override
bool to_string (std::string &fl) const override
void resize ()

Public Attributes

int NUP = 0
int IDPRUP = 0
double XWGTUP = 0
double SCALUP = 0
double AQEDUP = 0
double AQCDUP = 0
std::vector< long > IDUP {}
std::vector< int > ISTUP {}
std::vector< std::pair< int, int > > MOTHUP {}
std::vector< std::pair< int, int > > ICOLUP {}
std::vector< std::vector< double > > PUP {}
std::vector< double > VTIMUP {}
std::vector< double > SPINUP {}

Detailed Description

Definition at line 41 of file GenEvent.h.

Constructor & Destructor Documentation

◆ ShortEventAttribute() [1/2]

HepMC::ShortEventAttribute::ShortEventAttribute ( )
inline

Definition at line 43 of file GenEvent.h.

43: HepMC3::Attribute(){}

◆ ShortEventAttribute() [2/2]

HepMC::ShortEventAttribute::ShortEventAttribute ( const HepMC3::GenEvent * e)
inline

Definition at line 44 of file GenEvent.h.

44: HepMC3::Attribute(){ from_event(e); }
bool from_event(const HepMC3::GenEvent *e)
Definition GenEvent.h:46

Member Function Documentation

◆ from_event()

bool HepMC::ShortEventAttribute::from_event ( const HepMC3::GenEvent * e)
inline

Definition at line 46 of file GenEvent.h.

46 {
47 NUP=e->particles().size();
48 resize();
49 XWGTUP = e->weights().size() ? e->weights()[0] : 1.0;
50 auto A_signal_process_id = e->attribute<HepMC3::IntAttribute>(HepMCStr::signal_process_id);
51 IDPRUP = A_signal_process_id ? A_signal_process_id->value() : 0;
52 auto A_event_scale = e->attribute<HepMC3::DoubleAttribute>(HepMCStr::event_scale);
53 SCALUP = A_event_scale ? A_event_scale->value() : 0;
54 auto A_alphaQCD = e->attribute<HepMC3::DoubleAttribute>(HepMCStr::alphaQCD);
55 AQCDUP = A_alphaQCD ? A_alphaQCD->value() : 0;
56 auto A_alphaQED = e->attribute<HepMC3::DoubleAttribute>(HepMCStr::alphaQED);
57 AQEDUP = A_alphaQED ? A_alphaQED->value() : 0;
58 for ( int i = 0; i < NUP; ++i ){
59 const auto & thisParticle = e->particles().at(i);
60 PUP[i][0] = thisParticle->momentum().px();
61 PUP[i][1] = thisParticle->momentum().py();
62 PUP[i][2] = thisParticle->momentum().pz();
63 PUP[i][3] = thisParticle->momentum().e();
64 PUP[i][4] = thisParticle->momentum().m();
65 IDUP[i] = thisParticle->pdg_id();
66 const auto pv = thisParticle->production_vertex();
67 const auto ev = thisParticle->end_vertex();
68 if (pv && ev ) ISTUP[i] = 2;
69 if (pv && !ev ) ISTUP[i] = 1;
70 if (thisParticle->status() == 4 || !pv ) ISTUP[i] = -1;
71 const auto flow1 = thisParticle->attribute<HepMC3::IntAttribute>(HepMCStr::flow1);
72 const auto flow2 = thisParticle->attribute<HepMC3::IntAttribute>(HepMCStr::flow2);
73 ICOLUP[i].first = flow1 ? flow1->value() : 0;
74 ICOLUP[i].second = flow2 ? flow2->value() : 0;
75 int l = 0;
76 int h = 0;
77 if (pv && !pv->particles_in().empty()) {
78 l = pv->particles_in().front()->id();
79 h = l;
80 for (const auto& p : pv->particles_in()) {
81 const int id = p->id();
82 l = std::min(l, id);
83 h = std::max(h, id);
84 }
85 }
86 MOTHUP[i].first = h;
87 MOTHUP[i].second = l;
88 }
89 return true;
90 }
std::vector< std::vector< double > > PUP
Definition GenEvent.h:168
std::vector< std::pair< int, int > > ICOLUP
Definition GenEvent.h:167
std::vector< std::pair< int, int > > MOTHUP
Definition GenEvent.h:166
std::vector< long > IDUP
Definition GenEvent.h:164
std::vector< int > ISTUP
Definition GenEvent.h:165
int ev
Definition globals.cxx:25
const std::string event_scale
const std::string flow2
const std::string flow1
const std::string signal_process_id
const std::string alphaQED
const std::string alphaQCD
l
Printing final latex table to .tex output file.

◆ from_string()

bool HepMC::ShortEventAttribute::from_string ( const std::string & att)
inlineoverride

Definition at line 92 of file GenEvent.h.

92 {
93 std::istringstream iss(att);
94 iss >> NUP;
95 iss >> IDPRUP;
96 iss >> XWGTUP;
97 iss >> SCALUP;
98 iss >> AQEDUP;
99 iss >> AQCDUP;
100 //assume input is a trusted source
101 //coverity[tainted_data]
102 resize();
103 for ( int i = 0; i < NUP; ++i ){
104 iss >> IDUP[i];
105 iss >> ISTUP[i];
106 iss >> MOTHUP[i].first;
107 iss >> MOTHUP[i].second;
108 iss >> ICOLUP[i].first;
109 iss >> ICOLUP[i].second;
110 iss >> PUP[i][0];
111 iss >> PUP[i][1];
112 iss >> PUP[i][2];
113 iss >> PUP[i][3];
114 iss >> PUP[i][4];
115 iss >> VTIMUP[i];
116 iss >> SPINUP[i];
117 }
118 set_is_parsed(true);
119 return true;
120 }
std::vector< double > VTIMUP
Definition GenEvent.h:169
std::vector< double > SPINUP
Definition GenEvent.h:170

◆ resize()

void HepMC::ShortEventAttribute::resize ( )
inline

Definition at line 148 of file GenEvent.h.

148 {
149 IDUP.resize(NUP);
150 ISTUP.resize(NUP);
151 MOTHUP.resize(NUP);
152 ICOLUP.resize(NUP);
153 PUP.resize(NUP, std::vector<double>(5));
154 VTIMUP.resize(NUP);
155 SPINUP.resize(NUP);
156 }

◆ to_string()

bool HepMC::ShortEventAttribute::to_string ( std::string & fl) const
inlineoverride

Definition at line 122 of file GenEvent.h.

122 {
123 std::ostringstream file;
124 file << " " << std::setw(4) << NUP
125 << " " << std::setw(6) << IDPRUP
126 << " " << std::setw(14) << XWGTUP
127 << " " << std::setw(14) << SCALUP
128 << " " << std::setw(14) << AQEDUP
129 << " " << std::setw(14) << AQCDUP << "\n";
130 for ( int i = 0; i < NUP; ++i )
131 file << " " << std::setw(8) << IDUP[i]
132 << " " << std::setw(2) << ISTUP[i]
133 << " " << std::setw(4) << MOTHUP[i].first
134 << " " << std::setw(4) << MOTHUP[i].second
135 << " " << std::setw(4) << ICOLUP[i].first
136 << " " << std::setw(4) << ICOLUP[i].second
137 << " " << std::setw(14) << PUP[i][0]
138 << " " << std::setw(14) << PUP[i][1]
139 << " " << std::setw(14) << PUP[i][2]
140 << " " << std::setw(14) << PUP[i][3]
141 << " " << std::setw(14) << PUP[i][4]
142 << " " << std::setw(1) << VTIMUP[i]
143 << " " << std::setw(1) << SPINUP[i] << std::endl;
144 fl += file.str();
145 return true;
146 }
TFile * file

Member Data Documentation

◆ AQCDUP

double HepMC::ShortEventAttribute::AQCDUP = 0

Definition at line 163 of file GenEvent.h.

◆ AQEDUP

double HepMC::ShortEventAttribute::AQEDUP = 0

Definition at line 162 of file GenEvent.h.

◆ ICOLUP

std::vector< std::pair<int,int> > HepMC::ShortEventAttribute::ICOLUP {}

Definition at line 167 of file GenEvent.h.

167{};

◆ IDPRUP

int HepMC::ShortEventAttribute::IDPRUP = 0

Definition at line 159 of file GenEvent.h.

◆ IDUP

std::vector<long> HepMC::ShortEventAttribute::IDUP {}

Definition at line 164 of file GenEvent.h.

164{};

◆ ISTUP

std::vector<int> HepMC::ShortEventAttribute::ISTUP {}

Definition at line 165 of file GenEvent.h.

165{};

◆ MOTHUP

std::vector< std::pair<int,int> > HepMC::ShortEventAttribute::MOTHUP {}

Definition at line 166 of file GenEvent.h.

166{};

◆ NUP

int HepMC::ShortEventAttribute::NUP = 0

Definition at line 158 of file GenEvent.h.

◆ PUP

std::vector< std::vector<double> > HepMC::ShortEventAttribute::PUP {}

Definition at line 168 of file GenEvent.h.

168{};

◆ SCALUP

double HepMC::ShortEventAttribute::SCALUP = 0

Definition at line 161 of file GenEvent.h.

◆ SPINUP

std::vector<double> HepMC::ShortEventAttribute::SPINUP {}

Definition at line 170 of file GenEvent.h.

170{};

◆ VTIMUP

std::vector<double> HepMC::ShortEventAttribute::VTIMUP {}

Definition at line 169 of file GenEvent.h.

169{};

◆ XWGTUP

double HepMC::ShortEventAttribute::XWGTUP = 0

Definition at line 160 of file GenEvent.h.


The documentation for this class was generated from the following file: