38 Base_t::operator=( rhs );
55 msg << MSG::DEBUG <<
"Loading McEventCollection from persistent state..."
65 const unsigned int nEvts = persObj->
m_genEvents.size();
69 for ( std::vector<GenEvent_p3>::const_iterator
78 genEvt->add_attribute (
HepMCStr::barcodes, std::make_shared<HepMC::GenEventBarcodes>());
92 for (
unsigned int iVtx= persEvt.
m_verticesBegin; iVtx != endVtx; ++iVtx ) {
101 genEvt->m_signal_process_vertex = 0;
104 genEvt->m_vertex_barcodes.clear();
105 genEvt->m_particle_barcodes.clear();
106 genEvt->m_pdf_info = 0;
119 for (
unsigned int iVtx= persEvt.
m_verticesBegin; iVtx != endVtx; ++iVtx ) {
129 if ( sigProcVtx != 0 ) {
135 for (
auto & p : partToEndVtx) {
138 decayVtx->add_particle_in( p.first );
141 <<
"GenParticle points to null end vertex !!"
147 msg << MSG::DEBUG <<
"Loaded McEventCollection from persistent state [OK]"
156 <<
"This transient-to-persistent converter method has been RETIRED !!"
158 <<
"You are not supposed to end-up here ! Go away !"
161 throw std::runtime_error(
"Retired McEventCollectionCnv_p3::transToPers() !!" );
172 if (parent) parent->add_vertex(vtx);
175 vtx->set_position( HepMC::FourVector(persVtx.
m_x,persVtx.
m_y,persVtx.
m_z,persVtx.
m_t) );
176 vtx->set_status(persVtx.
m_id);
184 for (
unsigned int i = 0; i != nPartsIn; ++i ) {
189 for (
unsigned int i = 0; i != nPartsOut; ++i ) {
193 vtx->m_position.setX( persVtx.
m_x );
194 vtx->m_position.setY( persVtx.
m_y );
195 vtx->m_position.setZ( persVtx.
m_z );
196 vtx->m_position.setT( persVtx.
m_t );
197 vtx->m_particles_in.clear();
198 vtx->m_particles_out.clear();
199 vtx->m_id = persVtx.
m_id;
200 vtx->m_weights.m_weights.reserve( persVtx.
m_weights.size() );
201 vtx->m_weights.m_weights.assign ( persVtx.
m_weights.begin(),
208 for (
unsigned int i = 0; i != nPartsIn; ++i ) {
216 for (
unsigned int i = 0; i != nPartsOut; ++i ) {
232 if (parent) add_to_output?parent->add_particle_out(p):parent->add_particle_in(p);
235 p->set_pdg_id(persPart.
m_pdgId);
244 temp_e = std::sqrt( (
long double)(persPart.
m_px)*persPart.
m_px +
245 (
long double)(persPart.
m_py)*persPart.
m_py +
246 (
long double)(persPart.
m_pz)*persPart.
m_pz +
247 (
long double)(persPart.
m_m) *persPart.
m_m );
249 const int signM2 = ( persPart.
m_m >= 0. ? 1 : -1 );
250 const double persPart_ene =
251 std::sqrt( std::abs((
long double)(persPart.
m_px)*persPart.
m_px +
252 (
long double)(persPart.
m_py)*persPart.
m_py +
253 (
long double)(persPart.
m_pz)*persPart.
m_pz +
254 signM2* (
long double)(persPart.
m_m)* persPart.
m_m));
255 const int signEne = ( persPart.
m_recoMethod == 1 ? 1 : -1 );
256 temp_e=signEne * persPart_ene;
258 p->set_momentum(HepMC::FourVector(persPart.
m_px,persPart.
m_py,persPart.
m_pz,temp_e));
261 std::vector<int> flows;
262 const unsigned int nFlow = persPart.
m_flow.size();
263 for (
unsigned int iFlow= 0; iFlow != nFlow; ++iFlow ) {
264 flows.push_back(persPart.
m_flow[iFlow].second );
267 p->add_attribute(
HepMCStr::flows, std::make_shared<HepMC3::VectorIntAttribute>(flows));
270 p->m_pdg_id = persPart.
m_pdgId;
274 p->m_production_vertex = 0;
284 p->m_momentum.setPx( persPart.
m_px );
285 p->m_momentum.setPy( persPart.
m_py );
286 p->m_momentum.setPz( persPart.
m_pz );
287 double temp_e = std::sqrt( (
long double)(persPart.
m_px)*persPart.
m_px +
288 (
long double)(persPart.
m_py)*persPart.
m_py +
289 (
long double)(persPart.
m_pz)*persPart.
m_pz +
290 (
long double)(persPart.
m_m) *persPart.
m_m );
291 p->m_momentum.setE( temp_e );
293 const int signM2 = ( persPart.
m_m >= 0. ? 1 : -1 );
294 const double persPart_ene =
295 std::sqrt( std::abs((
long double)(persPart.
m_px)*persPart.
m_px +
296 (
long double)(persPart.
m_py)*persPart.
m_py +
297 (
long double)(persPart.
m_pz)*persPart.
m_pz +
298 signM2* (
long double)(persPart.
m_m)* persPart.
m_m));
299 const int signEne = ( persPart.
m_recoMethod == 1 ? 1 : -1 );
300 p->m_momentum.set( persPart.
m_px,
303 signEne * persPart_ene );
307 const unsigned int nFlow = persPart.
m_flow.size();
309 for (
unsigned int iFlow= 0; iFlow != nFlow; ++iFlow ) {
310 p->m_flow.set_icode( persPart.
m_flow[iFlow].first,
311 persPart.
m_flow[iFlow].second );
316 partToEndVtx[p] = persPart.
m_endVtx;
void prepareToAdd(unsigned int size)
Prepare to add cached elements.
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, as defined for HEPEVT.
float m_phiPolarization
phi polarization
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
float m_thetaPolarization
polarization
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...
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
void set_signal_process_vertex(GenEvent *e, T v)
GenVertex * barcode_to_vertex(const GenEvent *e, int id)
HepMC::GenVertex * GenVertexPtr
bool suggest_barcode(T &p, int i)
GenParticle * GenParticlePtr
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
A namespace for all vertexing packages and related stuff.
HepMC::GenParticlePtr getGenParticle()
GenPartPool_t part
an arena of HepMC::GenParticle for efficient object instantiation
HepMC::GenEvent * getGenEvent()
HepMC::GenVertexPtr getGenVertex()
GenVtxPool_t vtx
an arena of HepMC::GenVertex for efficient object instantiation
GenEvtPool_t evt
an arena of HepMC::GenEvent for efficient object instantiation