40 Base_t::operator=( rhs );
57 msg << MSG::DEBUG <<
"Loading McEventCollection from persistent state..."
67 const unsigned int nEvts = persObj->
m_genEvents.size();
71 for ( std::vector<GenEvent_p3>::const_iterator
81 genEvt->add_attribute (barcodesStr, std::make_shared<HepMC::GenEventBarcodes>());
82 genEvt->add_attribute(signalProcessIdStr,std::make_shared<HepMC3::IntAttribute>(persEvt.
m_signalProcessId));
84 genEvt->add_attribute(eventScaleStr,std::make_shared<HepMC3::DoubleAttribute>(persEvt.
m_eventScale));
85 genEvt->add_attribute(alphaQcdStr,std::make_shared<HepMC3::DoubleAttribute>(persEvt.
m_alphaQCD));
86 genEvt->add_attribute(alphaQedStr,std::make_shared<HepMC3::DoubleAttribute>(persEvt.
m_alphaQED));
88 genEvt->add_attribute(randomStatesStr,std::make_shared<HepMC3::VectorLongIntAttribute>(persEvt.
m_randomStates));
95 for (
unsigned int iVtx= persEvt.
m_verticesBegin; iVtx != endVtx; ++iVtx ) {
104 genEvt->m_signal_process_vertex = 0;
107 genEvt->m_vertex_barcodes.clear();
108 genEvt->m_particle_barcodes.clear();
109 genEvt->m_pdf_info = 0;
122 for (
unsigned int iVtx= persEvt.
m_verticesBegin; iVtx != endVtx; ++iVtx ) {
132 if ( sigProcVtx != 0 ) {
138 for (
auto & p : partToEndVtx) {
141 decayVtx->add_particle_in( p.first );
144 <<
"GenParticle points to null end vertex !!"
150 msg << MSG::DEBUG <<
"Loaded McEventCollection from persistent state [OK]"
159 <<
"This transient-to-persistent converter method has been RETIRED !!"
161 <<
"You are not supposed to end-up here ! Go away !"
164 throw std::runtime_error(
"Retired McEventCollectionCnv_p3::transToPers() !!" );
175 if (parent) parent->add_vertex(vtx);
178 vtx->set_position( HepMC::FourVector(persVtx.
m_x,persVtx.
m_y,persVtx.
m_z,persVtx.
m_t) );
179 vtx->set_status(persVtx.
m_id);
182 vtx->add_attribute(
"weights",std::make_shared<HepMC3::VectorDoubleAttribute>(
weights));
187 for (
unsigned int i = 0; i != nPartsIn; ++i ) {
192 for (
unsigned int i = 0; i != nPartsOut; ++i ) {
196 vtx->m_position.setX( persVtx.
m_x );
197 vtx->m_position.setY( persVtx.
m_y );
198 vtx->m_position.setZ( persVtx.
m_z );
199 vtx->m_position.setT( persVtx.
m_t );
200 vtx->m_particles_in.clear();
201 vtx->m_particles_out.clear();
202 vtx->m_id = persVtx.
m_id;
203 vtx->m_weights.m_weights.reserve( persVtx.
m_weights.size() );
204 vtx->m_weights.m_weights.assign ( persVtx.
m_weights.begin(),
211 for (
unsigned int i = 0; i != nPartsIn; ++i ) {
219 for (
unsigned int i = 0; i != nPartsOut; ++i ) {
235 if (parent) add_to_output?parent->add_particle_out(p):parent->add_particle_in(p);
238 p->set_pdg_id(persPart.
m_pdgId);
247 temp_e = std::sqrt( (
long double)(persPart.
m_px)*persPart.
m_px +
248 (
long double)(persPart.
m_py)*persPart.
m_py +
249 (
long double)(persPart.
m_pz)*persPart.
m_pz +
250 (
long double)(persPart.
m_m) *persPart.
m_m );
252 const int signM2 = ( persPart.
m_m >= 0. ? 1 : -1 );
253 const double persPart_ene =
254 std::sqrt( std::abs((
long double)(persPart.
m_px)*persPart.
m_px +
255 (
long double)(persPart.
m_py)*persPart.
m_py +
256 (
long double)(persPart.
m_pz)*persPart.
m_pz +
257 signM2* (
long double)(persPart.
m_m)* persPart.
m_m));
258 const int signEne = ( persPart.
m_recoMethod == 1 ? 1 : -1 );
259 temp_e=signEne * persPart_ene;
261 p->set_momentum(HepMC::FourVector(persPart.
m_px,persPart.
m_py,persPart.
m_pz,temp_e));
264 std::vector<int> flows;
265 const unsigned int nFlow = persPart.
m_flow.size();
266 for (
unsigned int iFlow= 0; iFlow != nFlow; ++iFlow ) {
267 flows.push_back(persPart.
m_flow[iFlow].second );
270 p->add_attribute(
"flows", std::make_shared<HepMC3::VectorIntAttribute>(flows));
273 p->m_pdg_id = persPart.
m_pdgId;
277 p->m_production_vertex = 0;
287 p->m_momentum.setPx( persPart.
m_px );
288 p->m_momentum.setPy( persPart.
m_py );
289 p->m_momentum.setPz( persPart.
m_pz );
290 double temp_e = std::sqrt( (
long double)(persPart.
m_px)*persPart.
m_px +
291 (
long double)(persPart.
m_py)*persPart.
m_py +
292 (
long double)(persPart.
m_pz)*persPart.
m_pz +
293 (
long double)(persPart.
m_m) *persPart.
m_m );
294 p->m_momentum.setE( temp_e );
296 const int signM2 = ( persPart.
m_m >= 0. ? 1 : -1 );
297 const double persPart_ene =
298 std::sqrt( std::abs((
long double)(persPart.
m_px)*persPart.
m_px +
299 (
long double)(persPart.
m_py)*persPart.
m_py +
300 (
long double)(persPart.
m_pz)*persPart.
m_pz +
301 signM2* (
long double)(persPart.
m_m)* persPart.
m_m));
302 const int signEne = ( persPart.
m_recoMethod == 1 ? 1 : -1 );
303 p->m_momentum.set( persPart.
m_px,
306 signEne * persPart_ene );
310 const unsigned int nFlow = persPart.
m_flow.size();
312 for (
unsigned int iFlow= 0; iFlow != nFlow; ++iFlow ) {
313 p->m_flow.set_icode( persPart.
m_flow[iFlow].first,
314 persPart.
m_flow[iFlow].second );
319 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...
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