selection.hpp 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 <iostream>
  37. #include <vector>
  38. #include <utility>
  39. #include <numeric>
  40. #include <limits>
  41. #include "filval/filval.hpp"
  42. #include "filval_root/filval_root.hpp"
  43. #include <TSystem.h>
  44. #define JET_REQUIREMENT 6
  45. #define B_JET_REQUIREMENT 3
  46. #define B_JET_WP 0. // lower bound on CMVA value
  47. using namespace fv;
  48. struct Selection {
  49. public:
  50. static ObsFilter* trilepton_filter;
  51. static ObsFilter* jet_multiplicity_filter;
  52. static ObsFilter* b_jet_multiplicity_filter;
  53. static void init(){
  54. auto nLep = lookup<int>("nLepGood");
  55. trilepton_filter = obs_filter("trilepton_filter",GenFunction::register_function<bool()>("trilepton_filter",
  56. FUNC(([nLep=nLep](){
  57. return nLep->get_value() == 3;
  58. }))));
  59. auto nJet = lookup<int>("nJet");
  60. jet_multiplicity_filter = obs_filter("jet_multiplicity_filter",GenFunction::register_function<bool()>("jet_multiplicity_filter",
  61. FUNC(([nJet=nJet](){
  62. return nJet->get_value() >= JET_REQUIREMENT;
  63. }))));
  64. auto bJet_MVA = lookup<std::vector<float>>("Jet_btagCMVA");
  65. b_jet_multiplicity_filter = obs_filter("b_jet_multiplicity_filter",GenFunction::register_function<bool()>("b_jet_multiplicity_filter",
  66. FUNC(([bJet_MVA=bJet_MVA](){
  67. int n_b_jet = 0;
  68. for(auto j : bJet_MVA->get_value()){
  69. if(j > B_JET_WP){
  70. n_b_jet++;
  71. }
  72. }
  73. return n_b_jet >= B_JET_REQUIREMENT;
  74. }))));
  75. }
  76. };
  77. #endif // SELECTION_HPP