![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Go to the documentation of this file.
39 Base_t::operator=( rhs );
56 msg <<
MSG::DEBUG <<
"Loading McEventCollection from persistent state..."
65 datapools.
part.prepareToAdd(nParts);
66 const unsigned int nEvts = persObj->
m_genEvents.size();
67 datapools.
evt.prepareToAdd(nEvts);
70 for ( std::vector<GenEvent_p3>::const_iterator
79 genEvt->add_attribute (
"barcodes", std::make_shared<HepMC::GenEventBarcodes>());
80 genEvt->add_attribute(
"signal_process_id",std::make_shared<HepMC3::IntAttribute>(persEvt.
m_signalProcessId));
82 genEvt->add_attribute(
"event_scale",std::make_shared<HepMC3::DoubleAttribute>(persEvt.
m_eventScale));
83 genEvt->add_attribute(
"alphaQCD",std::make_shared<HepMC3::DoubleAttribute>(persEvt.
m_alphaQCD));
84 genEvt->add_attribute(
"alphaQED",std::make_shared<HepMC3::DoubleAttribute>(persEvt.
m_alphaQED));
86 genEvt->add_attribute(
"random_states",std::make_shared<HepMC3::VectorLongIntAttribute>(persEvt.
m_randomStates));
93 for (
unsigned int iVtx= persEvt.
m_verticesBegin; iVtx != endVtx; ++iVtx ) {
102 genEvt->m_signal_process_vertex = 0;
105 genEvt->m_vertex_barcodes.clear();
106 genEvt->m_particle_barcodes.clear();
107 genEvt->m_pdf_info = 0;
120 for (
unsigned int iVtx= persEvt.
m_verticesBegin; iVtx != endVtx; ++iVtx ) {
130 if ( sigProcVtx != 0 ) {
136 for (
auto &
p : partToEndVtx) {
139 decayVtx->add_particle_in(
p.first );
142 <<
"GenParticle points to null end vertex !!"
148 msg <<
MSG::DEBUG <<
"Loaded McEventCollection from persistent state [OK]"
157 <<
"This transient-to-persistent converter method has been RETIRED !!"
159 <<
"You are not supposed to end-up here ! Go away !"
162 throw std::runtime_error(
"Retired McEventCollectionCnv_p3::transToPers() !!" );
176 vtx->set_position( HepMC::FourVector(persVtx.
m_x,persVtx.
m_y,persVtx.
m_z,persVtx.
m_t) );
177 vtx->set_status(persVtx.
m_id);
180 vtx->add_attribute(
"weights",std::make_shared<HepMC3::VectorDoubleAttribute>(weights));
185 for (
unsigned int i = 0;
i != nPartsIn; ++
i ) {
190 for (
unsigned int i = 0;
i != nPartsOut; ++
i ) {
194 vtx->m_position.setX( persVtx.
m_x );
195 vtx->m_position.setY( persVtx.
m_y );
196 vtx->m_position.setZ( persVtx.
m_z );
197 vtx->m_position.setT( persVtx.
m_t );
198 vtx->m_particles_in.clear();
199 vtx->m_particles_out.clear();
200 vtx->m_id = persVtx.
m_id;
201 vtx->m_weights.m_weights.reserve( persVtx.
m_weights.size() );
202 vtx->m_weights.m_weights.assign ( persVtx.
m_weights.begin(),
209 for (
unsigned int i = 0;
i != nPartsIn; ++
i ) {
217 for (
unsigned int i = 0;
i != nPartsOut; ++
i ) {
245 temp_e = std::sqrt( (
long double)(persPart.
m_px)*persPart.
m_px +
246 (
long double)(persPart.
m_py)*persPart.
m_py +
247 (
long double)(persPart.
m_pz)*persPart.
m_pz +
248 (
long double)(persPart.
m_m) *persPart.
m_m );
250 const int signM2 = ( persPart.
m_m >= 0. ? 1 : -1 );
251 const double persPart_ene =
252 std::sqrt( std::abs((
long double)(persPart.
m_px)*persPart.
m_px +
253 (
long double)(persPart.
m_py)*persPart.
m_py +
254 (
long double)(persPart.
m_pz)*persPart.
m_pz +
255 signM2* (
long double)(persPart.
m_m)* persPart.
m_m));
256 const int signEne = ( persPart.
m_recoMethod == 1 ? 1 : -1 );
257 temp_e=signEne * persPart_ene;
259 p->set_momentum(HepMC::FourVector(persPart.
m_px,persPart.
m_py,persPart.
m_pz,temp_e));
262 std::vector<int> flows;
263 const unsigned int nFlow = persPart.
m_flow.size();
264 for (
unsigned int iFlow= 0; iFlow != nFlow; ++iFlow ) {
265 flows.push_back(persPart.
m_flow[iFlow].second );
268 p->add_attribute(
"flows", std::make_shared<HepMC3::VectorIntAttribute>(flows));
275 p->m_production_vertex = 0;
285 p->m_momentum.setPx( persPart.
m_px );
286 p->m_momentum.setPy( persPart.
m_py );
287 p->m_momentum.setPz( persPart.
m_pz );
288 double temp_e = std::sqrt( (
long double)(persPart.
m_px)*persPart.
m_px +
289 (
long double)(persPart.
m_py)*persPart.
m_py +
290 (
long double)(persPart.
m_pz)*persPart.
m_pz +
291 (
long double)(persPart.
m_m) *persPart.
m_m );
292 p->m_momentum.setE( temp_e );
294 const int signM2 = ( persPart.
m_m >= 0. ? 1 : -1 );
295 const double persPart_ene =
296 std::sqrt( std::abs((
long double)(persPart.
m_px)*persPart.
m_px +
297 (
long double)(persPart.
m_py)*persPart.
m_py +
298 (
long double)(persPart.
m_pz)*persPart.
m_pz +
299 signM2* (
long double)(persPart.
m_m)* persPart.
m_m));
300 const int signEne = ( persPart.
m_recoMethod == 1 ? 1 : -1 );
301 p->m_momentum.set( persPart.
m_px,
304 signEne * persPart_ene );
308 const unsigned int nFlow = persPart.
m_flow.size();
310 for (
unsigned int iFlow= 0; iFlow != nFlow; ++iFlow ) {
311 p->m_flow.set_icode( persPart.
m_flow[iFlow].first,
312 persPart.
m_flow[iFlow].second );
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
HepMC::GenVertex * GenVertexPtr
unsigned int m_verticesBegin
Begin position in the vector of vertices composing this event.
bool suggest_barcode(T &p, int i)
int m_status
Status of this particle, as defined for HEPEVT.
float m_phiPolarization
phi polarization
double m_alphaQCD
value of the QCD coupling.
int nVertices(const Polygon &p)
int m_signalProcessId
Id of the processus being generated.
virtual void persToTrans(const McEventCollection_p3 *persObj, McEventCollection *transObj, MsgStream &log)
Method creating the transient representation of McEventCollection from its persistent representation ...
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
float m_pz
z-component of the 4-momentum of this particle
virtual void transToPers(const McEventCollection *transObj, McEventCollection_p3 *persObj, MsgStream &log)
Method creating the persistent representation McEventCollection_p3 from its transient representation ...
std::vector< GenEvent_p3 > m_genEvents
The vector of persistent representation of GenEvents.
int m_pdgId
identity of this particle, according to the Particle Data Group notation
GenParticle * GenParticlePtr
unsigned int m_particlesEnd
End position in the vector of particles composing this event.
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.
float m_thetaPolarization
polarization
std::vector< int > m_particlesOut
collection of barcodes of out-going particles connected to this vertex
int m_barcode
barcode of this particles (uniquely identifying this particle within a given GenEvent)
std::vector< float > m_weights
Weights for this vertex.
double m_alphaQED
value of the QED coupling.
double m_eventScale
Energy scale.
HepMC::GenParticlePtr getGenParticle()
std::vector< GenParticle_p3 > m_genParticles
The vector of persistent representation of GenParticles.
unsigned int m_particlesBegin
Begin position in the vector of particles composing this event.
float m_y
y-coordinate of the vertex
void set_signal_process_vertex(GenEvent *e, T v)
std::vector< std::pair< int, int > > m_flow
Flow for this particle.
float m_px
x-component of the 4-momentum of this particle
GenEvtPool_t evt
an arena of HepMC::GenEvent for efficient object instantiation
int m_eventNbr
Event number.
McEventCollectionCnv_p3()
Default constructor:
float m_x
x-coordinate of the 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.
McEventCollectionCnv_p3 & operator=(const McEventCollectionCnv_p3 &rhs)
Assignement operator.
void clear()
Erase all the elements in the collection.
float m_z
z-coordinate of the vertex
short m_recoMethod
switch to know which method to chose to better recover the original HepLorentzVector.
unsigned int m_verticesEnd
End position in the vector of vertices composing this event.
virtual ~McEventCollectionCnv_p3()
Destructor.
int m_id
Id of this vertex.
std::vector< double > m_weights
Weights for this event.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
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.
int m_barcode
barcode of this vertex (uniquely identifying a vertex within an event)
int m_endVtx
Barcode of the decay vertex of this particle.
HepMC::GenEvent * getGenEvent()
GenVertex * barcode_to_vertex(const GenEvent *e, int id)
std::unordered_map< HepMC::GenParticlePtr, int > ParticlesMap_t
std::vector< int > m_particlesIn
collection of barcodes of in-going particles connected to this vertex
int m_signalProcessVtx
Barcode of the GenVertex holding the signal process.
float m_py
y-component of the 4-momentum of this particle
float m_t
t-coordinate of the vertex
HepMC::GenVertexPtr getGenVertex()
float m_m
m-component of the 4-momentum of this particle
std::vector< GenVertex_p3 > m_genVertices
The vector of persistent representation of GenVertices.
std::vector< long int > m_randomStates
Container of random numbers for the generator states.
GenPartPool_t part
an arena of HepMC::GenParticle for efficient object instantiation