23#include "GaudiKernel/ThreadLocalContext.h"
30 "flows",
"flow1",
"flow2",
"flow3",
35 "filterWeight",
"filterHT",
"filterMET",
36 "event_scale",
"alphaQCD",
"alphaQED",
"random_states",
"weights",
37 "GenCrossSection",
"GenPdfInfo",
"GenHeavyIon"};
57 Base_t::operator=( rhs );
75 const EventContext& ctx = Gaudi::Hive::currentContext();
77 msg << MSG::DEBUG <<
"Loading McEventCollection from persistent state..."
89 const unsigned int nEvts = persObj->
m_genEvents.size();
93 for ( std::vector<GenEvent_p6>::const_iterator
99 HepMC::GenEvent * genEvt(
nullptr);
101 genEvt =
new HepMC::GenEvent();
106 genEvt->add_attribute (barcodesStr, std::make_shared<HepMC::GenEventBarcodes>());
113 genEvt->add_attribute(signalProcessIdStr, std::make_shared<HepMC3::IntAttribute>(persEvt.
m_signalProcessId));
115 genEvt->add_attribute(mpiStr, std::make_shared<HepMC3::IntAttribute>(persEvt.
m_mpi));
116 genEvt->add_attribute(eventScaleStr, std::make_shared<HepMC3::DoubleAttribute>(persEvt.
m_eventScale));
117 genEvt->add_attribute(alphaQcdStr, std::make_shared<HepMC3::DoubleAttribute>(persEvt.
m_alphaQCD));
118 genEvt->add_attribute(alphaQedStr, std::make_shared<HepMC3::DoubleAttribute>(persEvt.
m_alphaQED));
119 genEvt->add_attribute(filterWeightStr, std::make_shared<HepMC3::DoubleAttribute>(persEvt.
m_filterWeight));
120 genEvt->add_attribute(filterHtStr, std::make_shared<HepMC3::DoubleAttribute>(persEvt.m_filterHT));
121 genEvt->add_attribute(filterMetStr, std::make_shared<HepMC3::DoubleAttribute>(persEvt.m_filterMET));
123 genEvt->add_attribute(randomStatesStr, std::make_shared<HepMC3::VectorLongIntAttribute>(persEvt.
m_randomStates));
125 genEvt->set_units(
static_cast<HepMC3::Units::MomentumUnit
>(persEvt.
m_momentumUnit),
126 static_cast<HepMC3::Units::LengthUnit
>(persEvt.
m_lengthUnit));
129 if(!genEvt->run_info()) {
130 HepMC3::GenRunInfoData ri_read;
132 ri_read.tool_name = std::vector<std::string>();
133 ri_read.tool_version = std::vector<std::string>();
134 ri_read.tool_description = std::vector<std::string>();
137 auto ri = std::make_shared<HepMC3::GenRunInfo>();
138 ri->read_data(ri_read);
139 genEvt->set_run_info(std::move(ri));
144 auto cs = std::make_shared<HepMC3::GenCrossSection>();
146 genEvt->set_cross_section(cs);
147 if(
static_cast<bool>(xsection[0]) )
148 cs->set_cross_section(xsection[2],xsection[1]);
150 cs->set_cross_section(-1.0, -1.0);
155 auto hi = std::make_shared<HepMC3::GenHeavyIon>();
156 const std::vector<float>& hIon = persEvt.
m_heavyIon;
159 static_cast<int>(hIon[12]),
160 static_cast<int>(hIon[11]),
161 static_cast<int>(hIon[10]),
162 static_cast<int>(hIon[9]),
163 static_cast<int>(hIon[8]),
164 static_cast<int>(hIon[7]),
165 static_cast<int>(hIon[6]),
166 static_cast<int>(hIon[5]),
167 static_cast<int>(hIon[4]),
172 genEvt->set_heavy_ion(std::move(hi));
180 const std::vector<double>& pdf = persEvt.
m_pdfinfo;
181 HepMC3::GenPdfInfoPtr
pi = std::make_shared<HepMC3::GenPdfInfo>();
182 pi->set(
static_cast<int>(pdf[8]),
183 static_cast<int>(pdf[7]),
189 static_cast<int>(pdf[6]),
190 static_cast<int>(pdf[5]));
191 genEvt->set_pdf_info(std::move(
pi));
201 std::map<int, HepMC::GenVertexPtr> brc_to_vertex;
205 for (
unsigned int iVtx = persEvt.
m_verticesBegin; iVtx != endVtx; ++iVtx ) {
207 brc_to_vertex[persObj->
m_genVertices[iVtx].m_barcode] = std::move(vtx);
212 if ( sigProcVtx != 0 && brc_to_vertex.count(sigProcVtx) ) {
217 for (
auto & p : partToEndVtx) {
218 if ( brc_to_vertex.count(p.second) ) {
219 auto decayVtx = brc_to_vertex[p.second];
220 decayVtx->add_particle_in( p.first );
222 msg << MSG::ERROR <<
"GenParticle points to null end vertex !!" <<
endmsg;
228 if ( beamPart1 != 0 && beamPart2 != 0 ) {
236 genEvt->m_mpi = persEvt.
m_mpi;
240 genEvt->m_signal_process_vertex = 0;
241 genEvt->m_beam_particle_1 = 0;
242 genEvt->m_beam_particle_2 = 0;
245 genEvt->m_vertex_barcodes.clear();
246 genEvt->m_particle_barcodes.clear();
247 genEvt->m_momentum_unit =
static_cast<HepMC::Units::MomentumUnit
>(persEvt.
m_momentumUnit);
248 genEvt->m_position_unit =
static_cast<HepMC::Units::LengthUnit
>(persEvt.
m_lengthUnit);
254 if( genEvt->m_cross_section )
255 delete genEvt->m_cross_section;
256 genEvt->m_cross_section = 0;
259 genEvt->m_cross_section =
new HepMC::GenCrossSection();
261 if(
static_cast<bool>(xsection[0]) )
262 genEvt->m_cross_section->set_cross_section(xsection[2],xsection[1]);
266 if(genEvt->m_heavy_ion )
267 delete genEvt->m_heavy_ion;
268 genEvt->m_heavy_ion = 0;
270 const std::vector<float>& hIon = persEvt.
m_heavyIon;
271 genEvt->m_heavy_ion =
new HepMC::HeavyIon
273 static_cast<int>(hIon[12]),
274 static_cast<int>(hIon[11]),
275 static_cast<int>(hIon[10]),
276 static_cast<int>(hIon[9]),
277 static_cast<int>(hIon[8]),
278 static_cast<int>(hIon[7]),
279 static_cast<int>(hIon[6]),
280 static_cast<int>(hIon[5]),
281 static_cast<int>(hIon[4]),
291 if(genEvt->m_pdf_info)
292 delete genEvt->m_pdf_info;
293 genEvt->m_pdf_info = 0;
295 const std::vector<double>& pdf = persEvt.
m_pdfinfo;
296 genEvt->m_pdf_info =
new HepMC::PdfInfo
298 static_cast<int>(pdf[8]),
299 static_cast<int>(pdf[7]),
305 static_cast<int>(pdf[6]),
306 static_cast<int>(pdf[5])
321 for (
unsigned int iVtx= persEvt.
m_verticesBegin; iVtx != endVtx; ++iVtx ) {
330 if ( sigProcVtx != 0 ) {
331 genEvt->set_signal_process_vertex( genEvt->barcode_to_vertex( sigProcVtx ) );
335 for ( ParticlesMap_t::iterator
336 p = partToEndVtx.begin(),
337 endItr = partToEndVtx.end();
342 decayVtx->add_particle_in( p->first );
345 <<
"GenParticle points to null end vertex !!"
353 if ( beamPart1 != 0 && beamPart2 !=0 ) {
354 genEvt->set_beam_particles(genEvt->barcode_to_particle(beamPart1),
355 genEvt->barcode_to_particle(beamPart2));
363 msg << MSG::DEBUG <<
"Loaded McEventCollection from persistent state [OK]"
371 const EventContext& ctx = Gaudi::Hive::currentContext();
373 msg << MSG::DEBUG <<
"Creating persistent state of McEventCollection..."
377 const std::pair<unsigned int,unsigned int> stats = nbrParticlesAndVertices( transObj );
387 const HepMC::GenEvent* genEvt = *itr;
390 auto ri = genEvt->run_info();
391 HepMC3::GenRunInfoData ri_data;
393 ri->write_data(ri_data);
394 if (!ri_data.weight_names.empty()) {
395 m_hepMCWeightSvc->setWeightNames( names_to_name_index_map(ri_data.weight_names), ctx ).ignore();
403 auto A_mpi=genEvt->attribute<HepMC3::IntAttribute>(mpiStr);
404 auto A_signal_process_id=genEvt->attribute<HepMC3::IntAttribute>(signalProcessIdStr);
405 auto A_event_scale=genEvt->attribute<HepMC3::DoubleAttribute>(eventScaleStr);
406 auto A_alphaQCD=genEvt->attribute<HepMC3::DoubleAttribute>(alphaQcdStr);
407 auto A_alphaQED=genEvt->attribute<HepMC3::DoubleAttribute>(alphaQedStr);
408 auto A_filterWeight=genEvt->attribute<HepMC3::DoubleAttribute>(filterWeightStr);
409 auto A_filterHT=genEvt->attribute<HepMC3::DoubleAttribute>(filterHtStr);
410 auto A_filterMET=genEvt->attribute<HepMC3::DoubleAttribute>(filterMetStr);
414 if (!signal_process_vertex) {
415 auto event_spv = genEvt->attribute<HepMC3::IntAttribute>(
"signal_process_vertex");
418 if (event_spv) signal_process_vertex = genEvt->vertices().at(-event_spv->value()-1);
421 auto A_random_states=genEvt->attribute<HepMC3::VectorLongIntAttribute>(
"random_states");
422 auto beams=genEvt->beams();
424 emplace_back(A_signal_process_id?(A_signal_process_id->value()):-1,
425 genEvt->event_number(),
426 A_mpi?(A_mpi->value()):-1,
427 A_event_scale?(A_event_scale->value()):0.0,
428 A_alphaQCD?(A_alphaQCD->value()):0.0,
429 A_alphaQED?(A_alphaQED->value()):0.0,
430 A_filterWeight?(A_filterWeight->value()):1.0,
431 A_filterHT?(A_filterHT->value()):-13.,
432 A_filterMET?(A_filterMET->value()):-13.0,
437 A_random_states?(A_random_states->value()):std::vector<long>(),
438 std::vector<double>(),
439 std::vector<float>(),
440 std::vector<double>(),
441 genEvt->momentum_unit(),
442 genEvt->length_unit(),
444 nPersVtx + genEvt->vertices().size(),
446 nPersParts + genEvt->particles().size() );
449 std::map< std::string, std::map<int, std::shared_ptr<HepMC3::Attribute> > > e_atts = genEvt->attributes();
453 for (
auto& attmap: e_atts) {
455 if (attmap.first ==
"ShadowParticle")
continue;
456 if (attmap.first ==
"ShadowParticleId")
continue;
457 for (
auto& att: attmap.second) {
461 att.second->to_string(st);
481 if (genEvt->cross_section()) {
482 auto cs=genEvt->cross_section();
485 crossSection.resize(3);
486 crossSection[2] = cs->xsec();
487 crossSection[1] = cs->xsec_err();
488 crossSection[0] =
static_cast<double>(cs->is_valid());
491 if (crossSection[2] < 0) {
492 crossSection[2] = 0.0;
493 if (crossSection[1] < 0) {
494 crossSection[1] = 0.0;
496 crossSection[0] = 0.0;
502 if (genEvt->heavy_ion()) {
503 auto hi=genEvt->heavy_ion();
505 std::vector<float>& heavyIon = persEvt.
m_heavyIon;
507 heavyIon[12] =
static_cast<float>(hi->Ncoll_hard);
508 heavyIon[11] =
static_cast<float>(hi->Npart_proj);
509 heavyIon[10] =
static_cast<float>(hi->Npart_targ);
510 heavyIon[9] =
static_cast<float>(hi->Ncoll);
511 heavyIon[8] =
static_cast<float>(hi->spectator_neutrons);
512 heavyIon[7] =
static_cast<float>(hi->spectator_protons);
513 heavyIon[6] =
static_cast<float>(hi->N_Nwounded_collisions);
514 heavyIon[5] =
static_cast<float>(hi->Nwounded_N_collisions);
515 heavyIon[4] =
static_cast<float>(hi->Nwounded_Nwounded_collisions);
516 heavyIon[3] = hi->impact_parameter;
517 heavyIon[2] = hi->event_plane_angle;
518 heavyIon[1] = hi->eccentricity;
519 heavyIon[0] = hi->sigma_inel_NN;
523 if (genEvt->pdf_info()) {
524 auto pi=genEvt->pdf_info();
526 std::vector<double>& pdfinfo = persEvt.
m_pdfinfo;
528 pdfinfo[8] =
static_cast<double>(
pi->parton_id[0]);
529 pdfinfo[7] =
static_cast<double>(
pi->parton_id[1]);
530 pdfinfo[6] =
static_cast<double>(
pi->pdf_id[0]);
531 pdfinfo[5] =
static_cast<double>(
pi->pdf_id[1]);
532 pdfinfo[4] =
pi->x[0];
533 pdfinfo[3] =
pi->x[1];
534 pdfinfo[2] =
pi->scale;
535 pdfinfo[1] =
pi->xf[0];
536 pdfinfo[0] =
pi->xf[1];
540 for (
const auto& v: genEvt->vertices()) {
544 const int signalProcessVtx = genEvt->m_signal_process_vertex
545 ? genEvt->m_signal_process_vertex->barcode()
547 const int beamParticle1Barcode = genEvt->m_beam_particle_1
548 ? genEvt->m_beam_particle_1->barcode()
550 const int beamParticle2Barcode = genEvt->m_beam_particle_2
551 ? genEvt->m_beam_particle_2->barcode()
555 m_hepMCWeightSvc->setWeightNames( genEvt->m_weights.m_names, ctx ).ignore();
559 push_back(
GenEvent_p6( genEvt->m_signal_process_id,
560 genEvt->m_event_number,
562 genEvt->m_event_scale,
567 beamParticle1Barcode,
568 beamParticle2Barcode,
569 genEvt->m_weights.m_weights,
570 genEvt->m_random_states,
571 std::vector<double>(),
572 std::vector<float>(),
573 std::vector<double>(),
574 genEvt->m_momentum_unit,
575 genEvt->m_position_unit,
577 nPersVtx + genEvt->vertices_size(),
579 nPersParts + genEvt->particles_size() ) );
581 if (genEvt->m_cross_section) {
584 crossSection.resize(3);
585 crossSection[2] = genEvt->m_cross_section->m_cross_section;
586 crossSection[1] = genEvt->m_cross_section->m_cross_section_error;
587 crossSection[0] =
static_cast<double>(genEvt->m_cross_section->m_is_set);
591 if (genEvt->m_heavy_ion) {
593 std::vector<float>& heavyIon = persEvt.
m_heavyIon;
595 heavyIon[12] =
static_cast<float>(genEvt->m_heavy_ion->m_Ncoll_hard);
596 heavyIon[11] =
static_cast<float>(genEvt->m_heavy_ion->m_Npart_proj);
597 heavyIon[10] =
static_cast<float>(genEvt->m_heavy_ion->m_Npart_targ);
598 heavyIon[9] =
static_cast<float>(genEvt->m_heavy_ion->m_Ncoll);
599 heavyIon[8] =
static_cast<float>(genEvt->m_heavy_ion->m_spectator_neutrons);
600 heavyIon[7] =
static_cast<float>(genEvt->m_heavy_ion->m_spectator_protons);
601 heavyIon[6] =
static_cast<float>(genEvt->m_heavy_ion->m_N_Nwounded_collisions);
602 heavyIon[5] =
static_cast<float>(genEvt->m_heavy_ion->m_Nwounded_N_collisions);
603 heavyIon[4] =
static_cast<float>(genEvt->m_heavy_ion->m_Nwounded_Nwounded_collisions);
604 heavyIon[3] = genEvt->m_heavy_ion->m_impact_parameter;
605 heavyIon[2] = genEvt->m_heavy_ion->m_event_plane_angle;
606 heavyIon[1] = genEvt->m_heavy_ion->m_eccentricity;
607 heavyIon[0] = genEvt->m_heavy_ion->m_sigma_inel_NN;
611 if (genEvt->m_pdf_info) {
613 std::vector<double>& pdfinfo = persEvt.
m_pdfinfo;
615 pdfinfo[8] =
static_cast<double>(genEvt->m_pdf_info->m_id1);
616 pdfinfo[7] =
static_cast<double>(genEvt->m_pdf_info->m_id2);
617 pdfinfo[6] =
static_cast<double>(genEvt->m_pdf_info->m_pdf_id1);
618 pdfinfo[5] =
static_cast<double>(genEvt->m_pdf_info->m_pdf_id2);
619 pdfinfo[4] = genEvt->m_pdf_info->m_x1;
620 pdfinfo[3] = genEvt->m_pdf_info->m_x2;
621 pdfinfo[2] = genEvt->m_pdf_info->m_scalePDF;
622 pdfinfo[1] = genEvt->m_pdf_info->m_pdf1;
623 pdfinfo[0] = genEvt->m_pdf_info->m_pdf2;
627 const HepMC::GenEvent::vertex_const_iterator endVtx=genEvt->vertices_end();
628 for ( HepMC::GenEvent::vertex_const_iterator i = genEvt->vertices_begin();
637 msg << MSG::DEBUG <<
"Created persistent state of HepMC::GenEvent [OK]" <<
endmsg;
645 ,HepMC::GenEvent* parent
654 if (parent ) parent->add_vertex(vtx);
656 vtx->set_position(HepMC::FourVector( persVtx.
m_x , persVtx.
m_y , persVtx.
m_z ,persVtx.
m_t ));
661 vtx->add_attribute(
"weights",std::make_shared<HepMC3::VectorDoubleAttribute>(
weights));
665 for (
unsigned int i = 0; i != nPartsIn; ++i ) {
671 for (
unsigned int i = 0; i != nPartsOut; ++i ) {
675 vtx->m_position.setX( persVtx.
m_x );
676 vtx->m_position.setY( persVtx.
m_y );
677 vtx->m_position.setZ( persVtx.
m_z );
678 vtx->m_position.setT( persVtx.
m_t );
679 vtx->m_particles_in.clear();
680 vtx->m_particles_out.clear();
682 vtx->m_weights.m_weights.reserve( persVtx.
m_weights.size() );
683 vtx->m_weights.m_weights.assign ( persVtx.
m_weights.begin(),
690 for (
unsigned int i = 0; i != nPartsIn; ++i ) {
698 for (
unsigned int i = 0; i != nPartsOut; ++i ) {
718 if (parent) add_to_output?parent->add_particle_out(p):parent->add_particle_in(p);
720 p->set_pdg_id( persPart.
m_pdgId);
722 p->add_attribute(
"phi",std::make_shared<HepMC3::DoubleAttribute>(persPart.
m_phiPolarization));
723 p->add_attribute(
"theta",std::make_shared<HepMC3::DoubleAttribute>(persPart.
m_thetaPolarization));
733 double temp_e = std::sqrt( (
long double)(persPart.
m_px)*persPart.
m_px +
734 (
long double)(persPart.
m_py)*persPart.
m_py +
735 (
long double)(persPart.
m_pz)*persPart.
m_pz +
736 (
long double)(persPart.
m_m) *persPart.
m_m );
737 p->set_momentum( HepMC::FourVector(persPart.
m_px,persPart.
m_py,persPart.
m_pz,temp_e));
739 const int signM2 = ( persPart.
m_m >= 0. ? 1 : -1 );
740 const double persPart_ene =
741 std::sqrt( std::abs((
long double)(persPart.
m_px)*persPart.
m_px +
742 (
long double)(persPart.
m_py)*persPart.
m_py +
743 (
long double)(persPart.
m_pz)*persPart.
m_pz +
744 signM2* (
long double)(persPart.
m_m)* persPart.
m_m));
745 const int signEne = ( persPart.
m_recoMethod == 1 ? 1 : -1 );
746 p->set_momentum(HepMC::FourVector( persPart.
m_px,
749 signEne * persPart_ene ));
753 std::vector<int> flows;
754 const unsigned int nFlow = persPart.
m_flow.size();
755 for (
unsigned int iFlow= 0; iFlow != nFlow; ++iFlow ) {
756 flows.push_back(persPart.
m_flow[iFlow].second );
759 p->add_attribute(
"flows", std::make_shared<HepMC3::VectorIntAttribute>(flows));
761 p->m_pdg_id = persPart.
m_pdgId;
765 p->m_production_vertex = 0;
777 p->m_momentum.setPx( persPart.
m_px);
778 p->m_momentum.setPy( persPart.
m_py);
779 p->m_momentum.setPz( persPart.
m_pz);
780 double temp_e = std::sqrt( (
long double)(persPart.
m_px)*persPart.
m_px +
781 (
long double)(persPart.
m_py)*persPart.
m_py +
782 (
long double)(persPart.
m_pz)*persPart.
m_pz +
783 (
long double)(persPart.
m_m) *persPart.
m_m );
784 p->m_momentum.setE( temp_e);
786 const int signM2 = ( persPart.
m_m >= 0. ? 1 : -1 );
787 const double persPart_ene =
788 std::sqrt( std::abs((
long double)(persPart.
m_px)*persPart.
m_px +
789 (
long double)(persPart.
m_py)*persPart.
m_py +
790 (
long double)(persPart.
m_pz)*persPart.
m_pz +
791 signM2* (
long double)(persPart.
m_m)* persPart.
m_m));
792 const int signEne = ( persPart.
m_recoMethod == 1 ? 1 : -1 );
793 p->m_momentum.set( persPart.
m_px,
796 signEne * persPart_ene );
800 const unsigned int nFlow = persPart.
m_flow.size();
802 for (
unsigned int iFlow= 0; iFlow != nFlow; ++iFlow ) {
803 p->m_flow.set_icode( persPart.
m_flow[iFlow].first,
804 persPart.
m_flow[iFlow].second );
809 partToEndVtx[p] = persPart.
m_endVtx;
819 const HepMC::FourVector& position = vtx->position();
820 auto A_weights=vtx->attribute<HepMC3::VectorDoubleAttribute>(
"weights");
821 auto A_barcode=vtx->attribute<HepMC3::IntAttribute>(
"barcode");
824 auto weights_d = A_weights->value();
825 for (
auto& w: weights_d)
weights.push_back(w);
834 A_barcode?(A_barcode->value()):vtx->id() );
839 for (
const auto& p: vtx->particles_in()) {
840 if ( !
p->production_vertex() ||
p->production_vertex()->id() == 0 ) {
846 for (
const auto& p: vtx->particles_out()) {
855 const HepMC::FourVector& position = vtx.m_position;
862 vtx.m_weights.m_weights.begin(),
863 vtx.m_weights.m_weights.end(),
868 const std::vector<HepMC::GenParticlePtr>::const_iterator endInVtx = vtx.m_particles_in.end();
870 for ( std::vector<HepMC::GenParticlePtr>::const_iterator p = vtx.m_particles_in.begin();
873 if ( 0 == (*p)->production_vertex() ) {
878 const std::vector<HepMC::GenParticlePtr>::const_iterator endOutVtx = vtx.m_particles_out.end();
880 for ( std::vector<HepMC::GenParticlePtr>::const_iterator p = vtx.m_particles_out.begin();
894 const HepMC::FourVector mom = p->momentum();
895 const double ene = mom.e();
896 const double m2 = mom.m2();
899 const bool useP2M2 = !(m2 > 0) &&
901 !(std::abs(m2) < 2.0*DBL_EPSILON*ene*ene);
902 auto A_flows=p->attribute<HepMC3::VectorIntAttribute>(
"flows");
903 auto A_phi=p->attribute<HepMC3::DoubleAttribute>(
"phi");
904 auto A_theta=p->attribute<HepMC3::DoubleAttribute>(
"theta");
906 const short recoMethod = ( !useP2M2 ? 0: ( ene >= 0.? 1: 2 ) );
908 emplace_back( mom.px(),
914 A_flows?(A_flows->value().size()):0,
915 A_theta?(A_theta->value()):0.0,
916 A_phi?(A_phi->value()):0.0,
923 std::vector< std::pair<int,int> > flow_hepmc2;
924 if(A_flows) flow_hepmc2=vector_to_vector_int_int(A_flows->value());
925 persEvt.
m_genParticles.back().m_flow.assign( flow_hepmc2.begin(),flow_hepmc2.end() );
936 const HepMC::FourVector& mom = p.m_momentum;
937 const double ene = mom.e();
938 const double m2 = mom.m2();
941 const bool useP2M2 = !(m2 > 0) &&
943 !(std::abs(m2) < 2.0*DBL_EPSILON*ene*ene);
945 const short recoMethod = ( !useP2M2
959 p.m_polarization.theta(),
960 p.m_polarization.phi(),
961 p.m_production_vertex
962 ? p.m_production_vertex->barcode()
965 ? p.m_end_vertex->barcode()
static const std::set< std::string > attributes_to_ignore
void prepareToAdd(unsigned int size)
Prepare to add cached elements.
DataModel_detail::const_iterator< DataVector > const_iterator
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.
double m_alphaQED
value of the QED coupling.
int m_momentumUnit
HepMC::Units::MomentumUnit casted to int.
int m_signalProcessId
Id of the processus being generated.
unsigned int m_particlesBegin
Begin position in the vector of particles composing this event.
std::vector< double > m_crossSection
Container of HepMC::GenCrossSection object translated to vector<double>.
int m_mpi
Number of multi particle interactions.
int m_eventNbr
Event number.
std::vector< long int > m_randomStates
Container of random numbers for the generator states.
std::vector< std::string > m_r_attribute_name
Attribute name for run info.
unsigned int m_verticesEnd
End position in the vector of vertices composing this event.
std::vector< int > m_e_attribute_id
We define those exactly as in the HepMC3::GenEvent.
unsigned int m_verticesBegin
Begin position in the vector of vertices composing this event.
std::vector< double > m_pdfinfo
Container of HepMC::PdfInfo object translated to vector<double> for simplicity.
std::vector< double > m_weights
Weights for this event.
int m_beamParticle1
Barcode of the beam particle 1.
std::vector< std::string > m_e_attribute_string
Attribute serialized as string for event.
int m_signalProcessVtx
Barcode of the GenVertex holding the signal process.
int m_beamParticle2
Barcode of the beam particle 2.
unsigned int m_particlesEnd
End position in the vector of particles composing this event.
double m_eventScale
Energy scale.
double m_alphaQCD
value of the QCD coupling.
int m_lengthUnit
HepMC::Units::LengthUnit casted to int.
std::vector< std::string > m_r_attribute_string
Attribute serialized as string for run info.
double m_filterWeight
value of the extra weight introduced during reweighting events in filter and value of some variables ...
std::vector< std::string > m_e_attribute_name
Attribute name for event.
std::vector< float > m_heavyIon
Container of HepMC::HeavyIon object translated to vector<double>.
float m_py
y-component of the 4-momentum of this particle
float m_m
m-component of the 4-momentum of this particle
int m_barcode
barcode of this particles (uniquely identifying this particle within a given GenEvent)
std::vector< std::pair< int, int > > m_flow
Flow for this particle.
int m_status
Status of this particle, as defined for HEPEVT.
int m_endVtx
Barcode of the decay vertex of this particle.
short m_recoMethod
switch to know which method to chose to better recover the original HepLorentzVector.
float m_generated_mass
mass of this particle when it was generated
float m_phiPolarization
phi polarization
float m_pz
z-component of the 4-momentum of this particle
int m_pdgId
identity of this particle, according to the Particle Data Group notation
float m_thetaPolarization
polarization
float m_px
x-component of the 4-momentum of this particle
int m_barcode
barcode of this vertex (uniquely identifying a vertex within an event)
float m_t
t-coordinate of the vertex
std::vector< float > m_weights
Weights for this vertex.
float m_x
x-coordinate of the vertex
std::vector< int > m_particlesIn
collection of barcodes of in-going particles connected to this vertex
int m_id
Id of this vertex.
float m_z
z-coordinate of the vertex
float m_y
y-coordinate of the vertex
std::vector< int > m_particlesOut
collection of barcodes of out-going particles connected to this vertex
McEventCollectionCnv_p6()
Default constructor:
HepMC::GenParticlePtr createGenParticle(const GenParticle_p6 &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.
virtual void persToTrans(const McEventCollection_p6 *persObj, McEventCollection *transObj, MsgStream &log)
Method creating the transient representation of McEventCollection from its persistent representation ...
virtual ~McEventCollectionCnv_p6()
Destructor.
ServiceHandle< IHepMCWeightSvc > m_hepMCWeightSvc
HepMC::GenVertexPtr createGenVertex(const McEventCollection_p6 &persEvts, const GenVertex_p6 &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.
McEventCollectionCnv_p6 & operator=(const McEventCollectionCnv_p6 &rhs)
Assignement operator.
void writeGenVertex(const HepMC::GenVertex &vtx, McEventCollection_p6 &persEvt) const
Method to write a persistent GenVertex object.
std::unordered_map< HepMC::GenParticlePtr, int > ParticlesMap_t
T_AthenaPoolTPCnvBase< McEventCollection, McEventCollection_p6 > Base_t
int writeGenParticle(const HepMC::GenParticle &p, McEventCollection_p6 &persEvt) const
Method to write a persistent GenParticle object It returns the index of the persistent GenParticle in...
virtual void transToPers(const McEventCollection *transObj, McEventCollection_p6 *persObj, MsgStream &log)
Method creating the persistent representation McEventCollection_p6 from its transient representation ...
std::vector< GenParticle_p6 > m_genParticles
The vector of persistent representation of GenParticles.
std::vector< GenEvent_p6 > m_genEvents
The vector of persistent representation of GenEvents.
std::vector< GenVertex_p6 > 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)
GenParticle * barcode_to_particle(const GenEvent *e, int id)
GenVertex * barcode_to_vertex(const GenEvent *e, int id)
HepMC::GenVertex * GenVertexPtr
bool suggest_barcode(T &p, int i)
GenVertexPtr newGenVertexPtr(const HepMC::FourVector &pos=HepMC::FourVector(0.0, 0.0, 0.0, 0.0), const int i=0)
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.
GenParticlePtr newGenParticlePtr(const HepMC::FourVector &mom=HepMC::FourVector(0.0, 0.0, 0.0, 0.0), int pid=0, int status=0)
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.
GenParticle * GenParticlePtr
const GenParticle * ConstGenParticlePtr
GenVertex * signal_process_vertex(const GenEvent *e)
const HepMC::GenVertex * ConstGenVertexPtr
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
const Amg::Vector3D & position() const
Method to retrieve the position of the Intersection.
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