diff --git a/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/Root/JetTruthLabelingTool.cxx b/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/Root/JetTruthLabelingTool.cxx index 3305fe27e92f7cc4c22cec301be324b3bef6afdf..02838c392373f3f41c99b59dd46360bc467f2943 100644 --- a/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/Root/JetTruthLabelingTool.cxx +++ b/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/Root/JetTruthLabelingTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration */ #include "ParticleJetTools/JetTruthLabelingTool.h" @@ -239,22 +239,22 @@ int JetTruthLabelingTool::getTruthJetLabelDR( DecorHandles& dh, float dR = tlv_truth.first.DeltaR(jet.p4()); if( dR < m_dRTruthPart ) { - if ( std::abs(tlv_truth.second) == 23 && !matchZ ) { + if ( MC::isZ(tlv_truth.second) && !matchZ ) { dR_Z = dR; matchZ = true; } - if ( std::abs(tlv_truth.second) == 24 && !matchW ) { + if ( MC::isW(tlv_truth.second) && !matchW ) { dR_W = dR; matchW = true; } - if ( std::abs(tlv_truth.second) == 25 && !matchH ) { + if ( MC::isHiggs(tlv_truth.second) && !matchH ) { dR_H = dR; matchH = true; } - if ( std::abs(tlv_truth.second) == 6 && !matchTop ) { + if ( MC::isTop(tlv_truth.second) && !matchTop ) { dR_Top = dR; matchTop = true; } @@ -625,7 +625,7 @@ void JetTruthLabelingTool::getTLVs( std::vector<std::pair<TLorentzVector,int> > if ( MC::isPhysical(part1) ) continue; /// Skip anything that isn't a light quark - if ( std::abs(part1->pdgId()) > 5 ) continue; + if ( std::abs(part1->pdgId()) > MC::BQUARK ) continue; countStatus3++; /// We want to look at first 2 partons except beam particles. Sometimes beam particles are dropped from DxAODs... @@ -642,7 +642,7 @@ void JetTruthLabelingTool::getTLVs( std::vector<std::pair<TLorentzVector,int> > if ( MC::isPhysical(part2) ) continue; /// Skip anything that isn't a light quark - if ( std::abs(part2->pdgId()) > 5 ) continue; + if ( std::abs(part2->pdgId()) > MC::BQUARK ) continue; p2 = part2->p4(); @@ -651,7 +651,7 @@ void JetTruthLabelingTool::getTLVs( std::vector<std::pair<TLorentzVector,int> > isZCand = true; } /// W+ daughters should have a positive u or c - else if ( part1->pdgId() == 2 || part1->pdgId() == 4 || part2->pdgId() == 2 || part2->pdgId() == 4 ) { + else if ( part1->pdgId() == MC::UQUARK || part1->pdgId() == MC::CQUARK || part2->pdgId() == MC::UQUARK || part2->pdgId() == MC::CQUARK ) { isWPCand = true; } /// W+ daughters should have a positive u or c @@ -692,14 +692,14 @@ void JetTruthLabelingTool::getTLVs( std::vector<std::pair<TLorentzVector,int> > /// Store W/Z/H bosons for ( const xAOD::TruthParticle* part : *truthBosons ) { - if ( !(selectTruthParticle(part,23) || selectTruthParticle(part,24) || selectTruthParticle(part,25)) ) continue; + if ( !(selectTruthParticle(part,MC::Z0BOSON) || selectTruthParticle(part,MC::WPLUSBOSON) || selectTruthParticle(part,MC::HIGGSBOSON)) ) continue; /// Save 4-vector and pdgId tlvs.push_back(std::make_pair(part->p4(),part->pdgId())); } /// Store top quarks for ( const xAOD::TruthParticle* part : *truthTop ) { - if ( !selectTruthParticle(part,6) ) continue; + if ( !selectTruthParticle(part,MC::TQUARK) ) continue; /// Save 4-vector and pdgId tlvs.push_back(std::make_pair(part->p4(),part->pdgId())); } diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/HardTruthThinning.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/HardTruthThinning.cxx index cc34ebfa033dee8823fbf3371b12a1702ec86df2..f00367766e76ca7c60aed2e169c3e2b7fc071abf 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/HardTruthThinning.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/HardTruthThinning.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration */ ///////////////////////////////////////////////////////////////// @@ -306,10 +306,10 @@ StatusCode DerivationFramework::HardTruthThinning::doThinning() const const xAOD::TruthParticle* pp = dynamic_cast<const xAOD::TruthParticle*>(aipraw); if( pp ) { - if( pp->pt()>m_jetConstPtCut && pp->pdgId()!=22 ){ + if( pp->pt()>m_jetConstPtCut && !MC::isPhoton(pp) ){ uidJetConst.push_back( HepMC::uniqueID(pp) ); } - if( pp->pt()>m_jetPhotonPtCut && pp->pdgId()==22 ){ + if( pp->pt()>m_jetPhotonPtCut && !MC::isPhoton(pp) ){ uidJetConst.push_back( HepMC::uniqueID(pp) ); } } else { diff --git a/PhysicsAnalysis/TauID/TauDQA/CMakeLists.txt b/PhysicsAnalysis/TauID/TauDQA/CMakeLists.txt index a2f38c112a8f2986beb78a758d53decdee249996..911f887965414e77f30e57bc13ffb9700c426217 100644 --- a/PhysicsAnalysis/TauID/TauDQA/CMakeLists.txt +++ b/PhysicsAnalysis/TauID/TauDQA/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( TauDQA ) @@ -12,6 +12,6 @@ atlas_add_component( TauDQA INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} GaudiKernel AthenaBaseComps AthenaMonitoringLib TauAnalysisToolsLib TrkValHistUtils xAODJet xAODEgamma - xAODTau xAODTruth xAODEventInfo AthContainers ) + xAODTau xAODTruth xAODEventInfo TruthUtils AthContainers ) atlas_install_python_modules( python/*.py ) atlas_install_runtime( scripts/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/PhysicsAnalysis/TauID/TauDQA/src/PhysValTau.cxx b/PhysicsAnalysis/TauID/TauDQA/src/PhysValTau.cxx index 3c857f651f43da9f934df7cd1fc31e58db498380..8d4ce4d34ef1e890f2ccd079ec966061c639b4db 100644 --- a/PhysicsAnalysis/TauID/TauDQA/src/PhysValTau.cxx +++ b/PhysicsAnalysis/TauID/TauDQA/src/PhysValTau.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration */ // PhysValTau.cxx @@ -185,7 +185,7 @@ StatusCode PhysValTau::fillHistograms() m_oTauValidationPlots->m_oElMatchedParamPlotsNom.fill(*tau, weight); m_oTauValidationPlots->m_oElMatchedEVetoPlotsNom.fill(*tau, weight); } - } else if( std::abs(trueTau->pdgId()) < 7 || trueTau->pdgId() == 21){ + } else if( MC::isSMQuark(trueTau) || MC::isGluon(trueTau) ){ ATH_MSG_DEBUG("Tau is matched to a jet"); m_oTauValidationPlots->m_oFakeGeneralTauAllProngsPlots.fill(*tau, weight); // Substructure/PFO histograms diff --git a/PhysicsAnalysis/TrackingID/InDetTrackSystematicsTools/Root/InDetTrackTruthOriginTool.cxx b/PhysicsAnalysis/TrackingID/InDetTrackSystematicsTools/Root/InDetTrackTruthOriginTool.cxx index 2e470dd1a32c7b853064c76e471e79c4258652bc..fc855d986bba1f9d60c25bbc7e17c6901485376e 100644 --- a/PhysicsAnalysis/TrackingID/InDetTrackSystematicsTools/Root/InDetTrackTruthOriginTool.cxx +++ b/PhysicsAnalysis/TrackingID/InDetTrackSystematicsTools/Root/InDetTrackTruthOriginTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration */ #include "InDetTrackSystematicsTools/InDetTrackTruthOriginTool.h" @@ -7,7 +7,7 @@ #include "xAODTruth/TruthParticleContainer.h" #include "xAODTruth/TruthEventContainer.h" -#include "TruthUtils/MagicNumbers.h" +#include "TruthUtils/HepMCHelpers.h" #include "AthContainers/ConstAccessor.h" #include <math.h> @@ -71,19 +71,19 @@ namespace InDet { bool isFragmentation = true; // from B decay chain? - if(isFrom(truth, 5)) { + if(isFrom(truth, MC::BQUARK)) { origin = origin | (0x1 << InDet::TrkOrigin::BHadronDecay); isFragmentation = false; } // from D decay chain? - if(isFrom(truth, 4)) { + if(isFrom(truth, MC::CQUARK)) { origin = origin | (0x1 << InDet::TrkOrigin::DHadronDecay); isFragmentation = false; } // from tau decay chain? - if(isFrom(truth, 15)) { + if(isFrom(truth, MC::TAU)) { origin = origin | (0x1 << InDet::TrkOrigin::TauDecay); isFragmentation = false; } @@ -127,7 +127,7 @@ namespace InDet { else if(parent->isStrangeBaryon() && parent->nChildren() == 2) { origin = origin | (0x1 << InDet::TrkOrigin::StrangeBaryonDecay); // specifically Lambdas - if ((abs(pdgId) == 211 || abs(pdgId) == 2212) && abs(parentId) == 3122) { + if ((abs(pdgId) == MC::PIPLUS || abs(pdgId) == MC::PROTON) && abs(parentId) == MC::LAMBDA0) { origin = origin | (0x1 << InDet::TrkOrigin::LambdaDecay); } } @@ -222,13 +222,13 @@ namespace InDet { if ( depth > 30 ) return false; - if( flav != 5 && flav != 4 && flav != 15 ) return false; + if( flav != MC::BQUARK && flav != MC::CQUARK && flav != MC::TAU ) return false; - if( flav == 5 && truth->isBottomHadron() ) return true; + if( flav == MC::BQUARK && truth->isBottomHadron() ) return true; - if( flav == 4 && truth->isCharmHadron() ) return true; + if( flav == MC::CQUARK && truth->isCharmHadron() ) return true; - if( flav == 15 && abs(truth->pdgId()) == 15 ) return true; + if( flav == MC::TAU && MC::isTau(truth) ) return true; for(unsigned int p=0; p<truth->nParents(); p++) {