diff --git a/interface/MVAvarsBase.h b/interface/MVAvarsBase.h index 5344097b88a5aebc04c5417b60e8957b73de4f75..9c3e0e69939e378c47e78d647b7ece419031a938 100644 --- a/interface/MVAvarsBase.h +++ b/interface/MVAvarsBase.h @@ -56,6 +56,8 @@ class MVAvarsBase const std::vector<double> &selectedJetCSV, const std::vector<int> &jets_idx); + virtual void SetTopisleptonic(bool isit){cout << "ERROR: dont call `SetTopisleptonic()` for non MVAvarsJABDTthw-objects!" << endl;} + float GetGlobalDefault(){return globalDefault;} std::vector<std::string> GetRecolabels(){return Recolabels;} diff --git a/interface/MVAvarsJABDTthw.h b/interface/MVAvarsJABDTthw.h index a056763eaa1f7fe47b35a6c67c3fd2a36b91a041..a97abadaf3be0e3143789ecfc11ed311d235f401 100644 --- a/interface/MVAvarsJABDTthw.h +++ b/interface/MVAvarsJABDTthw.h @@ -37,7 +37,7 @@ class MVAvarsJABDTthw : public MVAvarsBase void SetTopisleptonic(bool isit){topisleptonic = isit;} - + std::map<std::string, TLorentzVector> GetVectors( const TLorentzVector &selectedLeptonP4, const std::vector<TLorentzVector> &selectedJetP4, const TLorentzVector &metP4, diff --git a/src/MVAvarsJABDTthw.cpp b/src/MVAvarsJABDTthw.cpp index c260c871705892a3a0bad1b467f4e0b5b89a07d1..9a63855a42323e5e438a8f9b1483c5ba3fa95150 100644 --- a/src/MVAvarsJABDTthw.cpp +++ b/src/MVAvarsJABDTthw.cpp @@ -125,8 +125,7 @@ void MVAvarsJABDTthw::FillMVAvarMap(const std::vector<TLorentzVector> &selectedL variableMap["Reco_tHW_whaddau_idx2"]= jets_idx.at(tHWIndexes::tHW_whaddau2_idx); variableMap["Reco_tHW_hdau_idx1"] = jets_idx.at(tHWIndexes::tHW_hdau1_idx); variableMap["Reco_tHW_hdau_idx2"] = jets_idx.at(tHWIndexes::tHW_hdau2_idx); - if(topisleptonic) variableMap["Reco_tHW_leptonictop"] = 1; - else variableMap["Reco_tHW_leptonictop"] = 0; + variableMap["Reco_tHW_leptonictop"] = topisleptonic; variableMap["Reco_tHW_top_m"] = vectors["top"].M(); variableMap["Reco_tHW_top_pt"] = vectors["top"].Pt(); diff --git a/src/thwHypothesisCombinatorics.cpp b/src/thwHypothesisCombinatorics.cpp index 8e7f67f00ef007b4b48490e420c5696bbbb76615..d6aabe0521c5dfb41470915143a0dcf6d7c259a8 100644 --- a/src/thwHypothesisCombinatorics.cpp +++ b/src/thwHypothesisCombinatorics.cpp @@ -30,15 +30,11 @@ std::map<std::string, float> thwHypothesisCombinatorics::GetBestPermutation(cons const TLorentzVector &metP4) { // reconstruct leptonic and hadronic top cases - MVAvarsJABDTthw* tempmvars = (MVAvarsJABDTthw*) &mvars; - std::map<std::string, float> leptonictop; - std::map<std::string, float> hadronictop; + mvars->SetTopisleptonic(true); + std::map<std::string, float> leptonictop = HypothesisCombinatorics::GetBestPermutation(selectedLeptonP4, selectedJetP4, selectedJetCSV, metP4); - tempmvars->SetTopisleptonic(false); - leptonictop = HypothesisCombinatorics::GetBestPermutation(selectedLeptonP4, selectedJetP4, selectedJetCSV, metP4); - - tempmvars->SetTopisleptonic(true); - hadronictop = HypothesisCombinatorics::GetBestPermutation(selectedLeptonP4, selectedJetP4, selectedJetCSV, metP4); + mvars->SetTopisleptonic(false); + std::map<std::string, float> hadronictop = HypothesisCombinatorics::GetBestPermutation(selectedLeptonP4, selectedJetP4, selectedJetCSV, metP4); if(hadronictop[bdtoutput_name] > leptonictop[bdtoutput_name]) {