Commit 4049a3f5 authored by John Kenneth Anders's avatar John Kenneth Anders Committed by Nils Erik Krumnack
Browse files

Removing TCC Jet functionality from SUSYTools & Edits to Large-R tagging

parent 15881dee
......@@ -61,6 +61,11 @@ namespace ST {
const static SG::AuxElement::Decorator<char> dec_passDRcut("passDRcut");
const static SG::AuxElement::ConstAccessor<char> acc_passDRcut("passDRcut");
const static SG::AuxElement::Decorator<int> dec_wtagged("wtagged");
const static SG::AuxElement::Decorator<int> dec_ztagged("ztagged");
const static SG::AuxElement::Decorator<int> dec_toptagged("toptagged");
StatusCode SUSYObjDef_xAOD::GetJets(xAOD::JetContainer*& copy, xAOD::ShallowAuxContainer*& copyaux, bool recordSG, const std::string& jetkey, const xAOD::JetContainer* containerToBeCopied)
{
if (!m_tool_init) {
......@@ -290,19 +295,8 @@ namespace ST {
// Truth Labeling (MC only)
if (!isData()) m_jetTruthLabelingTool->modifyJet(*jet);
//
ATH_CHECK( this->FillJet(*jet, true, true, true) );
ATH_CHECK( this->FillJet(*jet, true, true, doLargeRdecorations) );
//...
const static SG::AuxElement::Decorator<int> dec_wtagged("wtagged");
const static SG::AuxElement::Decorator<int> dec_ztagged("ztagged");
const static SG::AuxElement::Decorator<int> dec_toptagged("toptagged");
dec_wtagged(*jet) = -1;
dec_ztagged(*jet) = -1;
dec_toptagged(*jet) = -1;
if (doLargeRdecorations) {
if (!m_WtagConfig.empty()) dec_wtagged(*jet) = m_WTaggerTool->tag(*jet);
if (!m_ZtagConfig.empty()) dec_ztagged(*jet) = m_ZTaggerTool->tag(*jet);
if (!m_ToptagConfig.empty()) dec_toptagged(*jet) = m_TopTaggerTool->tag(*jet);
}
// For OR, selected if it passed cuts
if ( acc_baseline(*jet) ){
dec_selected(*jet) = 1;
......@@ -385,7 +379,7 @@ namespace ST {
return StatusCode::SUCCESS;
}
StatusCode SUSYObjDef_xAOD::FillJet(xAOD::Jet& input, bool doCalib, bool isFat, bool isTCC) {
StatusCode SUSYObjDef_xAOD::FillJet(xAOD::Jet& input, bool doCalib, bool isFat, bool doLargeRdecorations) {
ATH_MSG_VERBOSE( "Starting FillJet on jet with pt=" << input.pt() );
ATH_MSG_VERBOSE( "jet (pt,eta,phi) before calibration " << input.pt() << " " << input.eta() << " " << input.phi() );
......@@ -405,10 +399,20 @@ namespace ST {
dec_bjet_jetunc(input) = false;
dec_btag_weight(input) = -999.;
dec_wtagged(input) = -1;
dec_ztagged(input) = -1;
dec_toptagged(input) = -1;
if (doLargeRdecorations) {
if (!m_WtagConfig.empty()) dec_wtagged(input) = m_WTaggerTool->tag(input);
if (!m_ZtagConfig.empty()) dec_ztagged(input) = m_ZTaggerTool->tag(input);
if (!m_ToptagConfig.empty()) dec_toptagged(input) = m_TopTaggerTool->tag(input);
}
// If a user hasn't specified an uncertainty config, then the below tools will be empty
// for large R jets
if (!m_WTagjetUncertaintiesTool.empty() && !m_WTagUncConfig.empty() && !m_WtagConfig.empty()){
if (!m_WTagjetUncertaintiesTool.empty() && !m_WTagUncConfig.empty() && !m_WtagConfig.empty() && doLargeRdecorations){
CP::CorrectionCode result = m_WTagjetUncertaintiesTool->applyCorrection(input);
switch (result) {
case CP::CorrectionCode::Error:
......@@ -425,7 +429,7 @@ namespace ST {
ATH_MSG_DEBUG( "No valid large-R W-tagged fat jet uncertainty, but FillJet called with a fat jet. Skipping uncertainties." );
}
if (!m_ZTagjetUncertaintiesTool.empty() && !m_ZTagUncConfig.empty() && !m_ZtagConfig.empty()){
if (!m_ZTagjetUncertaintiesTool.empty() && !m_ZTagUncConfig.empty() && !m_ZtagConfig.empty() && doLargeRdecorations){
CP::CorrectionCode result = m_ZTagjetUncertaintiesTool->applyCorrection(input);
switch (result) {
case CP::CorrectionCode::Error:
......@@ -443,7 +447,7 @@ namespace ST {
}
if (!m_TopTagjetUncertaintiesTool.empty() && !m_TopTagUncConfig.empty() && !m_ToptagConfig.empty()){
if (!m_TopTagjetUncertaintiesTool.empty() && !m_TopTagUncConfig.empty() && !m_ToptagConfig.empty() && doLargeRdecorations){
CP::CorrectionCode result = m_TopTagjetUncertaintiesTool->applyCorrection(input);
switch (result) {
case CP::CorrectionCode::Error:
......@@ -477,28 +481,11 @@ namespace ST {
} else {
ATH_MSG_DEBUG( "No valid fat jet uncertainty, but FillJet called with a fat jet. Skipping uncertainties." );
}
// for TCC jets
if (!m_TCCjetUncertaintiesTool.empty() && isTCC){
CP::CorrectionCode result = m_TCCjetUncertaintiesTool->applyCorrection(input);
switch (result) {
case CP::CorrectionCode::Error:
ATH_MSG_ERROR( "Failed to apply TCC jet scale uncertainties.");
return StatusCode::FAILURE;
//break;
case CP::CorrectionCode::OutOfValidityRange:
ATH_MSG_VERBOSE( "No valid pt/eta/m range for TCC jet scale uncertainties. ");
break;
default:
break;
}
} else {
ATH_MSG_DEBUG( "No valid TCC jet uncertainty, but FillJet called with a TCC jet. Skipping uncertainties." );
}
return StatusCode::SUCCESS;
return StatusCode::SUCCESS;
}
ATH_MSG_VERBOSE( "jet (pt,eta,phi) after calibration " << input.pt() << " " << input.eta() << " " << input.phi() );
//central jvt
......@@ -534,7 +521,7 @@ namespace ST {
}
}
}
if(m_jetUncertaintiesPDsmearing){
if ( (input.pt() > m_jetPt) || (input.pt() > 15e3) ) {
if(!isFat && m_currentSyst.name().find("__2") != std::string::npos){
......@@ -592,7 +579,7 @@ namespace ST {
return StatusCode::SUCCESS;
}
StatusCode SUSYObjDef_xAOD::FillTrackJet(xAOD::Jet& input) {
ATH_MSG_VERBOSE( "Starting FillTrackJet on jet with pt=" << input.pt() );
......
......@@ -108,7 +108,6 @@ SUSYObjDef_xAOD::SUSYObjDef_xAOD( const std::string& name )
m_badJetCut(""),
m_fatJetUncConfig(""),
m_fatJetUncVars(""),
m_TCCJetUncConfig(""),
m_WTagUncConfig(""),
m_ZTagUncConfig(""),
m_TopTagUncConfig(""),
......@@ -293,7 +292,6 @@ SUSYObjDef_xAOD::SUSYObjDef_xAOD( const std::string& name )
m_metJetSelection(""),
m_fatJets(""),
m_TCCJets(""),
//
m_currentSyst(),
m_EG_corrModel(""),
......@@ -306,7 +304,6 @@ SUSYObjDef_xAOD::SUSYObjDef_xAOD( const std::string& name )
m_jetUncertaintiesTool(""),
m_jetUncertaintiesPDSmearTool(""),
m_fatjetUncertaintiesTool(""),
m_TCCjetUncertaintiesTool(""),
m_jetCleaningTool(""),
m_jetJvtUpdateTool(""),
m_jetFwdJvtTool(""),
......@@ -493,8 +490,6 @@ SUSYObjDef_xAOD::SUSYObjDef_xAOD( const std::string& name )
declareProperty( "JetJMSCalib", m_JMScalib );
declareProperty( "JetLargeRcollection", m_fatJets );
declareProperty( "JetTCCcollection", m_TCCJets );
//BTAGGING
declareProperty( "BtagTagger", m_BtagTagger);
declareProperty( "BtagWPOR", m_orBtagWP); //the one used in the Overlap Removal
......@@ -608,7 +603,6 @@ SUSYObjDef_xAOD::SUSYObjDef_xAOD( const std::string& name )
//LargeR uncertainties config, as from https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/JetUncertainties2016PrerecLargeR#Understanding_which_configuratio
declareProperty( "JetLargeRuncConfig", m_fatJetUncConfig );
declareProperty( "JetLargeRuncVars", m_fatJetUncVars );
declareProperty( "JetTCCuncConfig", m_TCCJetUncConfig );
declareProperty( "JetWtaggerConfig", m_WtagConfig );
declareProperty( "JetZtaggerConfig", m_ZtagConfig );
declareProperty( "JetWZTaggerCalibArea", m_WZTaggerCalibArea );
......@@ -634,7 +628,6 @@ SUSYObjDef_xAOD::SUSYObjDef_xAOD( const std::string& name )
m_jetUncertaintiesTool.declarePropertyFor( this, "JetUncertaintiesTool", "The JetUncertaintiesTool" );
m_jetUncertaintiesPDSmearTool.declarePropertyFor( this, "JetPDSmearUncertaintiesTool", "The JetPDSmearUncertaintiesTool" );
m_fatjetUncertaintiesTool.declarePropertyFor( this, "FatJetUncertaintiesTool", "The JetUncertaintiesTool for large-R jets" );
m_TCCjetUncertaintiesTool.declarePropertyFor( this, "TCCJetUncertaintiesTool", "The JetUncertaintiesTool for TCC jets" );
m_WTagjetUncertaintiesTool.declarePropertyFor( this, "WJetUncertaintiesTool", "The JetUncertaintiesTool for large-R W-tagged jets" );
m_ZTagjetUncertaintiesTool.declarePropertyFor( this, "ZJetUncertaintiesTool", "The JetUncertaintiesTool for large-R Z-tagged jets" );
m_TopTagjetUncertaintiesTool.declarePropertyFor( this, "TopJetUncertaintiesTool", "The JetUncertaintiesTool for large-R Top-tagged jets" );
......@@ -1408,8 +1401,6 @@ StatusCode SUSYObjDef_xAOD::readConfig()
configFromFile(m_fatJets, "Jet.LargeRcollection", rEnv, "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets"); // set to "None" to turn off large jets
configFromFile(m_fatJetUncConfig, "Jet.LargeRuncConfig", rEnv, "rel21/Spring2019/R10_GlobalReduction.config"); // https://twiki.cern.ch/twiki/bin/view/AtlasProtected/JetUncertaintiesRel21Moriond2018LargeR
configFromFile(m_fatJetUncVars, "Jet.LargeRuncVars", rEnv, "default"); // do all if not specified
configFromFile(m_TCCJets, "Jet.TCCcollection", rEnv, "AntiKt10TrackCaloClusterTrimmedPtFrac5SmallR20Jets"); // set to "None" to turn off TCC jets
configFromFile(m_TCCJetUncConfig, "Jet.TCCuncConfig", rEnv, "rel21/Summer2019/R10_Scale_TCC_all.config"); // https://twiki.cern.ch/twiki/bin/view/AtlasProtected/JetUncertaintiesRel21Summer2019TCC
configFromFile(m_WtagConfig, "Jet.WtaggerConfig", rEnv, "SmoothedInclWTagger_AntiKt10LCTopoTrimmed_FixedSignalEfficiency50_SUSYOpt_MC16_20210129.dat");
configFromFile(m_ZtagConfig, "Jet.ZtaggerConfig", rEnv, "SmoothedContainedZTagger_AntiKt10TrackCaloClusterTrimmed_MaxSignificance_3Var_MC16d_20190410.dat");
configFromFile(m_WZTaggerCalibArea, "Jet.WZTaggerCalibArea", rEnv, "SmoothedWZTaggers/Rel21/");
......@@ -2024,14 +2015,6 @@ CP::SystematicCode SUSYObjDef_xAOD::applySystematicVariation( const CP::Systemat
ATH_MSG_VERBOSE("Configured (Fat)JetUncertaintiesTool for systematic var. " << systConfig.name() );
}
}
if (!m_TCCjetUncertaintiesTool.empty()) {
CP::SystematicCode ret = m_TCCjetUncertaintiesTool->applySystematicVariation(systConfig);
if ( ret != CP::SystematicCode::Ok) {
ATH_MSG_VERBOSE("Cannot configure (TCC)JetUncertaintiesTool for systematic var. " << systConfig.name() );
} else {
ATH_MSG_VERBOSE("Configured (TCC)JetUncertaintiesTool for systematic var. " << systConfig.name() );
}
}
if (!m_jetJvtEfficiencyTool.empty()) {
CP::SystematicCode ret = m_jetJvtEfficiencyTool->applySystematicVariation(systConfig);
......@@ -2432,12 +2415,6 @@ ST::SystInfo SUSYObjDef_xAOD::getSystInfo(const CP::SystematicVariation& sys) co
sysInfo.affectsType = SystObjType::Jet;
}
}
if (!m_TCCjetUncertaintiesTool.empty()) {
if ( m_TCCjetUncertaintiesTool->isAffectedBySystematic( CP::SystematicVariation(sys.basename(), CP::SystematicVariation::CONTINUOUS) ) ) {
sysInfo.affectsKinematics = true;
sysInfo.affectsType = SystObjType::Jet;
}
}
if (!m_WTagjetUncertaintiesTool.empty()) {
if ( m_WTagjetUncertaintiesTool->isAffectedBySystematic( CP::SystematicVariation(sys.basename(), CP::SystematicVariation::CONTINUOUS) ) ) {
......
......@@ -415,24 +415,6 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit()
ATH_CHECK( m_TopTagjetUncertaintiesTool.retrieve() );
} else if (m_TopTagjetUncertaintiesTool.isUserConfigured()) ATH_CHECK(m_TopTagjetUncertaintiesTool.retrieve());
// Initialise jet uncertainty tool for TCC jets
// https://twiki.cern.ch/twiki/bin/view/AtlasProtected/JetUncertaintiesRel21Summer2019TCC
if (!m_TCCjetUncertaintiesTool.isUserConfigured() && !m_TCCJets.empty() && !m_TCCJetUncConfig.empty()) {
toolName = "JetUncertaintiesTool_" + m_TCCJets;
m_TCCjetUncertaintiesTool.setTypeAndName("JetUncertaintiesTool/"+toolName);
std::string TCCjetcoll(m_TCCJets);
if (TCCjetcoll.size()>3) TCCjetcoll = TCCjetcoll.substr(0,TCCjetcoll.size()-4); //remove "Jets" suffix
ATH_CHECK( m_TCCjetUncertaintiesTool.setProperty("JetDefinition", TCCjetcoll) );
ATH_CHECK( m_TCCjetUncertaintiesTool.setProperty("MCType", "MC16") );
ATH_CHECK( m_TCCjetUncertaintiesTool.setProperty("IsData", isData()) );
ATH_CHECK( m_TCCjetUncertaintiesTool.setProperty("ConfigFile", m_TCCJetUncConfig) );
if (m_jetUncertaintiesCalibArea != "default") ATH_CHECK( m_TCCjetUncertaintiesTool.setProperty("CalibArea", m_jetUncertaintiesCalibArea) );
ATH_CHECK( m_TCCjetUncertaintiesTool.setProperty("OutputLevel", this->msg().level()) );
ATH_CHECK( m_TCCjetUncertaintiesTool.retrieve() );
} else if (m_TCCjetUncertaintiesTool.isUserConfigured()) ATH_CHECK( m_TCCjetUncertaintiesTool.retrieve() );
// tagger SF and uncertainties
// https://twiki.cern.ch/twiki/bin/view/AtlasProtected/BoostedJetTaggingRecommendationFullRun2
......
......@@ -217,7 +217,7 @@ namespace ST {
// Apply the correction on a modifyable object
virtual StatusCode FillMuon(xAOD::Muon& input, const float ptcut, const float etacut) = 0;
virtual StatusCode FillJet(xAOD::Jet& input, const bool doCalib = true, const bool isFat = false, const bool isTCC = false) = 0;
virtual StatusCode FillJet(xAOD::Jet& input, const bool doCalib = true, const bool isFat = false, const bool doLargeRdecorations = false) = 0;
virtual StatusCode FillTrackJet(xAOD::Jet& input) = 0;
virtual StatusCode FillTau(xAOD::TauJet& input) = 0;
virtual StatusCode FillElectron(xAOD::Electron& input, const float etcut, const float etacut) = 0;
......
......@@ -143,7 +143,7 @@ namespace ST {
void setDataSource(int source);
// Apply the correction on a modifyable object
StatusCode FillJet(xAOD::Jet& input, const bool doCalib = true, bool isFat = false, bool isTCC = false) override final;
StatusCode FillJet(xAOD::Jet& input, const bool doCalib = true, bool isFat = false, bool doLargeRdecorations = false) override final;
StatusCode FillTrackJet(xAOD::Jet& input) override final;
StatusCode FillTau(xAOD::TauJet& input) override final;
StatusCode FillMuon(xAOD::Muon& input, const float ptcut, const float etacut) override final;
......@@ -485,7 +485,6 @@ namespace ST {
std::string m_fatJetUncConfig;
std::string m_fatJetUncVars;
std::string m_TCCJetUncConfig;
std::string m_WTagUncConfig;
std::string m_ZTagUncConfig;
std::string m_TopTagUncConfig;
......@@ -718,7 +717,6 @@ namespace ST {
std::string m_defaultJets;
std::string m_defaultTrackJets;
std::string m_fatJets;
std::string m_TCCJets;
std::string m_defaultTruthJets;
CP::SystematicSet m_defaultSyst = CP::SystematicSet();
......@@ -738,7 +736,6 @@ namespace ST {
asg::AnaToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesTool;
asg::AnaToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesPDSmearTool;
asg::AnaToolHandle<ICPJetUncertaintiesTool> m_fatjetUncertaintiesTool;
asg::AnaToolHandle<ICPJetUncertaintiesTool> m_TCCjetUncertaintiesTool;
asg::AnaToolHandle<IJetSelector> m_jetCleaningTool;
asg::AnaToolHandle<IJetUpdateJvt> m_jetJvtUpdateTool;
asg::AnaToolHandle<IJetModifier> m_jetFwdJvtTool;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment