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.

225 {
226 decltype(thePart->end_vertex()) EndVert = thePart->end_vertex();
227 decltype(thePart->end_vertex()) pVert(nullptr);
228 if (EndVert != nullptr) {
229 do {

◆ add() [2/2]

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

Definition at line 204 of file HepMCHelpers.h.

206 : particles_in(vtx) ) {
207 if (!parent) continue;
208 // should this really go into parton-level territory?
209 // probably depends where BSM particles are being decayed
210 fromBSM |= isBSM(parent);
auto particles_in(const VTX *p)
bool isBSM(const T &p)
APID: graviton and all Higgs extensions are BSM.

◆ barcode_to_particle() [1/2]

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

Definition at line 198 of file HepMCHelpers.h.

201 {
202 if (isHadron(p)&&!isBeam(p)) return true; // trivial case
bool isBeam(const T &p)
Identify if the particle is beam particle.
bool isHadron(const T &p)

◆ barcode_to_particle() [2/2]

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

Definition at line 193 of file HepMCHelpers.h.

◆ 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.

253 {

◆ barcode_to_vertex() [1/2]

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

Definition at line 188 of file HepMCHelpers.h.

189 {
190 auto incoming = pVert->particles_in();
191 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;
192 }

◆ 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 : 0;
185 pV = numOfPartIn && incoming.front() != nullptr ? incoming.front()->production_vertex() : nullptr;
186
187 } while (numOfPartIn == 1 && (std::abs(pdg) < 81 || std::abs(pdg) > 100) && pV != nullptr);

◆ 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.

◆ fillAttribute()

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

Definition at line 262 of file HepMCHelpers.h.

263 {
264 auto vecPart = findFinalStateParticles<V>(pVert);
265 finalStatePart.insert(finalStatePart.end(),vecPart.begin(),vecPart.end());
266 }
267 }
268 return finalStatePart;
269 }
270#if !defined(XAOD_ANALYSIS)
271#include "AtlasHepMC/GenEvent.h"
272inline void GeVToMeV(HepMC::GenEvent* evt) { for (auto& p: evt->particles()) { p->set_momentum(p->momentum()*1000); p->set_generated_mass(1000* p->generated_mass());}}
273inline 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());} }
274
275#endif
276}
277#endif
HepMC3::GenEvent GenEvent
void MeVToGeV(HepMC::GenEvent *evt)
void GeVToMeV(HepMC::GenEvent *evt)
auto findFinalStateParticles(V theVert) -> decltype(theVert->particles_out())
Function to find the stable particle descendants of the given vertex..

◆ 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.

254 {};
255 decltype(theVert->particles_out()) finalStatePart;
256 auto outgoing = theVert->particles_out();
257 for (const auto& thePart: outgoing) {
258 if (!thePart) continue;
259 finalStatePart.push_back(thePart);

◆ remove() [1/2]

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

Definition at line 231 of file HepMCHelpers.h.

234 : outgoing) {
235 if (!itrDaug) continue;
236 if ((( HepMC::is_same_generator_particle(itrDaug,thePart)) ||
237 // brem on generator level for tau
238 (outgoing.size() == 1 && incoming.size() == 1 &&
240 itrDaug->pdg_id() == thePart->pdg_id()) {
bool is_same_generator_particle(const T1 &p1, const T2 &p2)
Method to establish if two particles in the GenEvent actually represent the same generated particle.
bool is_simulation_particle(const T &p)
Method to establish if a particle (or barcode) was created during the simulation (TODO update to be s...

◆ remove() [2/2]

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

Definition at line 212 of file HepMCHelpers.h.

213 {
214 if (!hadron) hadron = parent; // assumes linear hadron parentage
215 return true;
216 }
217 fromHad |= isFromHadron(parent, hadron, fromTau, fromBSM);
218 }
219 return fromHad;
220 }
221
bool isFromHadron(T p, U hadron, bool &fromTau, bool &fromBSM)
Function to classify the particle.

◆ to_string()

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

Definition at line 178 of file HepMCHelpers.h.

180 {
181 pVert = pV;
182 auto incoming = pVert->particles_in();

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: