ATLAS Offline Software
Loading...
Searching...
No Matches
McEventCollectionCnv_p5.cxx
Go to the documentation of this file.
1
2
3/*
4 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
5*/
6
7// McEventCollectionCnv_p5.cxx
8// Implementation file for class McEventCollectionCnv_p5
9// Author: S.Binet<binet@cern.ch>
11
12// STL includes
13#include <utility>
14#include <cmath>
15#include <cfloat> // for DBL_EPSILON
16
17// GeneratorObjectsTPCnv includes
19#include "HepMcDataPool.h"
22#include "GaudiKernel/ThreadLocalContext.h"
24
25
27// Constructors
29
31 Base_t( ),
32 m_isPileup(false),m_hepMCWeightSvc("HepMCWeightSvc","McEventCollectionCnv_p5")
33{}
34
36 Base_t( rhs ),
37 m_isPileup(false),m_hepMCWeightSvc("HepMCWeightSvc","McEventCollectionCnv_p5")
38{}
39
42{
43 if ( this != &rhs ) {
44 Base_t::operator=( rhs );
46 }
47 return *this;
48}
49
51// Destructor
53
55= default;
56
57
59 McEventCollection* transObj,
60 MsgStream& msg )
61{
62 const EventContext& ctx = Gaudi::Hive::currentContext();
63
64 msg << MSG::DEBUG << "Loading McEventCollection from persistent state..."
65 << endmsg;
66
67 // elements are managed by DataPool
68 if (!m_isPileup) {
69 transObj->clear(SG::VIEW_ELEMENTS);
70 }
71 HepMC::DataPool datapools;
72 const unsigned int nVertices = persObj->m_genVertices.size();
73 datapools.vtx.prepareToAdd(nVertices);
74 const unsigned int nParts = persObj->m_genParticles.size();
75 datapools.part.prepareToAdd(nParts);
76 const unsigned int nEvts = persObj->m_genEvents.size();
77 datapools.evt.prepareToAdd(nEvts);
78 transObj->reserve( nEvts );
79 for ( std::vector<GenEvent_p5>::const_iterator
80 itr = persObj->m_genEvents.begin(),
81 itrEnd = persObj->m_genEvents.end();
82 itr != itrEnd;
83 ++itr ) {
84 const GenEvent_p5& persEvt = *itr;
85 HepMC::GenEvent * genEvt(nullptr);
86 if(m_isPileup) {
87 genEvt = new HepMC::GenEvent();
88 } else {
89 genEvt = datapools.getGenEvent();
90 }
91 genEvt->add_attribute (HepMCStr::barcodes, std::make_shared<HepMC::GenEventBarcodes>());
92 genEvt->add_attribute(HepMCStr::signal_process_id, std::make_shared<HepMC3::IntAttribute>(persEvt.m_signalProcessId));
93 genEvt->set_event_number(persEvt.m_eventNbr);
94 genEvt->add_attribute(HepMCStr::mpi, std::make_shared<HepMC3::IntAttribute>(persEvt.m_mpi));
95 genEvt->add_attribute(HepMCStr::event_scale, std::make_shared<HepMC3::DoubleAttribute>(persEvt.m_eventScale));
96 genEvt->add_attribute(HepMCStr::alphaQCD, std::make_shared<HepMC3::DoubleAttribute>(persEvt.m_alphaQCD));
97 genEvt->add_attribute(HepMCStr::alphaQED, std::make_shared<HepMC3::DoubleAttribute>(persEvt.m_alphaQED));
98 genEvt->weights()= persEvt.m_weights;
99 genEvt->add_attribute(HepMCStr::random_states, std::make_shared<HepMC3::VectorLongIntAttribute>(persEvt.m_randomStates));
100
101 genEvt->set_units(static_cast<HepMC3::Units::MomentumUnit>(persEvt.m_momentumUnit),
102 static_cast<HepMC3::Units::LengthUnit>(persEvt.m_lengthUnit));
103
104 //restore weight names from the dedicated svc (which was keeping them in metadata for efficiency)
105 if(!genEvt->run_info()) genEvt->set_run_info(std::make_shared<HepMC3::GenRunInfo>());
106 genEvt->run_info()->set_weight_names(m_hepMCWeightSvc->weightNameVec(ctx));
107 // cross-section restore
108
109 if (!persEvt.m_crossSection.empty()) {
110 auto cs = std::make_shared<HepMC3::GenCrossSection>();
111 const std::vector<double>& xsection = persEvt.m_crossSection;
112 genEvt->set_cross_section(cs);
113 if( static_cast<bool>(xsection[0]) )
114 cs->set_cross_section(xsection[2],xsection[1]);
115 else
116 cs->set_cross_section(-1.0, -1.0);
117 }
118
119 // heavyIon restore
120 if (!persEvt.m_heavyIon.empty()) {
121 auto hi = std::make_shared<HepMC3::GenHeavyIon>();
122 const std::vector<float>& hIon = persEvt.m_heavyIon;
123 //AV NOTE THE ORDER
124 hi->set(
125 static_cast<int>(hIon[12]), // Ncoll_hard
126 static_cast<int>(hIon[11]), // Npart_proj
127 static_cast<int>(hIon[10]), // Npart_targ
128 static_cast<int>(hIon[9]), // Ncoll
129 static_cast<int>(hIon[8]), // spectator_neutrons
130 static_cast<int>(hIon[7]), // spectator_protons
131 static_cast<int>(hIon[6]), // N_Nwounded_collisions
132 static_cast<int>(hIon[5]), // Nwounded_N_collisions
133 static_cast<int>(hIon[4]), // Nwounded_Nwounded_collisions
134 hIon[3], // impact_parameter
135 hIon[2], // event_plane_angle
136 hIon[1], // eccentricity
137 hIon[0] ); // sigma_inel_NN
138 genEvt->set_heavy_ion(std::move(hi));
139 }
140
141
142
143 // pdfinfo restore
144 if (!persEvt.m_pdfinfo.empty())
145 {
146 const std::vector<double>& pdf = persEvt.m_pdfinfo;
147 HepMC3::GenPdfInfoPtr pi = std::make_shared<HepMC3::GenPdfInfo>();
148 pi->set(static_cast<int>(pdf[8]), // id1
149 static_cast<int>(pdf[7]), // id2
150 pdf[4], // x1
151 pdf[3], // x2
152 pdf[2], // scalePDF
153 pdf[1], // pdf1
154 pdf[0], // pdf2
155 static_cast<int>(pdf[6]), // pdf_id1
156 static_cast<int>(pdf[5]));// pdf_id2
157 genEvt->set_pdf_info(std::move(pi));
158 }
159 transObj->push_back( genEvt );
160
161 // create a temporary map associating the barcode of an end-vtx to its
162 // particle.
163 // As not all particles are stable (d'oh!) we take 50% of the number of
164 // particles as an initial size of the hash-map (to prevent re-hash)
165 ParticlesMap_t partToEndVtx( (persEvt.m_particlesEnd - persEvt.m_particlesBegin)/2 );
166 // This is faster than the HepMC::barcode_to_vertex
167 std::map<int, HepMC::GenVertexPtr> brc_to_vertex;
168
169 // create the vertices
170 const unsigned int endVtx = persEvt.m_verticesEnd;
171 for ( unsigned int iVtx = persEvt.m_verticesBegin; iVtx != endVtx; ++iVtx ) {
172 auto vtx = createGenVertex( *persObj, persObj->m_genVertices[iVtx], partToEndVtx, datapools, genEvt );
173 brc_to_vertex[persObj->m_genVertices[iVtx].m_barcode] = std::move(vtx);
174 } //> end loop over vertices
175
176 // set the signal process vertex
177 const int sigProcVtx = persEvt.m_signalProcessVtx;
178 if ( sigProcVtx != 0 && brc_to_vertex.count(sigProcVtx) ) {
179 HepMC::set_signal_process_vertex(genEvt, brc_to_vertex[sigProcVtx] );
180 }
181
182 // connect particles to their end vertices
183 for (auto & p : partToEndVtx) {
184 if ( brc_to_vertex.count(p.second) ) {
185 auto decayVtx = brc_to_vertex[p.second];
186 decayVtx->add_particle_in( p.first );
187 } else {
188 msg << MSG::ERROR << "GenParticle points to null end vertex !!" << endmsg;
189 }
190 }
191 // set the beam particles
192 const int beamPart1 = persEvt.m_beamParticle1;
193 const int beamPart2 = persEvt.m_beamParticle2;
194 if ( beamPart1 != 0 && beamPart2 != 0 ) {
195 genEvt->set_beam_particles(HepMC::barcode_to_particle(genEvt, beamPart1),
196 HepMC::barcode_to_particle(genEvt, beamPart2));
197 }
198
199
200 } //> end loop over m_genEvents
201
202 msg << MSG::DEBUG << "Loaded McEventCollection from persistent state [OK]"
203 << endmsg;
204}
205
207 McEventCollection_p5* persObj,
208 MsgStream& msg )
209{
210 const EventContext& ctx = Gaudi::Hive::currentContext();
211
212 msg << MSG::DEBUG << "Creating persistent state of McEventCollection..."
213 << endmsg;
214 persObj->m_genEvents.reserve( transObj->size() );
215
216 const std::pair<unsigned int,unsigned int> stats = nbrParticlesAndVertices( transObj );
217 persObj->m_genParticles.reserve( stats.first );
218 persObj->m_genVertices.reserve ( stats.second );
219
220 const McEventCollection::const_iterator itrEnd = transObj->end();
221 for ( McEventCollection::const_iterator itr = transObj->begin();
222 itr != itrEnd;
223 ++itr ) {
224 const unsigned int nPersVtx = persObj->m_genVertices.size();
225 const unsigned int nPersParts = persObj->m_genParticles.size();
226 const HepMC::GenEvent* genEvt = *itr;
227 //save the weight names to metadata via the HepMCWeightSvc
228 if (genEvt->run_info()) {
229 if (!genEvt->run_info()->weight_names().empty()) {
230 m_hepMCWeightSvc->setWeightNames( names_to_name_index_map(genEvt->weight_names()), ctx ).ignore();
231 } else {
232 //AV : This to be decided if one would like to have default names.
233 //std::vector<std::string> names{"0"};
234 //m_hepMCWeightSvc->setWeightNames( names_to_name_index_map(names), ctx );
235 }
236 }
237
238 auto A_mpi=genEvt->attribute<HepMC3::IntAttribute>(HepMCStr::mpi);
239 auto A_signal_process_id=genEvt->attribute<HepMC3::IntAttribute>(HepMCStr::signal_process_id);
240 auto A_event_scale=genEvt->attribute<HepMC3::DoubleAttribute>(HepMCStr::event_scale);
241 auto A_alphaQCD=genEvt->attribute<HepMC3::DoubleAttribute>(HepMCStr::alphaQCD);
242 auto A_alphaQED=genEvt->attribute<HepMC3::DoubleAttribute>(HepMCStr::alphaQED);
243 auto signal_process_vertex = HepMC::signal_process_vertex(genEvt);
244 auto A_random_states=genEvt->attribute<HepMC3::VectorLongIntAttribute>(HepMCStr::random_states);
245 auto beams=genEvt->beams();
246 persObj->m_genEvents.
247 emplace_back(A_signal_process_id?(A_signal_process_id->value()):-1,
248 genEvt->event_number(),
249 A_mpi?(A_mpi->value()):-1,
250 A_event_scale?(A_event_scale->value()):0.0,
251 A_alphaQCD?(A_alphaQCD->value()):0.0,
252 A_alphaQED?(A_alphaQED->value()):0.0,
253 signal_process_vertex?HepMC::barcode(signal_process_vertex):0,
254 !beams.empty()?HepMC::barcode(beams[0]):0,
255 beams.size()>1?HepMC::barcode(beams[1]):0,
256 genEvt->weights(),
257 A_random_states?(A_random_states->value()):std::vector<long>(),
258 std::vector<double>(), // cross section
259 std::vector<float>(), // heavyion
260 std::vector<double>(), // pdf info
261 genEvt->momentum_unit(),
262 genEvt->length_unit(),
263 nPersVtx,
264 nPersVtx + genEvt->vertices().size(),
265 nPersParts,
266 nPersParts + genEvt->particles().size() );
267
268
269 //HepMC::GenCrossSection encoding
270 if (genEvt->cross_section()) {
271 auto cs=genEvt->cross_section();
272 GenEvent_p5& persEvt = persObj->m_genEvents.back();
273 std::vector<double>& crossSection = persEvt.m_crossSection;
274 crossSection.resize(3);
275 crossSection[2] = cs->xsec();
276 crossSection[1] = cs->xsec_err();
277 crossSection[0] = static_cast<double>(cs->is_valid());
280 if (crossSection[2] < 0) {
281 crossSection[2] = 0.0;
282 if (crossSection[1] < 0) {
283 crossSection[1] = 0.0;
284 }
285 crossSection[0] = 0.0;
286 }
287
288 }
289
290 //HepMC::HeavyIon encoding
291 if (genEvt->heavy_ion()) {
292 auto hi=genEvt->heavy_ion();
293 GenEvent_p5& persEvt = persObj->m_genEvents.back();
294 std::vector<float>& heavyIon = persEvt.m_heavyIon;
295 heavyIon.resize(13);
296 heavyIon[12] = static_cast<float>(hi->Ncoll_hard);
297 heavyIon[11] = static_cast<float>(hi->Npart_proj);
298 heavyIon[10] = static_cast<float>(hi->Npart_targ);
299 heavyIon[9] = static_cast<float>(hi->Ncoll);
300 heavyIon[8] = static_cast<float>(hi->spectator_neutrons);
301 heavyIon[7] = static_cast<float>(hi->spectator_protons);
302 heavyIon[6] = static_cast<float>(hi->N_Nwounded_collisions);
303 heavyIon[5] = static_cast<float>(hi->Nwounded_N_collisions);
304 heavyIon[4] = static_cast<float>(hi->Nwounded_Nwounded_collisions);
305 heavyIon[3] = hi->impact_parameter;
306 heavyIon[2] = hi->event_plane_angle;
307 heavyIon[1] = hi->eccentricity;
308 heavyIon[0] = hi->sigma_inel_NN;
309 }
310
311 //PdfInfo encoding
312 if (genEvt->pdf_info()) {
313 auto pi=genEvt->pdf_info();
314 GenEvent_p5& persEvt = persObj->m_genEvents.back();
315 std::vector<double>& pdfinfo = persEvt.m_pdfinfo;
316 pdfinfo.resize(9);
317 pdfinfo[8] = static_cast<double>(pi->parton_id[0]);
318 pdfinfo[7] = static_cast<double>(pi->parton_id[1]);
319 pdfinfo[6] = static_cast<double>(pi->pdf_id[0]);
320 pdfinfo[5] = static_cast<double>(pi->pdf_id[1]);
321 pdfinfo[4] = pi->x[0];
322 pdfinfo[3] = pi->x[1];
323 pdfinfo[2] = pi->scale;
324 pdfinfo[1] = pi->xf[0];
325 pdfinfo[0] = pi->xf[1];
326 }
327
328 // create vertices
329 for (const auto& v: genEvt->vertices()) {
330 writeGenVertex( v, *persObj );
331 }
332
333 } //> end loop over GenEvents
334
335 msg << MSG::DEBUG << "Created persistent state of HepMC::GenEvent [OK]" << endmsg;
336}
337
338
341 const GenVertex_p5& persVtx,
342 ParticlesMap_t& partToEndVtx, HepMC::DataPool& datapools
343 ,HepMC::GenEvent* parent
344 ) const
345{
346 HepMC::GenVertexPtr vtx(nullptr);
347 if(m_isPileup) {
349 } else {
350 vtx = datapools.getGenVertex();
351 }
352 if (parent ) parent->add_vertex(vtx);
353 vtx->set_position(HepMC::FourVector( persVtx.m_x , persVtx.m_y , persVtx.m_z ,persVtx.m_t ));
354 //AV ID cannot be assigned in HepMC3. And its meaning in HepMC2 is not clear.
355 int persVtxStatus(persVtx.m_id);
356 // GenVertex "status" (id in HepMC2) was not set for some of
357 // MC15/MC16 due to a bug in that production release.
358 if (persVtxStatus == 0 && HepMC::BarcodeBased::is_simulation_vertex(persVtx.m_barcode)) {
359 // Status values for GenVertex objects created during simulation
360 // should have been set to 1000 + Geant4 process in the old
361 // scheme. Overriding the value to 1000, means that status-based
362 // recognition of simulated vertices will work, while still
363 // indicating that the process was not set. (ATLASSIM-6901)
364 persVtxStatus = 1000;
365 }
366 vtx->set_status(HepMC::new_vertex_status_from_old(persVtxStatus, persVtx.m_barcode)); // UPDATED STATUS VALUE TO NEW SCHEME
367 // cast from std::vector<float> to std::vector<double>
368 std::vector<double> weights( persVtx.m_weights.begin(), persVtx.m_weights.end() );
369 vtx->add_attribute(HepMCStr::weights,std::make_shared<HepMC3::VectorDoubleAttribute>(weights));
371 // handle the in-going (orphans) particles
372 const unsigned int nPartsIn = persVtx.m_particlesIn.size();
373 for ( unsigned int i = 0; i != nPartsIn; ++i ) {
374 createGenParticle( persEvt.m_genParticles[persVtx.m_particlesIn[i]], partToEndVtx, datapools, vtx, false );
375 }
376
377 // now handle the out-going particles
378 const unsigned int nPartsOut = persVtx.m_particlesOut.size();
379 for ( unsigned int i = 0; i != nPartsOut; ++i ) {
380 createGenParticle( persEvt.m_genParticles[persVtx.m_particlesOut[i]], partToEndVtx, datapools, vtx );
381 }
382
383 return vtx;
384}
385
388 ParticlesMap_t& partToEndVtx, HepMC::DataPool& datapools ,const HepMC::GenVertexPtr& parent, bool add_to_output ) const
389{
390 HepMC::GenParticlePtr p(nullptr);
391 if (m_isPileup) {
393 } else {
394 p = datapools.getGenParticle();
395 }
396 if (parent) add_to_output?parent->add_particle_out(p):parent->add_particle_in(p);
397 p->set_pdg_id( persPart.m_pdgId);
398 p->set_status(HepMC::new_particle_status_from_old(persPart.m_status, persPart.m_barcode)); // UPDATED STATUS VALUE TO NEW SCHEME
399 p->add_attribute(HepMCStr::phi,std::make_shared<HepMC3::DoubleAttribute>(persPart.m_phiPolarization));
400 p->add_attribute(HepMCStr::theta,std::make_shared<HepMC3::DoubleAttribute>(persPart.m_thetaPolarization));
402 p->set_generated_mass(persPart.m_generated_mass);
403
404 // Note: do the E calculation in extended (long double) precision.
405 // That happens implicitly on x86 with optimization on; saying it
406 // explicitly ensures that we get the same results with and without
407 // optimization. (If this is a performance issue for platforms
408 // other than x86, one could change to double for those platforms.)
409 if ( 0 == persPart.m_recoMethod ) {
410 double temp_e = std::sqrt( (long double)(persPart.m_px)*persPart.m_px +
411 (long double)(persPart.m_py)*persPart.m_py +
412 (long double)(persPart.m_pz)*persPart.m_pz +
413 (long double)(persPart.m_m) *persPart.m_m );
414 p->set_momentum( HepMC::FourVector(persPart.m_px,persPart.m_py,persPart.m_pz,temp_e));
415 } else {
416 const int signM2 = ( persPart.m_m >= 0. ? 1 : -1 );
417 const double persPart_ene =
418 std::sqrt( std::abs((long double)(persPart.m_px)*persPart.m_px +
419 (long double)(persPart.m_py)*persPart.m_py +
420 (long double)(persPart.m_pz)*persPart.m_pz +
421 signM2* (long double)(persPart.m_m)* persPart.m_m));
422 const int signEne = ( persPart.m_recoMethod == 1 ? 1 : -1 );
423 p->set_momentum(HepMC::FourVector( persPart.m_px,
424 persPart.m_py,
425 persPart.m_pz,
426 signEne * persPart_ene ));
427 }
428
429 // setup flow
430 std::vector<int> flows;
431 const unsigned int nFlow = persPart.m_flow.size();
432 for ( unsigned int iFlow= 0; iFlow != nFlow; ++iFlow ) {
433 flows.push_back(persPart.m_flow[iFlow].second );
434 }
435 //We construct it here as vector w/o gaps.
436 p->add_attribute(HepMCStr::flows, std::make_shared<HepMC3::VectorIntAttribute>(flows));
437
438 if ( persPart.m_endVtx != 0 ) {
439 partToEndVtx[p] = persPart.m_endVtx;
440 }
441
442 return p;
443}
444
446 McEventCollection_p5& persEvt )
447{
448 const HepMC::FourVector& position = vtx->position();
449 auto A_weights=vtx->attribute<HepMC3::VectorDoubleAttribute>(HepMCStr::weights);
450 auto A_barcode=vtx->attribute<HepMC3::IntAttribute>(HepMCStr::barcode);
451 std::vector<float> weights;
452 if (A_weights) {
453 auto weights_d = A_weights->value();
454 for (auto& w: weights_d) weights.push_back(w);
455 }
456 persEvt.m_genVertices.emplace_back( position.x(),
457 position.y(),
458 position.z(),
459 position.t(),
460 HepMC::old_vertex_status_from_new(vtx->status()), // REVERTED STATUS VALUE TO OLD SCHEME
461 weights.begin(),
462 weights.end(),
463 A_barcode?(A_barcode->value()):vtx->id() );
464 GenVertex_p5& persVtx = persEvt.m_genVertices.back();
465
466 // we write only the orphans in-coming particles and beams
467 persVtx.m_particlesIn.reserve(vtx->particles_in().size());
468 for (const auto& p: vtx->particles_in()) {
469 if ( !p->production_vertex() || p->production_vertex()->id() == 0 ) {
470 persVtx.m_particlesIn.push_back( writeGenParticle( p, persEvt ) );
471 }
472 }
473
474 persVtx.m_particlesOut.reserve(vtx->particles_out().size());
475 for (const auto& p: vtx->particles_out()) {
476 persVtx.m_particlesOut.push_back( writeGenParticle( p, persEvt ) );
477 }
478
479 }
480
482 McEventCollection_p5& persEvt )
483{
484 const HepMC::FourVector mom = p->momentum();
485 const double ene = mom.e();
486 const double m2 = mom.m2();
487
488 // Definitions of Bool isTimeLilike, isSpacelike and isLightlike according to HepLorentzVector definition
489 const bool useP2M2 = !(m2 > 0) && // !isTimelike
490 (m2 < 0) && // isSpacelike
491 !(std::abs(m2) < 2.0*DBL_EPSILON*ene*ene); // !isLightlike
492 auto A_flows=p->attribute<HepMC3::VectorIntAttribute>(HepMCStr::flows);
493 auto A_phi=p->attribute<HepMC3::DoubleAttribute>(HepMCStr::phi);
494 auto A_theta=p->attribute<HepMC3::DoubleAttribute>(HepMCStr::theta);
495
496 const short recoMethod = ( !useP2M2 ? 0: ( ene >= 0.? 1: 2 ) );
497 persEvt.m_genParticles.
498 emplace_back( mom.px(),
499 mom.py(),
500 mom.pz(),
501 mom.m(),
502 p->pdg_id(),
503 HepMC::old_particle_status_from_new(p->status()), // REVERTED STATUS VALUE TO OLD SCHEME
504 A_flows?(A_flows->value().size()):0,
505 A_theta?(A_theta->value()):0.0,
506 A_phi?(A_phi->value()):0.0,
507 p->production_vertex()? HepMC::barcode(p->production_vertex()):0,
508 p->end_vertex()? HepMC::barcode(p->end_vertex()):0,
510 p->generated_mass(),
511 recoMethod );
512
513 std::vector< std::pair<int,int> > flow_hepmc2;
514 if(A_flows) flow_hepmc2=vector_to_vector_int_int(A_flows->value());
515 persEvt.m_genParticles.back().m_flow.assign( flow_hepmc2.begin(),flow_hepmc2.end() );
516
517 // we return the index of the particle in the big vector of particles
518 // (contained by the persistent GenEvent)
519 return (persEvt.m_genParticles.size() - 1);
520
521}
522
#define endmsg
#define pi
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
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.
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
void clear()
Erase all the elements in the collection.
int m_lengthUnit
HepMC::Units::LengthUnit casted to int.
int m_eventNbr
Event number.
Definition GenEvent_p5.h:78
std::vector< double > m_weights
Weights for this event.
int m_signalProcessId
Id of the processus being generated.
Definition GenEvent_p5.h:74
unsigned int m_particlesBegin
Begin position in the vector of particles composing this event.
double m_alphaQED
value of the QED coupling.
Definition GenEvent_p5.h:94
int m_beamParticle1
Barcode of the beam particle 1.
double m_alphaQCD
value of the QCD coupling.
Definition GenEvent_p5.h:90
int m_momentumUnit
HepMC::Units::MomentumUnit casted to int.
unsigned int m_verticesEnd
End position in the vector of vertices composing this event.
unsigned int m_verticesBegin
Begin position in the vector of vertices composing this event.
double m_eventScale
Energy scale.
Definition GenEvent_p5.h:86
std::vector< float > m_heavyIon
Container of HepMC::HeavyIon object translated to vector<double>.
std::vector< double > m_crossSection
Container of HepMC::GenCrossSection object translated to vector<double>.
int m_mpi
Number of multi particle interactions.
Definition GenEvent_p5.h:82
unsigned int m_particlesEnd
End position in the vector of particles composing this event.
std::vector< long int > m_randomStates
Container of random numbers for the generator states.
int m_beamParticle2
Barcode of the beam particle 2.
int m_signalProcessVtx
Barcode of the GenVertex holding the signal process.
std::vector< double > m_pdfinfo
Container of HepMC::PdfInfo object translated to vector<double> for simplicity.
std::vector< std::pair< int, int > > m_flow
Flow for this particle.
float m_thetaPolarization
polarization
float m_py
y-component of the 4-momentum of this particle
float m_px
x-component of the 4-momentum of this particle
int m_barcode
barcode of this particles (uniquely identifying this particle within a given GenEvent)
int m_status
Status of this particle.
float m_pz
z-component of the 4-momentum of this particle
int m_endVtx
Barcode of the decay vertex of this particle.
float m_phiPolarization
phi polarization
int m_pdgId
identity of this particle, according to the Particle Data Group notation
short m_recoMethod
switch to know which method to chose to better recover the original HepLorentzVector.
float m_m
m-component of the 4-momentum of this particle
float m_generated_mass
mass of this particle when it was generated
std::vector< float > m_weights
Weights for this vertex.
std::vector< int > m_particlesIn
collection of barcodes of in-going particles connected to this vertex
std::vector< int > m_particlesOut
collection of barcodes of out-going particles connected to this vertex
float m_y
y-coordinate of the vertex
float m_t
t-coordinate of the vertex
int m_id
Id of this vertex.
int m_barcode
barcode of this vertex (uniquely identifying a vertex within an event)
float m_z
z-coordinate of the vertex
float m_x
x-coordinate of the vertex
McEventCollectionCnv_p5 & operator=(const McEventCollectionCnv_p5 &rhs)
Assignement operator.
virtual void transToPers(const McEventCollection *transObj, McEventCollection_p5 *persObj, MsgStream &log)
Method creating the persistent representation McEventCollection_p5 from its transient representation ...
T_AthenaPoolTPCnvBase< McEventCollection, McEventCollection_p5 > Base_t
virtual ~McEventCollectionCnv_p5()
Destructor.
static int writeGenParticle(const HepMC::ConstGenParticlePtr &p, McEventCollection_p5 &persEvt)
Method to write a persistent GenParticle object It returns the index of the persistent GenParticle in...
McEventCollectionCnv_p5()
Default constructor:
HepMC::GenParticlePtr createGenParticle(const GenParticle_p5 &p, ParticlesMap_t &partToEndVtx, HepMC::DataPool &datapools, const HepMC::GenVertexPtr &parent=nullptr, bool add_to_output=true) const
Create a transient GenParticle from a persistent one (vers.1) It returns the new GenParticle.
std::unordered_map< HepMC::GenParticlePtr, int > ParticlesMap_t
virtual void persToTrans(const McEventCollection_p5 *persObj, McEventCollection *transObj, MsgStream &log)
Method creating the transient representation of McEventCollection from its persistent representation ...
static void writeGenVertex(const HepMC::ConstGenVertexPtr &vtx, McEventCollection_p5 &persEvt)
Method to write a persistent GenVertex object.
ServiceHandle< IHepMCWeightSvc > m_hepMCWeightSvc
HepMC::GenVertexPtr createGenVertex(const McEventCollection_p5 &persEvts, const GenVertex_p5 &vtx, ParticlesMap_t &bcToPart, HepMC::DataPool &datapools, HepMC::GenEvent *parent=nullptr) const
Create a transient GenVertex from a persistent one (version 1) It returns the new GenVertex.
std::vector< GenEvent_p5 > m_genEvents
The vector of persistent representation of GenEvents.
std::vector< GenVertex_p5 > m_genVertices
The vector of persistent representation of GenVertices.
std::vector< GenParticle_p5 > m_genParticles
The vector of persistent representation of GenParticles.
This defines the McEventCollection, which is really just an ObjectVector of McEvent objectsFile: Gene...
const std::string event_scale
const std::string phi
const std::string barcode
const std::string flows
const std::string weights
const std::string theta
const std::string signal_process_id
const std::string random_states
const std::string alphaQED
const std::string alphaQCD
const std::string barcodes
const std::string mpi
bool is_simulation_vertex(const T &v)
Method to establish if the vertex was created during simulation (only to be used in legacy TP convert...
int barcode(const T *p)
Definition Barcode.h:15
HepMC3::FourVector FourVector
ConstGenParticlePtr barcode_to_particle(const GenEvent *e, int id)
Definition GenEvent.h:443
void set_signal_process_vertex(GenEvent *e, T &v)
Definition GenEvent.h:591
ConstGenVertexPtr signal_process_vertex(const GenEvent *e)
Definition GenEvent.h:597
GenParticlePtr newGenParticlePtr(const HepMC3::FourVector &mom=HepMC3::FourVector::ZERO_VECTOR(), int pid=0, int status=0)
Definition GenParticle.h:21
bool suggest_barcode(T &p, int i)
Definition GenEvent.h:607
int new_vertex_status_from_old(const int oldStatus, const int barcode)
Get vertex status in the new scheme from the barcode and status in the old scheme.
int old_vertex_status_from_new(const int newStatus)
Get vertex status in the old scheme from the status in the new scheme.
HepMC3::GenParticlePtr GenParticlePtr
Definition GenParticle.h:19
GenVertexPtr newGenVertexPtr(const HepMC3::FourVector &pos=HepMC3::FourVector::ZERO_VECTOR(), const int i=0)
Definition GenVertex.h:25
HepMC3::GenVertexPtr GenVertexPtr
Definition GenVertex.h:23
HepMC3::ConstGenParticlePtr ConstGenParticlePtr
Definition GenParticle.h:20
int new_particle_status_from_old(const int oldStatus, const int barcode)
Get particle status in the new scheme from the barcode and status in the old scheme.
int old_particle_status_from_new(const int newStatus)
Get particle status in the old scheme from the status in the new scheme.
HepMC3::ConstGenVertexPtr ConstGenVertexPtr
Definition GenVertex.h:24
HepMC3::GenEvent GenEvent
Definition GenEvent.h:39
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
::DataPool< HepMC::GenEvent, ClearGenEvent > evt
::DataPool< HepMC::GenParticle, ClearGenParticle > part
HepMC::GenParticlePtr getGenParticle()
HepMC::GenEvent * getGenEvent()
HepMC::GenVertexPtr getGenVertex()
::DataPool< HepMC::GenVertex, ClearGenVertex > vtx
MsgStream & msg
Definition testRead.cxx:32