Skip to content

Commit

Permalink
Merge pull request #39 from OlivierBondu/bugfix_llmetjj_maps
Browse files Browse the repository at this point in the history
Bug fixes to llmetjj maps
  • Loading branch information
BrieucF committed Oct 22, 2015
2 parents ed4ffd4 + 70c7fa3 commit f2a3705
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
4 changes: 2 additions & 2 deletions interface/HHAnalyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ class HHAnalyzer: public Framework::Analyzer {
std::vector<std::vector<int>>& map_llmet_id_iso = tree["map_llmet_id_iso"].write_with_init<std::vector<std::vector<int>>>(lepID::Count * lepIso::Count * lepID::Count * lepIso::Count, std::vector<int>(0));
std::vector<std::vector<int>>& map_j_btagWP = tree["map_j_btagWP"].write_with_init<std::vector<std::vector<int>>>(btagWP::Count, std::vector<int>(0));
std::vector<std::vector<int>>& map_jj_btagWP_pair = tree["map_jj_btagWP_pair"].write_with_init<std::vector<std::vector<int>>>(btagWP::Count * btagWP::Count * jetPair::Count, std::vector<int>(0));
std::vector<std::vector<int>>& map_llmetjj_id_iso_btagWP_pair = tree["map_llmetjj_id_iso_btagWP_pair"].write_with_init<std::vector<std::vector<int>>>(lepID::Count * lepIso::Count * lepID::Count * lepIso::Count * btagWP::Count * jetPair::Count, std::vector<int>(0));
std::vector<std::vector<int>>& map_llmetjj_id_iso_btagWP_pair = tree["map_llmetjj_id_iso_btagWP_pair"].write_with_init<std::vector<std::vector<int>>>(lepID::Count * lepIso::Count * lepID::Count * lepIso::Count * btagWP::Count * btagWP::Count * jetPair::Count, std::vector<int>(0));
// associated multiplicities
std::vector<unsigned int>& n_map_l_id_iso = tree["n_map_l_id_iso"].write_with_init<std::vector<unsigned int>>(lepID::Count * lepIso::Count, 0);
std::vector<unsigned int>& n_map_ll_id_iso = tree["n_map_ll_id_iso"].write_with_init<std::vector<unsigned int>>(lepID::Count * lepIso::Count * lepID::Count * lepIso::Count, 0);
std::vector<unsigned int>& n_map_llmet_id_iso = tree["n_map_llmet_id_iso"].write_with_init<std::vector<unsigned int>>(lepID::Count * lepIso::Count * lepID::Count * lepIso::Count, 0);
std::vector<unsigned int>& n_map_j_btagWP = tree["n_map_j_btagWP"].write_with_init<std::vector<unsigned int>>(btagWP::Count, 0);
std::vector<unsigned int>& n_map_jj_btagWP_pair = tree["n_map_jj_btagWP_pair"].write_with_init<std::vector<unsigned int>>(btagWP::Count * btagWP::Count * jetPair::Count, 0);
std::vector<unsigned int>& n_map_llmetjj_id_iso_btagWP_pair = tree["n_map_llmetjj_id_iso_btagWP_pair"].write_with_init<std::vector<unsigned int>>(lepID::Count * lepIso::Count * lepID::Count * lepIso::Count * btagWP::Count * jetPair::Count, 0);
std::vector<unsigned int>& n_map_llmetjj_id_iso_btagWP_pair = tree["n_map_llmetjj_id_iso_btagWP_pair"].write_with_init<std::vector<unsigned int>>(lepID::Count * lepIso::Count * lepID::Count * lepIso::Count * btagWP::Count * btagWP::Count * jetPair::Count, 0);


virtual void analyze(const edm::Event&, const edm::EventSetup&, const ProducersManager&, const AnalyzersManager&, const CategoryManager&) override;
Expand Down
1 change: 0 additions & 1 deletion interface/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ namespace HH {
LorentzVector p4;
unsigned int illmet; // index in the HH::DileptonMet collection
unsigned int ijj; // index in the HH::Dijet collection
unsigned int imet; // index in the HH::Met collection
float DPhi_jj_met;
float minDPhi_j_met;
float maxDPhi_j_met;
Expand Down
29 changes: 28 additions & 1 deletion plugins/HHAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,10 @@ void HHAnalyzer::analyze(const edm::Event& event, const edm::EventSetup&, const
for (unsigned int i = 0; i < map_llmet_id_iso.size(); i++)
{
map_llmet_id_iso[i].clear();
map_llmet_id_iso[i] = map_ll_id_iso[i];
for (unsigned int j = 0; j < map_ll_id_iso[i].size(); j++)
{
map_llmet_id_iso[i].push_back(map_ll_id_iso[i][j]);
}
}
for (unsigned int i = 0; i < map_llmet_id_iso.size(); i++)
n_map_llmet_id_iso[i] = map_llmet_id_iso[i].size();
Expand Down Expand Up @@ -549,6 +552,7 @@ void HHAnalyzer::analyze(const edm::Event& event, const edm::EventSetup&, const
myllmetjj.minDPhi_j_met = std::max(ROOT::Math::VectorUtil::DeltaPhi(jets[jj[ijj].ijet1].p4, met[imet].p4), ROOT::Math::VectorUtil::DeltaPhi(jets[jj[ijj].ijet2].p4, met[imet].p4));
// content specific to HH::DileptonMetDijet
myllmetjj.illmet = illmet;
myllmetjj.ijj = ijj;
float DR_j1l1, DR_j1l2, DR_j2l1, DR_j2l2;
DR_j1l1 = ROOT::Math::VectorUtil::DeltaR(jets[ijet1].p4, leptons[ilep1].p4);
DR_j1l2 = ROOT::Math::VectorUtil::DeltaR(jets[ijet1].p4, leptons[ilep2].p4);
Expand All @@ -567,6 +571,7 @@ void HHAnalyzer::analyze(const edm::Event& event, const edm::EventSetup&, const
}
}

if (HHANADEBUG) {std::cout << "##### Now debugging the llmetjj maps" << std::endl;}
// llmetjj maps: cross product of llmet and jj maps
for (unsigned int i = 0; i < map_llmetjj_id_iso_btagWP_pair.size(); i++)
map_llmetjj_id_iso_btagWP_pair[i].clear();
Expand Down Expand Up @@ -612,12 +617,34 @@ void HHAnalyzer::analyze(const edm::Event& event, const edm::EventSetup&, const
int ijj = ibtag1 * bitY
+ ibtag2 * bitX
+ ipair;
if (map_llmet_id_iso[illmet].size() == 0 || map_jj_btagWP_pair[ijj].size() == 0)
{
continue;
}
if (HHANADEBUG)
{
std::cout << "Now treating illmetjj= " << illmetjj << " (illmet, ijj)= (" << illmet << ", " << ijj << ")" << std::endl;
std::cout << "map_llmet_id_iso[" << illmet << "].size()= " << map_llmet_id_iso[illmet].size() << std::endl;
for (unsigned int j = 0; j < map_llmet_id_iso[illmet].size(); j++)
std::cout << "\tmap_llmet_id_iso[" << illmet << "][" << j << "]= " << map_llmet_id_iso[illmet][j] << std::endl;
std::cout << "map_jj_btagWP_pair[" << ijj << "].size()= " << map_jj_btagWP_pair[ijj].size() << std::endl;
for (unsigned int j = 0; j < map_jj_btagWP_pair[ijj].size(); j++)
std::cout << "\tmap_jj_btagWP_pair[" << ijj << "][" << j << "]= " << map_jj_btagWP_pair[ijj][j] << std::endl;
}
for (unsigned int i = 0; i < llmetjj.size(); i++)
{
if (HHANADEBUG) {std::cout << "llmetjj[" << i << "].illmet= " << llmetjj[i].illmet << "\tllmetjj[" << i << "].ijj= " << llmetjj[i].ijj << std::endl;}
if (std::find(map_llmet_id_iso[illmet].begin(), map_llmet_id_iso[illmet].end(), llmetjj[i].illmet) == map_llmet_id_iso[illmet].end())
{
if (HHANADEBUG) {std::cout << "llmetjj candidate #" << i << " is NOT in the llmet map, skipping event" << std::endl;}
continue;
}
if (std::find(map_jj_btagWP_pair[ijj].begin(), map_jj_btagWP_pair[ijj].end(), llmetjj[i].ijj) == map_jj_btagWP_pair[ijj].end())
{
if (HHANADEBUG) { std::cout << "llmetjj candidate #" << i << " is NOT in the jj map, skipping event" << std::endl;}
continue;
}
if (HHANADEBUG) {std::cout << "llmetjj candidate selected, pushing it back" << std::endl;}
map_llmetjj_id_iso_btagWP_pair[illmetjj].push_back(i);
}
}
Expand Down

0 comments on commit f2a3705

Please sign in to comment.