diff --git a/Root/HiggsWeightTool.cxx b/Root/HiggsWeightTool.cxx index 9977b88acdb0b5f6469a32090aac41b32427c599..a95196d1288d4a25fc391d8756649a0e20b1ed11 100644 --- a/Root/HiggsWeightTool.cxx +++ b/Root/HiggsWeightTool.cxx @@ -12,7 +12,12 @@ namespace xAOD { : asg::AsgTool(name), m_init(false), m_Nweights(0), m_mcID(999), //m_weightTool("xAOD::TruthWeightTool/TruthWeightTool"), m_weightTool(nullptr) { - + + // wether to put constraints on the weights + declareProperty("RequireFinite", m_requireFinite=false); + declareProperty("WeightCutOff", m_weightCutOff=-1.0); + + // Force modes declareProperty("ForceNNLOPS", m_forceNNLOPS=false); // Run2-default Powheg NNLOPS ggF declareProperty("ForceVBF", m_forceVBF=false); // Run2-default Powheg VBF declareProperty("ForceVH", m_forceVH=false); // Run2-default Powheg VH (WpH, WmH, qq->ZH) @@ -187,6 +192,21 @@ namespace xAOD { /// Access MC weight for uncertainty propagation /// Note: input kinematics should be HTXS_Higgs_pt, HTXS_Njets_pTjet30, and HTXS_Stage1_Category_pTjet30 HiggsWeights HiggsWeightTool::getHiggsWeights(int STXS_Njets30, double STXS_pTH, int STXS_Stage1) { + HiggsWeights hw = getHiggsWeightsInternal(STXS_Njets30,STXS_pTH,STXS_Stage1); + if (m_requireFinite) updateWeights(hw); + return hw; + } + + void HiggsWeightTool::updateWeight(HiggsWeights &hw) { + + } + + + + + /// Access MC weight for uncertainty propagation + /// Note: input kinematics should be HTXS_Higgs_pt, HTXS_Njets_pTjet30, and HTXS_Stage1_Category_pTjet30 + HiggsWeights HiggsWeightTool::getHiggsWeightsInternal(int STXS_Njets30, double STXS_pTH, int STXS_Stage1) { // convert to GeV double pTH = STXS_pTH/1000; int Njets=STXS_Njets30; const std::vector<float> &weights = getMCweights(); diff --git a/TruthWeightTools/HiggsWeightTool.h b/TruthWeightTools/HiggsWeightTool.h index fcec1e14d68ab7106daa36357e79abe24d80c5ed..9242d3384cf6ed0d1b4fb4b30683a83d0dc4d169 100644 --- a/TruthWeightTools/HiggsWeightTool.h +++ b/TruthWeightTools/HiggsWeightTool.h @@ -148,6 +148,12 @@ namespace xAOD { private: + /// Access the HiggsWeights + HiggsWeights getHiggsWeightsInternal(int HTXS_Njets30=-1, double HTXS_pTH=-99.0, int HTXS_cat=-1); + + /// Protect against non-finite or outside-reqired-range weights + void updateWeights(HiggsWeights &hw); + /// Setup weights void setupWeights(size_t Nweights); @@ -179,6 +185,13 @@ namespace xAOD { /// getWeight double getWeight(size_t idx); + + /// options + bool m_requireFinite; + double m_weightCutOff; + + /// For statistics + std::map<TString,double> m_stats; /// index of weights size_t m_nom;