diff --git a/InnerDetector/InDetRawAlgs/InDetOverlay/test/TRTOverlay_test.cxx b/InnerDetector/InDetRawAlgs/InDetOverlay/test/TRTOverlay_test.cxx index a21c8c8b41dba29cacd77d04364fcb153c599b92..c458c6acb97a9081107ad264fdfa3c0ee96784b4 100644 --- a/InnerDetector/InDetRawAlgs/InDetOverlay/test/TRTOverlay_test.cxx +++ b/InnerDetector/InDetRawAlgs/InDetOverlay/test/TRTOverlay_test.cxx @@ -277,7 +277,7 @@ namespace OverlayTesting { return digit; } - bool initMcEventCollection(std::vector<HepMC::GenParticle*>& genPartList) + bool initMcEventCollection(std::vector<HepMC::GenParticlePtr>& genPartList) { // create dummy input McEventCollection with a name that // HepMcParticleLink knows about @@ -286,7 +286,7 @@ namespace OverlayTesting { // Add a dummy GenEvent const int process_id1(20); const int event_number1(17); - inputTestDataHandle->push_back(new HepMC::GenEvent(process_id1, event_number1)); + inputTestDataHandle->push_back(HepMC::newGenEvent(process_id1, event_number1)); HepMC::GenEvent& ge1 = *(inputTestDataHandle->at(0)); populateGenEvent(ge1,-11,11,genPartList); populateGenEvent(ge1,-13,13,genPartList); @@ -297,26 +297,26 @@ namespace OverlayTesting { return true; } - void populateGenEvent(HepMC::GenEvent & ge, int pdgid1, int pdgid2, std::vector<HepMC::GenParticle*>& genPartList) + void populateGenEvent(HepMC::GenEvent & ge, int pdgid1, int pdgid2, std::vector<HepMC::GenParticlePtr>& genPartList) { - CLHEP::HepLorentzVector myPos( 0.0, 0.0, 0.0, 0.0); - HepMC::GenVertex *myVertex = new HepMC::GenVertex( myPos, -1 ); + HepMC::FourVector myPos( 0.0, 0.0, 0.0, 0.0); + HepMC::GenVertexPtr myVertex = HepMC::newGenVertexPtr( myPos, -1 ); HepMC::FourVector fourMomentum1( 0.0, 0.0, 1.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle1 = new HepMC::GenParticle(fourMomentum1, pdgid1, 2); + HepMC::GenParticlePtr inParticle1 = HepMC::newGenParticlePtr(fourMomentum1, pdgid1, 2); myVertex->add_particle_in(inParticle1); HepMC::FourVector fourMomentum2( 0.0, 0.0, -1.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle2 = new HepMC::GenParticle(fourMomentum2, pdgid2, 2); + HepMC::GenParticlePtr inParticle2 = HepMC::newGenParticlePtr(fourMomentum2, pdgid2, 2); myVertex->add_particle_in(inParticle2); HepMC::FourVector fourMomentum3( 0.0, 1.0, 0.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle3 = new HepMC::GenParticle(fourMomentum3, pdgid1, 1); + HepMC::GenParticlePtr inParticle3 = HepMC::newGenParticlePtr(fourMomentum3, pdgid1, 1); myVertex->add_particle_out(inParticle3); genPartList.push_back(inParticle3); HepMC::FourVector fourMomentum4( 0.0, -1.0, 0.0, 1.0*CLHEP::TeV); - HepMC::GenParticle* inParticle4 = new HepMC::GenParticle(fourMomentum4, pdgid2, 1); + HepMC::GenParticlePtr inParticle4 = HepMC::newGenParticlePtr(fourMomentum4, pdgid2, 1); myVertex->add_particle_out(inParticle4); genPartList.push_back(inParticle4); ge.add_vertex( myVertex ); - ge.set_signal_process_vertex( myVertex ); + HepMC::set_signal_process_vertex( &ge, myVertex ); ge.set_beam_particles(inParticle1,inParticle2); } diff --git a/PhysicsAnalysis/D2PDMaker/src/D2PDTruthParticleSelector.cxx b/PhysicsAnalysis/D2PDMaker/src/D2PDTruthParticleSelector.cxx index e9649d21776517d8546bfbd6759788130cd8a84b..1e655dc0d91747c5fc31d9957c8945ccd0608287 100644 --- a/PhysicsAnalysis/D2PDMaker/src/D2PDTruthParticleSelector.cxx +++ b/PhysicsAnalysis/D2PDMaker/src/D2PDTruthParticleSelector.cxx @@ -297,14 +297,11 @@ StatusCode D2PDTruthParticleSelector::processObject( const TruthParticle* part, if( genPart->end_vertex() ) { int barcode = HepMC::barcode(genPart); - auto childItrBegin = genPart->end_vertex()->particles_begin(HepMC::children); - auto childItrEnd = genPart->end_vertex()->particles_end(HepMC::children); - for (auto childItr=childItrBegin; childItr!=childItrEnd; ++childItr ) + for (auto child: *(genPart->end_vertex())) { - auto child = (*childItr); if( child->pdg_id() == pdgID - && child->barcode() != barcode - && child->barcode() < 200000 ) + && HepMC::barcode(child) != barcode + && HepMC::barcode(child) < 200000 ) { isPassed = false; } @@ -605,17 +602,14 @@ bool D2PDTruthParticleSelector::getDaughters( HepMC::ConstGenParticlePtr genPart if( genPart->end_vertex() ) { int pdgID = genPart->pdg_id(); - int barcode = genPart->barcode(); + int barcode = HepMC::barcode(genPart); // Loop over all children - auto childItrBegin = genPart->end_vertex()->particles_begin(HepMC::children); - auto childItrEnd = genPart->end_vertex()->particles_end(HepMC::children); - for (auto childItr=childItrBegin; childItr != childItrEnd; ++childItr ) + for (auto child: *(genPart->end_vertex())) { - auto child = (*childItr); if( child->pdg_id() == pdgID - && child->barcode() != barcode - && child->barcode() < 200000 ) + && HepMC::barcode(child) != barcode + && HepMC::barcode(child) < 200000 ) { return getDaughters( child, daughters ); } diff --git a/Simulation/G4Atlas/G4AtlasTests/src/TruthTestTool.cxx b/Simulation/G4Atlas/G4AtlasTests/src/TruthTestTool.cxx index a5dac7b791caa2292e377df2d7dd6a2a152d0c1b..454f5bf9adb2078eea289a38cdfa212d01f89421 100644 --- a/Simulation/G4Atlas/G4AtlasTests/src/TruthTestTool.cxx +++ b/Simulation/G4Atlas/G4AtlasTests/src/TruthTestTool.cxx @@ -224,7 +224,6 @@ StatusCode TruthTestTool::processEvent() } int npart_prim=0, npart_sec=0; - HepMC::GenEvent::particle_const_iterator currentGenParticleIter; for (auto currentGenParticle: *(*currentGenEventIter)) { const HepMC::FourVector mom = currentGenParticle->momentum(); @@ -284,8 +283,9 @@ StatusCode TruthTestTool::processEvent() m_particle_type->Fill( particleType ); if ( HepMC::barcode(currentGenParticle)<200000 ) { - m_p_gen->Fill( mom.rho() ); - m_log_p_gen->Fill( log(mom.rho()) ); + double momentum=std::sqrt(mom.x()*mom.x()+mom.y()*mom.y()+mom.z()*mom.z()); + m_p_gen->Fill( momentum ); + m_log_p_gen->Fill( std::log(momentum) ); m_eta_gen->Fill( mom.eta() ); m_phi_gen->Fill( mom.phi() ); ++npart_prim;