40 #include "filval/filval.hpp" 41 #include "filval_root/filval_root.hpp" 43 #include "analysis/common/obj_types.hpp" 45 struct EventSelection{
47 ObsFilter* trilepton_eemu;
48 ObsFilter* trilepton_mumue;
50 ObsFilter* z_mass_veto;
63 EventSelection event_selection;
65 void init_selection(){
66 auto leptons = lookup<std::vector<Particle>>(
"leptons");
67 auto jets = lookup<std::vector<Particle>>(
"jets");
70 event_selection.trilepton = obs_filter(
"trilepton",GenFunction::register_function<
bool()>(
"trilepton",
72 return leptons->get_value().size() == 3;
76 event_selection.trilepton_eemu = obs_filter(
"trilepton_eemu",GenFunction::register_function<
bool()>(
"trilepton_eemu",
78 std::vector<Particle>& leps = leptons->get_value();
79 if(leps.size() != 3)
return false;
80 auto check_id = [](
int ref_id){
81 auto fn = [ref_id](
const Particle& p){
82 return p.lepton.pdg_id == ref_id;
86 bool has_ep = std::count_if(std::begin(leps), std::end(leps), check_id(-11)) == 1;
87 bool has_en = std::count_if(std::begin(leps), std::end(leps), check_id( 11)) == 1;
88 bool has_mup = std::count_if(std::begin(leps), std::end(leps), check_id(-13)) == 1;
89 bool has_mun = std::count_if(std::begin(leps), std::end(leps), check_id( 13)) == 1;
91 return has_ep && has_en && (has_mup != has_mun);
95 event_selection.trilepton_mumue = obs_filter(
"trilepton_mumue",GenFunction::register_function<
bool()>(
"trilepton_mumue",
97 std::vector<Particle>& leps = leptons->get_value();
98 if(leps.size() != 3)
return false;
99 auto check_id = [](
int ref_id){
100 auto fn = [ref_id](
const Particle& p){
101 return p.lepton.pdg_id == ref_id;
105 bool has_ep = std::count_if(std::begin(leps), std::end(leps), check_id(-11)) == 1;
106 bool has_en = std::count_if(std::begin(leps), std::end(leps), check_id( 11)) == 1;
107 bool has_mup = std::count_if(std::begin(leps), std::end(leps), check_id(-13)) == 1;
108 bool has_mun = std::count_if(std::begin(leps), std::end(leps), check_id( 13)) == 1;
110 return (has_ep != has_en) && has_mup && has_mun;
114 event_selection.b_jet3 = obs_filter(
"b_jet3",GenFunction::register_function<
bool()>(
"b_jet3",
117 for(
auto jet : jets->get_value()){
118 if(jet.tag == Particle::JET && jet.jet.b_cmva > 0)
121 return n_b_jets >= 3;
126 event_selection.z_mass_veto = obs_filter(
"z_mass_veto",GenFunction::register_function<
bool()>(
"z_mass_veto",
128 auto& leps = leptons->get_value();
130 for(
int i = 0; i < n; i++){
131 for(
int j = i+1; j < n; j++){
132 const Particle& p1 = leps[i];
133 const Particle& p2 = leps[j];
134 if(abs(p1.lepton.pdg_id) != abs(p2.lepton.pdg_id))
continue;
135 if(p1.lepton.charge == p2.lepton.charge)
continue;
136 double m = (p1.v + p2.v).M();
137 if(70 < m && m < 105)
145 event_selection.J4 = obs_filter(
"4jet_selection",GenFunction::register_function<
bool()>(
"4jet_selection",
147 return jets->get_value().size() >= 4;
150 event_selection.J5 = obs_filter(
"5jet_selection",GenFunction::register_function<
bool()>(
"5jet_selection",
152 return jets->get_value().size() >= 5;
155 event_selection.J6 = obs_filter(
"6jet_selection",GenFunction::register_function<
bool()>(
"6jet_selection",
157 return jets->get_value().size() >= 6;
161 event_selection.base_sel =
all({event_selection.z_mass_veto, event_selection.trilepton_eemu, event_selection.b_jet3});
162 event_selection.SR4j =
all(event_selection.base_sel, event_selection.J4);
163 event_selection.SR5j =
all(event_selection.base_sel, event_selection.J5);
164 event_selection.SR6j =
all(event_selection.base_sel, event_selection.J6);
166 #endif // SELECTION_HPP ObsFilter * all(const std::vector< ObsFilter *> &&fs)
Return a new filter that is the conjuction of a vector of source filters.