Skip to content

Commit

Permalink
Merge pull request #78 from OlivierBondu/stripping_content
Browse files Browse the repository at this point in the history
Stripping content to essentials
  • Loading branch information
blinkseb committed Feb 2, 2016
2 parents 53ae2d4 + 60dfa65 commit 897a9e1
Show file tree
Hide file tree
Showing 4 changed files with 154 additions and 62 deletions.
6 changes: 6 additions & 0 deletions interface/Categories.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ class DileptonCategory: public Category {
public:
const std::vector<HH::Lepton>& getLeptons(const AnalyzersManager& analyzers) const ;
const std::vector<HH::Dilepton>& getDileptons(const AnalyzersManager& analyzers) const ;
const std::vector<HH::DileptonMetDijet>& getDileptonMetDijets(const AnalyzersManager& analyzers) const ;
virtual void configure(const edm::ParameterSet& conf) override {
m_analyzer_name = conf.getUntrackedParameter<std::string>("m_analyzer_name", "hh_analyzer");
}
private:
std::string m_analyzer_name;
};

class MuMuCategory: public DileptonCategory {
Expand Down
44 changes: 27 additions & 17 deletions interface/HHAnalyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,39 +61,33 @@ class HHAnalyzer: public Framework::Analyzer {
}
}
}
virtual void endJob(MetadataManager&) override;

// leptons and dileptons stuff
BRANCH(electrons, std::vector<unsigned int>);
BRANCH(muons, std::vector<unsigned int>);
BRANCH(leptons, std::vector<HH::Lepton>);
BRANCH(ll, std::vector<HH::Dilepton>);
BRANCH(met, std::vector<HH::Met>);
BRANCH(llmet, std::vector<HH::DileptonMet>);
BRANCH(jets, std::vector<HH::Jet>);
BRANCH(jj, std::vector<HH::Dijet>);
BRANCH(llmetjj, std::vector<HH::DileptonMetDijet>);
std::vector<HH::Dilepton> ll;
std::vector<HH::DileptonMet> llmet;
std::vector<HH::Dijet> jj;
std::vector<HH::DileptonMetDijet> llmetjj;
// some few custom candidates, for convenience
// allTight= tight lepton ID, tight lepton Iso, Tight jet ID
BRANCH(llmetjj_allTight_btagL_ht, std::vector<HH::DileptonMetDijet>);
BRANCH(llmetjj_allTight_btagL_pt, std::vector<HH::DileptonMetDijet>);
BRANCH(llmetjj_allTight_btagL_csv, std::vector<HH::DileptonMetDijet>);
BRANCH(llmetjj_allTight_nobtag_ht, std::vector<HH::DileptonMetDijet>);
BRANCH(llmetjj_allTight_nobtag_pt, std::vector<HH::DileptonMetDijet>);
BRANCH(llmetjj_allTight_nobtag_csv, std::vector<HH::DileptonMetDijet>);
// Januray 2016: preapproval freezing custom candidates
BRANCH(llmetjj_HWWleptons_nobtag_csv, std::vector<HH::DileptonMetDijet>);
BRANCH(llmetjj_HWWleptons_btagL_csv, std::vector<HH::DileptonMetDijet>);
BRANCH(llmetjj_HWWleptons_btagM_csv, std::vector<HH::DileptonMetDijet>);
BRANCH(llmetjj_HWWleptons_btagT_csv, std::vector<HH::DileptonMetDijet>);

// maps
std::vector<std::vector<int>>& map_l = tree["map_l"].write_with_init<std::vector<std::vector<int>>>(lepID::Count * lepIso::Count, std::vector<int>(0));
std::vector<std::vector<int>>& map_ll = tree["map_ll"].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_l = std::vector<std::vector<int>>(lepID::Count * lepIso::Count, std::vector<int>(0));
std::vector<std::vector<int>> map_ll = std::vector<std::vector<int>>(lepID::Count * lepIso::Count * lepID::Count * lepIso::Count, std::vector<int>(0));
// FIXME: add enum over met?
std::vector<std::vector<int>>& map_llmet = tree["map_llmet"].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 = tree["map_j"].write_with_init<std::vector<std::vector<int>>>(jetID::Count * btagWP::Count, std::vector<int>(0));
std::vector<std::vector<int>>& map_jj = tree["map_jj"].write_with_init<std::vector<std::vector<int>>>(jetID::Count * jetID::Count * btagWP::Count * btagWP::Count * jetPair::Count, std::vector<int>(0));
std::vector<std::vector<int>>& map_llmetjj = tree["map_llmetjj"].write_with_init<std::vector<std::vector<int>>>(lepID::Count * lepIso::Count * lepID::Count * lepIso::Count * jetID::Count * jetID::Count * btagWP::Count * btagWP::Count * jetPair::Count, std::vector<int>(0));
std::vector<std::vector<int>> map_llmet = std::vector<std::vector<int>>(lepID::Count * lepIso::Count * lepID::Count * lepIso::Count, std::vector<int>(0));
std::vector<std::vector<int>> map_j = std::vector<std::vector<int>>(jetID::Count * btagWP::Count, std::vector<int>(0));
std::vector<std::vector<int>> map_jj = std::vector<std::vector<int>>(jetID::Count * jetID::Count * btagWP::Count * btagWP::Count * jetPair::Count, std::vector<int>(0));
std::vector<std::vector<int>> map_llmetjj = std::vector<std::vector<int>>(lepID::Count * lepIso::Count * lepID::Count * lepIso::Count * jetID::Count * jetID::Count * btagWP::Count * btagWP::Count * jetPair::Count, std::vector<int>(0));

virtual void analyze(const edm::Event&, const edm::EventSetup&, const ProducersManager&, const AnalyzersManager&, const CategoryManager&) override;
virtual void registerCategories(CategoryManager& manager, const edm::ParameterSet& config) override;
Expand All @@ -118,6 +112,22 @@ class HHAnalyzer: public Framework::Analyzer {
BRANCH(nLeptonsL, unsigned int);
BRANCH(nLeptonsT, unsigned int);

float count_has2leptons = 0.;
float count_has2leptons_elel = 0.;
float count_has2leptons_elmu = 0.;
float count_has2leptons_muel = 0.;
float count_has2leptons_mumu = 0.;
float count_has2leptons_1llmetjj = 0.;
float count_has2leptons_elel_1llmetjj = 0.;
float count_has2leptons_elmu_1llmetjj = 0.;
float count_has2leptons_muel_1llmetjj = 0.;
float count_has2leptons_mumu_1llmetjj = 0.;
float count_has2leptons_1llmetjj_2btagM = 0.;
float count_has2leptons_elel_1llmetjj_2btagM = 0.;
float count_has2leptons_elmu_1llmetjj_2btagM = 0.;
float count_has2leptons_muel_1llmetjj_2btagM = 0.;
float count_has2leptons_mumu_1llmetjj_2btagM = 0.;

private:
// Producers name
std::string m_electrons_producer;
Expand Down
21 changes: 15 additions & 6 deletions plugins/Categories.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,20 @@
// ***** ***** *****

const std::vector<HH::Lepton>& DileptonCategory::getLeptons(const AnalyzersManager& analyzers) const {
const HHAnalyzer& hh_analyzer = analyzers.get<HHAnalyzer>("hh_analyzer");
const HHAnalyzer& hh_analyzer = analyzers.get<HHAnalyzer>(m_analyzer_name);
return hh_analyzer.leptons;
}

const std::vector<HH::Dilepton>& DileptonCategory::getDileptons(const AnalyzersManager& analyzers) const {
const HHAnalyzer& hh_analyzer = analyzers.get<HHAnalyzer>("hh_analyzer");
const HHAnalyzer& hh_analyzer = analyzers.get<HHAnalyzer>(m_analyzer_name);
return hh_analyzer.ll;
}

const std::vector<HH::DileptonMetDijet>& DileptonCategory::getDileptonMetDijets(const AnalyzersManager& analyzers) const {
const HHAnalyzer& hh_analyzer = analyzers.get<HHAnalyzer>(m_analyzer_name);
return hh_analyzer.llmetjj;
}

// ***** ***** *****
// Dilepton Mu-Mu category
// ***** ***** *****
Expand All @@ -28,12 +33,13 @@ bool MuMuCategory::event_in_category_pre_analyzers(const ProducersManager& produ

bool MuMuCategory::event_in_category_post_analyzers(const ProducersManager& producers, const AnalyzersManager& analyzers) const {
const std::vector<HH::Dilepton>& ll = getDileptons(analyzers);
const std::vector<HH::DileptonMetDijet>& llmetjj = getDileptonMetDijets(analyzers);
bool isMuMu = false;
for (unsigned int idilep = 0; idilep < ll.size(); idilep++)
{
if (ll[idilep].isMuMu) isMuMu = true;
}
return (isMuMu);
return (isMuMu && llmetjj.size() > 0);
};

void MuMuCategory::register_cuts(CutManager& manager) {
Expand Down Expand Up @@ -62,12 +68,13 @@ bool ElElCategory::event_in_category_pre_analyzers(const ProducersManager& produ

bool ElElCategory::event_in_category_post_analyzers(const ProducersManager& producers, const AnalyzersManager& analyzers) const {
const std::vector<HH::Dilepton>& ll = getDileptons(analyzers);
const std::vector<HH::DileptonMetDijet>& llmetjj = getDileptonMetDijets(analyzers);
bool isElEl = false;
for (unsigned int idilep = 0; idilep < ll.size(); idilep++)
{
if (ll[idilep].isElEl) isElEl = true;
}
return (isElEl);
return (isElEl && llmetjj.size() > 0);
};

void ElElCategory::register_cuts(CutManager& manager) {
Expand Down Expand Up @@ -95,12 +102,13 @@ bool ElMuCategory::event_in_category_pre_analyzers(const ProducersManager& produ

bool ElMuCategory::event_in_category_post_analyzers(const ProducersManager& producers, const AnalyzersManager& analyzers) const {
const std::vector<HH::Dilepton>& ll = getDileptons(analyzers);
const std::vector<HH::DileptonMetDijet>& llmetjj = getDileptonMetDijets(analyzers);
bool isElMu = false;
for (unsigned int idilep = 0; idilep < ll.size(); idilep++)
{
if (ll[idilep].isElMu) isElMu = true;
}
return (isElMu);
return (isElMu && llmetjj.size() > 0);
};

void ElMuCategory::register_cuts(CutManager& manager) {
Expand All @@ -126,12 +134,13 @@ bool MuElCategory::event_in_category_pre_analyzers(const ProducersManager& produ

bool MuElCategory::event_in_category_post_analyzers(const ProducersManager& producers, const AnalyzersManager& analyzers) const {
const std::vector<HH::Dilepton>& ll = getDileptons(analyzers);
const std::vector<HH::DileptonMetDijet>& llmetjj = getDileptonMetDijets(analyzers);
bool isMuEl = false;
for (unsigned int idilep = 0; idilep < ll.size(); idilep++)
{
if (ll[idilep].isMuEl) isMuEl = true;
}
return (isMuEl);
return (isMuEl && llmetjj.size() > 0);
};

void MuElCategory::register_cuts(CutManager& manager) {
Expand Down
Loading

0 comments on commit 897a9e1

Please sign in to comment.