Skip to content

Commit

Permalink
Merge pull request #36 from OlivierBondu/more_fixes
Browse files Browse the repository at this point in the history
More fixes
  • Loading branch information
BrieucF committed Oct 22, 2015
2 parents 5430e30 + 787c3a1 commit 0bd8f15
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 12 deletions.
2 changes: 1 addition & 1 deletion interface/Enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ namespace btagWP {

namespace jetPair {
// enum jetPair { mh, pt, ht, btag, ptOverM, mc, Count }; //FIXME: ultimately
enum jetPair { ht, mh, pt, Count };
enum jetPair { ht, mh, pt, csv, jp, ptOverM, Count };
}
12 changes: 7 additions & 5 deletions interface/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ namespace HH {
};
struct Dilepton {
LorentzVector p4;
std::pair<unsigned int, unsigned int> idxs; // indices in the collection of HH::Lepton
unsigned int ilep1; // index in the corresponding framework collection
unsigned int ilep2; // index in the corresponding framework collection
std::pair<unsigned int, unsigned int> idxs; // indices in the corresponding framework collection
unsigned int ilep1; // index in the HH::Lepton collection
unsigned int ilep2; // index in the HH::Lepton collection
std::pair<int8_t, int8_t> hlt_idxs = std::make_pair(-1,-1); // Stores indices of matched online objects. (-1,-1) if no match
bool isOS; // Opposite Sign
bool isMuMu;
Expand Down Expand Up @@ -73,8 +73,8 @@ namespace HH {
};
struct Dijet {
LorentzVector p4;
std::pair<unsigned int, unsigned int> idxs; // indices in the collection of HH::Jet
unsigned int ijet1; // indices in the framework collection
std::pair<unsigned int, unsigned int> idxs; // indices in the framework collection
unsigned int ijet1; // indices in the HH::Jet collection
unsigned int ijet2;
bool btag_LL;
bool btag_LM;
Expand All @@ -85,6 +85,8 @@ namespace HH {
bool btag_TL;
bool btag_TM;
bool btag_TT;
float sumCSV;
float sumJP;
float DR_j_j;
float DPhi_j_j;
};
Expand Down
30 changes: 24 additions & 6 deletions plugins/HHAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ void HHAnalyzer::analyze(const edm::Event& event, const edm::EventSetup&, const
{
HH::Dilepton dilep;
dilep.p4 = leptons[ilep1].p4 + leptons[ilep2].p4;
dilep.idxs = std::make_pair(ilep1, ilep2);
dilep.ilep1 = leptons[ilep1].idx;
dilep.ilep2 = leptons[ilep2].idx;
dilep.idxs = std::make_pair(leptons[ilep1].idx, leptons[ilep2].idx);
dilep.ilep1 = ilep1;
dilep.ilep2 = ilep2;
dilep.isOS = leptons[ilep1].charge * leptons[ilep2].charge < 0;
dilep.isMuMu = leptons[ilep1].isMu && leptons[ilep2].isMu;
dilep.isElEl = leptons[ilep1].isEl && leptons[ilep2].isEl;
Expand Down Expand Up @@ -404,9 +404,9 @@ void HHAnalyzer::analyze(const edm::Event& event, const edm::EventSetup&, const
{
HH::Dijet myjj;
myjj.p4 = jets[ijet1].p4 + jets[ijet2].p4;
myjj.idxs = std::make_pair(ijet1, ijet2);
myjj.ijet1 = jets[ijet1].idx;
myjj.ijet2 = jets[ijet2].idx;
myjj.idxs = std::make_pair(jets[ijet1].idx, jets[ijet2].idx);
myjj.ijet1 = ijet1;
myjj.ijet2 = ijet2;
myjj.btag_LL = jets[ijet1].btagL && jets[ijet2].btagL;
myjj.btag_LM = jets[ijet1].btagL && jets[ijet2].btagM;
myjj.btag_LT = jets[ijet1].btagL && jets[ijet2].btagT;
Expand All @@ -416,6 +416,8 @@ void HHAnalyzer::analyze(const edm::Event& event, const edm::EventSetup&, const
myjj.btag_TL = jets[ijet1].btagT && jets[ijet2].btagL;
myjj.btag_TM = jets[ijet1].btagT && jets[ijet2].btagM;
myjj.btag_TT = jets[ijet1].btagT && jets[ijet2].btagT;
myjj.sumCSV = jets[ijet1].CSV + jets[ijet2].CSV;
myjj.sumJP = jets[ijet1].JP + jets[ijet2].JP;
myjj.DR_j_j = ROOT::Math::VectorUtil::DeltaR(jets[ijet1].p4, jets[ijet2].p4);
myjj.DPhi_j_j = ROOT::Math::VectorUtil::DeltaPhi(jets[ijet1].p4, jets[ijet2].p4);
jj.push_back(myjj);
Expand Down Expand Up @@ -457,6 +459,9 @@ void HHAnalyzer::analyze(const edm::Event& event, const edm::EventSetup&, const
int iht = ibtag1 * bitB + ibtag2 * bitA + jetPair::ht;
int jpt = ibtag1 * bitB + ibtag2 * bitA + jetPair::pt;
int jmh = ibtag1 * bitB + ibtag2 * bitA + jetPair::mh;
int jcsv = ibtag1 * bitB + ibtag2 * bitA + jetPair::csv;
int jjp = ibtag1 * bitB + ibtag2 * bitA + jetPair::jp;
int jptOverM = ibtag1 * bitB + ibtag2 * bitA + jetPair::ptOverM;
std::vector<int> tmp = map_jj_btagWP_pair[iht];
// do the ptjj sorted maps
std::sort(tmp.begin(), tmp.end(), [&](const int& a, const int& b){return jj[a].p4.Pt() > jj[b].p4.Pt();});
Expand All @@ -465,6 +470,17 @@ void HHAnalyzer::analyze(const edm::Event& event, const edm::EventSetup&, const
tmp = map_jj_btagWP_pair[iht];
std::sort(tmp.begin(), tmp.end(), [&](const int& a, const int& b){return abs(jj[a].p4.M() - mh) < abs(jj[b].p4.M() - mh);});
map_jj_btagWP_pair[jmh] = tmp;
// do the sum(btag) sorted maps
tmp = map_jj_btagWP_pair[iht];
std::sort(tmp.begin(), tmp.end(), [&](const int& a, const int& b){return jj[a].sumCSV > jj[b].sumCSV;});
map_jj_btagWP_pair[jcsv] = tmp;
tmp = map_jj_btagWP_pair[iht];
std::sort(tmp.begin(), tmp.end(), [&](const int& a, const int& b){return jj[a].sumJP > jj[b].sumJP;});
map_jj_btagWP_pair[jjp] = tmp;
// do the ptjj / mjj sorted maps
tmp = map_jj_btagWP_pair[iht];
std::sort(tmp.begin(), tmp.end(), [&](const int& a, const int& b){return (jj[a].p4.Pt() / jj[a].p4.M()) > (jj[b].p4.Pt() / jj[b].p4.M());});
map_jj_btagWP_pair[jptOverM] = tmp;
}
}
for (unsigned int i = 0; i < map_jj_btagWP_pair.size(); i++)
Expand Down Expand Up @@ -498,6 +514,8 @@ void HHAnalyzer::analyze(const edm::Event& event, const edm::EventSetup&, const
myllmetjj.btag_TL = jj[ijj].btag_TL;
myllmetjj.btag_TM = jj[ijj].btag_TM;
myllmetjj.btag_TT = jj[ijj].btag_TT;
myllmetjj.sumCSV = jj[ijj].sumCSV;
myllmetjj.sumJP = jj[ijj].sumJP;
myllmetjj.DR_j_j = jj[ijj].DR_j_j;
myllmetjj.DPhi_j_j = jj[ijj].DPhi_j_j;
// blind copy of the llmet content
Expand Down

0 comments on commit 0bd8f15

Please sign in to comment.