Commit 4cdf427d authored by Nils Erik Krumnack's avatar Nils Erik Krumnack
Browse files

Merge branch '21.2-FixSys' into '21.2'

AnalysisTop:fix for empty electronSF variation vectors

See merge request !43679
parents 4cc0499d 332f5107
......@@ -1874,12 +1874,12 @@ namespace top {
m_weight_leptonSF_EL_SF_Isol_DOWN = m_sfRetriever->leptonSF(event, top::topSFSyst::EL_SF_Isol_DOWN);
if (m_config->electronEfficiencySystematicModel() != "TOTAL") {
m_weight_leptonSF_EL_SF_CorrModel_Reco_UP = m_sfRetriever->electronSFSystVariationVector(event, top::topSFComp::RECO, 1);
m_weight_leptonSF_EL_SF_CorrModel_Reco_DOWN = m_sfRetriever->electronSFSystVariationVector(event, top::topSFComp::RECO, -1);
m_weight_leptonSF_EL_SF_CorrModel_ID_UP = m_sfRetriever->electronSFSystVariationVector(event, top::topSFComp::ID, 1);
m_weight_leptonSF_EL_SF_CorrModel_ID_DOWN = m_sfRetriever->electronSFSystVariationVector(event, top::topSFComp::ID, -1);
m_weight_leptonSF_EL_SF_CorrModel_Iso_UP = m_sfRetriever->electronSFSystVariationVector(event, top::topSFComp::ISOLATION, 1);
m_weight_leptonSF_EL_SF_CorrModel_Iso_DOWN = m_sfRetriever->electronSFSystVariationVector(event, top::topSFComp::ISOLATION, -1);
m_weight_leptonSF_EL_SF_CorrModel_Reco_UP = m_sfRetriever->electronSFSystVariationVector(event, top::topSFComp::RECO, 1, m_config->electronEfficiencySystematicModelRecoSize());
m_weight_leptonSF_EL_SF_CorrModel_Reco_DOWN = m_sfRetriever->electronSFSystVariationVector(event, top::topSFComp::RECO, -1,m_config->electronEfficiencySystematicModelRecoSize() );
m_weight_leptonSF_EL_SF_CorrModel_ID_UP = m_sfRetriever->electronSFSystVariationVector(event, top::topSFComp::ID, 1,m_config->electronEfficiencySystematicModelIdSize() );
m_weight_leptonSF_EL_SF_CorrModel_ID_DOWN = m_sfRetriever->electronSFSystVariationVector(event, top::topSFComp::ID, -1,m_config->electronEfficiencySystematicModelIdSize() );
m_weight_leptonSF_EL_SF_CorrModel_Iso_UP = m_sfRetriever->electronSFSystVariationVector(event, top::topSFComp::ISOLATION, 1,m_config->electronEfficiencySystematicModelIsoSize() );
m_weight_leptonSF_EL_SF_CorrModel_Iso_DOWN = m_sfRetriever->electronSFSystVariationVector(event, top::topSFComp::ISOLATION, -1,m_config->electronEfficiencySystematicModelIsoSize() );
}
m_weight_leptonSF_MU_SF_Trigger_STAT_UP = m_sfRetriever->leptonSF(event, top::topSFSyst::MU_SF_Trigger_STAT_UP);
m_weight_leptonSF_MU_SF_Trigger_STAT_DOWN = m_sfRetriever->leptonSF(event, top::topSFSyst::MU_SF_Trigger_STAT_DOWN);
......
......@@ -201,6 +201,9 @@ namespace top {
m_electronEfficiencySystematicModel("TOTAL"),
m_electronEfficiencySystematicModelNToys(40),
m_electronEfficiencySystematicModelToySeed(12345),
m_electronEfficiencySystematicModelRecoSize(400),
m_electronEfficiencySystematicModelIdSize(400),
m_electronEfficiencySystematicModelIsoSize(400),
m_electronEfficiencySystematicModelEtaBinning(""),
m_electronEfficiencySystematicModelEtBinning(""),
m_electronID("SetMe"),
......
......@@ -768,6 +768,23 @@ namespace top {
}
inline virtual void electronEfficiencySystematicModelRecoSize(const int& s) {
m_electronEfficiencySystematicModelRecoSize = s;
}
inline virtual void electronEfficiencySystematicModelIdSize(const int& s) {
m_electronEfficiencySystematicModelIdSize = s;
}
inline virtual void electronEfficiencySystematicModelIsoSize(const int& s) {
m_electronEfficiencySystematicModelIsoSize = s;
}
inline virtual void electronID(const std::string& s) {
if (!m_configFixed) {
m_electronID = s;
......@@ -861,6 +878,20 @@ namespace top {
return m_electronEfficiencySystematicModelToySeed;
}
inline virtual const int& electronEfficiencySystematicModelRecoSize() {
return m_electronEfficiencySystematicModelRecoSize;
}
inline virtual const int& electronEfficiencySystematicModelIdSize() {
return m_electronEfficiencySystematicModelIdSize;
}
inline virtual const int& electronEfficiencySystematicModelIsoSize() {
return m_electronEfficiencySystematicModelIsoSize;
}
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;}
......@@ -2371,6 +2402,9 @@ namespace top {
std::string m_electronEfficiencySystematicModel;
int m_electronEfficiencySystematicModelNToys;
int m_electronEfficiencySystematicModelToySeed;
int m_electronEfficiencySystematicModelRecoSize;
int m_electronEfficiencySystematicModelIdSize;
int m_electronEfficiencySystematicModelIsoSize;
std::string m_electronEfficiencySystematicModelEtaBinning;
std::string m_electronEfficiencySystematicModelEtBinning;
std::string m_electronID;
......
......@@ -228,6 +228,10 @@ namespace top {
"--->electron RECO " << m_config->electronEfficiencySystematicModel() << " component " << (count2++) << " is " <<
name);
}
m_config->electronEfficiencySystematicModelRecoSize(count2);
count = 0;
count2 = 0;
for (const CP::SystematicSet& isyst : m_systIDCorrModel) {
......@@ -239,6 +243,11 @@ namespace top {
"--->electron ID " << m_config->electronEfficiencySystematicModel() << " component " << (count2++) << " is " <<
name);
}
m_config->electronEfficiencySystematicModelIdSize(count2);
count = 0;
count2 = 0;
for (const CP::SystematicSet& isyst : m_systIsoCorrModel) {
......@@ -250,6 +259,10 @@ namespace top {
"--->electron ISO " << m_config->electronEfficiencySystematicModel() << " component " << (count2++) << " is " <<
name);
}
m_config->electronEfficiencySystematicModelIsoSize(count2);
}
......@@ -296,6 +309,9 @@ namespace top {
name);
count++;
}
m_config->electronEfficiencySystematicModelRecoSize(count);
count = 0;
for (const CP::SystematicSet& isyst : m_systIDCorrModel) {
TString name = isyst.name();
......@@ -304,6 +320,9 @@ namespace top {
name);
count++;
}
m_config->electronEfficiencySystematicModelIdSize(count);
count = 0;
for (const CP::SystematicSet& isyst : m_systIsoCorrModel) {
TString name = isyst.name();
......@@ -312,6 +331,10 @@ namespace top {
name);
count++;
}
m_config->electronEfficiencySystematicModelIsoSize(count);
}
m_decor_triggerEff = "EL_EFF_Trigger_" + m_config->electronID();
......
......@@ -253,8 +253,9 @@ namespace top {
}
std::vector<float> ScaleFactorRetriever::electronSFSystVariationVector(const top::Event& event,
const top::topSFComp SFComp, int var) const {
const top::topSFComp SFComp, int var, int sysSize) const {
std::vector<float> sf;
if (abs(var) != 1) {
ATH_MSG_ERROR("ScaleFactorRetriever::electronSFSystVariationVector must be called with var=+1 (up) or -1 (down)");
return sf;
......@@ -302,7 +303,6 @@ namespace top {
ATH_MSG_ERROR(
"ScaleFactorRetriever::electronSFSystVariationVector error in accessing decoration " << decorationName);
}
if (sf.size() == 0) sf = std::vector<float>(sf_aux.size(), leptonSF(event, top::topSFSyst::nominal));
if (sf.size() != sf_aux.size()) ATH_MSG_ERROR(
"ScaleFactorRetriever::electronSFSystVariationVector error in size of vector of electron SFs");
......@@ -316,6 +316,7 @@ namespace top {
}
}//end of loop on electrons
if (sf.size() == 0) sf = std::vector<float>(sysSize, leptonSF(event, top::topSFSyst::nominal));
return sf;
}
......
......@@ -251,6 +251,9 @@ namespace top {
//get vector of systematic variations of electron SFs, var=1 for up, var=-1 for down
std::vector<float> electronSFSystVariationVector(const top::Event& event, const top::topSFComp SFComp, int var = 1) const;
//get vector of systematic variations of electron SFs, var=1 for up, var=-1 for down and size of systematic variations
std::vector<float> electronSFSystVariationVector(const top::Event& event, const top::topSFComp SFComp, int var = 1, int size=50) const;
// Obtain the fwd electron SF
float fwdElectronSF(const top::Event& event,
const top::topSFSyst SFSyst,
......
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