selection.hpp 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /**
  2. * @file
  3. * @author Caleb Fangmeier <caleb@fangmeier.tech>
  4. * @version 0.1
  5. *
  6. * @section LICENSE
  7. *
  8. *
  9. * MIT License
  10. *
  11. * Copyright (c) 2017 Caleb Fangmeier
  12. *
  13. * Permission is hereby granted, free of charge, to any person obtaining a copy
  14. * of this software and associated documentation files (the "Software"), to deal
  15. * in the Software without restriction, including without limitation the rights
  16. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  17. * copies of the Software, and to permit persons to whom the Software is
  18. * furnished to do so, subject to the following conditions:
  19. *
  20. * The above copyright notice and this permission notice shall be included in all
  21. * copies or substantial portions of the Software.
  22. *
  23. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  24. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  25. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  26. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  27. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  28. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  29. * SOFTWARE.
  30. *
  31. * @section DESCRIPTION
  32. * Define a set of common event selections
  33. */
  34. #ifndef SELECTION_HPP
  35. #define SELECTION_HPP
  36. #include <vector>
  37. #include "filval/filval.hpp"
  38. #include "filval_root/filval_root.hpp"
  39. #include "analysis/common/obj_types.hpp"
  40. struct EventSelection{
  41. ObsFilter* trilepton;
  42. ObsFilter* b_jet3;
  43. ObsFilter* z_mass_veto;
  44. ObsFilter* base_sel;
  45. ObsFilter* J4;
  46. ObsFilter* J5;
  47. ObsFilter* J6;
  48. ObsFilter* SR4j;
  49. ObsFilter* SR5j;
  50. ObsFilter* SR6j;
  51. };
  52. EventSelection event_selection;
  53. void init_selection(){
  54. auto leptons = lookup<std::vector<Particle>>("leptons");
  55. auto jets = lookup<std::vector<Particle>>("jets");
  56. // Require *exactly* three charged leptons
  57. event_selection.trilepton = obs_filter("trilepton",GenFunction::register_function<bool()>("trilepton",
  58. FUNC(([leptons](){
  59. return leptons->get_value().size() == 3;
  60. }))));
  61. // Require at least three b-jets
  62. event_selection.b_jet3 = obs_filter("b_jet3",GenFunction::register_function<bool()>("b_jet3",
  63. FUNC(([jets](){
  64. int n_b_jets = 0;
  65. for(auto jet : jets->get_value()){
  66. if(jet.tag == Particle::JET && jet.jet.b_cmva > 0)
  67. n_b_jets++;
  68. }
  69. return n_b_jets >= 3;
  70. }))));
  71. // Require all same-flavour OS dilepton combinations are outside the Z mass
  72. // window (70,105)
  73. event_selection.z_mass_veto = obs_filter("z_mass_veto",GenFunction::register_function<bool()>("z_mass_veto",
  74. FUNC(([leptons](){
  75. auto& leps = leptons->get_value();
  76. int n = leps.size();
  77. for(int i = 0; i < n; i++){
  78. for(int j = i+1; j < n; j++){
  79. const Particle& p1 = leps[i];
  80. const Particle& p2 = leps[j];
  81. if(abs(p1.lepton.pdg_id) != abs(p2.lepton.pdg_id)) continue;
  82. if(p1.lepton.charge == p2.lepton.charge) continue;
  83. double m = (p1.v + p2.v).M();
  84. if(70 < m && m < 105)
  85. return false;
  86. }
  87. }
  88. return true;
  89. }))));
  90. event_selection.J4 = obs_filter("4jet_selection",GenFunction::register_function<bool()>("4jet_selection",
  91. FUNC(([jets](){
  92. return jets->get_value().size() >= 4;
  93. }))));
  94. event_selection.J5 = obs_filter("5jet_selection",GenFunction::register_function<bool()>("5jet_selection",
  95. FUNC(([jets](){
  96. return jets->get_value().size() >= 5;
  97. }))));
  98. event_selection.J6 = obs_filter("6jet_selection",GenFunction::register_function<bool()>("6jet_selection",
  99. FUNC(([jets](){
  100. return jets->get_value().size() >= 6;
  101. }))));
  102. event_selection.base_sel = ObsFilter::conj(event_selection.z_mass_veto, ObsFilter::conj(event_selection.trilepton, event_selection.b_jet3));
  103. event_selection.SR4j = ObsFilter::conj(event_selection.base_sel, event_selection.J4);
  104. event_selection.SR5j = ObsFilter::conj(event_selection.base_sel, event_selection.J5);
  105. event_selection.SR6j = ObsFilter::conj(event_selection.base_sel, event_selection.J6);
  106. }
  107. #endif // SELECTION_HPP