selection.hpp 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. ObsFilter* SR4j;
  41. ObsFilter* SR5j;
  42. ObsFilter* SR6j;
  43. void init_selection(){
  44. auto leptons = lookup<std::vector<Particle>>("leptons");
  45. auto jets = lookup<std::vector<Particle>>("jets");
  46. // Require *exactly* three charged leptons
  47. auto trilepton = obs_filter("trilepton",GenFunction::register_function<bool()>("trilepton",
  48. FUNC(([leptons](){
  49. return leptons->get_value().size() == 3;
  50. }))));
  51. // Require at least three charged b-jets
  52. auto b_jet = obs_filter("b_jet",GenFunction::register_function<bool()>("b_jet",
  53. FUNC(([jets](){
  54. int n_b_jets = 0;
  55. for(auto jet : jets->get_value()){
  56. if(jet.tag == Particle::JET && jet.jet.b_cmva > 0)
  57. n_b_jets++;
  58. }
  59. return n_b_jets >= 3;
  60. }))));
  61. // Require all same-flavour OS dilepton combinations are outside the Z mass
  62. // window (70,105)
  63. auto z_mass_window = obs_filter("z_mass_window",GenFunction::register_function<bool()>("z_mass_window",
  64. FUNC(([leptons](){
  65. auto& leps = leptons->get_value();
  66. int n = leps.size();
  67. for(int i = 0; i < n; i++){
  68. for(int j = i+1; j < n; j++){
  69. const Particle& p1 = leps[i];
  70. const Particle& p2 = leps[j];
  71. if(abs(p1.lepton.pdg_id) != abs(p2.lepton.pdg_id)) continue;
  72. if(p1.lepton.charge == p2.lepton.charge) continue;
  73. double m = (p1.v + p2.v).M();
  74. if(70 < m && m < 105)
  75. return false;
  76. }
  77. }
  78. return true;
  79. }))));
  80. auto J4 = obs_filter("4jet_selection",GenFunction::register_function<bool()>("4jet_selection",
  81. FUNC(([jets](){
  82. return jets->get_value().size() >= 4;
  83. }))));
  84. auto J5 = obs_filter("5jet_selection",GenFunction::register_function<bool()>("5jet_selection",
  85. FUNC(([jets](){
  86. return jets->get_value().size() >= 5;
  87. }))));
  88. auto J6 = obs_filter("6jet_selection",GenFunction::register_function<bool()>("6jet_selection",
  89. FUNC(([jets](){
  90. return jets->get_value().size() >= 6;
  91. }))));
  92. auto base_sel = ObsFilter::conj(z_mass_window, ObsFilter::conj(trilepton, b_jet));
  93. SR4j = ObsFilter::conj(base_sel, J4);
  94. SR5j = ObsFilter::conj(base_sel, J5);
  95. SR6j = ObsFilter::conj(base_sel, J6);
  96. }
  97. #endif // SELECTION_HPP