36 Base_t::operator=( rhs );
53 msg << MSG::DEBUG <<
"Loading McEventCollection from persistent state..."
60 if ( datapools.
vtx.capacity() - datapools.
vtx.allocated() < nVertices ) {
61 datapools.
vtx.reserve( datapools.
vtx.allocated() + nVertices );
64 if ( datapools.
part.capacity() - datapools.
part.allocated() < nParts ) {
65 datapools.
part.reserve( datapools.
part.allocated() + nParts );
67 const unsigned int nEvts = persObj->
m_genEvents.size();
68 if ( datapools.
evt.capacity() - datapools.
evt.allocated() < nEvts ) {
69 datapools.
evt.reserve( datapools.
evt.allocated() + nEvts );
73 const std::vector<GenEvent_p2>::const_iterator itrEnd = persObj->
m_genEvents.end();
74 for ( std::vector<GenEvent_p2>::const_iterator itr = persObj->
m_genEvents.begin();
79 genEvt->add_attribute (
HepMCStr::barcodes, std::make_shared<HepMC::GenEventBarcodes>());
94 for (
unsigned int iVtx= persEvt.
m_verticesBegin; iVtx != endVtx; ++iVtx ) {
108 for (
const auto& p: partToEndVtx) {
111 decayVtx->add_particle_in( p.first );
113 msg << MSG::ERROR<<
"GenParticle points to null end vertex !!"<<
endmsg;
118 msg << MSG::DEBUG <<
"Loaded McEventCollection from persistent state [OK]"
126 msg << MSG::DEBUG <<
"Creating persistent state of McEventCollection..."
130 <<
"This transient-to-persistent converter method has been RETIRED !!"
132 <<
"You are not supposed to end-up here ! Go away !"
135 throw std::runtime_error(
"Retired McEventCollectionCnv_p2::transToPers() !!" );
145 if (parent) parent->add_vertex(vtx);
147 vtx->set_status(persVtx.
m_id);
155 for (
unsigned int i = 0; i != nPartsIn; ++i ) {
161 for (
unsigned int i = 0; i != nPartsOut; ++i ) {
174 if (parent) parent->add_particle_out(p);
176 p->set_pdg_id( persPart.
m_pdgId);
183 std::vector<int> flows;
184 const unsigned int nFlow = persPart.
m_flow.size();
185 for (
unsigned int iFlow= 0; iFlow != nFlow; ++iFlow ) {
186 flows.push_back(persPart.
m_flow[iFlow].second );
189 p->add_attribute(
HepMCStr::flows, std::make_shared<HepMC3::VectorIntAttribute>(flows));
192 partToEndVtx[p] = persPart.
m_endVtx;
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
void clear()
Erase all the elements in the collection.
double m_alphaQED
value of the QED coupling.
std::vector< long int > m_randomStates
Container of random numbers for the generator states.
std::vector< double > m_weights
Weights for this event.
unsigned int m_particlesEnd
End position in the vector of particles composing this event.
double m_eventScale
Energy scale.
unsigned int m_particlesBegin
Begin position in the vector of particles composing this event.
int m_signalProcessId
Id of the processus being generated.
unsigned int m_verticesEnd
End position in the vector of vertices composing this event.
int m_signalProcessVtx
Barcode of the GenVertex holding the signal process.
int m_eventNbr
Event number.
unsigned int m_verticesBegin
Begin position in the vector of vertices composing this event.
double m_alphaQCD
value of the QCD coupling.
int m_endVtx
Barcode of the decay vertex of this particle.
double m_py
y-component of the 4-momentum of this particle
int m_pdgId
identity of this particle, according to the Particle Data Group notation
double m_px
x-component of the 4-momentum of this particle
int m_status
Status of this particle.
std::vector< std::pair< int, int > > m_flow
Flow for this particle.
float m_thetaPolarization
polarization
float m_phiPolarization
phi polarization
double m_ene
e-component of the 4-momentum of this particle
int m_barcode
barcode of this particles (uniquely identifying this particle within a given GenEvent)
double m_pz
z-component of the 4-momentum of this particle
double m_t
t-coordinate of the vertex
std::vector< int > m_particlesOut
collection of barcodes of out-going particles connected to this vertex
int m_barcode
barcode of this vertex (uniquely identifying a vertex within an event)
std::vector< float > m_weights
Weights for this vertex.
int m_id
Id of this vertex.
double m_x
x-coordinate of the vertex
double m_z
z-coordinate of the vertex
double m_y
y-coordinate of the vertex
std::vector< int > m_particlesIn
collection of barcodes of in-going particles connected to this vertex
static HepMC::GenVertexPtr createGenVertex(const McEventCollection_p2 &persEvts, const GenVertex_p2 &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.
McEventCollectionCnv_p2 & operator=(const McEventCollectionCnv_p2 &rhs)
Assignement operator.
virtual void persToTrans(const McEventCollection_p2 *persObj, McEventCollection *transObj, MsgStream &log)
Method creating the transient representation of McEventCollection from its persistent representation ...
McEventCollectionCnv_p2()
Default constructor:
std::unordered_map< HepMC::GenParticlePtr, int > ParticlesMap_t
virtual void transToPers(const McEventCollection *transObj, McEventCollection_p2 *persObj, MsgStream &log)
Method creating the persistent representation McEventCollection_p2 from its transient representation ...
T_AthenaPoolTPCnvBase< McEventCollection, McEventCollection_p2 > Base_t
static HepMC::GenParticlePtr createGenParticle(const GenParticle_p2 &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.
virtual ~McEventCollectionCnv_p2()
Destructor.
std::vector< GenParticle_p2 > m_genParticles
The vector of persistent representation of GenParticles.
std::vector< GenEvent_p2 > m_genEvents
The vector of persistent representation of GenEvents.
std::vector< GenVertex_p2 > m_genVertices
The vector of persistent representation of GenVertices.
This defines the McEventCollection, which is really just an ObjectVector of McEvent objectsFile: Gene...
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
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
A namespace for all vertexing packages and related stuff.
::DataPool< HepMC::GenEvent, ClearGenEvent > evt
::DataPool< HepMC::GenParticle, ClearGenParticle > part
HepMC::GenParticlePtr getGenParticle()
HepMC::GenEvent * getGenEvent()
HepMC::GenVertexPtr getGenVertex()
::DataPool< HepMC::GenVertex, ClearGenVertex > vtx