Commit d0568eed authored by Andrii Verbytskyi's avatar Andrii Verbytskyi Committed by Frank Winklmeier
Browse files

HepMC3 nightly branch fixes 23112020 part 2

parent 27fba961
......@@ -458,9 +458,11 @@ StatusCode CompactHardTruth::execute() {
if( doDebug ) ATH_MSG_DEBUG("Start parton thinning");
while( moreP ){
if( doDebug ) ATH_MSG_DEBUG("New parton pass " <<inEvent <<" "
<<thinEvt->particles_size() <<" "
<<thinEvt->vertices_size());
#ifdef HEPMC3
if( doDebug ) ATH_MSG_DEBUG("New parton pass " <<inEvent <<" "<<thinEvt->particles().size() <<" " <<thinEvt->vertices().size());
#else
if( doDebug ) ATH_MSG_DEBUG("New parton pass " <<inEvent <<" "<<thinEvt->particles_size() <<" " <<thinEvt->vertices_size());
#endif
moreP = false;
removePV.clear();
......
......@@ -137,10 +137,10 @@ StatusCode MultiParticleGunPileup::callGenerator() {
//-----------------------------------------
// change the process ID to incorporate the BCID * 10000
int pid=evt->signal_process_id();
int pid=HepMC::signal_process_id(evt);
evt->set_signal_process_id(pid+10000*bcid);
ATH_MSG_DEBUG("Signal process ID " << pid << " set to " <<
evt->signal_process_id() << " for BCID " << bcid);
HepMC::signal_process_id(evt) << " for BCID " << bcid);
m_evts.push_back(evt);
++m_ngen;
}
......
......@@ -106,10 +106,10 @@ StatusCode MultiPy8Pileup::callGenerator() {
HepMC::GenEvent* evt=new HepMC::GenEvent();
if (Pythia8_i::fillEvt(evt)==StatusCode::SUCCESS) {
// change the process ID to incorporate the BCID * 10000
int pid=evt->signal_process_id();
int pid=HepMC::signal_process_id(evt);
evt->set_signal_process_id(pid+10000*bcid);
ATH_MSG_DEBUG("Signal process ID " << pid << " set to " <<
evt->signal_process_id() << " for BCID " << bcid);
HepMC::signal_process_id(evt) << " for BCID " << bcid);
m_evts.push_back(evt);
++m_ngen;
} else {
......
......@@ -81,7 +81,7 @@ StatusCode CopyMcEventCollection::execute(const EventContext& ctx) const
if (!outputContainer->empty()) {
ATH_MSG_DEBUG("McEventCollection contents:");
for (const HepMC::GenEvent *event : *outputContainer) {
ATH_MSG_DEBUG(" GenEvent #" << event->event_number() << ", signal_process_id=" << event->signal_process_id());
ATH_MSG_DEBUG(" GenEvent #" << event->event_number() << ", signal_process_id=" << HepMC::signal_process_id(event));
}
}
}
......
......@@ -60,7 +60,6 @@ namespace Trk {
//analysis method
const TrkPriVxPurity * TrkPriVxPurityTool::purity ( const Trk::VxCandidate * vertex ) const {
// std::cout<<" The purity method called"<<std::endl;
//protection and related
if ( vertex != 0 ) {
const std::vector<Trk::VxTrackAtVertex *> * tracks = vertex->vxTrackAtVertex();
......@@ -97,7 +96,6 @@ namespace Trk {
( *pv )->position().t() );
double pv_r = pv_pos.perp();
double pv_z = pv_pos.z();
// std::cout<<"Purity: Primary vertex position: "<<pv_pos<<std::endl;
// storing all the ids of vertices reasonably close to the primary one.
// here the region of interest is selected.
......@@ -114,17 +112,6 @@ namespace Trk {
}//end of accepted vertices check
}//end of loop over all the vertices
// std::cout<<"Actual number of merged vertices "<<vertex_ids.size()<<std::endl;
/*-------------------Some debug output-------------------------------------------------
std::cout<<"Actual number of merged vertices "<<vertex_ids.size()<<std::endl;
for( std::map<int,HepMC::GenVertex *>::const_iterator i = vertex_ids.begin();
i != vertex_ids.end(); ++i)
{
HepMC::GenVertex * cev =(*i).second;
std::cout<<"Selected GenVertex has event index: "<<cev->parent_event()->event_number() <<std::endl;
}//end of debug loop over all the vertices
//------------------ End of debug output ------------------------------------------------
*/
//getting the track truth collection
const TrackParticleTruthCollection * trackParticleTruthCollection ( 0 );
......@@ -147,8 +134,7 @@ namespace Trk {
std::vector<double> out_weights ( 0 );
std::vector<double> pu_weights ( 0 );
std::vector<double> no_correspondance ( 0 );
// std::cout<< "Getting to the main loop"<<std::endl;
for ( ;vt!=ve;++vt ) {
//original element link
......@@ -163,7 +149,6 @@ namespace Trk {
if ( tr_part !=0 && tr_part->isValid()) {
// ++total_size;
// std::cout<< "Link non zero"<<std::endl;
std::map< Rec::TrackParticleTruthKey, TrackParticleTruth>::const_iterator ttItr = trackParticleTruthCollection->end();
......@@ -178,29 +163,21 @@ namespace Trk {
}
}
// std::cout<< "Find done"<<std::endl;
if (ttItr != trackParticleTruthCollection->end() ) {
// std::cout<< "Found correspondance"<<std::endl;
const HepMcParticleLink& particleLink = ttItr->second.particleLink();
const HepMC::GenParticle* genParticle = particleLink.cptr();
// std::cout<<"GenParticle pointer: "<< genParticle<<std::endl;
if(genParticle !=0) {
HepMC::GenEvent * tpEvent = genParticle->parent_event();
// std::cout<<"Parent event "<< tpEvent<<std::endl;
if(tpEvent==genEvent) {
const HepMC::GenVertex * pVertex(0);
if (genParticle!=0) pVertex = genParticle->production_vertex();
if ( pVertex != 0 ) {
int link_pid = genParticle->pdg_id();
bool primary_track = false;
bool secondary_track = false;
// std::cout<< "Decision loop starts"<<std::endl;
//loop over the particles until decision is really taken
do {
int tvrt_code = pVertex->barcode();
......
......@@ -287,13 +287,13 @@ StatusCode VertexSeedFinderTestAlg::execute()
StatusCode
VertexSeedFinderTestAlg::makeMcEventCollection (const EventContext& ctx) const
{
auto evt1 = std::make_unique<HepMC::GenEvent>();
auto evt2 = std::make_unique<HepMC::GenEvent>();
auto evt3 = std::make_unique<HepMC::GenEvent>();
auto evt1 = new HepMC::GenEvent();
auto evt2 = new HepMC::GenEvent();
auto evt3 = new HepMC::GenEvent();
evt1->set_signal_process_vertex (new HepMC::GenVertex({1*mm, 2*mm, 12*mm}));
evt2->set_signal_process_vertex (new HepMC::GenVertex({0.3*mm,-0.7*mm,-3*mm}));
evt3->set_signal_process_vertex (new HepMC::GenVertex({0.6*mm, 0.2*mm, 7*mm}));
HepMC::set_signal_process_vertex (evt1,HepMC::newGenVertexPtr(HepMC::FourVector{1*mm, 2*mm, 12*mm,0.0}));
HepMC::set_signal_process_vertex (evt2,HepMC::newGenVertexPtr(HepMC::FourVector{0.3*mm,-0.7*mm,-3*mm,0.0}));
HepMC::set_signal_process_vertex (evt3,HepMC::newGenVertexPtr(HepMC::FourVector{0.6*mm, 0.2*mm, 7*mm,0.0}));
Athena_test::uniform_real_distribution<double> ptdist (0.1*GeV, 100*GeV);
Athena_test::uniform_real_distribution<double> phidist (-M_PI, M_PI);
......@@ -306,17 +306,17 @@ VertexSeedFinderTestAlg::makeMcEventCollection (const EventContext& ctx) const
double e = pt*sinh(eta);
double charge = etadist(rng) > 0 ? 1 : -1;
HepMC::FourVector mom {pt*cos(phi), pt*sin(phi), e, e };
auto p = std::make_unique<HepMC::GenParticle> ( mom, charge * 11, 1 );
auto p = HepMC::newGenParticlePtr ( mom, charge * 11, 1 );
double vrand = etadist(rng);
if (vrand < 0) {
evt1->signal_process_vertex()->add_particle_out (p.release());
HepMC::signal_process_vertex(evt1)->add_particle_out (p);
}
else if (vrand < 3) {
evt2->signal_process_vertex()->add_particle_out (p.release());
HepMC::signal_process_vertex(evt2)->add_particle_out (p);
}
else {
evt3->signal_process_vertex()->add_particle_out (p.release());
HepMC::signal_process_vertex(evt3)->add_particle_out (p);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment