13#include "GaudiKernel/MsgStream.h"
40 msg << MSG::DEBUG <<
"Loading HepMC::GenEvent from persistent state..."
45 <<
"This instance of GenEventCnv_p1 has a null pointer to "
46 <<
"HepMC::DataPool !" <<
endmsg
47 <<
"This probably means the T/P converter (McEventCollectionCnv_pX) "
48 <<
"is misconfigured !!"
50 throw std::runtime_error(
"Null pointer to HepMC::DataPool !!");
53 const unsigned int nVertices = persObj->
m_vertices.size();
54 if (
m_pool->vtx.capacity() -
m_pool->vtx.allocated() < nVertices ) {
55 m_pool->vtx.reserve(
m_pool->vtx.allocated() + nVertices );
57 const unsigned int nParts = persObj->
m_particles.size();
58 if (
m_pool->part.capacity() -
m_pool->part.allocated() < nParts ) {
59 m_pool->part.reserve(
m_pool->part.allocated() + nParts );
62 transObj->add_attribute (
HepMCStr::barcodes, std::make_shared<HepMC::GenEventBarcodes>());
64 transObj->set_event_number(persObj->
m_eventNbr);
78 for (
unsigned int iVtx = 0; iVtx != nVertices; ++iVtx ) {
85 if ( sigProcVtx != 0 ) {
91 const ParticlesMap_t::iterator endItr= partToEndVtx.end();
92 for ( ParticlesMap_t::iterator p = partToEndVtx.begin();
97 decayVtx->add_particle_in( p->first );
100 <<
"GenParticle points to null end vertex !!"
105 msg << MSG::DEBUG <<
"Loaded HepMC::GenEvent from persistent state [OK]"
113 msg << MSG::DEBUG <<
"Creating persistent state of HepMC::GenEvent..."
117 <<
"This transient-to-persistent converter method has been RETIRED !!"
119 <<
"You are not supposed to end-up here ! Go away !"
122 throw std::runtime_error(
"Retired GenEventCnv_p1::transToPers() !!" );
136 if (parent) parent->add_vertex(vtx);
143 for (
unsigned int i = 0; i != nPartsIn; ++i ) {
148 for (
unsigned int i = 0; i != nPartsOut; ++i ) {
161 if (parent) parent->add_particle_out(p);
163 p->set_pdg_id(persPart.
m_pdgId);
169 std::vector<int> flows;
170 const unsigned int nFlow = persPart.
m_flow.size();
171 for (
unsigned int iFlow= 0; iFlow != nFlow; ++iFlow ) {
172 flows.push_back(persPart.
m_flow[iFlow].second );
175 p->add_attribute(
HepMCStr::flows, std::make_shared<HepMC3::VectorIntAttribute>(flows));
178 partToEndVtx[p] = persPart.
m_endVtx;
virtual void transToPers(const HepMC::GenEvent *transObj, GenEvent_p1 *persObj, MsgStream &msg)
Method creating the persistent representation GenEvent_p1 from its transient representation HepMC::Ge...
HepMC::DataPool * m_pool
a PIMPL idiom to hide the DataPools (and their specialized destructors) from the outside world
static HepMC::GenParticlePtr createGenParticle(const GenParticle_p1 &p, ParticlesMap_t &partToEndVtx, HepMC::DataPool &datapools, const HepMC::GenVertexPtr &parent=nullptr)
Create a transient GenParticle from a persistent one (vers.1) It returns the new GenParticle.
static HepMC::GenVertexPtr createGenVertex(const GenEvent_p1 &persEvt, const GenVertex_p1 &vtx, ParticlesMap_t &bcToPart, HepMC::DataPool &datapools, HepMC::GenEvent *parent=nullptr)
Create a transient GenVertex from a persistent one (version 1) It returns the new GenVertex.
virtual void persToTrans(const GenEvent_p1 *persObj, HepMC::GenEvent *transObj, MsgStream &msg)
Destructor:
void setDataPool(HepMC::DataPool *pool)
reset the @ HepMC::DataPool pointer
std::unordered_map< HepMC::GenParticlePtr, int > ParticlesMap_t
GenEventCnv_p1(HepMC::DataPool *pool=0)
constructor:
int m_eventNbr
Event number.
double m_alphaQCD
value of the QCD coupling.
std::vector< long int > m_randomStates
Container of random numbers for the generator states.
std::vector< GenVertex_p1 > m_vertices
Vector of vertices composing this event.
double m_eventScale
Energy scale.
double m_alphaQED
value of the QED coupling.
int m_signalProcessId
Id of the processus being generated.
std::vector< GenParticle_p1 > m_particles
Vector of particles composing this event.
int m_signalProcessVtx
Barcode of the GenVertex holding the signal process.
std::vector< double > m_weights
Weights for this event.
double m_phiPolarization
phi polarization
double m_px
x-component of the 4-momentum of this particle
int m_pdgId
identity of this particle, according to the Particle Data Group notation
double m_thetaPolarization
polarization
double m_py
y-component of the 4-momentum of this particle
int m_barcode
barcode of this particles (uniquely identifying this particle within a given GenEvent)
int m_status
Status of this particle.
int m_endVtx
Barcode of the decay vertex of this particle.
double m_pz
z-component of the 4-momentum of this particle
double m_ene
e-component of the 4-momentum of this particle
std::vector< std::pair< int, int > > m_flow
Flow for this particle.
std::vector< int > m_particlesOut
collection of barcodes of out-going particles connected to this vertex
double m_t
t-coordinate of the vertex
std::vector< int > m_particlesIn
collection of barcodes of in-going particles connected to this vertex
std::vector< double > m_weights
Weights for this vertex.
int m_barcode
barcode of this vertex (uniquely identifying a vertex within an event)
double m_x
x-coordinate of the vertex
double m_z
z-coordinate of the vertex
double m_y
y-coordinate of the vertex
const std::string event_scale
const std::string weights
const std::string signal_process_id
const std::string random_states
const std::string alphaQED
const std::string alphaQCD
const std::string barcodes
ConstGenVertexPtr barcode_to_vertex(const GenEvent *e, int id)
HepMC3::FourVector FourVector
void set_signal_process_vertex(GenEvent *e, T &v)
bool suggest_barcode(T &p, int i)
HepMC3::GenParticlePtr GenParticlePtr
HepMC3::GenVertexPtr GenVertexPtr
HepMC3::GenEvent GenEvent
A namespace for all vertexing packages and related stuff.
HepMC::GenParticlePtr getGenParticle()
HepMC::GenVertexPtr getGenVertex()