Commit 3dae7272 authored by Oliver Majersky's avatar Oliver Majersky Committed by Nils Erik Krumnack
Browse files

Enable JMS calibration for small-R jets in AnalysisTop

parent a712a6f7
......@@ -40,24 +40,35 @@ namespace top {
m_jetAntiKt4_MCFS_ConfigFile("JES_MC16Recommendation_Consolidated_EMTopo_Apr2019_Rel21.config"),
m_jetAntiKt4_MCFS_CalibSequence("JetArea_Residual_EtaJES_GSC_Smear"),
m_jetAntiKt4_Data_JMS_ConfigFile("JES_JMS_MC16Recommendation_Consolidated_data_only_EMTopo_Sep2019_Rel21.config"),
m_jetAntiKt4_Data_JMS_CalibSequence("JetArea_Residual_EtaJES_GSC_JMS_Insitu"),
m_jetAntiKt4_MCFS_JMS_ConfigFile("JES_JMS_MC16Recommendation_Consolidated_MC_only_EMTopo_July2019_Rel21.config"),
m_jetAntiKt4_MCFS_JMS_CalibSequence("JetArea_Residual_EtaJES_GSC_Smear_JMS"),
m_jetAntiKt4_MCAFII_ConfigFile("JES_MC16Recommendation_AFII_EMTopo_Apr2019_Rel21.config"),
m_jetAntiKt4_MCAFII_CalibSequence("JetArea_Residual_EtaJES_GSC_Smear"),
m_jetAntiKt4_MCAFII_PFlow_ConfigFile("JES_MC16Recommendation_AFII_PFlow_Apr2019_Rel21.config"),
m_jetAntiKt4_MCAFII_PFlow_CalibSequence("JetArea_Residual_EtaJES_GSC_Smear"),
m_jetAntiKt4_Data_PFlow_ConfigFile("JES_MC16Recommendation_Consolidated_PFlow_Apr2019_Rel21.config"),
m_jetAntiKt4_Data_PFlow_CalibSequence("JetArea_Residual_EtaJES_GSC_Insitu"),
m_jetAntiKt4_PFlow_MCFS_ConfigFile("JES_MC16Recommendation_Consolidated_PFlow_Apr2019_Rel21.config"),
m_jetAntiKt4_PFlow_MCFS_CalibSequence("JetArea_Residual_EtaJES_GSC_Smear"),
m_jetAntiKt4_Data_PFlow_ConfigFile("JES_MC16Recommendation_Consolidated_PFlow_Apr2019_Rel21.config"),
m_jetAntiKt4_Data_PFlow_CalibSequence("JetArea_Residual_EtaJES_GSC_Insitu") {
m_jetAntiKt4_Data_PFlow_JMS_ConfigFile("JES_JMS_MC16Recommendation_Consolidated_data_only_PFlow_July2019_Rel21.config"),
m_jetAntiKt4_Data_PFlow_JMS_CalibSequence("JetArea_Residual_EtaJES_GSC_JMS_Insitu"),
m_jetAntiKt4_PFlow_MCFS_JMS_ConfigFile("JES_JMS_MC16Recommendation_Consolidated_MC_only_PFlow_July2019_Rel21.config"),
m_jetAntiKt4_PFlow_MCFS_JMS_CalibSequence("JetArea_Residual_EtaJES_GSC_Smear_JMS") {
declareProperty("config", m_config);
declareProperty("JetCalibrationTool", m_jetCalibrationTool);
declareProperty("JetCalibrationToolLargeR", m_jetCalibrationToolLargeR);
declareProperty("JetUncertaintiesTool", m_jetUncertaintiesTool);
declareProperty("JetUncertaintiesToolFrozenJMS", m_jetUncertaintiesToolFrozenJMS);
declareProperty("JetUncertaintiesToolReducedNPScenario1", m_jetUncertaintiesToolReducedNPScenario1);
declareProperty("JetUncertaintiesToolReducedNPScenario2", m_jetUncertaintiesToolReducedNPScenario2);
declareProperty("JetUncertaintiesToolReducedNPScenario3", m_jetUncertaintiesToolReducedNPScenario3);
......@@ -126,25 +137,21 @@ namespace top {
}
jetCalibrationName.erase(jetCalibrationName.length() - 4);
// In case of using JMS calibration
if (m_config->jetCalibSequence() == "JMS") {
ATH_MSG_ERROR("Unable to calibrate jets with JMS calib sequence in release 21: No recommendations! ");
return StatusCode::FAILURE;
// If this is functional, remove the error above and reconfigure the calibration sequence
m_jetAntiKt4_MCFS_ConfigFile.erase(m_jetAntiKt4_MCFS_ConfigFile.length() - 7);//erase ".config" at the end
m_jetAntiKt4_MCFS_ConfigFile += "_JMS.config";
m_jetAntiKt4_MCFS_CalibSequence += "_JMS";
}
///-- Calibration --///
if (asg::ToolStore::contains<IJetCalibrationTool>("JetCalibrationTool")) {
m_jetCalibrationTool = asg::ToolStore::get<IJetCalibrationTool>("JetCalibrationTool");
} else {
std::string calibConfig, calibSequence;
if (m_config->isMC()) {
// AFII
if (m_config->isAFII()) {
if (m_config->isMC()) { // MC calibration and sequence
if (m_config->isAFII()) { // AFII calibrations, if supported
if (m_config->jetCalibSequence() == "JMS") {
if (m_config->allowSmallRJMSforAFII()) {
ATH_MSG_WARNING("You enabled support for JMS calibration on AFII samples for small-R jets! NOTE that if you want to use this in an analysis, you must get back to JetEtMiss to demonstrate that AFII use is justifiable in your analysis.");
} else {
ATH_MSG_ERROR("The JMS calibration for small-R jets is not supported for AFII samples! If you want to use this in an analysis, you must get back to JetEtMiss to demonstrate that AFII use is justifiable in your analysis. Set config option AllowJMSforAFII to True if you insist on running JMS on AFII.");
return StatusCode::FAILURE;
}
}
if (m_config->useParticleFlowJets()) {
calibConfig = m_jetAntiKt4_MCAFII_PFlow_ConfigFile;
calibSequence = m_jetAntiKt4_MCAFII_PFlow_CalibSequence;
......@@ -152,24 +159,42 @@ namespace top {
calibConfig = m_jetAntiKt4_MCAFII_ConfigFile;
calibSequence = m_jetAntiKt4_MCAFII_CalibSequence;
}
} else { // FullSim calibrations
if (m_config->jetCalibSequence() == "JMS") {
if (m_config->useParticleFlowJets()) { // PFlow
calibConfig = m_jetAntiKt4_PFlow_MCFS_JMS_ConfigFile;
calibSequence = m_jetAntiKt4_PFlow_MCFS_JMS_CalibSequence;
} else { // EMTopo
calibConfig = m_jetAntiKt4_MCFS_JMS_ConfigFile;
calibSequence = m_jetAntiKt4_MCFS_JMS_CalibSequence;
}
} else { // GSC, no JMS calibration, fullsim
if (m_config->useParticleFlowJets()) { // PFlow
calibConfig = m_jetAntiKt4_PFlow_MCFS_ConfigFile;
calibSequence = m_jetAntiKt4_PFlow_MCFS_CalibSequence;
} else { // EMTopo
calibConfig = m_jetAntiKt4_MCFS_ConfigFile;
calibSequence = m_jetAntiKt4_MCFS_CalibSequence;
}
}
}
// FS - PFlow
else if (m_config->useParticleFlowJets()) {
calibConfig = m_jetAntiKt4_PFlow_MCFS_ConfigFile;
calibSequence = m_jetAntiKt4_PFlow_MCFS_CalibSequence;
}
// FS
else {
calibConfig = m_jetAntiKt4_MCFS_ConfigFile;
calibSequence = m_jetAntiKt4_MCFS_CalibSequence;
}
} else {
if (m_config->useParticleFlowJets()) {
calibConfig = m_jetAntiKt4_Data_PFlow_ConfigFile;
calibSequence = m_jetAntiKt4_Data_PFlow_CalibSequence;
} else {
calibConfig = m_jetAntiKt4_Data_ConfigFile;
calibSequence = m_jetAntiKt4_Data_CalibSequence;
} else { // data calibration config & sequence
if (m_config->jetCalibSequence() == "JMS") {
if (m_config->useParticleFlowJets()) {
calibConfig = m_jetAntiKt4_Data_PFlow_JMS_ConfigFile;
calibSequence = m_jetAntiKt4_Data_PFlow_JMS_CalibSequence;
} else {
calibConfig = m_jetAntiKt4_Data_JMS_ConfigFile;
calibSequence = m_jetAntiKt4_Data_JMS_CalibSequence;
}
} else { // GSC, no JMS calibration, data
if (m_config->useParticleFlowJets()) {
calibConfig = m_jetAntiKt4_Data_PFlow_ConfigFile;
calibSequence = m_jetAntiKt4_Data_PFlow_CalibSequence;
} else {
calibConfig = m_jetAntiKt4_Data_ConfigFile;
calibSequence = m_jetAntiKt4_Data_CalibSequence;
}
}
}
......@@ -246,10 +271,6 @@ namespace top {
// Summer2019 - JES/JER update
std::string conference = "Summer2019";
// If JMS is allowed then there should also be extrapolation and frozen uncertainties configured
std::string JMS_Uncertainty = "";
if (m_config->jetCalibSequence() == "JMS") JMS_Uncertainty = "_JMSExtrap";
// By setting calib_area to "None" we pick up the default from the JES group
std::string calib_area = "None";
......@@ -285,30 +306,12 @@ namespace top {
JERisMC,
"rel21/" + conference
+ "/R4_" + m_config->jetUncertainties_NPModel()
+ JMS_Uncertainty
+ JERSmearModel
+ ".config",
nullptr,
m_config->jetUncertainties_QGFracFile(),
calib_area
);
// Implement additional tool for frozen config when using JMS
if (JMS_Uncertainty == "_JMSExtrap") {
JMS_Uncertainty = "_JMSFrozen";
m_jetUncertaintiesToolFrozenJMS = setupJetUncertaintiesTool("JetUncertaintiesToolFrozenJMS",
jetCalibrationName,
MC_type,
JERisMC,
"rel21/" + conference
+ "/R4_" + m_config->jetUncertainties_NPModel()
+ JMS_Uncertainty
+ ".config",
nullptr,
m_config->jetUncertainties_QGFracFile(),
calib_area
);
}
} else {
// Strong reductions now enabled. If you want to run a single scenario please note the new config file names
// R4_SR_Scenario*_SimpleJER
......
......@@ -50,17 +50,33 @@ namespace top {
std::string m_jetAntiKt4_MCFS_ConfigFile;
std::string m_jetAntiKt4_MCFS_CalibSequence;
// small-R calibration with jet mass calibration included
std::string m_jetAntiKt4_Data_JMS_ConfigFile;
std::string m_jetAntiKt4_Data_JMS_CalibSequence;
// only for fullsim, AFII not supported
std::string m_jetAntiKt4_MCFS_JMS_ConfigFile;
std::string m_jetAntiKt4_MCFS_JMS_CalibSequence;
std::string m_jetAntiKt4_MCAFII_ConfigFile;
std::string m_jetAntiKt4_MCAFII_CalibSequence;
std::string m_jetAntiKt4_MCAFII_PFlow_ConfigFile;
std::string m_jetAntiKt4_MCAFII_PFlow_CalibSequence;
std::string m_jetAntiKt4_Data_PFlow_ConfigFile;
std::string m_jetAntiKt4_Data_PFlow_CalibSequence;
std::string m_jetAntiKt4_PFlow_MCFS_ConfigFile;
std::string m_jetAntiKt4_PFlow_MCFS_CalibSequence;
std::string m_jetAntiKt4_Data_PFlow_ConfigFile;
std::string m_jetAntiKt4_Data_PFlow_CalibSequence;
// small-R calibration with jet mass calibration included
std::string m_jetAntiKt4_Data_PFlow_JMS_ConfigFile;
std::string m_jetAntiKt4_Data_PFlow_JMS_CalibSequence;
// only for fullsim, AFII not supported
std::string m_jetAntiKt4_PFlow_MCFS_JMS_ConfigFile;
std::string m_jetAntiKt4_PFlow_MCFS_JMS_CalibSequence;
ToolHandle<IJetCalibrationTool> m_jetCalibrationTool;
ToolHandle<IJetCalibrationTool> m_jetCalibrationToolLargeR;
......@@ -68,7 +84,6 @@ namespace top {
ToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesToolLargeR;
ToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesTool;
ToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesToolFrozenJMS;
ToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesToolReducedNPScenario1;
ToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesToolReducedNPScenario2;
ToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesToolReducedNPScenario3;
......
......@@ -242,7 +242,8 @@ namespace top {
registerParameter("JetJERSmearingModel",
"All (inc. data smearing), All_PseudoData (use MC as pseudo-data), Full (inc. data smearing), Full_PseudoData (use MC as pseudo-data) or Simple (MC only - default)",
"Simple");
registerParameter("JetCalibSequence", "Jet calibaration sequence, GSC (default) or JMS", "GSC");
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");
registerParameter("JSF", "Used for top mass analysis, default is 1.0", "1.0");
......
......@@ -263,6 +263,7 @@ namespace top {
m_doMultipleJES(false),
m_jetJERSmearingModel("Simple"),
m_jetCalibSequence("GSC"),
m_allowSmallRJMSforAFII(false),
m_jetStoreTruthLabels("True"),
m_doJVTInMETCalculation(true),
m_saveFailJVTJets(false),
......@@ -1340,6 +1341,7 @@ namespace top {
this->jetUncertainties_QGHistPatterns(settings->value("JetUncertainties_QGHistPatterns"));
this->jetJERSmearingModel(settings->value("JetJERSmearingModel"));
this->jetCalibSequence(settings->value("JetCalibSequence"));
this->allowSmallRJMSforAFII(settings->value("AllowJMSforAFII") == "True");
this->doJVTinMET(settings->retrieve("JVTinMETCalculation"));
this->saveFailJVTJets(settings->retrieve("SaveFailJVTJets"));
this->setJVTWP(settings->value("JVTWP"));
......
......@@ -1390,6 +1390,14 @@ namespace top {
inline virtual const std::string& jetCalibSequence() const {return m_jetCalibSequence;}
inline virtual void allowSmallRJMSforAFII(const bool setting) {
if (!m_configFixed) {
m_allowSmallRJMSforAFII = setting;
}
}
inline virtual bool allowSmallRJMSforAFII() const {return m_allowSmallRJMSforAFII;}
inline virtual void jetStoreTruthLabels(bool b) {
if (!m_configFixed) {
m_jetStoreTruthLabels = b;
......@@ -2345,6 +2353,7 @@ namespace top {
bool m_doMultipleJES;
std::string m_jetJERSmearingModel; // Full or Simple
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
bool m_doJVTInMETCalculation;
bool m_saveFailJVTJets;
......
......@@ -40,7 +40,6 @@ namespace top {
m_jetCalibrationToolLargeR("JetCalibrationToolLargeR"),
m_jetUncertaintiesTool("JetUncertaintiesTool"),
m_jetUncertaintiesToolFrozenJMS("JetUncertaintiesToolFrozenJMS"),
m_jetUncertaintiesToolReducedNPScenario1("JetUncertaintiesToolReducedNPScenario1"),
m_jetUncertaintiesToolReducedNPScenario2("JetUncertaintiesToolReducedNPScenario2"),
m_jetUncertaintiesToolReducedNPScenario3("JetUncertaintiesToolReducedNPScenario3"),
......@@ -53,7 +52,6 @@ namespace top {
m_jetSubstructure(nullptr),
m_systMap_AllNP(),
m_systMap_AllNP_FrozenJMS(),
m_systMap_ReducedNPScenario1(),
m_systMap_ReducedNPScenario2(),
m_systMap_ReducedNPScenario3(),
......@@ -65,7 +63,6 @@ namespace top {
declareProperty("JetCalibrationToolLargeR", m_jetCalibrationToolLargeR);
declareProperty("JetUncertaintiesTool", m_jetUncertaintiesTool);
declareProperty("JetUncertaintiesToolFrozenJMS", m_jetUncertaintiesToolFrozenJMS);
declareProperty("JetUncertaintiesToolReducedNPScenario1", m_jetUncertaintiesToolReducedNPScenario1);
declareProperty("JetUncertaintiesToolReducedNPScenario2", m_jetUncertaintiesToolReducedNPScenario2);
declareProperty("JetUncertaintiesToolReducedNPScenario3", m_jetUncertaintiesToolReducedNPScenario3);
......@@ -121,9 +118,6 @@ namespace top {
if (m_isMC || m_doFull_JER) {
if (!m_doMultipleJES) {
top::check(m_jetUncertaintiesTool.retrieve(), "Failed to retrieve JetUncertaintiesTool");
if (m_config->jetCalibSequence() == "JMS") {
top::check(m_jetUncertaintiesToolFrozenJMS.retrieve(), "Failed to retrieve JetUncertaintiesTool (FrozenJMS)");
}
} else {
top::check(
m_jetUncertaintiesToolReducedNPScenario1.retrieve(),
......@@ -182,17 +176,11 @@ namespace top {
if (m_isMC || m_doFull_JER) {
std::string allNP(m_config->jetUncertainties_NPModel() + "_"),
np1("SR_Scenario1_"), np2("SR_Scenario2_"), np3("SR_Scenario3_"), np4("SR_Scenario4_");
std::string allNP_FrozenJMS(m_config->jetUncertainties_NPModel() + "_FrozenJMS_");
bool onlyJER = ((!m_isMC) && m_doFull_JER) || (m_isMC && m_doFull_JER_Pseudodata);
if (!m_doMultipleJES) {
addSystematics(syst, m_jetUncertaintiesTool->recommendedSystematics(), m_systMap_AllNP, allNP, false, onlyJER);
if (m_config->jetCalibSequence() == "JMS") {
addSystematics(syst,
m_jetUncertaintiesToolFrozenJMS->recommendedSystematics(), m_systMap_AllNP_FrozenJMS, allNP_FrozenJMS, false,
onlyJER);
}
} else {
addSystematics(syst,
m_jetUncertaintiesToolReducedNPScenario1->recommendedSystematics(), m_systMap_ReducedNPScenario1, np1, false,
......@@ -366,10 +354,6 @@ namespace top {
if (m_isMC || m_doFull_JER) {
if (!m_doMultipleJES) {
top::check(applySystematic(m_jetUncertaintiesTool, m_systMap_AllNP), "Failed to apply JES");
if (m_config->jetCalibSequence() == "JMS") {
top::check(applySystematic(m_jetUncertaintiesToolFrozenJMS,
m_systMap_AllNP_FrozenJMS), "Failed to apply JES Frozen JMS");
}
}
if (m_doMultipleJES) {
top::check(applySystematic(m_jetUncertaintiesToolReducedNPScenario1,
......
......@@ -125,7 +125,6 @@ namespace top {
ToolHandle<IJetCalibrationTool> m_jetCalibrationToolLargeR;
ToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesTool;
ToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesToolFrozenJMS;
ToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesToolReducedNPScenario1;
ToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesToolReducedNPScenario2;
ToolHandle<ICPJetUncertaintiesTool> m_jetUncertaintiesToolReducedNPScenario3;
......@@ -150,7 +149,6 @@ namespace top {
std::unique_ptr<top::TopJetSubstructure> m_jetSubstructure;
systMap m_systMap_AllNP;
systMap m_systMap_AllNP_FrozenJMS;
systMap m_systMap_ReducedNPScenario1;
systMap m_systMap_ReducedNPScenario2;
systMap m_systMap_ReducedNPScenario3;
......
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