From aa1d9fd153cd8629e1fccd5d8b49708ead3be21a Mon Sep 17 00:00:00 2001 From: mamerl Date: Fri, 16 Feb 2024 09:37:42 +0100 Subject: [PATCH] Rebase to upstream/main and resolve merge conflicts --- .github/workflows/ci.yml | 2 +- Root/Algorithm.cxx | 51 +++-------------- Root/BasicEventSelection.cxx | 50 +++++++++++++---- Root/ElectronContainer.cxx | 13 ++++- Root/ElectronSelector.cxx | 60 +++++++++----------- Root/HelperClasses.cxx | 1 + Root/HistogramManager.cxx | 27 +++++++++ Root/IsoCloseByCorr.cxx | 2 +- Root/JetCalibrator.cxx | 16 ++++++ Root/LinkDef.h | 1 - Root/METConstructor.cxx | 82 ++++++++++++++++------------ Root/MuonEfficiencyCorrector.cxx | 21 ++++--- Root/MuonSelector.cxx | 53 +++++++----------- Root/OverlapRemover.cxx | 4 +- Root/ParticlePIDManager.cxx | 11 +++- Root/PhotonCalibrator.cxx | 4 +- Root/PhotonContainer.cxx | 42 +++++++------- docs/Algorithms.rst | 2 - docs/index.rst | 5 -- python/cli_options.py | 6 -- xAODAnaHelpers/Algorithm.h | 20 ------- xAODAnaHelpers/BasicEventSelection.h | 9 ++- xAODAnaHelpers/HistogramManager.h | 3 +- xAODAnaHelpers/JetCalibrator.h | 18 +++++- xAODAnaHelpers/JetSelector.h | 2 +- xAODAnaHelpers/METConstructor.h | 8 ++- xAODAnaHelpers/ParticlePIDManager.h | 1 + xAODAnaHelpers/PhotonCalibrator.h | 1 - xAODAnaHelpers/TauCalibrator.h | 1 - 29 files changed, 274 insertions(+), 242 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 86c3e642eb..d3c569545f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: env: RELEASE_TYPE: ${{ matrix.release_type }} RELEASE_VERSION: ${{ matrix.release_version }} - DOCKER_BASE_REPO: gitlab-registry.cern.ch/atlas/athena + DOCKER_BASE_REPO: atlas DOCKER_TARGET_REPO: ucatlas RELEASE: ${{ format('{0}@{1}', matrix.release_type, matrix.release_version) }} strategy: diff --git a/Root/Algorithm.cxx b/Root/Algorithm.cxx index 40180f4536..f18160902c 100644 --- a/Root/Algorithm.cxx +++ b/Root/Algorithm.cxx @@ -7,8 +7,6 @@ #include #include "xAODEventInfo/EventInfo.h" -#include - std::map xAH::Algorithm::m_instanceRegistry = {}; // this is needed to distribute the algorithm to the workers @@ -37,13 +35,14 @@ StatusCode xAH::Algorithm::algInitialize(){ //Backwards compatibility - m_forceFastSim = m_forceFastSim || m_setAFII || m_setAF3; + m_forceFastSim = m_forceFastSim || m_setAFII; //Return a failure if there's contradictory flags (2 or more are true) if( m_forceData ? (m_forceFastSim || m_forceFullSim) : (m_forceFastSim && m_forceFullSim) ){ ANA_MSG_ERROR("Multiple input-type flags are set, be sure only one of m_forceData(" << m_forceData << "), m_forceFastSim(" << m_forceFastSim << "), and m_forceFullSim(" << m_forceFullSim << ") are true."); return StatusCode::FAILURE; } + return StatusCode::SUCCESS; } @@ -115,49 +114,13 @@ bool xAH::Algorithm::isFastSim(){ ANA_CHECK( wk()->xaodEvent()->retrieveMetaInput(fmd, "FileMetaData") ); fmd->value(xAOD::FileMetaData::simFlavour, SimulationFlavour); - boost::to_upper(SimulationFlavour); - m_isFastSim = SimulationFlavour.find("ATLFAST") != std::string::npos; - - return m_isFastSim; -} - -bool xAH::Algorithm::isAF3(){ - - // If already set return - if (m_isAF3==0 || m_isAF3==1){ - return m_isAF3; - } - // If full sim, return empty string (call function first to make sure Force options are considered) - bool isFaS = isFastSim(); - if (!isFaS){ - m_isAF3 = 0; - return m_isAF3; - } - - if (m_setAF3){ - m_isAF3 = 1; - return m_isAF3; - } - - std::string SimulationFlavour; - const xAOD::FileMetaData* fmd = nullptr; - if( wk()->xaodEvent()->retrieveMetaInput(fmd, "FileMetaData") != StatusCode::SUCCESS){ - ANA_MSG_ERROR("Cannot retreve File Metadata to find simulation flavour"); - return false; - } - fmd->value(xAOD::FileMetaData::simFlavour, SimulationFlavour); - - boost::to_upper(SimulationFlavour); - if(SimulationFlavour.find("ATLFASTII") != std::string::npos){ - m_isAF3 = 0; - } else if (SimulationFlavour.find("ATLFAST3") != std::string::npos){ - m_isAF3 = 1; - } else { - ANA_MSG_ERROR("Unexpected Simulation type: "<< SimulationFlavour); - return false; + if( SimulationFlavour == "AtlfastII" ){ + m_isFastSim = 1; + }else{ + m_isFastSim = 0; } - return m_isAF3; + return m_isFastSim; } bool xAH::Algorithm::isPHYS(){ diff --git a/Root/BasicEventSelection.cxx b/Root/BasicEventSelection.cxx index 1e8ce50c8c..5dcae473a2 100644 --- a/Root/BasicEventSelection.cxx +++ b/Root/BasicEventSelection.cxx @@ -962,7 +962,19 @@ EL::StatusCode BasicEventSelection :: execute () if ( m_applyTriggerCut ) { - if ( !triggerChainGroup->isPassed() ) { + // additional DEBUG logging to validate conditional logicss + ANA_MSG_DEBUG("Applying trigger cut corresponding to chain group " << m_triggerSelection); + ANA_MSG_DEBUG("Trigger chain group is NOT passed && is TLA data = " << int(!triggerChainGroup->isPassed(TrigDefs::requireDecision) && m_isTLAData)); + ANA_MSG_DEBUG("Trigger chain group is NOT passed (no requireDecision) && is NOT TLA data = " << int(!triggerChainGroup->isPassed() && !m_isTLAData)); + + // different behaviour for isPassed depending on whether you are running on TLA data or not + // if running on TLA data, we only store the HLT part of the trigger decision i.e. the L1 part + // will always be "false", so we need to use TrigDefs::requireDecision to limit the decision + // to being satisfied by the HLT leg(s) of the trigger chain + // TODO: check performance of this method when using trigger chains with the SAME HLT leg but different L1 seed + // e.g. HLT_j20_pf_ftf_L1J100 vs. HLT_j20_pf_ftf_L1HT190-J15s5pETA21 + if ( (m_isTLAData && !triggerChainGroup->isPassed(TrigDefs::requireDecision)) || (!m_isTLAData && !triggerChainGroup->isPassed()) ) { + // if (!triggerChainGroup->isPassed(TrigDefs::requireDecision)) { wk()->skipEvent(); return EL::StatusCode::SUCCESS; } @@ -986,7 +998,7 @@ EL::StatusCode BasicEventSelection :: execute () // for ( auto &trigName : triggerChainGroup->getListOfTriggers() ) { auto trigChain = m_trigDecTool_handle->getChainGroup( trigName ); - if ( trigChain->isPassed() ) { + if ( (m_isTLAData && trigChain->isPassed(TrigDefs::requireDecision)) || (!m_isTLAData && trigChain->isPassed()) ) { passedTriggers.push_back( trigName ); triggerPrescales.push_back( trigChain->getPrescale() ); @@ -1008,7 +1020,7 @@ EL::StatusCode BasicEventSelection :: execute () for ( const std::string &trigName : m_extraTriggerSelectionList ) { auto trigChain = m_trigDecTool_handle->getChainGroup( trigName ); - if ( trigChain->isPassed() ) { + if ( (m_isTLAData && trigChain->isPassed(TrigDefs::requireDecision)) || (!m_isTLAData && trigChain->isPassed()) ) { passedTriggers.push_back( trigName ); triggerPrescales.push_back( trigChain->getPrescale() ); @@ -1054,7 +1066,11 @@ EL::StatusCode BasicEventSelection :: execute () } if ( m_storePassHLT ) { static SG::AuxElement::Decorator< int > passHLT("passHLT"); - passHLT(*eventInfo) = ( m_triggerSelection.find("HLT_") != std::string::npos ) ? (int)m_trigDecTool_handle->isPassed(m_triggerSelection.c_str()) : -1; + if (!m_isTLAData) { + passHLT(*eventInfo) = ( m_triggerSelection.find("HLT_") != std::string::npos ) ? (int)m_trigDecTool_handle->isPassed(m_triggerSelection.c_str()) : -1; + } else { + passHLT(*eventInfo) = ( m_triggerSelection.find("HLT_") != std::string::npos ) ? (int)m_trigDecTool_handle->isPassed(m_triggerSelection.c_str(), TrigDefs::requireDecision) : -1; + } } } // if giving a specific list of triggers to look at @@ -1122,7 +1138,7 @@ StatusCode BasicEventSelection::autoconfigurePileupRWTool() ANA_CHECK( m_event->retrieve( eventInfo, "EventInfo" ) ); // Determine simulation flavour - std::string SimulationFlavour = isFastSim() ? ( isAF3() ? "AF3" : "AFII" ) : "FS"; + std::string SimulationFlavour = isFastSim() ? "AFII" : "FS"; // Extract campaign automatically from Run Number std::string mcCampaignMD = ""; @@ -1140,6 +1156,9 @@ StatusCode BasicEventSelection::autoconfigurePileupRWTool() case 310000 : mcCampaignMD="mc20e"; break; + case 410000 : + mcCampaignMD="mc23"; + break; default : ANA_MSG_ERROR( "Could not determine mc campaign from run number! Impossible to autoconfigure PRW. Aborting." ); return StatusCode::FAILURE; @@ -1170,14 +1189,14 @@ StatusCode BasicEventSelection::autoconfigurePileupRWTool() bool mc20X_GoodFromProperty = !mcCampaignList.empty(); bool mc20X_GoodFromMetadata = false; for(const auto& mcCampaignP : mcCampaignList) mc20X_GoodFromProperty &= ( mcCampaignP == "mc20a" || mcCampaignP == "mc20d" || mcCampaignP == "mc20e"); - if( mcCampaignMD == "mc20a" || mcCampaignMD == "mc20d" || mcCampaignMD == "mc20e") mc20X_GoodFromMetadata = true; + if( mcCampaignMD == "mc20a" || mcCampaignMD == "mc20d" || mcCampaignMD == "mc20e"|| mcCampaignMD == "mc23") mc20X_GoodFromMetadata = true; if( !mc20X_GoodFromMetadata && !mc20X_GoodFromProperty ) { // :: std::string MetadataAndPropertyBAD(""); MetadataAndPropertyBAD += "autoconfigurePileupRWTool(): access to FileMetaData failed, but don't panic. You can try to manually set the 'mcCampaign' BasicEventSelection property to "; - MetadataAndPropertyBAD += "'mc20a', 'mc20c', 'mc20d', 'mc20e', or 'mc20f' and restart your job. If you set it to any other string, you will still incur in this error."; + MetadataAndPropertyBAD += "'mc20a', 'mc20c', 'mc20d', 'mc20e', 'mc20f', or 'mc23' and restart your job. If you set it to any other string, you will still incur in this error."; ANA_MSG_ERROR( MetadataAndPropertyBAD ); return StatusCode::FAILURE; // :: @@ -1248,6 +1267,8 @@ StatusCode BasicEventSelection::autoconfigurePileupRWTool() prwConfigFiles.push_back(PathResolverFindCalibFile(m_prwActualMu2017File)); if( !m_prwActualMu2018File.empty() && (mcCampaign == "mc20e" || mcCampaign=="mc20f") ) prwConfigFiles.push_back(PathResolverFindCalibFile(m_prwActualMu2018File)); + if( !m_prwActualMu2022File.empty() && (mcCampaign == "mc23") ) + prwConfigFiles.push_back(PathResolverFindCalibFile(m_prwActualMu2022File)); } // also need to handle lumicalc files: only use 2015+2016 with mc20a @@ -1275,8 +1296,12 @@ StatusCode BasicEventSelection::autoconfigurePileupRWTool() for(const auto& filename : allLumiCalcFiles) { // looking for things of format "stuff/data15_13TeV/stuff" etc - size_t pos = filename.find("data"); - std::string year = filename.substr(pos+4, 2); + // If keyword 'data' appears multiple times in the path we need to modify the substring we search for + // /cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data22_13p6TeV/*/ilumi* + // size_t pos = filename.find("data"); + // std::string year = filename.substr(pos+4, 2); + size_t pos = filename.find("GoodRunsLists/data"); + std::string year = filename.substr(pos+18, 2); if (mcCampaign == "mc20a") { if (year == "15" || year == "16") { @@ -1290,7 +1315,12 @@ StatusCode BasicEventSelection::autoconfigurePileupRWTool() if (year == "18") { lumiCalcFiles.push_back(filename); } - } else { + } else if (mcCampaign == "mc23") { + if (year == "22") { + lumiCalcFiles.push_back(filename); + } + } + else { ANA_MSG_ERROR( "No lumicalc file is suitable for your mc campaign!" ); } } diff --git a/Root/ElectronContainer.cxx b/Root/ElectronContainer.cxx index c7ce6f463d..0eac27f45f 100644 --- a/Root/ElectronContainer.cxx +++ b/Root/ElectronContainer.cxx @@ -825,8 +825,17 @@ void ElectronContainer::FillElectron( const xAOD::IParticle* particle, const xAO for (auto& PID : m_infoSwitch.m_PIDWPs) { if (!PID.empty()) { - accPID.insert( std::pair > ( PID , SG::AuxElement::Accessor( PID ) ) ); - safeFill( elec, accPID.at( PID ), m_PID->at( PID ), -1 ); + if (PID == "LHLooseBL") { + accPID.insert( std::pair > ( PID , SG::AuxElement::Accessor( "LHLoose" ) ) ); + if ( accPID.at( PID ).isAvailable( *elec ) && accBLayer.isAvailable( *elec ) ) { + m_PID->at( PID )->push_back( accBLayer( *elec ) == 1 && (accPID.at( PID ))( *elec ) == 1 ); + } else { + m_PID->at( PID )->push_back( -1 ); + } + } else { + accPID.insert( std::pair > ( PID , SG::AuxElement::Accessor( PID ) ) ); + safeFill( elec, accPID.at( PID ), m_PID->at( PID ), -1 ); + } } } } diff --git a/Root/ElectronSelector.cxx b/Root/ElectronSelector.cxx index 4fdfdbd2ad..6351b0577b 100644 --- a/Root/ElectronSelector.cxx +++ b/Root/ElectronSelector.cxx @@ -284,6 +284,12 @@ EL::StatusCode ElectronSelector :: initialize () } if ( m_readIDFlagsFromDerivation ) { + // LooseBL is not in Derivations, so choose Loose and do BLayer cut locally + if( m_LHOperatingPoint == "LooseBL" ){ + m_LHOperatingPoint = "Loose"; + m_doBLTrackQualityCut = true; + } + ANA_MSG_INFO( "Reading Electron LH ID from DAODs ..." ); ANA_CHECK( m_el_LH_PIDManager->setupWPs( false )); } else { @@ -345,47 +351,35 @@ EL::StatusCode ElectronSelector :: initialize () // do not initialise if there are no input trigger chains if( !( m_singleElTrigChains.empty() && m_diElTrigChains.empty() ) ) { - // grab the TrigDecTool from the ToolStore - if(!m_trigDecTool_handle.isUserConfigured()){ - ANA_MSG_FATAL("A configured " << m_trigDecTool_handle.typeAndName() << " must have been previously created! Are you creating one in xAH::BasicEventSelection?" ); - return EL::StatusCode::FAILURE; - } - ANA_CHECK( m_trigDecTool_handle.retrieve()); - ANA_MSG_DEBUG("Retrieved tool: " << m_trigDecTool_handle); + if( !isPHYS() ) { + // Grab the TrigDecTool from the ToolStore + if(!m_trigDecTool_handle.isUserConfigured()){ + ANA_MSG_FATAL("A configured " << m_trigDecTool_handle.typeAndName() << " must have been previously created! Are you creating one in xAH::BasicEventSelection?" ); + return EL::StatusCode::FAILURE; + } + ANA_CHECK( m_trigDecTool_handle.retrieve()); + ANA_MSG_DEBUG("Retrieved tool: " << m_trigDecTool_handle); - // in AB we need to explicitly retrieve this tool, see https://twiki.cern.ch/twiki/bin/viewauth/Atlas/R22TriggerAnalysis - ANA_CHECK( m_scoreTool.retrieve()); + ANA_CHECK( m_scoreTool.retrieve()); - // Run3 got a new trigger navigation - if (m_useRun3navigation) { - m_trigElectronMatchTool_handle = asg::AnaToolHandle("Trig::R3MatchingTool/TrigR3MatchingTool"); + // everything went fine, let's initialise the tool! + m_trigElectronMatchTool_handle = asg::AnaToolHandle("Trig::MatchingTool/MatchingTool");; ANA_CHECK( m_trigElectronMatchTool_handle.setProperty( "TrigDecisionTool", m_trigDecTool_handle )); ANA_CHECK( m_trigElectronMatchTool_handle.setProperty( "ScoringTool", m_scoreTool )); - ANA_CHECK( m_trigElectronMatchTool_handle.setProperty("OutputLevel", msg().level() )); + ANA_CHECK( m_trigElectronMatchTool_handle.setProperty( "OutputLevel", msg().level() )); ANA_CHECK( m_trigElectronMatchTool_handle.retrieve()); ANA_MSG_DEBUG("Retrieved tool: " << m_trigElectronMatchTool_handle); - } - // otherwise we have to configure the Run2-style navigation - else { - if( !isPHYS() ) { - m_trigElectronMatchTool_handle = asg::AnaToolHandle("Trig::MatchingTool/MatchingTool");; - ANA_CHECK( m_trigElectronMatchTool_handle.setProperty( "TrigDecisionTool", m_trigDecTool_handle )); - ANA_CHECK( m_trigElectronMatchTool_handle.setProperty( "ScoringTool", m_scoreTool )); - ANA_CHECK( m_trigElectronMatchTool_handle.setProperty( "OutputLevel", msg().level() )); - ANA_CHECK( m_trigElectronMatchTool_handle.retrieve()); - ANA_MSG_DEBUG("Retrieved tool: " << m_trigElectronMatchTool_handle); - } - else { // For DAOD_PHYS samples - m_trigElectronMatchTool_handle = asg::AnaToolHandle("Trig::MatchFromCompositeTool/MatchFromCompositeTool");; - ANA_CHECK( m_trigElectronMatchTool_handle.setProperty( "OutputLevel", msg().level() )); - if (!m_trigInputPrefix.empty()){ - ANA_CHECK( m_trigElectronMatchTool_handle.setProperty( "InputPrefix", m_trigInputPrefix )); - ANA_CHECK( m_trigElectronMatchTool_handle.setProperty( "RemapBrokenLinks", true) ); - } - ANA_CHECK( m_trigElectronMatchTool_handle.retrieve()); - ANA_MSG_DEBUG("Retrieved tool: " << m_trigElectronMatchTool_handle); + } else { // For DAOD_PHYS samples + m_trigElectronMatchTool_handle = asg::AnaToolHandle("Trig::MatchFromCompositeTool/MatchFromCompositeTool");; + ANA_CHECK( m_trigElectronMatchTool_handle.setProperty( "OutputLevel", msg().level() )); + if (!m_trigInputPrefix.empty()){ + ANA_CHECK( m_trigElectronMatchTool_handle.setProperty( "InputPrefix", m_trigInputPrefix )); + ANA_CHECK( m_trigElectronMatchTool_handle.setProperty( "RemapBrokenLinks", true) ); } + ANA_CHECK( m_trigElectronMatchTool_handle.retrieve()); + ANA_MSG_DEBUG("Retrieved tool: " << m_trigElectronMatchTool_handle); } + } else { m_doTrigMatch = false; diff --git a/Root/HelperClasses.cxx b/Root/HelperClasses.cxx index 9e71c03361..86ea7e0c38 100644 --- a/Root/HelperClasses.cxx +++ b/Root/HelperClasses.cxx @@ -304,6 +304,7 @@ namespace HelperClasses{ m_clean = has_exact("clean"); m_cleanLight = has_exact("cleanLight"); m_cleanTrig = has_exact("cleanTrig"); + m_timing = has_exact("timing"); m_cleanLLP = has_exact("cleanLLP"); m_timing = has_exact("timing"); m_energy = has_exact("energy"); diff --git a/Root/HistogramManager.cxx b/Root/HistogramManager.cxx index 5babe2a0bd..cb7d7ca1d7 100644 --- a/Root/HistogramManager.cxx +++ b/Root/HistogramManager.cxx @@ -156,6 +156,7 @@ TProfile* HistogramManager::book(std::string name, std::string title, return tmp; } + MsgStream& HistogramManager :: msg () const { return m_msg; } MsgStream& HistogramManager :: msg (int level) const { MsgStream& result = msg(); @@ -242,3 +243,29 @@ void HistogramManager::fillHist(const std::string& histName, double valueX, doub } histPointer->Fill(valueX, valueY, weight); } + +void HistogramManager::fillHist(const std::string& histName, double valueX, double valueY, double valueZ, double weight) { + TH3* histPointer(NULL); + HistMap_t::const_iterator it = m_histMap.find( histName ); + if ( it == m_histMap.end() ) { + ANA_MSG_ERROR("Histogram name " << histName << " not found"); + return; + } + else { + histPointer = (TH3*)it->second; + } + histPointer->Fill(valueX, valueY, valueZ, weight); +} + +void HistogramManager::fillProfile(const std::string& histName, double valueX, double valueY, double weight) { + TProfile* histPointer(NULL); + HistMap_t::const_iterator it = m_histMap.find( histName ); + if ( it == m_histMap.end() ) { + ANA_MSG_ERROR("Histogram name " << histName << " not found"); + return; + } + else { + histPointer = (TProfile*)it->second; + } + histPointer->Fill(valueX, valueY, weight); +} diff --git a/Root/IsoCloseByCorr.cxx b/Root/IsoCloseByCorr.cxx index 6977ddcb08..2215fd7d23 100644 --- a/Root/IsoCloseByCorr.cxx +++ b/Root/IsoCloseByCorr.cxx @@ -233,4 +233,4 @@ EL::StatusCode IsoCloseByCorr :: histFinalize () ANA_MSG_INFO( "Calling histFinalize"); ANA_CHECK( xAH::Algorithm::algFinalize()); return EL::StatusCode::SUCCESS; -} +} \ No newline at end of file diff --git a/Root/JetCalibrator.cxx b/Root/JetCalibrator.cxx index 88223b0938..8d05b1ae28 100644 --- a/Root/JetCalibrator.cxx +++ b/Root/JetCalibrator.cxx @@ -227,6 +227,17 @@ EL::StatusCode JetCalibrator :: initialize () if ( m_jetCalibToolsDEV ) { ANA_CHECK( m_JetCalibrationTool_handle.setProperty("DEVmode", m_jetCalibToolsDEV)); } + // HLT jet re-calibration configuration + if (m_recalibrateHLTJets) { + ANA_CHECK( m_JetCalibrationTool_handle.setProperty("UseHLTEventShape", true) ); + // Note: PrimaryVerticesContainerName is actually a private ReadHandleKey, but we can set its value via the setProperty method + ANA_CHECK( m_JetCalibrationTool_handle.setProperty("PrimaryVerticesContainerName", m_HLTVertexContainerName) ); + ANA_CHECK( m_JetCalibrationTool_handle.setProperty("averageInteractionsPerCrossingKey", m_HLTAvgMuDecor) ); + if (m_EvtInfoHLTNPVDecor != "") { + ANA_CHECK( m_JetCalibrationTool_handle.setProperty("UseNPVFromEventInfo", true) ); + ANA_CHECK( m_JetCalibrationTool_handle.setProperty("NPVKey", m_EvtInfoHLTNPVDecor) ); + } + } ANA_CHECK( m_JetCalibrationTool_handle.retrieve()); ANA_MSG_DEBUG("Retrieved tool: " << m_JetCalibrationTool_handle); @@ -461,6 +472,11 @@ EL::StatusCode JetCalibrator :: execute () // } // } + if(isMC() && m_useLargeRTruthLabelingTool && m_JetTruthLabelingTool_handle.isInitialized()){ + // largeR jet truth labelling + m_JetTruthLabelingTool_handle->modify(*(calibJetsSC.first)); + } + // loop over available systematics - remember syst == "Nominal" --> baseline auto vecOutContainerNames = std::make_unique< std::vector< std::string > >(); diff --git a/Root/LinkDef.h b/Root/LinkDef.h index bb3d3d95b1..94ca0dfa22 100644 --- a/Root/LinkDef.h +++ b/Root/LinkDef.h @@ -108,7 +108,6 @@ #pragma link C++ class MinixAOD+; #pragma link C++ class OverlapRemover+; -#pragma link C++ class IsoCloseByCorr+; #pragma link C++ class TrigMatcher+; #pragma link C++ class TauJetMatching+; #pragma link C++ class Writer+; diff --git a/Root/METConstructor.cxx b/Root/METConstructor.cxx index 1efe836cd0..f74d6b2118 100644 --- a/Root/METConstructor.cxx +++ b/Root/METConstructor.cxx @@ -122,6 +122,9 @@ EL::StatusCode METConstructor :: initialize () if ( m_doPFlow ) { ANA_CHECK(m_metmaker_handle.setProperty("DoPFlow", true)); } + if ( m_doMuonPFlowBugfix ) { + ANA_CHECK(m_metmaker_handle.setProperty("DoMuonPFlowBugfix", true)); + } if ( !m_METWorkingPoint.empty() ){ ANA_CHECK(m_metmaker_handle.setProperty("JetSelection", m_METWorkingPoint)); } @@ -129,11 +132,9 @@ EL::StatusCode METConstructor :: initialize () ANA_MSG_DEBUG("Retrieved tool: " << m_metmaker_handle); ///////////// IMETSystematicsTool /////////////////// - if (!m_systConfigPrefix.empty()) { - ANA_CHECK(m_metSyst_handle.setProperty("ConfigPrefix", m_systConfigPrefix)); - } - if (!m_systConfigSoftTrkFile.empty()) { - ANA_CHECK(m_metSyst_handle.setProperty("ConfigSoftTrkFile", m_systConfigSoftTrkFile)); + if ( m_doPFlow ) { // do TST + ANA_CHECK(m_metSyst_handle.setProperty("ConfigPrefix", "METUtilities/run2_13TeV/")); + ANA_CHECK(m_metSyst_handle.setProperty("ConfigSoftTrkFile", "TrackSoftTerms-pflow.config")); } ANA_CHECK(m_metSyst_handle.retrieve()); ANA_MSG_DEBUG("Retrieved tool: " << m_metSyst_handle); @@ -147,7 +148,7 @@ EL::StatusCode METConstructor :: initialize () ANA_CHECK( m_metSignificance_handle.setProperty("SoftTermReso", m_significanceSoftTermReso) ); // For AFII samples - if ( isFastSim() ){ + if ( isFastSim() ){ ANA_MSG_INFO( "Setting simulation flavour to AFII"); ANA_CHECK( m_metSignificance_handle.setProperty("IsAFII", true)); } @@ -206,6 +207,8 @@ EL::StatusCode METConstructor :: execute () const xAOD::MissingETAssociationMap* metMap = 0; ANA_CHECK( HelperFunctions::retrieve(metMap, m_mapName, m_event, m_store, msg())); xAOD::MissingETAssociationHelper metHelper(metMap); + // Reset all the met map associations + metHelper.resetObjSelectionFlags(); std::vector::const_iterator sysListItr; auto vecOutContainerNames = std::make_unique< std::vector< std::string > >(); @@ -224,10 +227,8 @@ EL::StatusCode METConstructor :: execute () ANA_CHECK( HelperFunctions::retrieve(sysJetsNames, m_jetSystematics, 0, m_store, msg())); for ( auto systName : *sysJetsNames ) { - if (systName != "" && !(std::find(m_sysList.begin(), m_sysList.end(), CP::SystematicSet(systName)) != m_sysList.end())) { - m_sysList.push_back(CP::SystematicSet(systName)); - ANA_MSG_DEBUG("jet syst added is = "<< systName); - } + if (systName != "" && !(std::find(m_sysList.begin(), m_sysList.end(), CP::SystematicSet(systName)) != m_sysList.end())) m_sysList.push_back(CP::SystematicSet(systName)); + ANA_MSG_DEBUG("jet syst added is = "<< systName); } } @@ -237,10 +238,8 @@ EL::StatusCode METConstructor :: execute () ANA_CHECK( HelperFunctions::retrieve(sysElectronsNames, m_eleSystematics, 0, m_store, msg())); for ( auto systName : *sysElectronsNames ) { - if (systName != "" && !(std::find(m_sysList.begin(), m_sysList.end(), CP::SystematicSet(systName)) != m_sysList.end())) { - m_sysList.push_back(CP::SystematicSet(systName)); - ANA_MSG_DEBUG("ele syst added is = "<< systName); - } + if (systName != "" && !(std::find(m_sysList.begin(), m_sysList.end(), CP::SystematicSet(systName)) != m_sysList.end()) ) m_sysList.push_back(CP::SystematicSet(systName)); + ANA_MSG_DEBUG("ele syst added is = "<< systName); } } @@ -250,10 +249,8 @@ EL::StatusCode METConstructor :: execute () ANA_CHECK( HelperFunctions::retrieve(sysMuonsNames, m_muonSystematics, 0, m_store, msg())); for ( auto systName : *sysMuonsNames ) { - if (systName != "" && !(std::find(m_sysList.begin(), m_sysList.end(), CP::SystematicSet(systName)) != m_sysList.end())) { - m_sysList.push_back(CP::SystematicSet(systName)); - ANA_MSG_DEBUG("muon syst added is = "<< systName); - } + if (systName != "" && !(std::find(m_sysList.begin(), m_sysList.end(), CP::SystematicSet(systName)) != m_sysList.end())) m_sysList.push_back(CP::SystematicSet(systName)); + ANA_MSG_DEBUG("muon syst added is = "<< systName); } } @@ -263,10 +260,8 @@ EL::StatusCode METConstructor :: execute () ANA_CHECK( HelperFunctions::retrieve(sysTausNames, m_tauSystematics, 0, m_store, msg())); for ( auto systName : *sysTausNames ) { - if (systName != "" && !(std::find(m_sysList.begin(), m_sysList.end(), CP::SystematicSet(systName)) != m_sysList.end())) { - m_sysList.push_back(CP::SystematicSet(systName)); - ANA_MSG_DEBUG("tau syst added is = "<< systName); - } + if (systName != "" && !(std::find(m_sysList.begin(), m_sysList.end(), CP::SystematicSet(systName)) != m_sysList.end())) m_sysList.push_back(CP::SystematicSet(systName)); + ANA_MSG_DEBUG("tau syst added is = "<< systName); } } @@ -276,10 +271,8 @@ EL::StatusCode METConstructor :: execute () ANA_CHECK( HelperFunctions::retrieve(sysPhotonsNames, m_phoSystematics, 0, m_store, msg())); for ( auto systName : *sysPhotonsNames ) { - if (systName != "" && !(std::find(m_sysList.begin(), m_sysList.end(), CP::SystematicSet(systName)) != m_sysList.end())) { - m_sysList.push_back(CP::SystematicSet(systName)); - ANA_MSG_DEBUG("photon syst added is = "<< systName); - } + if (systName != "" && !(std::find(m_sysList.begin(), m_sysList.end(), CP::SystematicSet(systName)) != m_sysList.end())) m_sysList.push_back(CP::SystematicSet(systName)); + ANA_MSG_DEBUG("photon syst added is = "<< systName); } } @@ -302,9 +295,6 @@ EL::StatusCode METConstructor :: execute () vecOutContainerNames->push_back( systName ); - // Reset all the met map associations - metHelper.resetObjSelectionFlags(); - //create a met container, one for each syst auto newMet = std::make_unique(); auto metAuxCont = std::make_unique(); @@ -321,7 +311,7 @@ EL::StatusCode METConstructor :: execute () const xAOD::ElectronContainer* eleCont(0); std::string suffix = ""; if (sysElectronsNames && std::find(std::begin(*sysElectronsNames), std::end(*sysElectronsNames), systName) != std::end(*sysElectronsNames)) { - if (systName != "") ANA_MSG_DEBUG("doing electron systematics"); + ANA_MSG_DEBUG("doing electron systematics"); suffix = systName; } @@ -352,7 +342,7 @@ EL::StatusCode METConstructor :: execute () const xAOD::PhotonContainer* phoCont(0); std::string suffix = ""; if (sysPhotonsNames && std::find(std::begin(*sysPhotonsNames), std::end(*sysPhotonsNames), systName) != std::end(*sysPhotonsNames)) { - if (systName != "") ANA_MSG_DEBUG("doing photon systematics"); + ANA_MSG_DEBUG("doing photon systematics"); suffix = systName; } @@ -399,7 +389,7 @@ EL::StatusCode METConstructor :: execute () const xAOD::TauJetContainer* tauCont(0); std::string suffix = ""; if (sysTausNames && std::find(std::begin(*sysTausNames), std::end(*sysTausNames), systName) != std::end(*sysTausNames)) { - if (systName != "") ANA_MSG_DEBUG("doing tau systematics"); + ANA_MSG_DEBUG("doing tau systematics"); suffix = systName; } @@ -436,7 +426,7 @@ EL::StatusCode METConstructor :: execute () const xAOD::MuonContainer* muonCont(0); std::string suffix = ""; if (sysMuonsNames && std::find(std::begin(*sysMuonsNames), std::end(*sysMuonsNames), systName) != std::end(*sysMuonsNames)) { - if (systName != "") ANA_MSG_DEBUG("doing muon systematics"); + ANA_MSG_DEBUG("doing muon systematics"); suffix = systName; } @@ -470,7 +460,7 @@ EL::StatusCode METConstructor :: execute () const xAOD::JetContainer* jetCont(0); std::string suffix = ""; if (sysJetsNames && std::find(std::begin(*sysJetsNames), std::end(*sysJetsNames), systName) != std::end(*sysJetsNames)) { - if (systName != "") ANA_MSG_DEBUG("doing jet systematics"); + ANA_MSG_DEBUG("doing muon systematics"); suffix = systName; } @@ -517,7 +507,7 @@ EL::StatusCode METConstructor :: execute () if(!m_rebuildUsingTracksInJets && m_addSoftClusterTerms){ //get the soft cluster term, and applyCorrection - xAOD::MissingET * softClusMet = (*newMet)["SoftClus"]; + xAOD::MissingET * softClusMet = (*newMet)["SoftClusCore"]; //assert( softClusMet != 0); //check we retrieved the clust term if( isMC() && m_metSyst_handle->applyCorrection(*softClusMet, metHelper) != CP::CorrectionCode::Ok) { ANA_MSG_ERROR( "Could not apply correction to soft clus met !!!! "); @@ -577,6 +567,28 @@ EL::StatusCode METConstructor :: execute () ANA_MSG_DEBUG("storing met container : " << (m_outputContainer + systName)); ANA_MSG_DEBUG("storing Aux met container : "<< (m_outputContainer + systName + "Aux.")); + // Debug compare reference and recomputed MET + if ( m_msgLevel <= MSG::DEBUG ) { + const xAOD::MissingETContainer* oldMet(0); + ANA_CHECK( HelperFunctions::retrieve(oldMet, m_referenceMETContainer, m_event, m_store, msg()) ); + + ANA_MSG_DEBUG( ">>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + if ( !m_inputElectrons.empty() ) ANA_MSG_DEBUG( "RefEle: old=" << (*oldMet->find("RefEle"))->met() << " \tnew" << (*newMet->find("RefEle"))->met()); + if ( !m_inputPhotons.empty() ) ANA_MSG_DEBUG( "RefPhoton: old=" << (*oldMet->find("RefGamma"))->met() << " \tnew" << (*newMet->find("RefGamma"))->met()); + if ( !m_inputTaus.empty() ) ANA_MSG_DEBUG( "RefTau: old=" << (*oldMet->find("RefTau"))->met() << " \tnew" << (*newMet->find("RefTau"))->met()); + if ( !m_inputMuons.empty() ) ANA_MSG_DEBUG( "RefMuon: old=" << (*oldMet->find("Muons"))->met() << " \tnew" << (*newMet->find("Muons"))->met()); + ANA_MSG_DEBUG( "RefJet: old=" << (*oldMet->find("RefJet"))->met() << " \tnew" << (*newMet->find("RefJet"))->met()); + if ( m_addSoftClusterTerms ) { + ANA_MSG_DEBUG( "SoftClus: old=" << (*oldMet->find("SoftClus"))->met() << " \tnew" << (*newMet->find("SoftClus"))->met()); + } + ANA_MSG_DEBUG( "PVSoftTrk: old=" << (*oldMet->find("PVSoftTrk"))->met() << " \tnew" << (*newMet->find("PVSoftTrk"))->met()); + ANA_MSG_DEBUG( " "); + ANA_MSG_DEBUG( "FinalClus: old=" << (*oldMet->find("FinalClus"))->met() << " \tnew" << (*newMet->find("FinalClus"))->met()); + ANA_MSG_DEBUG( " >>>>> R=" << (*oldMet->find("FinalClus"))->met()/ (*newMet->find("FinalClus"))->met()); + ANA_MSG_INFO( "FinalTrk: old=" << (*oldMet->find("FinalTrk"))->met() << " \tnew" << (*newMet->find("FinalTrk"))->met()); + ANA_MSG_INFO( " >>>>> R=" << (*oldMet->find("FinalTrk"))->met()/ (*newMet->find("FinalTrk"))->met()); + } + // Store MET ANA_CHECK( m_store->record( std::move(newMet), (m_outputContainer + systName) )); ANA_CHECK( m_store->record( std::move(metAuxCont), (m_outputContainer + systName + "Aux."))); diff --git a/Root/MuonEfficiencyCorrector.cxx b/Root/MuonEfficiencyCorrector.cxx index b26772743a..c79458390c 100644 --- a/Root/MuonEfficiencyCorrector.cxx +++ b/Root/MuonEfficiencyCorrector.cxx @@ -141,7 +141,7 @@ EL::StatusCode MuonEfficiencyCorrector :: initialize () ANA_CHECK(checkToolStore(m_recoEffSF_tool_name)); const bool recoEffSFInstanceExists = asg::ToolStore::contains(m_recoEffSF_tool_name); - + // calling with only the first arg causes AnaToolHandle to use std::shared_ptr and return any already existing instance (aka making the tool "public") m_muRecoSF_tool = asg::AnaToolHandle("CP::MuonEfficiencyScaleFactors/"+m_recoEffSF_tool_name); @@ -155,7 +155,7 @@ EL::StatusCode MuonEfficiencyCorrector :: initialize () assert(m_muRecoSF_tool.isInitialized()); // only process systematics once per efficiency SF/WP - if(not recoEffSFInstanceExists) { + if(not recoEffSFInstanceExists) { // Add the chosen WP to the string labelling the vector decoration // m_outputSystNamesReco = m_outputSystNamesReco + "_Reco" + m_WorkingPointReco; @@ -190,7 +190,7 @@ EL::StatusCode MuonEfficiencyCorrector :: initialize () ANA_CHECK( checkToolStore(m_isoEffSF_tool_name)); const bool isoEffSFInstanceExists = asg::ToolStore::contains(m_isoEffSF_tool_name); - + // calling with only the first arg causes AnaToolHandle to use std::shared_ptr and return any already existing instance (aka making the tool "public") m_muIsoSF_tool = asg::AnaToolHandle("CP::MuonEfficiencyScaleFactors/"+m_isoEffSF_tool_name); // setProperty is ignored if tool is already configured (i.e. for isoEffSFInstanceExists == true) @@ -201,7 +201,7 @@ EL::StatusCode MuonEfficiencyCorrector :: initialize () } ANA_CHECK(m_muIsoSF_tool.retrieve()); assert(m_muIsoSF_tool.isInitialized()); - + // only process systematics once per efficiency SF/WP if(not isoEffSFInstanceExists){ @@ -241,7 +241,7 @@ EL::StatusCode MuonEfficiencyCorrector :: initialize () // calling with only the first arg causes AnaToolHandle to use std::shared_ptr and return any already existing instance (aka making the tool "public") m_muTrigSF_tool = asg::AnaToolHandle("CP::MuonTriggerScaleFactors/"+m_trigEffSF_tool_name ); - // setProperty is ignored if tool is already configured + // setProperty is ignored if tool is already configured if ( m_AllowZeroSF ) { ANA_MSG_WARNING( "m_AllowZeroSF is set to True. No errors will arise for runs missing required triggers!!!"); ANA_CHECK( m_muTrigSF_tool.setProperty("AllowZeroSF", m_AllowZeroSF )); @@ -249,7 +249,7 @@ EL::StatusCode MuonEfficiencyCorrector :: initialize () ANA_CHECK(m_muTrigSF_tool.setProperty("MuonQuality", m_WorkingPointReco )); ANA_CHECK(m_muTrigSF_tool.retrieve()); assert(m_muTrigSF_tool.isInitialized()); - + std::string token; std::istringstream ss(m_MuTrigLegs); while ( std::getline(ss, token, ',') ) { @@ -292,10 +292,10 @@ EL::StatusCode MuonEfficiencyCorrector :: initialize () ANA_CHECK( checkToolStore(m_TTVAEffSF_tool_name)); const bool TTVASFInstanceExists = asg::ToolStore::contains(m_TTVAEffSF_tool_name); - + // calling with only the first arg causes AnaToolHandle to use std::shared_ptr and return any already existing instance (aka making the tool "public") m_muTTVASF_tool = asg::AnaToolHandle("CP::MuonEfficiencyScaleFactors/"+m_TTVAEffSF_tool_name); - // setProperty is ignored if tool is already configured (i.e. for TTVASFInstanceExists == true) + // setProperty is ignored if tool is already configured (i.e. for TTVASFInstanceExists == true) ANA_CHECK( m_muTTVASF_tool.setProperty("WorkingPoint", m_WorkingPointTTVA )); if ( !m_overrideCalibRelease.empty() ) { ANA_MSG_WARNING("Overriding muon efficiency calibration release to " << m_overrideCalibRelease); @@ -703,8 +703,7 @@ EL::StatusCode MuonEfficiencyCorrector :: executeSF ( const xAOD::EventInfo* eve auto trig_it = trig.second; if (trig.first.find("2015")!=std::string::npos && run>284484) continue; - else if ((trig.first.find("2016")!=std::string::npos || trig.first.find("2017")!=std::string::npos || trig.first.find("2018")!=std::string::npos) && (run<=284484 || run >400000) ) continue; - else if (trig.first.find("2022")!=std::string::npos && run< 400000) continue; + else if ((trig.first.find("2016")!=std::string::npos || trig.first.find("2017")!=std::string::npos || trig.first.find("2018")!=std::string::npos) && run<=284484) continue; std::unique_ptr< std::vector< std::string > > sysVariationNamesTrig = nullptr; if ( writeSystNames ) sysVariationNamesTrig = std::make_unique< std::vector< std::string > >(); @@ -840,7 +839,7 @@ EL::StatusCode MuonEfficiencyCorrector :: executeSF ( const xAOD::EventInfo* eve ++idx; } // close muon loop - + // Get global trigger efficiency SF (using all muons) if(!m_usePerMuonTriggerSFs){ // Get SF diff --git a/Root/MuonSelector.cxx b/Root/MuonSelector.cxx index 3b8f982ec3..ce8230e607 100644 --- a/Root/MuonSelector.cxx +++ b/Root/MuonSelector.cxx @@ -293,48 +293,35 @@ EL::StatusCode MuonSelector :: initialize () // // ************************************** if( !( m_singleMuTrigChains.empty() && m_diMuTrigChains.empty() ) ) { + if( !isPHYS() ) { + // Grab the TrigDecTool from the ToolStore + if(!m_trigDecTool_handle.isUserConfigured()){ + ANA_MSG_FATAL("A configured " << m_trigDecTool_handle.typeAndName() << " must have been previously created! Are you creating one in xAH::BasicEventSelection?" ); + return EL::StatusCode::FAILURE; + } + ANA_CHECK( m_trigDecTool_handle.retrieve()); + ANA_MSG_DEBUG("Retrieved tool: " << m_trigDecTool_handle); - // grab the TrigDecTool from the ToolStore - if(!m_trigDecTool_handle.isUserConfigured()){ - ANA_MSG_FATAL("A configured " << m_trigDecTool_handle.typeAndName() << " must have been previously created! Are you creating one in xAH::BasicEventSelection?" ); - return EL::StatusCode::FAILURE; - } - ANA_CHECK( m_trigDecTool_handle.retrieve()); - ANA_MSG_DEBUG("Retrieved tool: " << m_trigDecTool_handle); - - // in AB we need to explicitly retrieve this tool, see https://twiki.cern.ch/twiki/bin/viewauth/Atlas/R22TriggerAnalysis - ANA_CHECK( m_scoreTool.retrieve()); + ANA_CHECK( m_scoreTool.retrieve()); - // Run3 got a new trigger navigation - if (m_useRun3navigation) { - m_trigMuonMatchTool_handle = asg::AnaToolHandle("Trig::R3MatchingTool/TrigR3MatchingTool"); + // everything went fine, let's initialise the tool! + m_trigMuonMatchTool_handle = asg::AnaToolHandle("Trig::MatchingTool/MatchingTool"); ANA_CHECK( m_trigMuonMatchTool_handle.setProperty( "TrigDecisionTool", m_trigDecTool_handle )); ANA_CHECK( m_trigMuonMatchTool_handle.setProperty( "ScoringTool", m_scoreTool )); ANA_CHECK( m_trigMuonMatchTool_handle.setProperty("OutputLevel", msg().level() )); ANA_CHECK( m_trigMuonMatchTool_handle.retrieve()); ANA_MSG_DEBUG("Retrieved tool: " << m_trigMuonMatchTool_handle); - } - // otherwise we have to configure the Run2-style navigation - else { - if( !isPHYS() ) { - m_trigMuonMatchTool_handle = asg::AnaToolHandle("Trig::MatchingTool/MatchingTool"); - ANA_CHECK( m_trigMuonMatchTool_handle.setProperty( "TrigDecisionTool", m_trigDecTool_handle )); - ANA_CHECK( m_trigMuonMatchTool_handle.setProperty( "ScoringTool", m_scoreTool )); - ANA_CHECK( m_trigMuonMatchTool_handle.setProperty("OutputLevel", msg().level() )); - ANA_CHECK( m_trigMuonMatchTool_handle.retrieve()); - ANA_MSG_DEBUG("Retrieved tool: " << m_trigMuonMatchTool_handle); - } - else { // For DAOD_PHYS samples - m_trigMuonMatchTool_handle = asg::AnaToolHandle("Trig::MatchFromCompositeTool/MatchFromCompositeTool"); - ANA_CHECK( m_trigMuonMatchTool_handle.setProperty( "OutputLevel", msg().level() )); - if (!m_trigInputPrefix.empty()){ - ANA_CHECK( m_trigMuonMatchTool_handle.setProperty( "InputPrefix", m_trigInputPrefix )); - ANA_CHECK( m_trigMuonMatchTool_handle.setProperty( "RemapBrokenLinks", true) ); - } - ANA_CHECK( m_trigMuonMatchTool_handle.retrieve()); - ANA_MSG_DEBUG("Retrieved tool: " << m_trigMuonMatchTool_handle); + } else { // For DAOD_PHYS samples + m_trigMuonMatchTool_handle = asg::AnaToolHandle("Trig::MatchFromCompositeTool/MatchFromCompositeTool"); + ANA_CHECK( m_trigMuonMatchTool_handle.setProperty( "OutputLevel", msg().level() )); + if (!m_trigInputPrefix.empty()){ + ANA_CHECK( m_trigMuonMatchTool_handle.setProperty( "InputPrefix", m_trigInputPrefix )); + ANA_CHECK( m_trigMuonMatchTool_handle.setProperty( "RemapBrokenLinks", true) ); } + ANA_CHECK( m_trigMuonMatchTool_handle.retrieve()); + ANA_MSG_DEBUG("Retrieved tool: " << m_trigMuonMatchTool_handle); } + } else { m_doTrigMatch = false; diff --git a/Root/OverlapRemover.cxx b/Root/OverlapRemover.cxx index a8854c9ae9..ae0e4b1b5a 100644 --- a/Root/OverlapRemover.cxx +++ b/Root/OverlapRemover.cxx @@ -480,7 +480,7 @@ EL::StatusCode OverlapRemover :: executeOR( const xAOD::ElectronContainer* inEl } } - if ( m_store->contains >(m_inContainerName_Jets) ) { + if ( m_store->contains >(m_inContainerName_Jets) || m_store->contains(m_inContainerName_Jets) ) { ANA_CHECK( HelperFunctions::retrieve(inJets, m_inContainerName_Jets, m_event, m_store, msg()) ); } else { nomContainerNotFound = true; @@ -488,7 +488,7 @@ EL::StatusCode OverlapRemover :: executeOR( const xAOD::ElectronContainer* inEl } if ( m_usePhotons ) { - if ( m_store->contains >(m_inContainerName_Photons) ) { + if ( m_store->contains >(m_inContainerName_Photons) || m_store->contains(m_inContainerName_Photons) ) { ANA_CHECK( HelperFunctions::retrieve(inPhotons, m_inContainerName_Photons, m_event, m_store, msg()) ); } else { nomContainerNotFound = true; diff --git a/Root/ParticlePIDManager.cxx b/Root/ParticlePIDManager.cxx index 3b7bcf3a7c..2eb539bcd7 100644 --- a/Root/ParticlePIDManager.cxx +++ b/Root/ParticlePIDManager.cxx @@ -3,6 +3,7 @@ ANA_MSG_SOURCE(msgPIDManager, "PIDManager") ElectronLHPIDManager :: ElectronLHPIDManager ( std::string WP, bool debug ) : + m_asgElectronLikelihoodTool_VeryLooseNP(nullptr), m_asgElectronLikelihoodTool_VeryLoose(nullptr), m_asgElectronLikelihoodTool_Loose(nullptr), m_asgElectronLikelihoodTool_LooseBL(nullptr), @@ -18,6 +19,7 @@ ElectronLHPIDManager :: ElectronLHPIDManager ( std::string WP, bool debug ) : m_debug = debug; /* fill the multimap with WPs and corresponding tools */ + std::pair < std::string, AsgElectronLikelihoodTool* > veryloosenp = std::make_pair( std::string("VeryLooseNoPix"), m_asgElectronLikelihoodTool_VeryLooseNP ); std::pair < std::string, AsgElectronLikelihoodTool* > veryloose = std::make_pair( std::string("VeryLoose"), m_asgElectronLikelihoodTool_VeryLoose ); std::pair < std::string, AsgElectronLikelihoodTool* > loose = std::make_pair( std::string("Loose"), m_asgElectronLikelihoodTool_Loose ); std::pair < std::string, AsgElectronLikelihoodTool* > loosebl = std::make_pair( std::string("LooseBL"), m_asgElectronLikelihoodTool_LooseBL ); @@ -31,7 +33,7 @@ ElectronLHPIDManager :: ElectronLHPIDManager ( std::string WP, bool debug ) : m_allWPTools.insert(veryloose); m_allWPAuxDecors.insert("VeryLoose"); m_allWPTools.insert(loose); m_allWPAuxDecors.insert("Loose"); - m_allWPTools.insert(loosebl); m_allWPAuxDecors.insert("LooseBL"); + m_allWPTools.insert(loosebl); m_allWPAuxDecors.insert("Loose"); //Not saved in DAODs, so use Loose decision m_allWPTools.insert(medium); m_allWPAuxDecors.insert("Medium"); m_allWPTools.insert(tight); m_allWPAuxDecors.insert("Tight"); @@ -43,6 +45,7 @@ ElectronLHPIDManager :: ElectronLHPIDManager ( std::string WP, bool debug ) : ElectronLHPIDManager :: ~ElectronLHPIDManager() { + if ( m_asgElectronLikelihoodTool_VeryLooseNP ) { delete m_asgElectronLikelihoodTool_VeryLooseNP; m_asgElectronLikelihoodTool_VeryLooseNP = nullptr; } if ( m_asgElectronLikelihoodTool_VeryLoose ) { delete m_asgElectronLikelihoodTool_VeryLoose; m_asgElectronLikelihoodTool_VeryLoose = nullptr; } if ( m_asgElectronLikelihoodTool_Loose ) { delete m_asgElectronLikelihoodTool_Loose; m_asgElectronLikelihoodTool_Loose = nullptr; } if ( m_asgElectronLikelihoodTool_LooseBL ) { delete m_asgElectronLikelihoodTool_LooseBL; m_asgElectronLikelihoodTool_LooseBL = nullptr; } @@ -59,8 +62,12 @@ ElectronLHPIDManager :: ~ElectronLHPIDManager() StatusCode ElectronLHPIDManager :: setupWPs( bool configTools, std::string selector_name) { using namespace msgPIDManager; +<<<<<<< HEAD std::string selectedWP = m_selectedWP; if (m_selectedWP.find("NoPix") != std::string::npos) selectedWP = m_selectedWP.substr(0, m_selectedWP.size()-5) + "LLP"; +======= + const std::string selectedWP = ( m_selectedWP == "LooseBL" ) ? "Loose" : m_selectedWP; +>>>>>>> 5a838f69 (Merge TLA-specific xAODAnaHelpers modifications from personal branches into central Dijet+ISR TLA branch) HelperClasses::EnumParser selectedWP_parser; unsigned int selectedWP_enum = static_cast( selectedWP_parser.parseEnum(selectedWP) ); @@ -135,7 +142,7 @@ StatusCode ElectronLHPIDManager :: setDecorations( const xAOD::Electron* electro const std::string ElectronLHPIDManager :: getSelectedWP () { - const std::string WP = m_selectedWP; + const std::string WP = ( m_selectedWP == "LooseAndBLayer" ) ? "Loose" : m_selectedWP; return WP; } diff --git a/Root/PhotonCalibrator.cxx b/Root/PhotonCalibrator.cxx index 3a6ff71afe..b1e44a4471 100644 --- a/Root/PhotonCalibrator.cxx +++ b/Root/PhotonCalibrator.cxx @@ -154,7 +154,7 @@ EL::StatusCode PhotonCalibrator :: initialize () if(m_randomRunNumber>0) ANA_CHECK( m_EgammaCalibrationAndSmearingTool->setProperty("randomRunNumber", m_randomRunNumber)); //Backwards compatibility - if (m_useAFII || m_useAF3) + if (m_useAFII) m_forceFastSim = true; if ( isFastSim() ){ ANA_MSG_INFO( "Setting simulation flavour to Fast Sim"); @@ -259,7 +259,7 @@ EL::StatusCode PhotonCalibrator :: initialize () } else { dataType = PATCore::ParticleDataType::Full; } - ANA_MSG_DEBUG("isSimulation=" << ( isMC() ? "Y" : "N") << " Simulation type: " << ( isFastSim() ? ( isAF3() ? "AF3" : "AFII") : "FullSim" ) << " selected dataType=" << dataType ); + ANA_MSG_DEBUG("isSimulation=" << ( isMC() ? "Y" : "N") << " isAFII=" << ( isFastSim() ? "Y" : "N" ) << " selected dataType=" << dataType ); // photon efficiency correction tool diff --git a/Root/PhotonContainer.cxx b/Root/PhotonContainer.cxx index 7c204d1bb5..a47c0f1ac8 100644 --- a/Root/PhotonContainer.cxx +++ b/Root/PhotonContainer.cxx @@ -13,18 +13,18 @@ PhotonContainer::PhotonContainer(const std::string& name, const std::string& det if(m_infoSwitch.m_isolation || std::find(m_infoSwitch.m_isoCones.begin(), m_infoSwitch.m_isoCones.end(), "20") != m_infoSwitch.m_isoCones.end()){ m_ptcone20 = new std::vector (); - m_ptvarcone20 = new std::vector (); + //m_ptvarcone20 = new std::vector (); m_topoetcone20 = new std::vector (); m_isIsolated_Cone20 = new std::vector (); } if(m_infoSwitch.m_isolation || std::find(m_infoSwitch.m_isoCones.begin(), m_infoSwitch.m_isoCones.end(), "30") != m_infoSwitch.m_isoCones.end()){ m_ptcone30 = new std::vector (); - m_ptvarcone30 = new std::vector (); + //m_ptvarcone30 = new std::vector (); m_topoetcone30 = new std::vector (); } if(m_infoSwitch.m_isolation || std::find(m_infoSwitch.m_isoCones.begin(), m_infoSwitch.m_isoCones.end(), "40") != m_infoSwitch.m_isoCones.end()){ m_ptcone40 = new std::vector (); - m_ptvarcone40 = new std::vector (); + //m_ptvarcone40 = new std::vector (); m_topoetcone40 = new std::vector (); m_isIsolated_Cone40CaloOnly = new std::vector (); m_isIsolated_Cone40 = new std::vector (); @@ -76,18 +76,18 @@ PhotonContainer::~PhotonContainer() if(m_infoSwitch.m_isolation || std::find(m_infoSwitch.m_isoCones.begin(), m_infoSwitch.m_isoCones.end(), "20") != m_infoSwitch.m_isoCones.end()){ delete m_ptcone20; - delete m_ptvarcone20; + //delete m_ptvarcone20; delete m_topoetcone20; delete m_isIsolated_Cone20; } if(m_infoSwitch.m_isolation || std::find(m_infoSwitch.m_isoCones.begin(), m_infoSwitch.m_isoCones.end(), "30") != m_infoSwitch.m_isoCones.end()){ delete m_ptcone30; - delete m_ptvarcone30; + //delete m_ptvarcone30; delete m_topoetcone30; } if(m_infoSwitch.m_isolation || std::find(m_infoSwitch.m_isoCones.begin(), m_infoSwitch.m_isoCones.end(), "40") != m_infoSwitch.m_isoCones.end()){ delete m_ptcone40; - delete m_ptvarcone40; + //delete m_ptvarcone40; delete m_topoetcone40; delete m_isIsolated_Cone40; delete m_isIsolated_Cone40CaloOnly; @@ -140,18 +140,18 @@ void PhotonContainer::setTree(TTree *tree) if(m_infoSwitch.m_isolation || std::find(m_infoSwitch.m_isoCones.begin(), m_infoSwitch.m_isoCones.end(), "20") != m_infoSwitch.m_isoCones.end()){ connectBranch(tree, "ptcone20", &m_ptcone20 ); - connectBranch(tree, "ptvarcone20", &m_ptvarcone20 ); + //connectBranch(tree, "ptvarcone20", &m_ptvarcone20 ); connectBranch(tree, "topoetcone20", &m_topoetcone20 ); connectBranch (tree, "isIsolated_Cone20", &m_isIsolated_Cone20 ); } if(m_infoSwitch.m_isolation || std::find(m_infoSwitch.m_isoCones.begin(), m_infoSwitch.m_isoCones.end(), "30") != m_infoSwitch.m_isoCones.end()){ connectBranch(tree, "ptcone30", &m_ptcone30 ); - connectBranch(tree, "ptvarcone30", &m_ptvarcone30 ); + //connectBranch(tree, "ptvarcone30", &m_ptvarcone30 ); connectBranch(tree, "topoetcone30", &m_topoetcone30 ); } if(m_infoSwitch.m_isolation || std::find(m_infoSwitch.m_isoCones.begin(), m_infoSwitch.m_isoCones.end(), "40") != m_infoSwitch.m_isoCones.end()){ connectBranch(tree, "ptcone40", &m_ptcone40 ); - connectBranch(tree, "ptvarcone40", &m_ptvarcone40 ); + //connectBranch(tree, "ptvarcone40", &m_ptvarcone40 ); connectBranch(tree, "topoetcone40", &m_topoetcone40 ); connectBranch (tree, "isIsolated_Cone40CaloOnly", &m_isIsolated_Cone40CaloOnly ); connectBranch (tree, "isIsolated_Cone40", &m_isIsolated_Cone40 ); @@ -211,17 +211,17 @@ void PhotonContainer::updateParticle(uint idx, Photon& photon) if(m_infoSwitch.m_isolation || std::find(m_infoSwitch.m_isoCones.begin(), m_infoSwitch.m_isoCones.end(), "20") != m_infoSwitch.m_isoCones.end()){ photon.ptcone20 = m_ptcone20 ->at(idx); photon.topoetcone20 = m_topoetcone20 ->at(idx); - photon.ptvarcone20 = m_ptvarcone20 ->at(idx); + //photon.ptvarcone20 = m_ptvarcone20 ->at(idx); photon.isIsolated_Cone20 = m_isIsolated_Cone20 ->at(idx); } if(m_infoSwitch.m_isolation || std::find(m_infoSwitch.m_isoCones.begin(), m_infoSwitch.m_isoCones.end(), "30") != m_infoSwitch.m_isoCones.end()){ photon.ptcone30 = m_ptcone30 ->at(idx); photon.topoetcone30 = m_topoetcone30 ->at(idx); - photon.ptvarcone30 = m_ptvarcone30 ->at(idx); + //photon.ptvarcone30 = m_ptvarcone30 ->at(idx); } if(m_infoSwitch.m_isolation || std::find(m_infoSwitch.m_isoCones.begin(), m_infoSwitch.m_isoCones.end(), "40") != m_infoSwitch.m_isoCones.end()){ photon.ptcone40 = m_ptcone40 ->at(idx); - photon.ptvarcone40 = m_ptvarcone40 ->at(idx); + //photon.ptvarcone40 = m_ptvarcone40 ->at(idx); photon.topoetcone40 = m_topoetcone40 ->at(idx); photon.isIsolated_Cone40CaloOnly = m_isIsolated_Cone40CaloOnly ->at(idx); photon.isIsolated_Cone40 = m_isIsolated_Cone40 ->at(idx); @@ -272,18 +272,18 @@ void PhotonContainer::setBranches(TTree *tree) if(m_infoSwitch.m_isolation || std::find(m_infoSwitch.m_isoCones.begin(), m_infoSwitch.m_isoCones.end(), "20") != m_infoSwitch.m_isoCones.end()){ setBranch(tree, "ptcone20", m_ptcone20 ); - setBranch(tree, "ptvarcone20", m_ptvarcone20 ); + //setBranch(tree, "ptvarcone20", m_ptvarcone20 ); setBranch(tree, "topoetcone20", m_topoetcone20 ); setBranch (tree, "isIsolated_Cone20", m_isIsolated_Cone20 ); } if(m_infoSwitch.m_isolation || std::find(m_infoSwitch.m_isoCones.begin(), m_infoSwitch.m_isoCones.end(), "30") != m_infoSwitch.m_isoCones.end()){ setBranch(tree, "ptcone30", m_ptcone30 ); - setBranch(tree, "ptvarcone30", m_ptvarcone30 ); + //setBranch(tree, "ptvarcone30", m_ptvarcone30 ); setBranch(tree, "topoetcone30", m_topoetcone30 ); } if(m_infoSwitch.m_isolation || std::find(m_infoSwitch.m_isoCones.begin(), m_infoSwitch.m_isoCones.end(), "40") != m_infoSwitch.m_isoCones.end()){ setBranch(tree, "ptcone40", m_ptcone40 ); - setBranch(tree, "ptvarcone40", m_ptvarcone40 ); + //setBranch(tree, "ptvarcone40", m_ptvarcone40 ); setBranch(tree, "topoetcone40", m_topoetcone40 ); setBranch (tree, "isIsolated_Cone40CaloOnly", m_isIsolated_Cone40CaloOnly ); setBranch (tree, "isIsolated_Cone40", m_isIsolated_Cone40 ); @@ -343,18 +343,18 @@ void PhotonContainer::clear() if(m_infoSwitch.m_isolation || std::find(m_infoSwitch.m_isoCones.begin(), m_infoSwitch.m_isoCones.end(), "20") != m_infoSwitch.m_isoCones.end()){ m_ptcone20 -> clear() ; - m_ptvarcone20 -> clear() ; + //m_ptvarcone20 -> clear() ; m_topoetcone20 -> clear() ; m_isIsolated_Cone20 -> clear() ; } if(m_infoSwitch.m_isolation || std::find(m_infoSwitch.m_isoCones.begin(), m_infoSwitch.m_isoCones.end(), "30") != m_infoSwitch.m_isoCones.end()){ m_ptcone30 -> clear() ; - m_ptvarcone30 -> clear() ; + //m_ptvarcone30 -> clear() ; m_topoetcone30 -> clear() ; } if(m_infoSwitch.m_isolation || std::find(m_infoSwitch.m_isoCones.begin(), m_infoSwitch.m_isoCones.end(), "40") != m_infoSwitch.m_isoCones.end()){ m_ptcone40 -> clear() ; - m_ptvarcone40 -> clear() ; + //m_ptvarcone40 -> clear() ; m_topoetcone40 -> clear(); m_isIsolated_Cone40CaloOnly-> clear(); m_isIsolated_Cone40 -> clear() ; @@ -420,19 +420,19 @@ void PhotonContainer::FillPhoton( const xAOD::IParticle* particle ) if(m_infoSwitch.m_isolation || std::find(m_infoSwitch.m_isoCones.begin(), m_infoSwitch.m_isoCones.end(), "20") != m_infoSwitch.m_isoCones.end()){ m_ptcone20 -> push_back( photon->isolation( xAOD::Iso::ptcone20 ) / m_units ); - m_ptvarcone20 -> push_back( photon->isolation( xAOD::Iso::ptvarcone20 ) / m_units ); + //m_ptvarcone20 -> push_back( photon->isolation( xAOD::Iso::ptvarcone20 ) / m_units ); m_topoetcone20 -> push_back( photon->isolation( xAOD::Iso::topoetcone20) / m_units ); static SG::AuxElement::Accessor isIsoCone20Acc ("isIsolated_FixedCutLoose"); safeFill(photon, isIsoCone20Acc, m_isIsolated_Cone20, -1); } if(m_infoSwitch.m_isolation || std::find(m_infoSwitch.m_isoCones.begin(), m_infoSwitch.m_isoCones.end(), "30") != m_infoSwitch.m_isoCones.end()){ m_ptcone30 -> push_back( photon->isolation( xAOD::Iso::ptcone30 ) / m_units ); - m_ptvarcone30 -> push_back( photon->isolation( xAOD::Iso::ptvarcone30 ) / m_units ); + //m_ptvarcone30 -> push_back( photon->isolation( xAOD::Iso::ptvarcone30 ) / m_units ); m_topoetcone30 -> push_back( photon->isolation( xAOD::Iso::topoetcone30) / m_units ); } if(m_infoSwitch.m_isolation || std::find(m_infoSwitch.m_isoCones.begin(), m_infoSwitch.m_isoCones.end(), "40") != m_infoSwitch.m_isoCones.end()){ m_ptcone40 -> push_back( photon->isolation( xAOD::Iso::ptcone40 ) / m_units ); - m_ptvarcone40 -> push_back( photon->isolation( xAOD::Iso::ptvarcone40 ) / m_units ); + //m_ptvarcone40 -> push_back( photon->isolation( xAOD::Iso::ptvarcone40 ) / m_units ); m_topoetcone40 -> push_back( photon->isolation( xAOD::Iso::topoetcone40) / m_units ); static SG::AuxElement::Accessor isIsoCone40CaloOnlyAcc ("isIsolated_FixedCutTightCaloOnly"); diff --git a/docs/Algorithms.rst b/docs/Algorithms.rst index d40ec96ea6..1d8a7e4c59 100644 --- a/docs/Algorithms.rst +++ b/docs/Algorithms.rst @@ -94,13 +94,11 @@ with the decision of the cuts. A new xAOD::JetCollection can be made from the ones passing the cuts. The JVT selection is OFF by default, it can be turned ON with ```m_doJVT```. -The default algorithm is NNJvt. If another algorithm is needed, use corresponding index for the enum here: https://acode-browser1.usatlas.bnl.gov/lxr/source/athena/PhysicsAnalysis/Interfaces/JetAnalysisInterfaces/JetAnalysisInterfaces/IJetJvtEfficiency.h#0022 (note: this link points to the latest r22 version, i.e. master, if a release is used, please check the corresponding enum for the given release: https://gitlab.cern.ch/atlas/athena/-/tags?search=release%2F22.2&sort=updated_desc) The default JVT working point is ```FixedEffPt```, it can be changed with ```m_WorkingPointJVT```. JVT is no longer recalculated in JetCalibrator, it is now done in JetSelector. It can be disabled by setting ```m_recalculateJvtScores``` to ```false```. Furthermore, the JVT algorithm is now NNJvt (default for R22). - JetHists and JetHistsAlgo ~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/index.rst b/docs/index.rst index 63fb2d8ea5..c2e5e82a78 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -22,11 +22,6 @@ The xAOD analysis framework, born out of ProofAna...or not. Welcome to the xAODAnaHelpers wiki! This is an xAOD Analysis Framework built for Run II of ATLAS. -Supported releases ------------------- - -xAODAnaHelpers supports 21 and 22 releases. This documentation is for R22, please follow this `link `_ to see the documentation for R21. - .. _Versions: Latest Version diff --git a/python/cli_options.py b/python/cli_options.py index b6c93d3611..a99ae97aba 100755 --- a/python/cli_options.py +++ b/python/cli_options.py @@ -62,12 +62,6 @@ "default": False, "help": "Running on AFII", }, - "isAF3": { - "action": "store_true", - "dest": "is_AF3", - "default": False, - "help": "Running on AF3", - }, "extraOptions": { "dest": "extra_options", "metavar": "[param=val]", diff --git a/xAODAnaHelpers/Algorithm.h b/xAODAnaHelpers/Algorithm.h index 298ed3cabe..935549c89f 100644 --- a/xAODAnaHelpers/Algorithm.h +++ b/xAODAnaHelpers/Algorithm.h @@ -165,22 +165,6 @@ namespace xAH { */ int m_isFastSim = -1; - /** - @rst - This stores the isAF3 decision, and can also be used to override at the algorithm level to force analyzing FastSim with AF3 or not. - - ===== ======================================================== - Value Meaning - ===== ======================================================== - -1 Default, use Metadata object to determine if AF3 FastSim or not - 0 Treat the input as FullSim or AFII - 1 Treat the input as FastSim with AF3 - ===== ======================================================== - - @endrst - */ - int m_isAF3 = -1; - /** Flag to use Run 3 trigger navigation (true), or Run 2 navigation (false)*/ bool m_useRun3navigation = false; @@ -196,7 +180,6 @@ namespace xAH { /** Backwards compatibility, same as m_forceFastSim */ bool m_setAFII = false; - bool m_setAF3 = false; protected: @@ -249,9 +232,6 @@ namespace xAH { */ bool isFastSim(); - /** If the name includes ATLFASTII or ATLFAST3 then set to AFII or AF3, if deemed fullSim then FS else leave as empty string and complain */ - bool isAF3(); - /** Determines if using DAOD_PHYS or not. */ bool isPHYS(); diff --git a/xAODAnaHelpers/BasicEventSelection.h b/xAODAnaHelpers/BasicEventSelection.h index c6d1aaec5f..70b001a895 100644 --- a/xAODAnaHelpers/BasicEventSelection.h +++ b/xAODAnaHelpers/BasicEventSelection.h @@ -48,6 +48,11 @@ class BasicEventSelection : public xAH::Algorithm { public: + + // Dijet+ISR TLA specific options + /// @brief Flag to determine when running on TLA data for different handling of TDT + bool m_isTLAData = false; + // Sample type settings /// @brief Protection when running on truth xAOD bool m_truthLevelOnly = false; @@ -56,7 +61,6 @@ class BasicEventSelection : public xAH::Algorithm SimulationFlavour will be determined from the sample MetaData, unless AFII or FS is explicitely requested with the following flags. @endrst */ bool m_setAFII = false; - bool m_setAF3 = false; bool m_setFS = false; // GRL @@ -94,6 +98,9 @@ class BasicEventSelection : public xAH::Algorithm std::string m_prwActualMu2017File = ""; /// @brief actualMu configuration file for the MC16e campaign (2018). Added to the PRW tool when using PRW autoconfiguration. std::string m_prwActualMu2018File = ""; + /// @brief actualMu configuration file for the MC23 campaign (2022). Added to the PRW tool when using PRW autoconfiguration. + std::string m_prwActualMu2022File = ""; + /** @rst mc16(acd) to bypass the automatic campaign determination from AMI, several campaigns can be separated by a comma. Only used diff --git a/xAODAnaHelpers/HistogramManager.h b/xAODAnaHelpers/HistogramManager.h index 5c92ed7112..9bcddab052 100644 --- a/xAODAnaHelpers/HistogramManager.h +++ b/xAODAnaHelpers/HistogramManager.h @@ -243,7 +243,8 @@ class HistogramManager { */ void fillHist(const std::string& histName, double value, double weight); void fillHist(const std::string& histName, double valueX, double valueY, double weight); - + void fillHist(const std::string& histName, double valueX, double valueY, double valueZ, double weight); + void fillProfile(const std::string& histName, double valueX, double valueY, double weight); private: /** diff --git a/xAODAnaHelpers/JetCalibrator.h b/xAODAnaHelpers/JetCalibrator.h index 7b02d8c561..038f1e3ed5 100644 --- a/xAODAnaHelpers/JetCalibrator.h +++ b/xAODAnaHelpers/JetCalibrator.h @@ -21,7 +21,7 @@ #include "JetCPInterfaces/ICPJetUncertaintiesTool.h" #include "JetInterface/IJetSelector.h" #include "JetCPInterfaces/IJetTileCorrectionTool.h" -// #include "ParticleJetTools/JetTruthLabelingTool.h" +#include "ParticleJetTools/JetTruthLabelingTool.h" #include "xAODCore/ShallowCopy.h" // algorithm wrapper @@ -57,6 +57,18 @@ class JetCalibrator : public xAH::Algorithm /// @brief Write systematics names to metadata bool m_writeSystToMetadata = false; + + /// @brief whether to run HLT jet re-calibration + bool m_recalibrateHLTJets = false; + /// @brief vertex container name to use for HLT jet re-calibration + std::string m_HLTVertexContainerName = "HLT_IDVertex_FS"; + /// @brief HLT average mu decoration on EventInfo after formatting + std::string m_HLTAvgMuDecor = "EventInfo.AvgMu"; + /// @brief location of the HLT NPV on EventInfo object (e.g. EventInfo.NPV) + /// this defaults to an empty string and is only configured in JetCalibrationTool + /// when a non-empty string is provided + std::string m_EvtInfoHLTNPVDecor = ""; + /// @brief config for JetCalibrationTool ConfigDir, set it to override tool defaults std::string m_calibConfigDir = ""; /// @brief config for JetCalibrationTool for Data @@ -146,8 +158,8 @@ class JetCalibrator : public xAH::Algorithm asg::AnaToolHandle m_JetUncertaintiesTool_handle {"JetUncertaintiesTool" , this}; //! asg::AnaToolHandle m_pseudodataJERTool_handle {"PseudodataJERTool" , this}; //! asg::AnaToolHandle m_JetCleaningTool_handle {"JetCleaningTool" , this}; //! - // asg::AnaToolHandle m_JetTileCorrectionTool_handle{"JetTileCorrectionTool", this}; //! - // asg::AnaToolHandle m_JetTruthLabelingTool_handle {"JetTruthLabelingTool" , this}; //! + asg::AnaToolHandle m_JetTileCorrectionTool_handle{"JetTileCorrectionTool", this}; //! + asg::AnaToolHandle m_JetTruthLabelingTool_handle {"JetTruthLabelingTool" , this}; //! std::vector> m_AllJetCleaningTool_handles; //! std::vector m_decisionNames; //! diff --git a/xAODAnaHelpers/JetSelector.h b/xAODAnaHelpers/JetSelector.h index 63a07995f8..dec396d9f0 100644 --- a/xAODAnaHelpers/JetSelector.h +++ b/xAODAnaHelpers/JetSelector.h @@ -181,7 +181,7 @@ class JetSelector : public xAH::Algorithm */ std::string m_SFFileJVT = "DummySFs.root"; // Due to a recent change in the JetJvtEfficiency tool, we need to explicitly turn on the dummy SF mode by given this string std::string m_outputSystNamesJVT = "JetJvtEfficiency_JVTSyst"; - /// @brief Tagging algorithm to be used to veto PU jets in central region - default in R22 is NNJvt. If another algorithm is needed, use corresponding index for the enum here: https://acode-browser1.usatlas.bnl.gov/lxr/source/athena/PhysicsAnalysis/Interfaces/JetAnalysisInterfaces/JetAnalysisInterfaces/IJetJvtEfficiency.h#0022 (note: this link points to the latest r22 version, i.e. master, if a release is used, please check the corresponding enum for the given release: https://gitlab.cern.ch/atlas/athena/-/tags?search=release%2F22.2&sort=updated_desc) + /// @brief Tagging algorithm to be used to veto PU jets in central region - default in R22 is NNJvt int m_JvtTaggingAlg = CP::JvtTagger::NNJvt; /// @brief Do re-calculation of NNJvt - scores need to be re-evaluated in case jet pt changed w.r.t. derivation bool m_recalculateJvtScores = true; diff --git a/xAODAnaHelpers/METConstructor.h b/xAODAnaHelpers/METConstructor.h index faa6210988..418870ea04 100644 --- a/xAODAnaHelpers/METConstructor.h +++ b/xAODAnaHelpers/METConstructor.h @@ -28,11 +28,10 @@ class METConstructor : public xAH::Algorithm public: // configuration variables + std::string m_referenceMETContainer = "MET_Reference_AntiKt4LCTopo"; std::string m_mapName = "METAssoc_AntiKt4LCTopo"; std::string m_coreName = "MET_Core_AntiKt4LCTopo"; std::string m_outputContainer = "NewRefFinal"; - std::string m_systConfigPrefix = "METUtilities/R22_PreRecs"; - std::string m_systConfigSoftTrkFile = "TrackSoftTerms-pflow.config"; std::string m_inputJets = ""; std::string m_inputElectrons = ""; std::string m_inputPhotons = ""; @@ -53,7 +52,10 @@ class METConstructor : public xAH::Algorithm std::string m_fJVTdecorName = "passFJVT"; /// @brief To turn on p-flow MET calculation set m_doPFlow to true - bool m_doPFlow = true; + bool m_doPFlow = false; + + /// @brief Set DoMuonPFlowBugfix property + bool m_doMuonPFlowBugfix = false; /// @brief Name of MET Working Point (defines the JetSelection applied in METMaker) std::string m_METWorkingPoint = ""; diff --git a/xAODAnaHelpers/ParticlePIDManager.h b/xAODAnaHelpers/ParticlePIDManager.h index 38cd00ed8f..511c9d7227 100644 --- a/xAODAnaHelpers/ParticlePIDManager.h +++ b/xAODAnaHelpers/ParticlePIDManager.h @@ -57,6 +57,7 @@ class ElectronLHPIDManager std::set m_allWPAuxDecors; std::set m_validWPs; + AsgElectronLikelihoodTool* m_asgElectronLikelihoodTool_VeryLooseNP; AsgElectronLikelihoodTool* m_asgElectronLikelihoodTool_VeryLoose; AsgElectronLikelihoodTool* m_asgElectronLikelihoodTool_Loose; AsgElectronLikelihoodTool* m_asgElectronLikelihoodTool_LooseBL; diff --git a/xAODAnaHelpers/PhotonCalibrator.h b/xAODAnaHelpers/PhotonCalibrator.h index 3d1739b18c..3ad79e9e53 100644 --- a/xAODAnaHelpers/PhotonCalibrator.h +++ b/xAODAnaHelpers/PhotonCalibrator.h @@ -55,7 +55,6 @@ class PhotonCalibrator : public xAH::Algorithm std::string m_outputAlgoSystNames = "PhotonCalibrator_Syst"; bool m_useAFII = false; //For backwards compatibility - bool m_useAF3 = false; //For backwards compatibility float m_systVal = 0.0; std::string m_systName = ""; diff --git a/xAODAnaHelpers/TauCalibrator.h b/xAODAnaHelpers/TauCalibrator.h index b6d1120d94..f2bc68b670 100644 --- a/xAODAnaHelpers/TauCalibrator.h +++ b/xAODAnaHelpers/TauCalibrator.h @@ -26,7 +26,6 @@ class TauCalibrator : public xAH::Algorithm std::string m_generator = ""; std::string m_campaign = ""; bool m_setAFII = false; - bool m_setAF3 = false; bool m_skipTruthMatchCheck = false;