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

#include <HepMCHelpers.h>

Inheritance diagram for MC::HepMC::GenEventBarcodes:
Collaboration diagram for MC::HepMC::GenEventBarcodes:

Public Member Functions

virtual bool from_string (const std::string &) override
virtual bool to_string (std::string &att) const override
ConstGenVertexPtr barcode_to_vertex (int id) const
GenVertexPtr barcode_to_vertex (int id)
ConstGenParticlePtr barcode_to_particle (int id) const
GenParticlePtr barcode_to_particle (int id)
void add (GenVertexPtr p)
void remove (GenVertexPtr p)
void add (GenParticlePtr p)
void remove (GenParticlePtr p)
std::map< int, ConstGenVertexPtrbarcode_to_vertex_map () const
std::map< int, ConstGenParticlePtrbarcode_to_particle_map () const
std::map< int, int > id_to_barcode_map () const
void fillAttribute (GenEvent *e)

Private Attributes

std::unordered_map< int, GenVertexPtrm_vertexBC
std::unordered_map< int, GenParticlePtrm_particleBC

Detailed Description

Definition at line 174 of file HepMCHelpers.h.

Member Function Documentation

◆ add() [1/2]

void MC::HepMC::GenEventBarcodes::add ( GenParticlePtr p)
inline

Definition at line 223 of file HepMCHelpers.h.

223 {
224 bool samePart = false;
225 pVert = nullptr;
226 auto outgoing = EndVert->particles_out();
227 auto incoming = EndVert->particles_in();
228 for (const auto& itrDaug: outgoing) {
229 if (!itrDaug) continue;

◆ add() [2/2]

void MC::HepMC::GenEventBarcodes::add ( GenVertexPtr p)
inline

Definition at line 204 of file HepMCHelpers.h.

207 {
208 if (!hadron) hadron = parent; // assumes linear hadron parentage
209 return true;
210 }

◆ barcode_to_particle() [1/2]

GenParticlePtr MC::HepMC::GenEventBarcodes::barcode_to_particle ( int id)
inline

Definition at line 198 of file HepMCHelpers.h.

200 : vtx->particles_in() ) {
201 if (!parent) continue;
202 // should this really go into parton-level territory?

◆ barcode_to_particle() [2/2]

ConstGenParticlePtr MC::HepMC::GenEventBarcodes::barcode_to_particle ( int id) const
inline

Definition at line 193 of file HepMCHelpers.h.

195 {
196 if (isHadron(p)&&!isBeam(p)) return true; // trivial case
197 auto vtx = p->production_vertex();
bool isBeam(const T &p)
Identify if the particle is beam particle.
bool isHadron(const T &p)

◆ barcode_to_particle_map()

std::map< int, ConstGenParticlePtr > MC::HepMC::GenEventBarcodes::barcode_to_particle_map ( ) const
inline

Definition at line 248 of file HepMCHelpers.h.

248 {};
249 decltype(theVert->particles_out()) finalStatePart;
250 auto outgoing = theVert->particles_out();
251 for (const auto& thePart: outgoing) {
252 if (!thePart) continue;
253 finalStatePart.push_back(thePart);

◆ barcode_to_vertex() [1/2]

GenVertexPtr MC::HepMC::GenEventBarcodes::barcode_to_vertex ( int id)
inline

Definition at line 188 of file HepMCHelpers.h.

◆ barcode_to_vertex() [2/2]

ConstGenVertexPtr MC::HepMC::GenEventBarcodes::barcode_to_vertex ( int id) const
inline

Definition at line 183 of file HepMCHelpers.h.

184 {
185 auto incoming = pVert->particles_in();
186 if (incoming.at(0) && incoming.at(1) && (std::abs(incoming.at(0)->pdg_id()) < 7 || incoming.at(0)->pdg_id() == 21) && (std::abs(incoming.at(1)->pdg_id()) < 7 || incoming.at(1)->pdg_id() == 21)) return true;
187 }

◆ barcode_to_vertex_map()

std::map< int, ConstGenVertexPtr > MC::HepMC::GenEventBarcodes::barcode_to_vertex_map ( ) const
inline

Definition at line 242 of file HepMCHelpers.h.

247 {

◆ fillAttribute()

void MC::HepMC::GenEventBarcodes::fillAttribute ( GenEvent * e)
inline

Definition at line 262 of file HepMCHelpers.h.

266 { for (auto& p: evt->particles()) { p->set_momentum(p->momentum()*1000); p->set_generated_mass(1000* p->generated_mass());}}
267inline void MeVToGeV(HepMC::GenEvent* evt) { for (auto& p: evt->particles()) { p->set_momentum(p->momentum()*1.0/1000); p->set_generated_mass(1.0/1000* p->generated_mass());} }
268
269#endif
270}
271#endif
HepMC3::GenEvent GenEvent
void MeVToGeV(HepMC::GenEvent *evt)

◆ from_string()

virtual bool MC::HepMC::GenEventBarcodes::from_string ( const std::string & )
inlineoverridevirtual

Definition at line 177 of file HepMCHelpers.h.

◆ id_to_barcode_map()

std::map< int, int > MC::HepMC::GenEventBarcodes::id_to_barcode_map ( ) const
inline

Definition at line 254 of file HepMCHelpers.h.

257 {
258 auto vecPart = findFinalStateParticles<V>(pVert);
259 finalStatePart.insert(finalStatePart.end(),vecPart.begin(),vecPart.end());
auto findFinalStateParticles(V theVert) -> decltype(theVert->particles_out())
Function to find the stable particle descendants of the given vertex..

◆ remove() [1/2]

void MC::HepMC::GenEventBarcodes::remove ( GenParticlePtr p)
inline

Definition at line 231 of file HepMCHelpers.h.

234 {
235 samePart = true;
236 pVert = itrDaug->end_vertex();
237 }
238 }
239 if (samePart) EndVert = pVert;
240 } while (pVert != nullptr && pVert != EndVert); // pVert!=EndVert to prevent Sherpa loop

◆ remove() [2/2]

void MC::HepMC::GenEventBarcodes::remove ( GenVertexPtr p)
inline

Definition at line 212 of file HepMCHelpers.h.

219 {
220 decltype(thePart->end_vertex()) EndVert = thePart->end_vertex();
221 decltype(thePart->end_vertex()) pVert(nullptr);

◆ to_string()

virtual bool MC::HepMC::GenEventBarcodes::to_string ( std::string & att) const
inlineoverridevirtual

Definition at line 178 of file HepMCHelpers.h.

179 : 0;
180 pV = numOfPartIn && incoming.front() != nullptr ? incoming.front()->production_vertex() : nullptr;
181
182 } while (numOfPartIn == 1 && (std::abs(pdg) < 81 || std::abs(pdg) > 100) && pV != nullptr);

Member Data Documentation

◆ m_particleBC

std::unordered_map<int, GenParticlePtr> MC::HepMC::GenEventBarcodes::m_particleBC
private

Definition at line 300 of file HepMCHelpers.h.

◆ m_vertexBC

std::unordered_map<int, GenVertexPtr> MC::HepMC::GenEventBarcodes::m_vertexBC
private

Definition at line 299 of file HepMCHelpers.h.


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