diff --git a/Generators/TruthUtils/TruthUtils/MagicNumbers.h b/Generators/TruthUtils/TruthUtils/MagicNumbers.h index a07ada8640dd47e029fdeb928493f0e591ed84e8..796346aa34addaa773b4e458ef60bb1e162a37f6 100644 --- a/Generators/TruthUtils/TruthUtils/MagicNumbers.h +++ b/Generators/TruthUtils/TruthUtils/MagicNumbers.h @@ -193,10 +193,10 @@ namespace HepMC { template <class T> inline bool is_truth_suppressed_pileup(const T& p){ return (barcode(p) == SUPPRESSED_PILEUP_BARCODE);} /// @brief Method to establish if a if the object is linked to something which was never saved to the HepMC Truth - for example particle was too low energy to be recorded - template <class T> inline bool no_truth_link(const T& p){ return (barcode(p) == UNDEFINED_ID);} + template <class T> inline bool has_truth_link(const T& p){ return (barcode(p) != UNDEFINED_ID);} /// @brief Helper function for SDO creation in PileUpTools - template <class T> inline bool ignoreTruthLink(const T& p, bool vetoPileUp){ const int b = barcode(p); return no_truth_link(b) || (vetoPileUp && is_truth_suppressed_pileup(b)); } + template <class T> inline bool ignore_truth_link(const T& p, bool vetoPileUp){ const int b = barcode(p); return !has_truth_link(b) || (vetoPileUp && is_truth_suppressed_pileup(b)); } /// @brief Method to establish if a particle (or barcode) was created during the simulation (only to be used in legacy TP converters) template <class T> inline bool is_simulation_particle(const T& p){ return (barcode(p)>SIM_BARCODE_THRESHOLD);} @@ -234,25 +234,25 @@ namespace HepMC { } /// @brief Method to establish if a if the object is linked to something which was never saved to the HepMC Truth - for example particle was too low energy to be recorded - template <class T> inline bool no_truth_link(const T& p){ + template <class T> inline bool has_truth_link(const T& p){ if constexpr (std::is_same_v<std::remove_const_t<T>, HepMcParticleLink>) { - return p.linkIsNull(); + return !p.linkIsNull(); } else if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T>>>, HepMcParticleLink>) { - return p->linkIsNull(); + return !p->linkIsNull(); } else { - return (uniqueID(p) == UNDEFINED_ID); + return (uniqueID(p) != UNDEFINED_ID); } } /// @brief Helper function for SDO creation in PileUpTools - template <class T> inline bool ignoreTruthLink(const T& p, bool vetoPileUp){ + template <class T> inline bool ignore_truth_link(const T& p, bool vetoPileUp){ if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T>>>, HepMcParticleLink>) { - return no_truth_link(p) || (vetoPileUp && is_truth_suppressed_pileup(p)); + return !has_truth_link(p) || (vetoPileUp && is_truth_suppressed_pileup(p)); } else { - const int u = uniqueID(p); return no_truth_link(u) || (vetoPileUp && is_truth_suppressed_pileup(u)); + const int u = uniqueID(p); return !has_truth_link(u) || (vetoPileUp && is_truth_suppressed_pileup(u)); } } @@ -328,15 +328,15 @@ namespace HepMC { } /// @brief Method to establish if a if the object is linked to something which was never saved to the HepMC Truth - for example particle was too low energy to be recorded - template <class T> inline bool no_truth_link(const T& p){ return StatusBased::no_truth_link(p);} + template <class T> inline bool has_truth_link(const T& p){ return StatusBased::has_truth_link(p);} /// @brief Helper function for SDO creation in PileUpTools - template <class T> inline bool ignoreTruthLink(const T& p, bool vetoPileUp){ + template <class T> inline bool ignore_truth_link(const T& p, bool vetoPileUp){ if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T>>>, HepMcParticleLink>) { - return StatusBased::ignoreTruthLink(p, vetoPileUp); + return StatusBased::ignore_truth_link(p, vetoPileUp); } else { - return BarcodeBased::ignoreTruthLink(p, vetoPileUp); + return BarcodeBased::ignore_truth_link(p, vetoPileUp); } } diff --git a/HighGranularityTimingDetector/HGTD_Digitization/HGTD_Digitization/src/HGTD_DigitizationTool.cxx b/HighGranularityTimingDetector/HGTD_Digitization/HGTD_Digitization/src/HGTD_DigitizationTool.cxx index 494b30f52e41df3987f5270c37f6eed11ef49965..2598df7a43d3e347a15aa506187200a18f7012ba 100644 --- a/HighGranularityTimingDetector/HGTD_Digitization/HGTD_Digitization/src/HGTD_DigitizationTool.cxx +++ b/HighGranularityTimingDetector/HGTD_Digitization/HGTD_Digitization/src/HGTD_DigitizationTool.cxx @@ -421,7 +421,7 @@ void HGTD_DigitizationTool::createAndStoreSDO( for (; charge_list_itr != charge_list_itr_end; ++charge_list_itr) { const HepMcParticleLink &trkLink = charge_list_itr->particleLink(); - if (HepMC::ignoreTruthLink(trkLink, m_vetoPileUpTruthLinks)) { + if (HepMC::ignore_truth_link(trkLink, m_vetoPileUpTruthLinks)) { continue; } if (!real_particle_hit) { @@ -434,7 +434,7 @@ void HGTD_DigitizationTool::createAndStoreSDO( // processType()==SiCharge::cut_track // Tracks With Truth: barcode!=0 && // processType()==SiCharge::track - if (!HepMC::no_truth_link(trkLink) && charge_list_itr->processType() == SiCharge::track) { + if (HepMC::has_truth_link(trkLink) && charge_list_itr->processType() == SiCharge::track) { real_particle_hit = true; } // real_particle_hit = trkLink.isValid(); diff --git a/HighGranularityTimingDetector/HGTD_Digitization/HGTD_FastDigitization/src/HGTD_SmearedDigitizationTool.cxx b/HighGranularityTimingDetector/HGTD_Digitization/HGTD_FastDigitization/src/HGTD_SmearedDigitizationTool.cxx index f99dc6b6715f287302a53f99a460e04a41745c10..7e162cf68cf13661f2609754d8ad4f97f63591a0 100644 --- a/HighGranularityTimingDetector/HGTD_Digitization/HGTD_FastDigitization/src/HGTD_SmearedDigitizationTool.cxx +++ b/HighGranularityTimingDetector/HGTD_Digitization/HGTD_FastDigitization/src/HGTD_SmearedDigitizationTool.cxx @@ -364,7 +364,7 @@ StatusCode HGTD_SmearedDigitizationTool::fillMultiTruthCollection(PRD_MultiTruth << *cluster << " and link = " << trk_link); if (trk_link.isValid()) { - if (!HepMC::ignoreTruthLink(trk_link, m_vetoPileUpTruthLinks)) { + if (!HepMC::ignore_truth_link(trk_link, m_vetoPileUpTruthLinks)) { map->insert(std::make_pair(cluster->identify(), trk_link)); } } diff --git a/InnerDetector/InDetDigitization/FastSiDigitization/src/PixelFastDigitizationTool.cxx b/InnerDetector/InDetDigitization/FastSiDigitization/src/PixelFastDigitizationTool.cxx index 104215a68c5448eab222c9ec7554012123ffdbbb..67f9bb78ff38bf342f916203590db8223081ff3a 100644 --- a/InnerDetector/InDetDigitization/FastSiDigitization/src/PixelFastDigitizationTool.cxx +++ b/InnerDetector/InDetDigitization/FastSiDigitization/src/PixelFastDigitizationTool.cxx @@ -786,7 +786,7 @@ StatusCode PixelFastDigitizationTool::digitize(const EventContext& ctx, const PixelCluster* insertedCluster = it->second; if (currentLink.isValid()) { - if (!HepMC::ignoreTruthLink(currentLink, m_vetoPileUpTruthLinks)) { + if (!HepMC::ignore_truth_link(currentLink, m_vetoPileUpTruthLinks)) { m_pixPrdTruth->insert( std::make_pair(insertedCluster->identify(), currentLink)); ATH_MSG_DEBUG("Truth map filled with cluster" diff --git a/InnerDetector/InDetDigitization/FastSiDigitization/src/SCT_FastDigitizationTool.cxx b/InnerDetector/InDetDigitization/FastSiDigitization/src/SCT_FastDigitizationTool.cxx index e02b6480333fa7df74db31700318fcd85c460ce9..d4e4aa41d59f5dc92853288ea2fef83039565835 100644 --- a/InnerDetector/InDetDigitization/FastSiDigitization/src/SCT_FastDigitizationTool.cxx +++ b/InnerDetector/InDetDigitization/FastSiDigitization/src/SCT_FastDigitizationTool.cxx @@ -862,7 +862,7 @@ StatusCode SCT_FastDigitizationTool::digitize(const EventContext& ctx, // Build Truth info for current cluster if (currentLink.isValid()) { - if (!HepMC::ignoreTruthLink(currentLink, m_vetoPileUpTruthLinks)) { + if (!HepMC::ignore_truth_link(currentLink, m_vetoPileUpTruthLinks)) { sctPrdTruth->insert(std::make_pair(potentialCluster->identify(), currentLink)); ATH_MSG_DEBUG("Truth map filled with cluster" << potentialCluster << " and link = " << currentLink); } diff --git a/InnerDetector/InDetDigitization/FastSiDigitization/src/SiSmearedDigitizationTool.cxx b/InnerDetector/InDetDigitization/FastSiDigitization/src/SiSmearedDigitizationTool.cxx index e2d44b16f95ff5eff6f2afc53793574a1364b386..528c187cb6d83b9829f5f1577b6e01cd33ab5296 100644 --- a/InnerDetector/InDetDigitization/FastSiDigitization/src/SiSmearedDigitizationTool.cxx +++ b/InnerDetector/InDetDigitization/FastSiDigitization/src/SiSmearedDigitizationTool.cxx @@ -484,7 +484,7 @@ StatusCode SiSmearedDigitizationTool::FillTruthMap(PRD_MultiTruthCollection * ma ATH_MSG_DEBUG("Truth map filling with cluster " << *cluster << " and link = " << hit->particleLink()); if (hit->particleLink().isValid()){ - if (!HepMC::ignoreTruthLink(hit->particleLink(), m_vetoPileUpTruthLinks)) { + if (!HepMC::ignore_truth_link(hit->particleLink(), m_vetoPileUpTruthLinks)) { map->insert(std::make_pair(cluster->identify(), hit->particleLink())); ATH_MSG_DEBUG("Truth map filled with cluster " << *cluster << " and link = " << hit->particleLink()); } diff --git a/InnerDetector/InDetDigitization/FastTRT_Digitization/src/TRTFastDigitizationTool.cxx b/InnerDetector/InDetDigitization/FastTRT_Digitization/src/TRTFastDigitizationTool.cxx index ec46a3ceaa9530645d36d77bb038be876120c5b8..0d39c8c5f8f35f901dfbda4cbe086e67b7547f5a 100644 --- a/InnerDetector/InDetDigitization/FastTRT_Digitization/src/TRTFastDigitizationTool.cxx +++ b/InnerDetector/InDetDigitization/FastTRT_Digitization/src/TRTFastDigitizationTool.cxx @@ -405,7 +405,7 @@ StatusCode TRTFastDigitizationTool::produceDriftCircles(const EventContext& ctx, m_driftCircleMap.insert( std::multimap< Identifier, InDet::TRT_DriftCircle * >::value_type( straw_id, trtDriftCircle ) ); const HepMcParticleLink particleLink = HepMcParticleLink::getRedirectedLink(hit->particleLink(), hit.eventId(), ctx); // This link should now correctly resolve to the TruthEvent McEventCollection in the main StoreGateSvc. if ( particleLink.isValid() ) { - if (!HepMC::ignoreTruthLink(particleLink, m_vetoPileUpTruthLinks)) { + if (!HepMC::ignore_truth_link(particleLink, m_vetoPileUpTruthLinks)) { trtPrdTruth->insert( std::make_pair( trtDriftCircle->identify(), particleLink ) ); ATH_MSG_DEBUG( "Truth map filled with cluster " << trtDriftCircle << " and link = " << particleLink ); } diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/PixelDigitizationTool.cxx b/InnerDetector/InDetDigitization/PixelDigitization/src/PixelDigitizationTool.cxx index 58ad1bd27feffe8481f27736c2103f7ed66f921b..a67ff08e2a0bdcbc2b04ac53dfa4226f2c6cb3cf 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/PixelDigitizationTool.cxx +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/PixelDigitizationTool.cxx @@ -295,7 +295,7 @@ void PixelDigitizationTool::addSDO(SiChargedDiodeCollection* collection) { for (list_t::const_iterator i_ListOfCharges = charges.begin(); i_ListOfCharges != EndOfChargeList; ++i_ListOfCharges) { const HepMcParticleLink& trkLink = i_ListOfCharges->particleLink(); - if (HepMC::ignoreTruthLink(trkLink, m_vetoPileUpTruthLinks)) { + if (HepMC::ignore_truth_link(trkLink, m_vetoPileUpTruthLinks)) { continue; } if (!real_particle_hit) { diff --git a/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_DigitizationTool.cxx b/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_DigitizationTool.cxx index f26c08b9910f897ecc32bdcfbe4f98f36e6bd22a..6f4ae075a37a5b49df38cf253355ef6b7236e3c0 100644 --- a/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_DigitizationTool.cxx +++ b/InnerDetector/InDetDigitization/SCT_Digitization/src/SCT_DigitizationTool.cxx @@ -774,7 +774,7 @@ void SCT_DigitizationTool::addSDO(SiChargedDiodeCollection* collection, SG::Writ const list_t::const_iterator EndOfChargeList{charges.end()}; for (list_t::const_iterator i_ListOfCharges{charges.begin()}; i_ListOfCharges != EndOfChargeList; ++i_ListOfCharges) { const HepMcParticleLink& trkLink{i_ListOfCharges->particleLink()}; - if (HepMC::ignoreTruthLink(trkLink, m_vetoPileUpTruthLinks)) { + if (HepMC::ignore_truth_link(trkLink, m_vetoPileUpTruthLinks)) { continue; } if (!real_particle_hit) { @@ -787,7 +787,7 @@ void SCT_DigitizationTool::addSDO(SiChargedDiodeCollection* collection, SG::Writ // processType()==SiCharge::cut_track // Tracks With Truth: barcode!=0 and // processType()==SiCharge::track - if (!HepMC::no_truth_link(trkLink) && i_ListOfCharges->processType() == SiCharge::track) { + if (HepMC::has_truth_link(trkLink) && i_ListOfCharges->processType() == SiCharge::track) { real_particle_hit = true; } } diff --git a/InnerDetector/InDetDigitization/StripDigitization/src/StripDigitizationTool.cxx b/InnerDetector/InDetDigitization/StripDigitization/src/StripDigitizationTool.cxx index e303f95af27762392bcd719cd7d4da782d76e743..d15b7945a7375478e870f8e50c67d80eaf857f2b 100644 --- a/InnerDetector/InDetDigitization/StripDigitization/src/StripDigitizationTool.cxx +++ b/InnerDetector/InDetDigitization/StripDigitization/src/StripDigitizationTool.cxx @@ -885,7 +885,7 @@ void StripDigitizationTool::addSDO(SiChargedDiodeCollection* collection, SG::Wri list_t::const_iterator EndOfChargeList{charges.end()}; for (list_t::const_iterator i_ListOfCharges{charges.begin()}; i_ListOfCharges != EndOfChargeList; ++i_ListOfCharges) { const HepMcParticleLink& trkLink{i_ListOfCharges->particleLink()}; - if (HepMC::ignoreTruthLink(trkLink, m_vetoPileUpTruthLinks)) { + if (HepMC::ignore_truth_link(trkLink, m_vetoPileUpTruthLinks)) { continue; } if (not real_particle_hit) { @@ -898,7 +898,7 @@ void StripDigitizationTool::addSDO(SiChargedDiodeCollection* collection, SG::Wri // processType()==SiCharge::cut_track // Tracks With Truth: barcode!=0 and // processType()==SiCharge::track - if (!HepMC::no_truth_link(trkLink) && i_ListOfCharges->processType() == SiCharge::track) { + if (HepMC::has_truth_link(trkLink) && i_ListOfCharges->processType() == SiCharge::track) { real_particle_hit = true; } } diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigitizationTool.cxx b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigitizationTool.cxx index 2760aef149b64d480455699b88184e66e8180a68..50af15af3638a521c517a9af52e92fec8b52b853 100644 --- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigitizationTool.cxx +++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigitizationTool.cxx @@ -428,7 +428,7 @@ StatusCode TRTDigitizationTool::processStraws(const EventContext& ctx, // create a new deposit InDetSimData::Deposit deposit( HepMcParticleLink::getRedirectedLink((*hit_iter)->particleLink(), hit_iter->eventId(), ctx), // This link should now correctly resolve to the TruthEvent McEventCollection in the main StoreGateSvc. (*hit_iter)->GetEnergyDeposit() ); - if (HepMC::ignoreTruthLink(deposit.first, m_vetoPileUpTruthLinks)) { + if (HepMC::ignore_truth_link(deposit.first, m_vetoPileUpTruthLinks)) { continue; } ATH_MSG_VERBOSE ( "Deposit: trackID " << deposit.first << " energyDeposit " << deposit.second ); diff --git a/MuonSpectrometer/MuonDigitization/CSC_Digitization/src/CscDigitizationTool.cxx b/MuonSpectrometer/MuonDigitization/CSC_Digitization/src/CscDigitizationTool.cxx index f059df7b238fa8e699008ade3bcfe2e486ed7ec4..94165ddde783bc00d283ee0d3c136adef0e5f4fd 100644 --- a/MuonSpectrometer/MuonDigitization/CSC_Digitization/src/CscDigitizationTool.cxx +++ b/MuonSpectrometer/MuonDigitization/CSC_Digitization/src/CscDigitizationTool.cxx @@ -204,7 +204,7 @@ StatusCode CscDigitizationTool::CoreDigitization(Collections_t& collections,CscS zpos = zi + f*dz; } - if (!m_includePileUpTruth && HepMC::ignoreTruthLink(phit->particleLink(), m_vetoPileUpTruthLinks)) { + if (!m_includePileUpTruth && HepMC::ignore_truth_link(phit->particleLink(), m_vetoPileUpTruthLinks)) { hashVec.clear(); continue; } diff --git a/MuonSpectrometer/MuonDigitization/MDT_Digitization/src/MdtDigitizationTool.cxx b/MuonSpectrometer/MuonDigitization/MDT_Digitization/src/MdtDigitizationTool.cxx index df5019fbc5f9803c1dec92563cd7d7b671c1dac0..d296023377d7e475064edd765adc6018a915d9fb 100644 --- a/MuonSpectrometer/MuonDigitization/MDT_Digitization/src/MdtDigitizationTool.cxx +++ b/MuonSpectrometer/MuonDigitization/MDT_Digitization/src/MdtDigitizationTool.cxx @@ -762,7 +762,7 @@ bool MdtDigitizationTool::createDigits(const EventContext& ctx, Collections_t& c ATH_MSG_VERBOSE(" createDigits() phit-" << &phit << " hit-" << hit.print() << " localZPos = " << hit.localPosition().z()); // Do not store pile-up truth information - if (!m_includePileUpTruth && HepMC::ignoreTruthLink(phit->particleLink(), m_vetoPileUpTruthLinks)) { continue; } + if (!m_includePileUpTruth && HepMC::ignore_truth_link(phit->particleLink(), m_vetoPileUpTruthLinks)) { continue; } // Create the Deposit for MuonSimData MuonSimData::Deposit deposit(HepMcParticleLink::getRedirectedLink(phit->particleLink(), phit.eventId(), ctx), // This link should now correctly resolve to the TruthEvent McEventCollection in the main StoreGateSvc. diff --git a/MuonSpectrometer/MuonDigitization/RPC_Digitization/src/RpcDigitizationTool.cxx b/MuonSpectrometer/MuonDigitization/RPC_Digitization/src/RpcDigitizationTool.cxx index 683ce0cfc721e4a746fe1171c0aaf3a05a9a25fa..206fbd84ad99b2e72fbb550cb859f956e6447f9b 100644 --- a/MuonSpectrometer/MuonDigitization/RPC_Digitization/src/RpcDigitizationTool.cxx +++ b/MuonSpectrometer/MuonDigitization/RPC_Digitization/src/RpcDigitizationTool.cxx @@ -659,7 +659,7 @@ StatusCode RpcDigitizationTool::doDigitization(const EventContext& ctx, // MuonMCData((*b),G4Time+bunchTime+proptime )); // store tof+strip_propagation // Do not store pile-up truth information - if (m_includePileUpTruth || !HepMC::ignoreTruthLink(phit->particleLink(), m_vetoPileUpTruthLinks)) { + if (m_includePileUpTruth || !HepMC::ignore_truth_link(phit->particleLink(), m_vetoPileUpTruthLinks)) { if (std::abs(hit.particleEncoding()) == 13 || hit.particleEncoding() == 0) { if (channelSimDataMap.find(atlasId) == channelSimDataMap.end()) { SimDataContent& content = channelSimDataMap[atlasId]; diff --git a/MuonSpectrometer/MuonDigitization/TGC_Digitization/src/TgcDigitizationTool.cxx b/MuonSpectrometer/MuonDigitization/TGC_Digitization/src/TgcDigitizationTool.cxx index b6f2e8bf682a06afca0c7b6c3626980ec2d91420..e36f3c1aca297733e3b7394ade9db461ee319075 100644 --- a/MuonSpectrometer/MuonDigitization/TGC_Digitization/src/TgcDigitizationTool.cxx +++ b/MuonSpectrometer/MuonDigitization/TGC_Digitization/src/TgcDigitizationTool.cxx @@ -442,7 +442,7 @@ StatusCode TgcDigitizationTool::digitizeCore(const EventContext& ctx) { // fill the SDO collection in StoreGate if not pile-up if (!m_includePileUpTruth && - HepMC::ignoreTruthLink(phit->particleLink(), + HepMC::ignore_truth_link(phit->particleLink(), m_vetoPileUpTruthLinks)) { continue; } diff --git a/MuonSpectrometer/MuonPhaseII/MuonDigitization/MuonDigitizationR4/src/MuonDigitizationTool.cxx b/MuonSpectrometer/MuonPhaseII/MuonDigitization/MuonDigitizationR4/src/MuonDigitizationTool.cxx index 2fe1610ca66bee1ded2970e9a2bb184c5c22bb67..eb2d7c96f9fdee6d2e9685b3d29b90ae1046ec16 100644 --- a/MuonSpectrometer/MuonPhaseII/MuonDigitization/MuonDigitizationR4/src/MuonDigitizationTool.cxx +++ b/MuonSpectrometer/MuonPhaseII/MuonDigitization/MuonDigitizationR4/src/MuonDigitizationTool.cxx @@ -151,7 +151,7 @@ namespace MuonR4{ ATH_MSG_VERBOSE("No SDO container setup of writing"); return nullptr; } - if (!m_includePileUpTruth && HepMC::ignoreTruthLink(hit->genParticleLink(), m_vetoPileUpTruthLinks)) { + if (!m_includePileUpTruth && HepMC::ignore_truth_link(hit->genParticleLink(), m_vetoPileUpTruthLinks)) { ATH_MSG_VERBOSE("Hit "<<m_idHelperSvc->toString(hit->identify())<<" is a pile-up truth link"); return nullptr; }