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 32db0d064a985e2a4ea70c16f40db7f116343fe9..58f4e92c1f19369f338284d129a623b7cccbe2e8 100644 --- a/src/MVAvarsJABDTthw.cpp +++ b/src/MVAvarsJABDTthw.cpp @@ -11,6 +11,7 @@ MVAvarsJABDTthw::MVAvarsJABDTthw() ,"Reco_tHW_whaddau_idx2" ,"Reco_tHW_hdau_idx1" ,"Reco_tHW_hdau_idx2" + ,"Reco_tHW_leptonictop" ,"Reco_tHW_top_m" ,"Reco_tHW_top_pt" @@ -84,6 +85,8 @@ MVAvarsJABDTthw::MVAvarsJABDTthw() ,"Reco_JABDT_tHW_log_h_pt" ,"Reco_JABDT_tHW_log_wb_m" ,"Reco_JABDT_tHW_log_wb_pt" + ,"Reco_JABDT_tHW_log_whad_m" + ,"Reco_JABDT_tHW_log_whad_pt" ,"Reco_JABDT_tHW_abs_top_eta__M__wb_eta" ,"Reco_JABDT_tHW_abs_btop_eta" @@ -124,6 +127,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); + variableMap["Reco_tHW_leptonictop"] = topisleptonic; variableMap["Reco_tHW_top_m"] = vectors["top"].M(); variableMap["Reco_tHW_top_pt"] = vectors["top"].Pt(); @@ -198,6 +202,8 @@ void MVAvarsJABDTthw::FillMVAvarMap(const std::vector<TLorentzVector> &selectedL variableMap["Reco_JABDT_tHW_log_h_pt"] = log(vectors["higg"].Pt()); variableMap["Reco_JABDT_tHW_log_wb_m"] = log(vectors["wb"].M()); variableMap["Reco_JABDT_tHW_log_wb_pt"] = log(vectors["wb"].Pt()); + variableMap["Reco_JABDT_tHW_log_whad_m"] = log(vectors["whad"].M()); + variableMap["Reco_JABDT_tHW_log_whad_pt"] = log(vectors["whad"].Pt()); variableMap["Reco_JABDT_tHW_abs_top_eta__M__wb_eta"] = fabs(vectors["top"].Eta() - vectors["wb"].Eta()); variableMap["Reco_JABDT_tHW_abs_btop_eta"] = fabs(vectors["btop"].Eta()); @@ -227,6 +233,9 @@ std::map<std::string, TLorentzVector> MVAvarsJABDTthw::GetVectors(const TLorentz vectors["higg"] = vectors["hdau1"] + vectors["hdau2"]; vectors["whad"] = vectors["whaddau1"] + vectors["whaddau2"]; + vectors["toplep"] = vectors["leptonicW"] + vectors["btop"]; + vectors["tophad"] = vectors["whad"] + vectors["btop"]; + if(topisleptonic) { vectors["wtop"] = vectors["leptonicW"]; @@ -242,19 +251,28 @@ std::map<std::string, TLorentzVector> MVAvarsJABDTthw::GetVectors(const TLorentz return vectors; } -bool MVAvarsJABDTthw::SkipEvent( const std::vector<TLorentzVector> &selectedJetP4, - const std::vector<double> &selectedJetCSV, - const std::vector<int> &jets_idx) +bool MVAvarsJABDTthw::SkipEvent(const std::vector<TLorentzVector> &selectedJetP4, + const std::vector<double> &selectedJetCSV, + const std::vector<int> &jets_idx) { int btop = jets_idx.at(tHWIndexes::tHW_btop_idx); -// int whaddau1 = jets_idx.at(tHWIndexes::tHW_whaddau1_idx); -// int whaddau2 = jets_idx.at(tHWIndexes::tHW_whaddau2_idx); + int whaddau1 = jets_idx.at(tHWIndexes::tHW_whaddau1_idx); + int whaddau2 = jets_idx.at(tHWIndexes::tHW_whaddau2_idx); int hdau1 = jets_idx.at(tHWIndexes::tHW_hdau1_idx); int hdau2 = jets_idx.at(tHWIndexes::tHW_hdau2_idx); - if (!JetIsCentral(selectedJetP4[btop])) return true; + if (!JetIsCentral(selectedJetP4[btop])) return true; if (!JetIsCentral(selectedJetP4[hdau1])) return true; if (!JetIsCentral(selectedJetP4[hdau2])) return true; + if (JetIsTagged(selectedJetP4[whaddau1], selectedJetCSV.at(whaddau1))) return true; + if (JetIsTagged(selectedJetP4[whaddau2], selectedJetCSV.at(whaddau2))) return true; + + int btags = 0; + if(JetIsTagged(selectedJetP4.at(btop), selectedJetCSV.at(btop))) btags++; + if(JetIsTagged(selectedJetP4.at(hdau1), selectedJetCSV.at(hdau1))) btags++; + if(JetIsTagged(selectedJetP4.at(hdau2), selectedJetCSV.at(hdau2))) btags++; + + if(btags < 1) return true; return false; } \ No newline at end of file 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]) {