13 #include "GaudiKernel/MsgStream.h"
37 HepMC::GenEvent* transObj,
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 !!");
57 const unsigned int nParts = persObj->
m_particles.size();
63 transObj->add_attribute (
"barcodes", std::make_shared<HepMC::GenEventBarcodes>());
64 transObj->add_attribute(
"signal_process_id",std::make_shared<HepMC3::IntAttribute>(persObj->
m_signalProcessId ));
65 transObj->set_event_number(persObj->
m_eventNbr);
66 transObj->add_attribute(
"event_scale",std::make_shared<HepMC3::DoubleAttribute>(persObj->
m_eventScale));
67 transObj->add_attribute(
"alphaQCD",std::make_shared<HepMC3::DoubleAttribute>(persObj->
m_alphaQCD));
68 transObj->add_attribute(
"alphaQED",std::make_shared<HepMC3::DoubleAttribute>(persObj->
m_alphaQED));
70 transObj->add_attribute(
"random_states",std::make_shared<HepMC3::VectorLongIntAttribute>(persObj->
m_randomStates));
74 transObj->set_event_number( persObj->
m_eventNbr );
76 transObj->set_alphaQCD ( persObj->
m_alphaQCD );
77 transObj->set_alphaQED ( persObj->
m_alphaQED );
84 transObj->m_vertex_barcodes.clear();
85 transObj->m_particle_barcodes.clear();
87 transObj->m_pdf_info = 0;
97 for (
unsigned int iVtx = 0; iVtx !=
nVertices; ++iVtx ) {
104 if ( sigProcVtx != 0 ) {
116 decayVtx->add_particle_in(
p->first );
119 <<
"GenParticle points to null end vertex !!"
124 msg <<
MSG::DEBUG <<
"Loaded HepMC::GenEvent from persistent state [OK]"
132 msg <<
MSG::DEBUG <<
"Creating persistent state of HepMC::GenEvent..."
136 <<
"This transient-to-persistent converter method has been RETIRED !!"
138 <<
"You are not supposed to end-up here ! Go away !"
141 throw std::runtime_error(
"Retired GenEventCnv_p1::transToPers() !!" );
157 vtx->set_position( HepMC::FourVector(persVtx.
m_x,persVtx.
m_y,persVtx.
m_z,persVtx.
m_t) );
158 vtx->add_attribute(
"weights",std::make_shared<HepMC3::VectorDoubleAttribute>(persVtx.
m_weights));
163 for (
unsigned int i = 0;
i != nPartsIn; ++
i ) {
168 for (
unsigned int i = 0;
i != nPartsOut; ++
i ) {
173 vtx->m_position.setX( persVtx.
m_x );
174 vtx->m_position.setY( persVtx.
m_y );
175 vtx->m_position.setZ( persVtx.
m_z );
176 vtx->m_position.setT( persVtx.
m_t );
177 vtx->m_particles_in.clear();
178 vtx->m_particles_out.clear();
179 vtx->m_id = persVtx.
m_id;
187 for (
unsigned int i = 0;
i != nPartsIn; ++
i ) {
195 for (
unsigned int i = 0;
i != nPartsOut; ++
i ) {
212 p->set_momentum( HepMC::FourVector(persPart.
m_px,persPart.
m_py,persPart.
m_pz,persPart.
m_ene));
215 p->add_attribute(
"phi",std::make_shared<HepMC3::DoubleAttribute>(persPart.
m_phiPolarization));
216 p->add_attribute(
"theta",std::make_shared<HepMC3::DoubleAttribute>(persPart.
m_thetaPolarization));
219 std::vector<int> flows;
220 const unsigned int nFlow = persPart.
m_flow.size();
221 for (
unsigned int iFlow= 0; iFlow != nFlow; ++iFlow ) {
222 flows.push_back(persPart.
m_flow[iFlow].second );
225 p->add_attribute(
"flows", std::make_shared<HepMC3::VectorIntAttribute>(flows));
229 p->m_momentum.setPx( persPart.
m_px );
230 p->m_momentum.setPy( persPart.
m_py );
231 p->m_momentum.setPz( persPart.
m_pz );
232 p->m_momentum.setE ( persPart.
m_ene );
237 p->m_production_vertex = 0;
242 const unsigned int nFlow = persPart.
m_flow.size();
243 for (
unsigned int iFlow= 0; iFlow != nFlow; ++iFlow ) {
244 p->m_flow.set_icode( persPart.
m_flow[iFlow].first, persPart.
m_flow[iFlow].second );