diff --git a/Simulation/G4Atlas/G4AtlasTests/src/CalibHitValidate.cxx b/Simulation/G4Atlas/G4AtlasTests/src/CalibHitValidate.cxx index d27b20c1d01dcb18a40d287400203fa773c7df8f..a30d051c3970df812b38833beb5216bc8aa02aa7 100644 --- a/Simulation/G4Atlas/G4AtlasTests/src/CalibHitValidate.cxx +++ b/Simulation/G4Atlas/G4AtlasTests/src/CalibHitValidate.cxx @@ -63,8 +63,12 @@ StatusCode CalibHitValidate::execute() ATH_MSG_ERROR ( "No McEventCollection found"); return StatusCode::FAILURE; } +#ifdef HEPMC3 + auto gen = truthEvent->at(0)->particles().front(); +#else HepMC::GenEvent::particle_const_iterator pit = truthEvent->at(0)->particles_begin(); HepMC::ConstGenParticlePtr gen = *pit; +#endif std::vector<std::string>::iterator containerNameIter; diff --git a/Simulation/G4Utilities/MCTruthSimAlgs/src/SimpleMergeMcEventCollTool.cxx b/Simulation/G4Utilities/MCTruthSimAlgs/src/SimpleMergeMcEventCollTool.cxx index 9bc8b15e63b005faa6b64978cbee1d9cf878fd82..5cc7dcf35d3b8eceb5907486b0396a555963f277 100644 --- a/Simulation/G4Utilities/MCTruthSimAlgs/src/SimpleMergeMcEventCollTool.cxx +++ b/Simulation/G4Utilities/MCTruthSimAlgs/src/SimpleMergeMcEventCollTool.cxx @@ -160,13 +160,17 @@ void SimpleMergeMcEventCollTool::printDetailsOfMergedMcEventCollection(McEventCo ATH_MSG_INFO ( "Current OUTPUT GenEvent: " ); while(outputEventItr!=endOfEvents) { - const int signal_process_id((*outputEventItr)->signal_process_id()); + const int signal_process_id=HepMC::signal_process_id(*outputEventItr); const int event_number((*outputEventItr)->event_number()); +#ifdef HEPMC3 + ATH_MSG_INFO ( "GenEvent #"<<event_number<<", signal_process_id="<<signal_process_id<</*", category="<<event->second<<*/", number of Vertices="<<(*outputEventItr)->vertices().size() ); +#else ATH_MSG_INFO ( "GenEvent #"<<event_number<<", signal_process_id="<<signal_process_id<</*", category="<<event->second<<*/", number of Vertices="<<(*outputEventItr)->vertices_size() ); +#endif char fname[80]; sprintf(fname,"%s.event%d.txt",m_truthCollInputKey.value().c_str(),event_number); std::ofstream of(fname); - (*outputEventItr)->print(of); // verbose output + HepMC::Print::line(of,*(*outputEventItr)); // verbose output of.close(); ++outputEventItr; } diff --git a/Simulation/Tests/DigitizationTests/src/McEventCollectionTestTool.cxx b/Simulation/Tests/DigitizationTests/src/McEventCollectionTestTool.cxx index 6971c5a66a9ee4d2d63db0ceec2d5a68950ba22e..82e7cc683a3493d541067ecdee30b5d6c28ba083 100644 --- a/Simulation/Tests/DigitizationTests/src/McEventCollectionTestTool.cxx +++ b/Simulation/Tests/DigitizationTests/src/McEventCollectionTestTool.cxx @@ -82,6 +82,31 @@ StatusCode McEventCollectionTestTool::processEvent() { if(genEventIter != p_mceventcollection->begin()) isFirstEvent = false; +#ifdef HEPMC3 + ATH_MSG_INFO ("GenEvent Position in McEventCollection: " << n_genEvent-1 << + ", signal_process_id: " << HepMC::signal_process_id(currentGenEvent) << + ", event_number: " << currentGenEvent->event_number() << + ", particles_size: " << currentGenEvent->particles().size() << + ", vertices_size: " << currentGenEvent->vertices().size() << + " ."); + if(currentGenEvent->particles().empty()) + { + ++genEventIter; + continue; + } + ++n_genEventNonEmpty; + if(isFirstEvent) + { + m_sig_n_vert->Fill(currentGenEvent->vertices().size()); + m_sig_n_part->Fill(currentGenEvent->particles().size()); + } + else + { + m_bkg_n_vert->Fill(currentGenEvent->vertices().size()); + m_bkg_n_part->Fill(currentGenEvent->particles().size()); + } + ++genEventIter; +#else ATH_MSG_INFO ("GenEvent Position in McEventCollection: " << n_genEvent-1 << ", signal_process_id: " << currentGenEvent->signal_process_id() << ", event_number: " << currentGenEvent->event_number() << @@ -105,6 +130,7 @@ StatusCode McEventCollectionTestTool::processEvent() { m_bkg_n_part->Fill(currentGenEvent->particles_size()); } ++genEventIter; +#endif } m_nGenEvents->Fill(n_genEvent,1); m_nEmptyGenEvents->Fill(n_genEvent-n_genEventNonEmpty,1); diff --git a/Tracking/TrkTools/TrkTruthCreatorTools/src/DetailedTrackTruthBuilder.cxx b/Tracking/TrkTools/TrkTruthCreatorTools/src/DetailedTrackTruthBuilder.cxx index 89f49bf63f8084430aa8700f8b5165f5b22c4842..e560005102d3c15c47fc65608d53cfdb865f4dab 100755 --- a/Tracking/TrkTools/TrkTruthCreatorTools/src/DetailedTrackTruthBuilder.cxx +++ b/Tracking/TrkTools/TrkTruthCreatorTools/src/DetailedTrackTruthBuilder.cxx @@ -446,7 +446,7 @@ void DetailedTrackTruthBuilder::makeTruthToRecMap( PRD_InverseTruth& result, con for( const auto& i : rec2truth ) { // i.first = Identifier // i.second = HepMcParticleLink - const HepMC::GenParticle* pa = i.second.cptr(); + auto pa = i.second.cptr(); if( !pa ) { continue; } // skip noise if( HepMC::barcode(pa)==std::numeric_limits<int32_t>::max() && pa->pdg_id()==999 ) { continue; } // skip geantinos diff --git a/Tracking/TrkValidation/TrkValTools/src/GenParticleJetFinder.cxx b/Tracking/TrkValidation/TrkValTools/src/GenParticleJetFinder.cxx index f26bbb1c707d79f43008afb509b7b82c3419af75..b4dc39371d167b4f8d6bae6a6269795212e27065 100644 --- a/Tracking/TrkValidation/TrkValTools/src/GenParticleJetFinder.cxx +++ b/Tracking/TrkValidation/TrkValTools/src/GenParticleJetFinder.cxx @@ -113,7 +113,7 @@ std::vector< Trk::GenParticleJet >* Trk::GenParticleJetFinder::jetMCFinder( std << " ("<<(*jAtMin).getIndicesInEvent().size()<<")" ); if((*iAtMin).getNumParticles()>(*jAtMin).getNumParticles()) { - std::vector<const HepMC::GenParticle* > partsTemp = (*jAtMin).getParticles(); + auto partsTemp = (*jAtMin).getParticles(); std::vector<int> indexTemp = (*jAtMin).getIndicesInEvent(); // int partsTempSize = partsTemp.size(); if (partsTemp.size()!=0) { @@ -132,7 +132,7 @@ std::vector< Trk::GenParticleJet >* Trk::GenParticleJetFinder::jetMCFinder( std } else { - std::vector<const HepMC::GenParticle* > partsTemp = (*iAtMin).getParticles(); + auto partsTemp = (*iAtMin).getParticles(); std::vector<int> indexTemp = (*iAtMin).getIndicesInEvent(); if (partsTemp.size()!=0) {