diff --git a/Simulation/FastShower/FastCaloSim/src/FastShowerCellBuilderTool.cxx b/Simulation/FastShower/FastCaloSim/src/FastShowerCellBuilderTool.cxx index 488fdbeffb2ae13a61942a01e331fbfc0f77ab77..7e3dc1fe2b1d1b7da30c44fbffd81400ef719b9d 100644 --- a/Simulation/FastShower/FastCaloSim/src/FastShowerCellBuilderTool.cxx +++ b/Simulation/FastShower/FastCaloSim/src/FastShowerCellBuilderTool.cxx @@ -2516,7 +2516,7 @@ std::vector<Trk::HitInfo>* FastShowerCellBuilderTool::caloHits(const HepMC::GenP // geantinos not handled by PdgToParticleHypothesis - fix there if ( pdgId == 999 ) pHypothesis = Trk::geantino; - HepMC::GenVertex *vtx = part.production_vertex(); + auto vtx = part.production_vertex(); Amg::Vector3D pos(0.,0.,0.); // default if (vtx) { diff --git a/Simulation/FastSimulation/FastChainPileup/src/MultiParticleGunPileup.cxx b/Simulation/FastSimulation/FastChainPileup/src/MultiParticleGunPileup.cxx index 89dfb261ec48ae7f07a77301eb3cd50715fdd117..833e49bb3281a51541fc4a261ad664b92d367d33 100644 --- a/Simulation/FastSimulation/FastChainPileup/src/MultiParticleGunPileup.cxx +++ b/Simulation/FastSimulation/FastChainPileup/src/MultiParticleGunPileup.cxx @@ -122,11 +122,11 @@ StatusCode MultiParticleGunPileup::callGenerator() { // Make particle-creation vertex // TODO: do something cleverer than one vertex per particle? HepMC::FourVector pos(p.m_pos.X(), p.m_pos.Y(), p.m_pos.Z(), p.m_pos.T()); - HepMC::GenVertexPtr gv = new HepMC::GenVertex(pos); + HepMC::GenVertexPtr gv = HepMC::newGenVertexPtr(pos); evt->add_vertex(gv); // Make particle with status == 1 HepMC::FourVector mom(p.m_mom.Px(), p.m_mom.Py(), p.m_mom.Pz(), p.m_mom.E()); - HepMC::GenParticlePtr gp = new HepMC::GenParticle; + HepMC::GenParticlePtr gp = HepMC::newGenParticlePtr(); gp->set_status(1); gp->set_pdg_id(p.m_pid); gp->set_momentum(mom); diff --git a/Simulation/ISF/ISF_Core/ISF_Services/src/InputConverter.cxx b/Simulation/ISF/ISF_Core/ISF_Services/src/InputConverter.cxx index d1a74c303ed2517a411fed6e63d75020face89e9..d1fb4dbc389630b7fe49c9e46b07db1fd702eb91 100644 --- a/Simulation/ISF/ISF_Core/ISF_Services/src/InputConverter.cxx +++ b/Simulation/ISF/ISF_Core/ISF_Services/src/InputConverter.cxx @@ -142,7 +142,7 @@ ISF::InputConverter::convert(const McEventCollection& inputGenEvents, if (eventPtr == nullptr) { continue; } ATH_MSG_DEBUG("Starting conversion of GenEvent with" - " signal_process_id=" << eventPtr->signal_process_id() << + " signal_process_id=" << HepMC::signal_process_id(eventPtr) << " and event_number=" << eventPtr->event_number() ); // new collection containing all gen particles that passed filters @@ -262,7 +262,7 @@ ISF::InputConverter::convertParticle(HepMC::GenParticlePtr genPartPtr, EBC_EVCOL const double pTime = pVertex->position().t() / Gaudi::Units::c_light; /// particle origin (TODO: add proper GeoID, collision/cosmics) DetRegionSvcIDPair origin(AtlasDetDescr::fUndefinedAtlasRegion, ISF::fEventGeneratorSimID); - const auto pBarcode = genPart.barcode(); + const auto pBarcode = HepMC::barcode(genPart); auto tBinding = std::make_unique<ISF::TruthBinding>(genPartPtr); auto *parentEvent = genPart.parent_event(); @@ -445,14 +445,14 @@ G4PrimaryParticle* ISF::InputConverter::getG4PrimaryParticle(const HepMC::GenPar for ( auto daughterIter=genpart.end_vertex()->particles_out_const_begin(); daughterIter!=genpart.end_vertex()->particles_out_const_end(); ++daughterIter ) { if(m_quasiStableParticlesIncluded) { - ATH_MSG_VERBOSE ( "Attempting to add daughter particle of "<<genpart.barcode()<<": " << **daughterIter ); + ATH_MSG_VERBOSE ( "Attempting to add daughter particle of "<<HepMC::barcode(genpart)<<": " << **daughterIter ); } else { - ATH_MSG_WARNING ( "Attempting to add daughter particle of "<<genpart.barcode()<<": " << **daughterIter ); + ATH_MSG_WARNING ( "Attempting to add daughter particle of "<<HepMC::barcode(genpart)<<": " << **daughterIter ); } G4PrimaryParticle *daughterG4Particle = this->getG4PrimaryParticle( **daughterIter ); if(!daughterG4Particle) { - ATH_MSG_ERROR("Bailing out of loop over daughters of particle with barcode: "<<genpart.barcode() << + ATH_MSG_ERROR("Bailing out of loop over daughters of particle with barcode: "<<HepMC::barcode(genpart) << " due to errors - will not return G4Particle."); return nullptr; } @@ -556,14 +556,14 @@ G4PrimaryParticle* ISF::InputConverter::getG4PrimaryParticle(const ISF::ISFParti for ( auto daughterIter=genpart->end_vertex()->particles_out_const_begin(); daughterIter!=genpart->end_vertex()->particles_out_const_end(); ++daughterIter ) { if(m_quasiStableParticlesIncluded) { - ATH_MSG_VERBOSE ( "Attempting to add daughter particle of "<<genpart->barcode()<<": " << **daughterIter ); + ATH_MSG_VERBOSE ( "Attempting to add daughter particle of "<<HepMC::barcode(genpart)<<": " << **daughterIter ); } else { - ATH_MSG_WARNING ( "Attempting to add daughter particle of "<<genpart->barcode()<<": " << **daughterIter ); + ATH_MSG_WARNING ( "Attempting to add daughter particle of "<<HepMC::barcode(genpart)<<": " << **daughterIter ); } G4PrimaryParticle *daughterG4Particle = this->getG4PrimaryParticle( **daughterIter ); if(!daughterG4Particle) { - ATH_MSG_ERROR("Bailing out of loop over daughters of particle with barcode: "<<genpart->barcode() << + ATH_MSG_ERROR("Bailing out of loop over daughters of particle with barcode: "<<HepMC::barcode(genpart) << " due to errors - will not return G4Particle."); return nullptr; } diff --git a/Simulation/ISF/ISF_Core/ISF_Services/test/InputConverter_test.cxx b/Simulation/ISF/ISF_Core/ISF_Services/test/InputConverter_test.cxx index ea5c25131f40f17fa83a86abc2caa1e42cb43391..17813c67825ba28e507970a03bd22fb37ae5ef1d 100644 --- a/Simulation/ISF/ISF_Core/ISF_Services/test/InputConverter_test.cxx +++ b/Simulation/ISF/ISF_Core/ISF_Services/test/InputConverter_test.cxx @@ -159,7 +159,7 @@ TEST_F(InputConverter_test, convertParticle_nullptr) { TEST_F(InputConverter_test, convertParticle_without_production_vertex) { HepMC::FourVector mom(12.3, 45.6, 78.9, 0.12); - HepMC::GenParticlePtr genPart = new HepMC::GenParticle(mom, + HepMC::GenParticlePtr genPart = HepMC::newGenParticlePtr(mom, 123, // pdg 1 // status ); @@ -232,7 +232,7 @@ TEST_F(InputConverter_test, convertParticle_using_particleDataTable_photon) { HepMC::FourVector mom(12.3, 45.6, 78.9, 0.12); // dynamic allocation necessary as particle ownership is // handed over to a HepMC::GenVertex later - HepMC::GenParticlePtr genPart = new HepMC::GenParticle(mom, + HepMC::GenParticlePtr genPart = HepMC::newGenParticlePtr(mom, 22, // pdg id (gamma) 1 // status ); @@ -241,7 +241,7 @@ TEST_F(InputConverter_test, convertParticle_using_particleDataTable_photon) { HepMC::FourVector pos(9.8, 7.65, 4.3, 0.321); // NB: 4th component is time*c int vtx_id = -123; - HepMC::GenVertexPtr prodVtx = new HepMC::GenVertex(pos, vtx_id); + HepMC::GenVertexPtr prodVtx = HepMC::newGenVertexPtr(pos, vtx_id); prodVtx->add_particle_out(genPart); // create dummy input McEventCollection containing a dummy GenEvent @@ -286,7 +286,7 @@ TEST_F(InputConverter_test, convertParticle_using_particleDataTable_electron) { HepMC::FourVector mom(12.3, 45.6, 78.9, 0.12); // dynamic allocation necessary as particle ownership is // handed over to a HepMC::GenVertex later - HepMC::GenParticlePtr genPart = new HepMC::GenParticle(mom, + HepMC::GenParticlePtr genPart = HepMC::newGenParticlePtr(mom, 11, // pdg id (e-) 1 // status ); @@ -295,7 +295,7 @@ TEST_F(InputConverter_test, convertParticle_using_particleDataTable_electron) { HepMC::FourVector pos(9.8, 7.65, 4.3, 0.321); // NB: 4th component is time*c int vtx_id = -123; - HepMC::GenVertexPtr prodVtx = new HepMC::GenVertex(pos, vtx_id); + HepMC::GenVertexPtr prodVtx = HepMC::newGenVertexPtr(pos, vtx_id); prodVtx->add_particle_out(genPart); // create dummy input McEventCollection containing a dummy GenEvent diff --git a/Simulation/Tools/McEventCollectionFilter/src/McEventCollectionFilter.cxx b/Simulation/Tools/McEventCollectionFilter/src/McEventCollectionFilter.cxx index ca0d931e1a82d0fd2c18fec52f62ca1f376e1bd2..173e660195c5a8f83d245a2b9a7f0afe9bb76613 100644 --- a/Simulation/Tools/McEventCollectionFilter/src/McEventCollectionFilter.cxx +++ b/Simulation/Tools/McEventCollectionFilter/src/McEventCollectionFilter.cxx @@ -198,7 +198,7 @@ StatusCode McEventCollectionFilter::ReduceMCEventCollection(){ //to set geantino vertex as a truth primary vertex - HepMC::GenVertexPtr hScatVx = genEvt->barcode_to_vertex(-3); + HepMC::GenVertexPtr hScatVx = HepMC::barcode_to_vertex(genEvt,-3); if(hScatVx!=nullptr) { const HepMC::FourVector& pmvxpos=hScatVx->position(); genVertex->set_position(pmvxpos); @@ -229,7 +229,7 @@ StatusCode McEventCollectionFilter::ReduceMCEventCollection(){ //-------------------------------------- if(m_IsKeepTRTElect){ for(int i=0;i<(int) m_elecBarcode.size();i++){ - HepMC::GenParticlePtr thePart=genEvt->barcode_to_particle(m_elecBarcode[i]); + HepMC::GenParticlePtr thePart=HepMC::barcode_to_particle(genEvt,m_elecBarcode[i]); if (!thePart){ ATH_MSG_DEBUG( "Could not find particle for barcode " << m_elecBarcode[i] ); continue; @@ -248,7 +248,7 @@ StatusCode McEventCollectionFilter::ReduceMCEventCollection(){ //.....add new vertex with geantino evt->add_vertex(genVertex); - m_RefBarcode=HepMC::barcode(*genPart); + m_RefBarcode=HepMC::barcode(genPart); m_outputTruthCollection->push_back(evt);