Commit f03e6d96 authored by Christopher Andrew Garner's avatar Christopher Andrew Garner Committed by Nils Erik Krumnack
Browse files

Large-R PseudoData Update and JER Fix

parent 09210637
......@@ -70,6 +70,9 @@ namespace top {
declareProperty("JetCalibrationTool", m_jetCalibrationTool);
declareProperty("JetCalibrationToolLargeR", m_jetCalibrationToolLargeR);
declareProperty("JetUncertaintiesToolLargeR", m_jetUncertaintiesToolLargeR);
declareProperty("JetUncertaintiesToolLargeRPseudoData", m_jetUncertaintiesToolLargeRPseudoData);
declareProperty("JetUncertaintiesTool", m_jetUncertaintiesTool);
declareProperty("JetUncertaintiesToolPseudoData", m_jetUncertaintiesToolPseudoData);
declareProperty("FFJetSmearingTool", m_FFJetSmearingTool);
......@@ -484,18 +487,35 @@ namespace top {
std::string MC_type = "MC16";
configDir = m_config->largeRJetUncertaintiesConfigDir();
//This has zero impact on the JES uncertainties, but controls how the JER uncertainties (currently only for small-R
// jets) are applied
bool JERisMC = true;
if(m_config->largeRJESJMSConfig() != "UFOSDMass"){
m_jetUncertaintiesToolLargeR
= setupJetUncertaintiesTool("JetUncertaintiesToolLargeR",
jetCalibrationNameLargeR, MC_type, JERisMC,
configDir + "/R10_" + largeRJESJERJMS_unc_config + ".config", nullptr, "", calibArea);
jetCalibrationNameLargeR,
MC_type,
m_config->isMC(),
configDir + "/R10_" + largeRJESJERJMS_unc_config + ".config",
nullptr,
"",
calibArea);
// setup the large-R pseudodata tool when required
if (m_config->isMC() && m_config->doLargeRPseudodataJER()) {
m_jetUncertaintiesToolLargeRPseudoData
= setupJetUncertaintiesTool("JetUncertaintiesToolLargeRPseudoData",
jetCalibrationNameLargeR,
MC_type,
false, // treat MC as data
configDir + "/R10_" + largeRJESJERJMS_unc_config + ".config",
nullptr,
"",
calibArea);
}
if (!m_config->isSystNominal(m_config->systematics()))
m_FFJetSmearingTool = setupFFJetSmearingTool(calibChoice,configDir + "/R10_" + largeRJMR_unc_config + ".config");
}
return StatusCode::SUCCESS;
......
......@@ -84,6 +84,7 @@ namespace top {
ToolHandle<IJetCalibrationTool> m_jetCalibrationToolLargeR;
ToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesToolLargeR;
ToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesToolLargeRPseudoData;
ToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesTool;
ToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesToolPseudoData;
......
......@@ -244,9 +244,9 @@ namespace top {
"JMS_frozen (The shape and magnitude of the uncertainties at m/pT = 0.25 are also used for m/pT > 0.25),"
"JMS_scaled (The magnitude of the uncertainties at m/pT = 0.25 was scaled linearly with increasing m/pT)",
"None");
registerParameter("LargeRSysts_TreatMCasPseudodata",
"If set to True, treat MC as pseudo-data; only apply JER smearing, and only when FullJER/AllJER is specified with LargeRJetUncertainties_JESJERJMS_NPModel.",
"False",{"True", "False"});
registerParameter("DoLargeRPseudodataJER",
"If set to True, produce additional JER smearing systematics treating MC as pseudo-data, provided FullJER or AllJER is specified with LargeRJetUncertainties_JESJERJMS_NPModel.",
"True",{"True", "False"});
registerParameter("JetCalibSequence", "Jet calibaration sequence.", "GSC", {"GSC", "JMS"});
registerParameter("AllowJMSforAFII", "Enable use of UNSUPPORTED small-R jet JMS calibration use on AFII samples.", "False", {"True", "False"});
registerParameter("StoreJetTruthLabels", "Flag to store truth labels for jets - True (default) or False", "True");
......
......@@ -274,7 +274,7 @@ namespace top {
m_doMultipleJES(false),
m_jetJERSmearingModel("Simple"),
m_jetJMSOption("None"),
m_largeRSysts_TreatMCasPseudodata(false),
m_doLargeRPseudodataJER(false),
m_jetCalibSequence("GSC"),
m_allowSmallRJMSforAFII(false),
m_jetStoreTruthLabels("True"),
......@@ -1376,10 +1376,10 @@ namespace top {
this->jetUncertainties_QGHistPatterns(settings->value("JetUncertainties_QGHistPatterns"));
this->jetJERSmearingModel(settings->value("JetJERSmearingModel"));
this->jetJMSOption(settings->value("JetJMSOption"));
if (settings->value("LargeRSysts_TreatMCasPseudodata") == "False") {
this->largeRSysts_TreatMCasPseudodata(false);
} else if (settings->value("LargeRSysts_TreatMCasPseudodata") == "True") {
this->largeRSysts_TreatMCasPseudodata(true);
if (settings->value("DoLargeRPseudodataJER") == "False") {
this->doLargeRPseudodataJER(false);
} else if (settings->value("DoLargeRPseudodataJER") == "True") {
this->doLargeRPseudodataJER(true);
}
this->jetCalibSequence(settings->value("JetCalibSequence"));
this->allowSmallRJMSforAFII(settings->value("AllowJMSforAFII") == "True");
......
......@@ -1496,13 +1496,13 @@ namespace top {
inline virtual const std::string& jetJMSOption() const {return m_jetJMSOption;}
inline virtual void largeRSysts_TreatMCasPseudodata(const bool& b) {
inline virtual void doLargeRPseudodataJER(const bool& b) {
if (!m_configFixed) {
m_largeRSysts_TreatMCasPseudodata = b;
m_doLargeRPseudodataJER = b;
}
}
inline virtual bool largeRSysts_TreatMCasPseudodata() const {return m_largeRSysts_TreatMCasPseudodata;}
inline virtual bool doLargeRPseudodataJER() const {return m_doLargeRPseudodataJER;}
inline virtual void jetCalibSequence(const std::string& s) {
if (!m_configFixed) {
......@@ -2501,7 +2501,7 @@ namespace top {
bool m_doMultipleJES;
std::string m_jetJERSmearingModel; // Full or Simple
std::string m_jetJMSOption; // None, JMS_frozen or JMS_scaled
bool m_largeRSysts_TreatMCasPseudodata; // True or False
bool m_doLargeRPseudodataJER; // True or False
std::string m_jetCalibSequence; // GCC or JMS
bool m_allowSmallRJMSforAFII; // JMS is not supported on AFII so we crash, unless people override this option
bool m_jetStoreTruthLabels; // True or False
......
......@@ -26,7 +26,8 @@ namespace top {
m_config(nullptr),
m_doFull_JER(false),
m_doFull_JER_Pseudodata(false),
m_doOnly_JER_largeR(false),
m_doFull_JER_largeR(false),
m_doFull_JER_largeR_Pseudodata(false),
m_isMC(false),
m_doMultipleJES(false),
......@@ -46,6 +47,7 @@ namespace top {
m_jetUncertaintiesToolReducedNPScenario3("JetUncertaintiesToolReducedNPScenario3"),
m_jetUncertaintiesToolReducedNPScenario4("JetUncertaintiesToolReducedNPScenario4"),
m_jetUncertaintiesToolLargeR("JetUncertaintiesToolLargeR"),
m_jetUncertaintiesToolLargeRPseudoData("JetUncertaintiesToolLargeRPseudoData"),
m_FFJetSmearingTool("FFJetSmearingTool"),
m_jetUpdateJvtTool("JetUpdateJvtTool"),
......@@ -59,7 +61,8 @@ namespace top {
m_systMap_ReducedNPScenario2(),
m_systMap_ReducedNPScenario3(),
m_systMap_ReducedNPScenario4(),
m_systMap_LargeR() {
m_systMap_LargeR(),
m_systMap_LargeR_JERPseudo() {
declareProperty("config", m_config);
declareProperty("JetCalibrationTool", m_jetCalibrationTool);
......@@ -72,6 +75,7 @@ namespace top {
declareProperty("JetUncertaintiesToolReducedNPScenario3", m_jetUncertaintiesToolReducedNPScenario3);
declareProperty("JetUncertaintiesToolReducedNPScenario4", m_jetUncertaintiesToolReducedNPScenario4);
declareProperty("JetUncertaintiesToolLargeR", m_jetUncertaintiesToolLargeR);
declareProperty("JetUncertaintiesToolLargeRPseudoData", m_jetUncertaintiesToolLargeRPseudoData);
declareProperty("FFJetSmearingTool", m_FFJetSmearingTool);
declareProperty("JetUpdateJvtTool", m_jetUpdateJvtTool);
......@@ -97,6 +101,9 @@ namespace top {
if(m_config->largeRJESJMSConfig() != "UFOSDMass"){
top::check(m_jetUncertaintiesToolLargeR.retrieve(),
"Failed to retrieve JetUncertaintiesToolLargeR");
if (m_config->isMC() && m_config->doLargeRPseudodataJER())
top::check(m_jetUncertaintiesToolLargeRPseudoData.retrieve(),
"Failed to retrieve JetUncertaintiesToolLargeRPseudoData");
if (!m_config->isSystNominal(m_config->systematics()))
top::check(m_FFJetSmearingTool.retrieve(),
"Failed to retrieve FFJetSmearingTool");
......@@ -115,13 +122,13 @@ namespace top {
else m_doFull_JER_Pseudodata = false;
///-- Large-R JER (Pseudo-)Data Smearing Config --///
if ((!m_config->isMC() || m_config->largeRSysts_TreatMCasPseudodata())
&& (m_config->largeRJetUncertainties_NPModel()).find("_SimpleJER_") == std::string::npos) m_doOnly_JER_largeR = true;
else m_doOnly_JER_largeR = false;
bool skip_systs = false;
if (m_config->largeRSysts_TreatMCasPseudodata()
&& (m_config->largeRJetUncertainties_NPModel()).find("_SimpleJER_") != std::string::npos) skip_systs = true;
if (!m_config->isMC() && (m_config->largeRJetUncertainties_NPModel()).find("_SimpleJER_") == std::string::npos)
m_doFull_JER_largeR = true;
else m_doFull_JER_largeR = false;
if (m_config->isMC() && m_config->doLargeRPseudodataJER() && (m_config->largeRJetUncertainties_NPModel()).find("_SimpleJER_") == std::string::npos)
m_doFull_JER_largeR_Pseudodata = true;
else m_doFull_JER_largeR_Pseudodata = false;
m_isMC = m_config->isMC();
m_doMultipleJES = m_config->doMultipleJES();
......@@ -220,7 +227,7 @@ namespace top {
///-- Large-R JES/JER/JMS/JMR systematics --///
CP::SystematicSet largeRsysts;
if ((m_config->isMC() || m_doOnly_JER_largeR) && m_config->useLargeRJets()) {
if ((m_isMC || m_doFull_JER_largeR) && m_config->useLargeRJets()) {
if (m_config->largeRJESJMSConfig() == "CombMass") { // Only CombMass is supported for large-R JES/JER/JMS/JMR systematics at the moment
largeRsysts.insert(m_jetUncertaintiesToolLargeR->recommendedSystematics());
if (!m_config->isSystNominal(m_config->systematics()))
......@@ -270,9 +277,11 @@ namespace top {
// add the merged set of systematics for large-R jets including the tagging SF systs
if ((m_config->isMC() || m_doOnly_JER_largeR) && (m_config->useLargeRJets()) && (!skip_systs)) {
if ((m_config->isMC() || m_doFull_JER_largeR) && m_config->useLargeRJets()) {
std::string allNPlargeR("");
addSystematics(systLargeR, largeRsysts, m_systMap_LargeR, allNPlargeR, true, m_doOnly_JER_largeR, false);
addSystematics(systLargeR, largeRsysts, m_systMap_LargeR, allNPlargeR, true, m_doFull_JER_largeR, false);
if (m_doFull_JER_largeR_Pseudodata)
addSystematics(systLargeR, largeRsysts, m_systMap_LargeR_JERPseudo, allNPlargeR, true, true, true);
}
///-- Large R jet substructure --///
......@@ -394,10 +403,13 @@ namespace top {
// tag calibrated (nominal) jets -- the tagging information will be available
// for systematically-shifted shallow copies as well
top::check(tagNominalLargeRJets(), "Failed to tag large-R jets");
if (m_isMC || m_doOnly_JER_largeR) {
if (m_isMC || m_doFull_JER_largeR) {
top::check(applyTaggingSFSystematic(),"Failed to apply large-R tagging SFs syst.");
top::check(applySystematic(m_jetUncertaintiesToolLargeR, m_systMap_LargeR,
true), "Failed to apply large-R syst.");
if (m_doFull_JER_largeR_Pseudodata)
top::check(applySystematic(m_jetUncertaintiesToolLargeRPseudoData, m_systMap_LargeR_JERPseudo,
true), "Failed to apply large-R pseudodata JER.");
}
}
......
......@@ -113,7 +113,8 @@ namespace top {
std::shared_ptr<top::TopConfig> m_config;
bool m_doFull_JER;
bool m_doFull_JER_Pseudodata;
bool m_doOnly_JER_largeR;
bool m_doFull_JER_largeR;
bool m_doFull_JER_largeR_Pseudodata;
bool m_isMC;
bool m_doMultipleJES;
bool m_do_fjvt = false;
......@@ -136,6 +137,7 @@ namespace top {
ToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesToolReducedNPScenario4;
ToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesToolLargeR;
ToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesToolLargeRPseudoData;
std::unordered_map<std::string, ToolHandle<ICPJetUncertaintiesTool> > m_tagSFuncertTool;
std::unordered_map<std::string, std::vector<CP::SystematicSet>> m_tagSFUncorrelatedSystematics; // Uncertainties name fo
std::unordered_map<std::string, std::vector<std::string>> m_tagSFSysNames;
......@@ -160,6 +162,7 @@ namespace top {
systMap m_systMap_ReducedNPScenario3;
systMap m_systMap_ReducedNPScenario4;
systMap m_systMap_LargeR;
systMap m_systMap_LargeR_JERPseudo;
typedef std::unordered_map<CP::SystematicSet, CP::SystematicSet>::const_iterator Itr;
......
Markdown is supported
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