|
ATLAS Offline Software
|
Go to the documentation of this file.
37 Base_t::operator=( rhs );
54 msg <<
MSG::DEBUG <<
"Loading McEventCollection from persistent state..."
61 if ( datapools.
vtx.capacity() - datapools.
vtx.allocated() <
nVertices ) {
65 if ( datapools.
part.capacity() - datapools.
part.allocated() < nParts ) {
66 datapools.
part.reserve( datapools.
part.allocated() + nParts );
68 const unsigned int nEvts = persObj->
m_genEvents.size();
69 if ( datapools.
evt.capacity() - datapools.
evt.allocated() < nEvts ) {
70 datapools.
evt.reserve( datapools.
evt.allocated() + nEvts );
74 const std::vector<GenEvent_p2>::const_iterator itrEnd = persObj->
m_genEvents.end();
75 for ( std::vector<GenEvent_p2>::const_iterator itr = persObj->
m_genEvents.begin();
81 genEvt->add_attribute (
"barcodes", std::make_shared<HepMC::GenEventBarcodes>());
82 genEvt->add_attribute(
"signal_process_id",std::make_shared<HepMC3::IntAttribute>(persEvt.
m_signalProcessId));
84 genEvt->add_attribute(
"event_scale",std::make_shared<HepMC3::DoubleAttribute>(persEvt.
m_eventScale));
85 genEvt->add_attribute(
"alphaQCD",std::make_shared<HepMC3::DoubleAttribute>(persEvt.
m_alphaQCD));
86 genEvt->add_attribute(
"alphaQED",std::make_shared<HepMC3::DoubleAttribute>(persEvt.
m_alphaQED));
88 genEvt->add_attribute(
"random_states",std::make_shared<HepMC3::VectorLongIntAttribute>(persEvt.
m_randomStates));
96 for (
unsigned int iVtx= persEvt.
m_verticesBegin; iVtx != endVtx; ++iVtx ) {
110 for (
const auto&
p: partToEndVtx) {
113 decayVtx->add_particle_in(
p.first );
115 msg << MSG::ERROR<<
"GenParticle points to null end vertex !!"<<
endmsg;
124 genEvt->m_signal_process_vertex = 0;
127 genEvt->m_vertex_barcodes.clear();
128 genEvt->m_particle_barcodes.clear();
129 genEvt->m_pdf_info = 0;
142 for (
unsigned int iVtx= persEvt.
m_verticesBegin; iVtx != endVtx; ++iVtx ) {
151 if ( sigProcVtx != 0 ) {
152 genEvt->set_signal_process_vertex( genEvt->barcode_to_vertex( sigProcVtx ) );
160 auto decayVtx = genEvt->barcode_to_vertex(
p->second );
162 decayVtx->add_particle_in(
p->first );
165 <<
"GenParticle points to null end vertex !!"
172 msg <<
MSG::DEBUG <<
"Loaded McEventCollection from persistent state [OK]"
180 msg <<
MSG::DEBUG <<
"Creating persistent state of McEventCollection..."
184 <<
"This transient-to-persistent converter method has been RETIRED !!"
186 <<
"You are not supposed to end-up here ! Go away !"
189 throw std::runtime_error(
"Retired McEventCollectionCnv_p2::transToPers() !!" );
201 vtx->set_position( HepMC::FourVector(persVtx.
m_x,persVtx.
m_y, persVtx.
m_z, persVtx.
m_t) );
202 vtx->set_status(persVtx.
m_id);
205 vtx->add_attribute(
"weights",std::make_shared<HepMC3::VectorDoubleAttribute>(
weights));
210 for (
unsigned int i = 0;
i != nPartsIn; ++
i ) {
216 for (
unsigned int i = 0;
i != nPartsOut; ++
i ) {
220 vtx->m_position.setX( persVtx.
m_x );
221 vtx->m_position.setY( persVtx.
m_y );
222 vtx->m_position.setZ( persVtx.
m_z );
223 vtx->m_position.setT( persVtx.
m_t );
224 vtx->m_particles_in.clear();
225 vtx->m_particles_out.clear();
226 vtx->m_id = persVtx.
m_id;
227 vtx->m_weights.m_weights.reserve( persVtx.
m_weights.size() );
228 vtx->m_weights.m_weights.assign ( persVtx.
m_weights.begin(),
235 for (
unsigned int i = 0;
i != nPartsIn; ++
i ) {
243 for (
unsigned int i = 0;
i != nPartsOut; ++
i ) {
261 p->set_momentum( HepMC::FourVector(persPart.
m_px,persPart.
m_py,persPart.
m_pz, persPart.
m_ene ));
264 p->add_attribute(
"phi",std::make_shared<HepMC3::DoubleAttribute>(persPart.
m_phiPolarization));
265 p->add_attribute(
"theta",std::make_shared<HepMC3::DoubleAttribute>(persPart.
m_thetaPolarization));
269 std::vector<int> flows;
270 const unsigned int nFlow = persPart.
m_flow.size();
271 for (
unsigned int iFlow= 0; iFlow != nFlow; ++iFlow ) {
272 flows.push_back(persPart.
m_flow[iFlow].second );
275 p->add_attribute(
"flows", std::make_shared<HepMC3::VectorIntAttribute>(flows));
278 p->m_momentum.setPx( persPart.
m_px );
279 p->m_momentum.setPy( persPart.
m_py );
280 p->m_momentum.setPz( persPart.
m_pz );
281 p->m_momentum.setE ( persPart.
m_ene );
286 p->m_production_vertex = 0;
291 const unsigned int nFlow = persPart.
m_flow.size();
293 for (
unsigned int iFlow= 0; iFlow != nFlow; ++iFlow ) {
294 p->m_flow.set_icode( persPart.
m_flow[iFlow].first,
295 persPart.
m_flow[iFlow].second );
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
HepMC::GenVertex * GenVertexPtr
JetConstituentVector::iterator iterator
bool suggest_barcode(T &p, int i)
int m_endVtx
Barcode of the decay vertex of this particle.
double m_pz
z-component of the 4-momentum of this particle
double m_py
y-component of the 4-momentum of this particle
int nVertices(const Polygon &p)
double m_y
y-coordinate of the vertex
int m_signalProcessVtx
Barcode of the GenVertex holding the signal process.
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
int m_barcode
barcode of this vertex (uniquely identifying a vertex within an event)
std::vector< double > m_weights
Weights for this event.
GenParticle * GenParticlePtr
double m_px
x-component of the 4-momentum of this particle
double m_t
t-coordinate of the vertex
std::vector< GenEvent_p2 > m_genEvents
The vector of persistent representation of GenEvents.
double m_ene
e-component of the 4-momentum of this particle
double m_alphaQED
value of the QED coupling.
int m_pdgId
identity of this particle, according to the Particle Data Group notation
std::vector< std::pair< int, int > > m_flow
Flow for this particle.
HepMC::GenParticlePtr getGenParticle()
virtual void persToTrans(const McEventCollection_p2 *persObj, McEventCollection *transObj, MsgStream &log)
Method creating the transient representation of McEventCollection from its persistent representation ...
double m_x
x-coordinate of the vertex
int m_eventNbr
Event number.
unsigned int m_verticesBegin
Begin position in the vector of vertices composing this event.
int m_signalProcessId
Id of the processus being generated.
McEventCollectionCnv_p2 & operator=(const McEventCollectionCnv_p2 &rhs)
Assignement operator.
unsigned int m_particlesEnd
End position in the vector of particles composing this event.
void set_signal_process_vertex(GenEvent *e, T v)
GenEvtPool_t evt
an arena of HepMC::GenEvent for efficient object instantiation
double m_z
z-coordinate of the vertex
double m_alphaQCD
value of the QCD coupling.
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 void transToPers(const McEventCollection *transObj, McEventCollection_p2 *persObj, MsgStream &log)
Method creating the persistent representation McEventCollection_p2 from its transient representation ...
float m_thetaPolarization
polarization
int m_id
Id of this vertex.
GenVtxPool_t vtx
an arena of HepMC::GenVertex for efficient object instantiation
This defines the McEventCollection, which is really just an ObjectVector of McEvent objects.
void clear()
Erase all the elements in the collection.
std::unordered_map< HepMC::GenParticlePtr, int > ParticlesMap_t
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.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
McEventCollectionCnv_p2()
Default constructor:
std::vector< int > m_particlesIn
collection of barcodes of in-going particles connected to this vertex
unsigned int m_particlesBegin
Begin position in the vector of particles composing this event.
int m_status
Status of this particle, as defined for HEPEVT.
double m_eventScale
Energy scale.
float m_phiPolarization
phi polarization
virtual ~McEventCollectionCnv_p2()
Destructor.
std::vector< int > m_particlesOut
collection of barcodes of out-going particles connected to this vertex
HepMC::GenEvent * getGenEvent()
GenVertex * barcode_to_vertex(const GenEvent *e, int id)
std::vector< long int > m_randomStates
Container of random numbers for the generator states.
std::vector< GenVertex_p2 > m_genVertices
The vector of persistent representation of GenVertices.
std::vector< GenParticle_p2 > m_genParticles
The vector of persistent representation of GenParticles.
HepMC::GenVertexPtr getGenVertex()
unsigned int m_verticesEnd
End position in the vector of vertices composing this event.
std::vector< float > m_weights
Weights for this vertex.
GenPartPool_t part
an arena of HepMC::GenParticle for efficient object instantiation
int m_barcode
barcode of this particles (uniquely identifying this particle within a given GenEvent)