38 Base_t::operator=( rhs );
55 msg << MSG::DEBUG <<
"Loading McEventCollection from persistent state..."
62 datapools.
vtx.prepareToAdd(nVertices);
64 datapools.
part.prepareToAdd(nParts);
65 const unsigned int nEvts = persObj->
m_genEvents.size();
66 datapools.
evt.prepareToAdd(nEvts);
69 for ( std::vector<GenEvent_p3>::const_iterator
77 genEvt->add_attribute (HepMCStr::barcodes, std::make_shared<HepMC::GenEventBarcodes>());
78 genEvt->add_attribute(HepMCStr::signal_process_id,std::make_shared<HepMC3::IntAttribute>(persEvt.
m_signalProcessId));
80 genEvt->add_attribute(HepMCStr::event_scale,std::make_shared<HepMC3::DoubleAttribute>(persEvt.
m_eventScale));
81 genEvt->add_attribute(HepMCStr::alphaQCD,std::make_shared<HepMC3::DoubleAttribute>(persEvt.
m_alphaQCD));
82 genEvt->add_attribute(HepMCStr::alphaQED,std::make_shared<HepMC3::DoubleAttribute>(persEvt.
m_alphaQED));
84 genEvt->add_attribute(HepMCStr::random_states,std::make_shared<HepMC3::VectorLongIntAttribute>(persEvt.
m_randomStates));
91 for (
unsigned int iVtx= persEvt.
m_verticesBegin; iVtx != endVtx; ++iVtx ) {
97 if ( sigProcVtx != 0 ) {
103 for (
auto & p : partToEndVtx) {
106 decayVtx->add_particle_in( p.first );
109 <<
"GenParticle points to null end vertex !!"
115 msg << MSG::DEBUG <<
"Loaded McEventCollection from persistent state [OK]"
124 <<
"This transient-to-persistent converter method has been RETIRED !!"
126 <<
"You are not supposed to end-up here ! Go away !"
129 throw std::runtime_error(
"Retired McEventCollectionCnv_p3::transToPers() !!" );
140 if (parent) parent->add_vertex(vtx);
143 vtx->set_status(persVtx.
m_id);
146 vtx->add_attribute(HepMCStr::weights,std::make_shared<HepMC3::VectorDoubleAttribute>(
weights));
150 for (
unsigned int i = 0; i != nPartsIn; ++i ) {
155 for (
unsigned int i = 0; i != nPartsOut; ++i ) {
168 if (parent) add_to_output?parent->add_particle_out(p):parent->add_particle_in(p);
170 p->set_pdg_id(persPart.
m_pdgId);
179 temp_e = std::sqrt( (
long double)(persPart.
m_px)*persPart.
m_px +
180 (
long double)(persPart.
m_py)*persPart.
m_py +
181 (
long double)(persPart.
m_pz)*persPart.
m_pz +
182 (
long double)(persPart.
m_m) *persPart.
m_m );
184 const int signM2 = ( persPart.
m_m >= 0. ? 1 : -1 );
185 const double persPart_ene =
186 std::sqrt( std::abs((
long double)(persPart.
m_px)*persPart.
m_px +
187 (
long double)(persPart.
m_py)*persPart.
m_py +
188 (
long double)(persPart.
m_pz)*persPart.
m_pz +
189 signM2* (
long double)(persPart.
m_m)* persPart.
m_m));
190 const int signEne = ( persPart.
m_recoMethod == 1 ? 1 : -1 );
191 temp_e=signEne * persPart_ene;
196 std::vector<int> flows;
197 const unsigned int nFlow = persPart.
m_flow.size();
198 for (
unsigned int iFlow= 0; iFlow != nFlow; ++iFlow ) {
199 flows.push_back(persPart.
m_flow[iFlow].second );
202 p->add_attribute(HepMCStr::flows, std::make_shared<HepMC3::VectorIntAttribute>(flows));
206 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.
std::vector< long int > m_randomStates
Container of random numbers for the generator states.
double m_eventScale
Energy scale.
int m_signalProcessVtx
Barcode of the GenVertex holding the signal process.
unsigned int m_verticesEnd
End position in the vector of vertices composing this event.
double m_alphaQED
value of the QED coupling.
unsigned int m_particlesEnd
End position in the vector of particles composing this event.
int m_signalProcessId
Id of the processus being generated.
std::vector< double > m_weights
Weights for this event.
unsigned int m_particlesBegin
Begin position in the vector of particles composing this event.
double m_alphaQCD
value of the QCD coupling.
int m_eventNbr
Event number.
unsigned int m_verticesBegin
Begin position in the vector of vertices composing this event.
float m_pz
z-component of the 4-momentum of this particle
int m_status
Status of this particle.
short m_recoMethod
switch to know which method to chose to better recover the original HepLorentzVector.
int m_barcode
barcode of this particles (uniquely identifying this particle within a given GenEvent)
float m_m
m-component of the 4-momentum of this particle
float m_px
x-component of the 4-momentum of this particle
std::vector< std::pair< int, int > > m_flow
Flow for this particle.
float m_py
y-component of the 4-momentum of this particle
int m_endVtx
Barcode of the decay vertex of this particle.
int m_pdgId
identity of this particle, according to the Particle Data Group notation
std::vector< float > m_weights
Weights for this 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)
float m_z
z-coordinate of the vertex
std::vector< int > m_particlesIn
collection of barcodes of in-going particles connected to this vertex
float m_x
x-coordinate of the vertex
float m_y
y-coordinate of the vertex
int m_id
Id of this vertex.
float m_t
t-coordinate of the vertex
virtual void transToPers(const McEventCollection *transObj, McEventCollection_p3 *persObj, MsgStream &log)
Method creating the persistent representation McEventCollection_p3 from its transient representation ...
McEventCollectionCnv_p3 & operator=(const McEventCollectionCnv_p3 &rhs)
Assignement operator.
static HepMC::GenVertexPtr createGenVertex(const McEventCollection_p3 &persEvts, const GenVertex_p3 &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_p3()
Default constructor:
static HepMC::GenParticlePtr createGenParticle(const GenParticle_p3 &p, ParticlesMap_t &partToEndVtx, HepMC::DataPool &datapools, const HepMC::GenVertexPtr &parent=nullptr, bool add_to_output=true)
Create a transient GenParticle from a persistent one (vers.1) It returns the new GenParticle.
virtual void persToTrans(const McEventCollection_p3 *persObj, McEventCollection *transObj, MsgStream &log)
Method creating the transient representation of McEventCollection from its persistent representation ...
std::unordered_map< HepMC::GenParticlePtr, int > ParticlesMap_t
T_AthenaPoolTPCnvBase< McEventCollection, McEventCollection_p3 > Base_t
virtual ~McEventCollectionCnv_p3()
Destructor.
std::vector< GenParticle_p3 > m_genParticles
The vector of persistent representation of GenParticles.
std::vector< GenEvent_p3 > m_genEvents
The vector of persistent representation of GenEvents.
std::vector< GenVertex_p3 > m_genVertices
The vector of persistent representation of GenVertices.
This defines the McEventCollection, which is really just an ObjectVector of McEvent objectsFile: Gene...
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