Commit 441703b8 authored by Merve Sahinsoy's avatar Merve Sahinsoy Committed by Nils Erik Krumnack
Browse files

AnalysisTop:adding ElectronEfficiencyCorrelationModel "COMBMCTOYS"

parent d4ca3ceb
......@@ -378,20 +378,25 @@ namespace top {
ATH_MSG_INFO(
"Requested Electrons SF tool for " << m_config->electronEfficiencySystematicModel() << " correlation model");
if (m_config->electronEfficiencySystematicModel() != "TOTAL") {
ATH_MSG_INFO(
"Setting up Electrons SF tool for " << m_config->electronEfficiencySystematicModel() << " correlation model");
const std::string elSFPrefixCorrModel = elSFPrefix + "CorrModel_";
// Reco SFs
m_electronEffSFRecoCorrModel = setupElectronSFToolWithMap(elSFPrefixCorrModel + "Reco", m_electronEffSFRecoFile,
"Reconstruction", "", "", "", dataType,
m_config->electronEfficiencySystematicModelNToys(),
m_config->electronEfficiencySystematicModelToySeed(),
m_config->electronEfficiencySystematicModel(),
m_config->electronEfficiencySystematicModelEtaBinning(),
m_config->electronEfficiencySystematicModelEtBinning());
// ID SFs
if(m_config->electronIDSFFilePath() =="Default") m_electronEffSFIDCorrModel = setupElectronSFToolWithMap(elSFPrefixCorrModel + "ID", m_electronEffSFIDFile, "",
electronID, "", "", dataType,
m_config->electronEfficiencySystematicModelNToys(),
m_config->electronEfficiencySystematicModelToySeed(),
m_config->electronEfficiencySystematicModel(),
m_config->electronEfficiencySystematicModelEtaBinning(),
m_config->electronEfficiencySystematicModelEtBinning());
......@@ -399,9 +404,12 @@ namespace top {
m_config->electronEfficiencySystematicModel(),
m_config->electronEfficiencySystematicModelEtaBinning(),
m_config->electronEfficiencySystematicModelEtBinning());
m_electronEffSFIDLooseCorrModel = setupElectronSFToolWithMap(elSFPrefixCorrModel + "IDLoose",
m_electronEffSFIDLooseFile, "", electronIDLoose, "",
"", dataType,
m_config->electronEfficiencySystematicModelNToys(),
m_config->electronEfficiencySystematicModelToySeed(),
m_config->electronEfficiencySystematicModel(),
m_config->electronEfficiencySystematicModelEtaBinning(),
m_config->electronEfficiencySystematicModelEtBinning());
......@@ -409,6 +417,8 @@ namespace top {
m_electronEffSFTriggerCorrModel = setupElectronSFToolWithMap(elSFPrefixCorrModel + "TriggerSF",
m_electronEffSFTriggerFile, "", electronID,
electronIsolation, trigger_string, dataType,
m_config->electronEfficiencySystematicModelNToys(),
m_config->electronEfficiencySystematicModelToySeed(),
m_config->electronEfficiencySystematicModel(),
m_config->electronEfficiencySystematicModelEtaBinning(),
m_config->electronEfficiencySystematicModelEtBinning());
......@@ -416,6 +426,8 @@ namespace top {
m_electronEffSFTriggerLooseFile, "",
electronIDLoose, electronIsolationLoose,
trigger_string, dataType,
m_config->electronEfficiencySystematicModelNToys(),
m_config->electronEfficiencySystematicModelToySeed(),
m_config->electronEfficiencySystematicModel(),
m_config->electronEfficiencySystematicModelEtaBinning(),
m_config->electronEfficiencySystematicModelEtBinning());
......@@ -423,6 +435,8 @@ namespace top {
m_electronEffTriggerCorrModel = setupElectronSFToolWithMap(elSFPrefixCorrModel + "Trigger",
m_electronEffTriggerFile, "", electronID,
electronIsolation, "Eff_" + trigger_string, dataType,
m_config->electronEfficiencySystematicModelNToys(),
m_config->electronEfficiencySystematicModelToySeed(),
m_config->electronEfficiencySystematicModel(),
m_config->electronEfficiencySystematicModelEtaBinning(),
m_config->electronEfficiencySystematicModelEtBinning());
......@@ -430,6 +444,8 @@ namespace top {
m_electronEffTriggerLooseFile, "",
electronIDLoose, electronIsolationLoose,
"Eff_" + trigger_string, dataType,
m_config->electronEfficiencySystematicModelNToys(),
m_config->electronEfficiencySystematicModelToySeed(),
m_config->electronEfficiencySystematicModel(),
m_config->electronEfficiencySystematicModelEtaBinning(),
m_config->electronEfficiencySystematicModelEtBinning());
......@@ -445,6 +461,8 @@ namespace top {
else {
m_electronEffSFIsoCorrModel = setupElectronSFToolWithMap(elSFPrefixCorrModel + "Iso", m_electronEffSFIsoFile, "",
electronID, electronIsolation, "", dataType,
m_config->electronEfficiencySystematicModelNToys(),
m_config->electronEfficiencySystematicModelToySeed(),
m_config->electronEfficiencySystematicModel(),
m_config->electronEfficiencySystematicModelEtaBinning(),
m_config->electronEfficiencySystematicModelEtBinning());
......@@ -462,6 +480,8 @@ namespace top {
m_electronEffSFIsoLooseCorrModel = setupElectronSFToolWithMap(elSFPrefixCorrModel + "IsoLoose",
m_electronEffSFIsoLooseFile, "", electronIDLoose,
electronIsolationLoose, "", dataType,
m_config->electronEfficiencySystematicModelNToys(),
m_config->electronEfficiencySystematicModelToySeed(),
m_config->electronEfficiencySystematicModel(),
m_config->electronEfficiencySystematicModelEtaBinning(),
m_config->electronEfficiencySystematicModelEtBinning());
......@@ -584,13 +604,98 @@ namespace top {
bins), "Failed to set correlation model " + binningName + " binning to " + binning);
}
void EgammaCPTools::setCorrelationModelToys(IAsgElectronEfficiencyCorrectionTool* tool,
const std::string& ToysName, const int& number) {
ATH_MSG_INFO(" ---> electron SF tools will use " << ToysName << " :"<< number);
top::check(asg::setProperty(tool, ToysName,
number), "Failed to set correlation model " + ToysName );
}
IAsgElectronEfficiencyCorrectionTool*
EgammaCPTools::setupElectronSFToolWithMap(const std::string& name, const std::string& map_path,
const std::string& reco_key, const std::string& ID_key,
const std::string& ISO_key, const std::string& trigger_key,
const int& data_type,
const int& correlationModelNToys,
const int& correlationModelToySeed,
const std::string& correlation_model,
const std::string& correlationModelEtaBinning,
const std::string& correlationModelEtBinning) {
std::string iso_key = ISO_key;
// https://twiki.cern.ch/twiki/bin/view/AtlasProtected/LatestRecommendationsElectronIDRun2#PLV_scale_factors_for_central_el
// If isolation WP is PLVTight or PLVLoose, switch to no isolation to trick this function.
if (iso_key == "PLVTight" || iso_key == "PLVLoose") iso_key = "";
std::string infoStr = "Configuring : name=" + name + " map=" + map_path + " reco_key=" + reco_key + " ID_key=" +
ID_key + " iso_key=" + iso_key + " trigger_key=" + trigger_key + "data_type=" +
std::to_string(data_type) +
" correlation_model=" + correlation_model + " etaBinning=" + correlationModelEtaBinning +
" etBinning=" +
correlationModelEtBinning;
ATH_MSG_INFO(infoStr);
IAsgElectronEfficiencyCorrectionTool* tool = nullptr;
if (asg::ToolStore::contains<IAsgElectronEfficiencyCorrectionTool>(name)) {
tool = asg::ToolStore::get<IAsgElectronEfficiencyCorrectionTool>(name);
} else {
tool = new AsgElectronEfficiencyCorrectionTool(name);
// Give the full map path
top::check(asg::setProperty(tool, "MapFilePath", map_path), "Failed to set MapFilePath to " + name);
// Set the data type for all tools
top::check(asg::setProperty(tool, "ForceDataType", data_type), "Failed to set ForceDataType to " + name);
// Set the correlation model for all tools
top::check(asg::setProperty(tool, "CorrelationModel",
correlation_model), "Failed to set CorrelationModel to " + name);
if (correlationModelEtaBinning != "" && correlationModelEtaBinning != "default") this->setCorrelationModelBinning(
tool, "UncorrEtaBinsUser", correlationModelEtaBinning);
if (correlationModelEtBinning != "" && correlationModelEtBinning != "default") this->setCorrelationModelBinning(
tool, "UncorrEtBinsUser", correlationModelEtBinning);
//MC Toy model variables
if (correlationModelNToys != 0 ) this->setCorrelationModelToys(
tool, "NumberOfToys", correlationModelNToys);
if (correlationModelToySeed != 0) this->setCorrelationModelToys(
tool, "MCToySeed", correlationModelToySeed);
// Set the keys which configure the tool options (empty string means we do not include this key)
if (reco_key != "" && reco_key != "None") {
ATH_MSG_INFO(" Adding RecoKey : " + reco_key);
top::check(asg::setProperty(tool, "RecoKey", reco_key), "Failed to set RecoKey to " + name);
}
if (ID_key != "" && ID_key != "None") {
std::string id_key = mapWorkingPoints(ID_key);
ATH_MSG_INFO(" Adding IDKey : " + id_key);
top::check(asg::setProperty(tool, "IdKey", id_key), "Failed to set IdKey to " + name);
}
if (iso_key != "" && iso_key != "None") {
ATH_MSG_INFO(" Adding IsoKey : " + iso_key);
top::check(asg::setProperty(tool, "IsoKey", iso_key), "Failed to set IsoKey to " + name);
}
if (trigger_key != "" && trigger_key != "None") {
ATH_MSG_INFO(" Adding TriggerKey : " + trigger_key);
top::check(asg::setProperty(tool, "TriggerKey", trigger_key), "Failed to set TriggerKey to " + name);
}
// Initialise this tool
top::check(tool->initialize(), "Failed to initialize " + name);
}
return tool;
}
IAsgElectronEfficiencyCorrectionTool*
EgammaCPTools::setupElectronSFToolWithMap(const std::string& name, const std::string& map_path,
const std::string& reco_key, const std::string& ID_key,
const std::string& ISO_key, const std::string& trigger_key,
const int& data_type, const std::string& correlation_model,
const int& data_type,
const std::string& correlation_model,
const std::string& correlationModelEtaBinning,
const std::string& correlationModelEtBinning) {
std::string iso_key = ISO_key;
// https://twiki.cern.ch/twiki/bin/view/AtlasProtected/LatestRecommendationsElectronIDRun2#PLV_scale_factors_for_central_el
// If isolation WP is PLVTight or PLVLoose, switch to no isolation to trick this function.
......
......@@ -106,6 +106,9 @@ namespace top {
const std::string& correlationModelEtaBinning="",
const std::string& correlationModelEtBinning="");
// Helper function to deal with path resolving the
// egamma groups very long file names for SFs and efficiencies.
std::string electronSFFilePath(const std::string& type, const std::string& ID, const std::string& ISO);
......@@ -122,10 +125,35 @@ namespace top {
const std::string& correlationModelEtaBinning,
const std::string& correlationModelEtBinning);
IAsgElectronEfficiencyCorrectionTool* setupElectronSFToolWithMap(const std::string& name,
const std::string& map_path,
const std::string& reco_key,
const std::string& ID_key,
const std::string& iso_key,
const std::string& trigger_key,
const int& data_type,
const int& correlationModelNtoys,
const int& correlationToySeed,
const std::string& correlationModel,
const std::string& correlationModelEtaBinning,
const std::string& correlationModelEtBinning);
std::string electronSFMapFilePath(const std::string& type);
void setCorrelationModelBinning(IAsgElectronEfficiencyCorrectionTool* tool, const std::string& binningName,
const std::string& binning);
void setCorrelationModelToys(IAsgElectronEfficiencyCorrectionTool* tool, const std::string& ToysName,
const int& number);
std::string mapWorkingPoints(const std::string& type);
};
} // namespace top
......
......@@ -66,8 +66,12 @@ namespace top {
"This should only be used by experts for testing SFs! Default: Using the most recent recommended map.", "Default");
registerParameter("EgammaSystematicModel", "Egamma Calibration Systematic model : FULL_v1 , 1NP_v1 (default)",
"1NP_v1");
registerParameter("ElectronEfficiencySystematicModelNToys",
"Electron Efficiency Toy Systematics Number of Toys: ","40");
registerParameter("ElectronEfficiencySystematicModelToySeed",
"Electron Efficiency Toy Systematics Seed of Toys: ","12345");
registerParameter("ElectronEfficiencySystematicModel",
"Electron Efficiency Systematic model : FULL, SIMPLIFIED, TOTAL (default)", "TOTAL");
"Electron Efficiency Systematic model : FULL, SIMPLIFIED, TOTAL (default), COMBMCTOYS", "TOTAL");
registerParameter("ElectronEfficiencySystematicModelEtaBinning",
"Electron Efficiency Systematic model eta binning (option for SIMPLIFIED model, do not specify to use default; format XXX:YYY:ZZZ, e.g. 0.0:1.37:4.9)",
"default");
......
......@@ -199,6 +199,8 @@ namespace top {
// Electron configuration
m_egammaSystematicModel("1NP_v1"),
m_electronEfficiencySystematicModel("TOTAL"),
m_electronEfficiencySystematicModelNToys(40),
m_electronEfficiencySystematicModelToySeed(12345),
m_electronEfficiencySystematicModelEtaBinning(""),
m_electronEfficiencySystematicModelEtBinning(""),
m_electronID("SetMe"),
......@@ -1172,6 +1174,8 @@ namespace top {
this->electronEfficiencySystematicModel(settings->value("ElectronEfficiencySystematicModel"));
this->electronEfficiencySystematicModelEtaBinning(settings->value("ElectronEfficiencySystematicModelEtaBinning"));
this->electronEfficiencySystematicModelEtBinning(settings->value("ElectronEfficiencySystematicModelEtBinning"));
this->electronEfficiencySystematicModelNToys(std::stof(settings->value("ElectronEfficiencySystematicModelNToys")));
this->electronEfficiencySystematicModelToySeed(std::stof(settings->value("ElectronEfficiencySystematicModelToySeed")));
this->electronID(settings->value("ElectronID"));
this->electronIDLoose(settings->value("ElectronIDLoose"));
{
......
......@@ -125,6 +125,7 @@ namespace top {
std::ostream& operator << (std::ostream& os, const ConfigurationSettings& settings);
std::ostream& operator << (std::ostream& os, const SelectionConfigurationData& data);
}
......
......@@ -754,6 +754,20 @@ namespace top {
}
}
inline virtual void electronEfficiencySystematicModelNToys(const int& s) {
if (!m_configFixed) {
m_electronEfficiencySystematicModelNToys = s;
}
}
inline virtual void electronEfficiencySystematicModelToySeed(const int& s) {
if (!m_configFixed) {
m_electronEfficiencySystematicModelToySeed = s;
}
}
inline virtual void electronID(const std::string& s) {
if (!m_configFixed) {
m_electronID = s;
......@@ -839,6 +853,14 @@ namespace top {
inline virtual const std::string& electronEfficiencySystematicModelEtBinning() {
return m_electronEfficiencySystematicModelEtBinning;
}
inline virtual const int& electronEfficiencySystematicModelNToys() {
return m_electronEfficiencySystematicModelNToys;
}
inline virtual const int& electronEfficiencySystematicModelToySeed() {
return m_electronEfficiencySystematicModelToySeed;
}
inline virtual const std::string& electronID() const {return m_electronID;}
inline virtual const std::string& electronIDLoose() const {return m_electronIDLoose;}
inline virtual bool electronVetoLArCrack() const {return m_electronVetoLArCrack;}
......@@ -2347,6 +2369,8 @@ namespace top {
// Electron configuration
std::string m_egammaSystematicModel;
std::string m_electronEfficiencySystematicModel;
int m_electronEfficiencySystematicModelNToys;
int m_electronEfficiencySystematicModelToySeed;
std::string m_electronEfficiencySystematicModelEtaBinning;
std::string m_electronEfficiencySystematicModelEtBinning;
std::string m_electronID;
......
......@@ -7,6 +7,7 @@
#include "TopConfiguration/TopConfig.h"
#include "TopEvent/EventTools.h"
#include "PATInterfaces/MakeSystematicsVector.h"
#include "xAODEgamma/ElectronContainer.h"
#include "TString.h"
......@@ -200,7 +201,7 @@ namespace top {
m_systChargeMisID_SYST_UP.insert(CP::SystematicVariation("EL_CHARGEID_SYStotal", 1));
m_systChargeMisID_SYST_DOWN.insert(CP::SystematicVariation("EL_CHARGEID_SYStotal", -1));
if (m_config->electronEfficiencySystematicModel() != "TOTAL") {
if (m_config->electronEfficiencySystematicModel() != "TOTAL" && m_config->electronEfficiencySystematicModel() != "COMBMCTOYS") {
CP::SystematicSet triggerSet = m_electronEffSFTrigger->recommendedSystematics(); //currently we have only the
// TOTAL model implemented for
// trigger SF, it's useless to
......@@ -251,6 +252,68 @@ namespace top {
}
}
if (m_config->electronEfficiencySystematicModel() == "COMBMCTOYS") {
CP::SystematicSet triggerSet = m_electronEffSFTrigger->recommendedSystematics(); //currently we have only the
// TOTAL model implemented for
// trigger SF, it's useless to
// use an advanced model here
CP::SystematicSet recoSet = m_electronEffSFRecoCorrModel->recommendedSystematics();
CP::SystematicSet idSet = m_electronEffSFIDCorrModel->recommendedSystematics();
CP::SystematicSet isoSet = m_electronEffSFIsoCorrModel->recommendedSystematics();
CP::MakeSystematicsVector recosysVecToys;
CP::MakeSystematicsVector idsysVecToys;
CP::MakeSystematicsVector isosysVecToys;
recosysVecToys.addGroup("toys");
idsysVecToys.addGroup("toys");
isosysVecToys.addGroup("toys");
recosysVecToys.setToys( m_config->electronEfficiencySystematicModelNToys() );
idsysVecToys.setToys( m_config->electronEfficiencySystematicModelNToys() );
isosysVecToys.setToys( m_config->electronEfficiencySystematicModelNToys() );
recosysVecToys.calc(recoSet);
idsysVecToys.calc(idSet);
isosysVecToys.calc(isoSet);
m_systRecoCorrModel=recosysVecToys.result("toys");
m_systIDCorrModel =idsysVecToys.result("toys");
m_systIsoCorrModel =isosysVecToys.result("toys");
m_systTriggerCorrModel = CP::make_systematics_vector(triggerSet);
ATH_MSG_INFO(
"For electron RECO, ID, ISOLATION using the correlation model " <<
m_config->electronEfficiencySystematicModel());
int count = 0;
for (const CP::SystematicSet& isyst : m_systRecoCorrModel) {
TString name = isyst.name();
ATH_MSG_INFO(
"--->electron RECO " << m_config->electronEfficiencySystematicModel() << " component " << count << " is " <<
name);
count++;
}
count = 0;
for (const CP::SystematicSet& isyst : m_systIDCorrModel) {
TString name = isyst.name();
ATH_MSG_INFO(
"--->electron ID " << m_config->electronEfficiencySystematicModel() << " component " << count << " is " <<
name);
count++;
}
count = 0;
for (const CP::SystematicSet& isyst : m_systIsoCorrModel) {
TString name = isyst.name();
ATH_MSG_INFO(
"--->electron ISO " << m_config->electronEfficiencySystematicModel() << " component " << count << " is " <<
name);
count++;
}
}
m_decor_triggerEff = "EL_EFF_Trigger_" + m_config->electronID();
m_decor_triggerEff_loose = "EL_LOOSE_EFF_Trigger_" + m_config->electronIDLoose();
m_decor_triggerSF = "EL_SF_Trigger_" + m_config->electronID();
......@@ -648,7 +711,7 @@ namespace top {
/////now taking care of additional systematic model if needed
if (m_config->electronEfficiencySystematicModel() != "TOTAL") {
if ((m_config->electronEfficiencySystematicModel() != "TOTAL") && (m_config->electronEfficiencySystematicModel() != "COMBMCTOYS")){
std::vector<float> vec_Eff_Trigger_UP, vec_Eff_Trigger_DOWN, vec_Eff_TriggerLoose_UP,
vec_Eff_TriggerLoose_DOWN;
std::vector<float> vec_SF_Trigger_UP, vec_SF_Trigger_DOWN, vec_SF_TriggerLoose_UP,
......@@ -902,6 +965,233 @@ namespace top {
}//end of saving additional systematic model
if (m_config->electronEfficiencySystematicModel() == "COMBMCTOYS"){
std::vector<float> vec_Eff_Trigger_UP, vec_Eff_Trigger_DOWN, vec_Eff_TriggerLoose_UP,
vec_Eff_TriggerLoose_DOWN;
std::vector<float> vec_SF_Trigger_UP, vec_SF_Trigger_DOWN, vec_SF_TriggerLoose_UP,
vec_SF_TriggerLoose_DOWN;
std::vector<float> vec_SF_Reco_UP, vec_SF_Reco_DOWN;
std::vector<float> vec_SF_ID_UP, vec_SF_ID_DOWN, vec_SF_IDLoose_UP, vec_SF_IDLoose_DOWN;
std::vector<float> vec_SF_Isol_UP, vec_SF_Isol_DOWN, vec_SF_IsolLoose_UP, vec_SF_IsolLoose_DOWN;
std::vector<float> vec_SF_ChargeID_UP, vec_SF_ChargeID_DOWN, vec_SF_ChargeIDLoose_UP,
vec_SF_ChargeIDLoose_DOWN;
std::vector<float> vec_SF_ChargeMisID_UP, vec_SF_ChargeMisID_DOWN, vec_SF_ChargeMisIDLoose_UP,
vec_SF_ChargeMisIDLoose_DOWN;
double EFF_Trigger(1.), EFF_TriggerLoose(1.);
double SF_Trigger(1.), SF_TriggerLoose(1.);
double SF_Reco(1.);
double SF_ID(1.), SF_IDLoose(1.);
double SF_Isol(1.), SF_IsolLoose(1.);
/// --Trigger-- ///
int count = 0;
for (const CP::SystematicSet& isyst : m_systTriggerCorrModel) {
top::check(m_electronEffSFTriggerCorrModel->applySystematicVariation(isyst),
"Failed to set systematic");
top::check(m_electronEffSFTriggerLooseCorrModel->applySystematicVariation(
isyst), "Failed to set systematic");
top::check(m_electronEffSFTriggerCorrModel->getEfficiencyScaleFactor(*electronPtr,
SF_Trigger), "Failed to get SF");
top::check(m_electronEffSFTriggerLooseCorrModel->getEfficiencyScaleFactor(*electronPtr,
SF_TriggerLoose),
"Failed to get SF");
top::check(m_electronEffTriggerCorrModel->applySystematicVariation(isyst), "Failed to set systematic");
top::check(m_electronEffTriggerLooseCorrModel->applySystematicVariation(
isyst), "Failed to set systematic");
top::check(m_electronEffTriggerCorrModel->getEfficiencyScaleFactor(*electronPtr,
EFF_Trigger), "Failed to get SF");
top::check(m_electronEffTriggerLooseCorrModel->getEfficiencyScaleFactor(*electronPtr,
EFF_TriggerLoose),
"Failed to get SF");
vec_SF_Trigger_DOWN.emplace_back(SF_Trigger);
vec_SF_TriggerLoose_DOWN.emplace_back(SF_TriggerLoose);
vec_Eff_Trigger_DOWN.emplace_back(EFF_Trigger);
vec_Eff_TriggerLoose_DOWN.emplace_back(EFF_TriggerLoose);
vec_SF_Trigger_UP.emplace_back(SF_Trigger);
vec_SF_TriggerLoose_UP.emplace_back(SF_TriggerLoose);
vec_Eff_Trigger_UP.emplace_back(EFF_Trigger);
vec_Eff_TriggerLoose_UP.emplace_back(EFF_TriggerLoose);
count++;
}
// Do some sanity check
if (vec_SF_Trigger_DOWN.size() != vec_SF_Trigger_UP.size()) {
throw std::runtime_error {
"ElectronScaleFactorCalculator::execute: Sizes of trigger SF for up and down are different"
};
}
if (vec_SF_TriggerLoose_DOWN.size() != vec_SF_TriggerLoose_UP.size()) {
throw std::runtime_error {
"ElectronScaleFactorCalculator::execute: Sizes of triggerLoose SF for up and down are different"
};
}
if (vec_Eff_Trigger_DOWN.size() != vec_Eff_Trigger_UP.size()) {
throw std::runtime_error {
"ElectronScaleFactorCalculator::execute: Sizes of trigger Eff for up and down are different"
};
}
if (vec_Eff_TriggerLoose_DOWN.size() != vec_Eff_TriggerLoose_UP.size()) {
throw std::runtime_error {
"ElectronScaleFactorCalculator::execute: Sizes of triggerLoose Eff for up and down are different"
};
}
///-- Trigger reset to nominal --///
top::check(m_electronEffSFTriggerCorrModel->applySystematicVariation(
m_systNominal), "Failed to set systematic");
top::check(m_electronEffSFTriggerLooseCorrModel->applySystematicVariation(
m_systNominal), "Failed to set systematic");
top::check(m_electronEffTriggerCorrModel->applySystematicVariation(
m_systNominal), "Failed to set systematic");
top::check(m_electronEffTriggerLooseCorrModel->applySystematicVariation(
m_systNominal), "Failed to set systematic");
/// --Reco-- ///
count = 0;
for (const CP::SystematicSet& isyst : m_systRecoCorrModel) {
top::check(m_electronEffSFRecoCorrModel->applySystematicVariation(isyst), "Failed to set systematic");
top::check(m_electronEffSFRecoCorrModel->getEfficiencyScaleFactor(*electronPtr,
SF_Reco), "Failed to get SF");
vec_SF_Reco_DOWN.emplace_back(SF_Reco);
vec_SF_Reco_UP.emplace_back(SF_Reco);
++count;
}
if (vec_SF_Reco_DOWN.size() != vec_SF_Reco_UP.size()) {
throw std::runtime_error {
"ElectronScaleFactorCalculator::execute: Sizes of Reco SF for up and down are different"
};
}
///-- Reco reset to nominal --///
top::check(m_electronEffSFRecoCorrModel->applySystematicVariation(
m_systNominal), "Failed to set systematic");
/// --ID-- ///
count = 0;
for (const CP::SystematicSet& isyst : m_systIDCorrModel) {
top::check(m_electronEffSFIDCorrModel->applySystematicVariation(isyst), "Failed to set systematic");
top::check(m_electronEffSFIDLooseCorrModel->applySystematicVariation(isyst),
"Failed to set systematic");
top::check(m_electronEffSFIDCorrModel->getEfficiencyScaleFactor(*electronPtr, SF_ID),
"Failed to get SF");
top::check(m_electronEffSFIDLooseCorrModel->getEfficiencyScaleFactor(*electronPtr,
SF_IDLoose), "Failed to get SF");
vec_SF_ID_DOWN.emplace_back(SF_ID);
vec_SF_IDLoose_DOWN.emplace_back(SF_IDLoose);
vec_SF_ID_UP.emplace_back(SF_ID);
vec_SF_IDLoose_UP.emplace_back(SF_IDLoose);
++count;
}
if (vec_SF_ID_DOWN.size() != vec_SF_ID_UP.size()) {
throw std::runtime_error {
"ElectronScaleFactorCalculator::execute: Sizes of ID SF for up and down are different"
};
}
if (vec_SF_IDLoose_DOWN.size() != vec_SF_IDLoose_UP.size()) {
throw std::runtime_error {
"ElectronScaleFactorCalculator::execute: Sizes of IDLoose SF for up and down are different"
};
}
///-- ID reset to nominal --///
top::check(m_electronEffSFIDCorrModel->applySystematicVariation(m_systNominal),
"Failed to set systematic");
top::check(m_electronEffSFIDLooseCorrModel->applySystematicVariation(
m_systNominal), "Failed to set systematic");
///-- Iso --///
count = 0;
for (const CP::SystematicSet& isyst : m_systIsoCorrModel) {