DAS  3.0
Das Analysis System
Filters.h
Go to the documentation of this file.
1 #include <vector>
2 #include <system_error>
3 #include <iostream>
4 #include <TString.h>
5 
9 
10 #include <darwin.h>
11 
12 using namespace std;
13 
14 namespace pt = boost::property_tree;
15 namespace fs = filesystem;
16 
17 namespace DE = Darwin::Exceptions;
18 namespace DT = Darwin::Tools;
19 
20 namespace DAS::MissingET {
21 
22 struct Filters {
23  vector<TString> METnames;
24  vector<int> METbitsToApply;
25 
26  //For more info look at https://indico.cern.ch/event/1305273/#12-status-update-from-hamburg, contribution by V. Guglielmi
27 
28  // NOTE: this is taken from the python config file, check that the name
29  // still make sense.....
30  Filters (int year)
31  {
32  switch (year) {
33  case 2016:
34  METnames = {"goodVertices", "globalSuperTightHalo2016Filter", "HBHENoiseFilter",
35  "HBHENoiseIsoFilter", "EcalDeadCellTriggerPrimitiveFilter",
36  "BadPFMuonFilter", /*this one destroys Herwig16, for some reason*/
37  "BadPFMuonDzFilter", //always return null value, to be better studied
38  "BadChargedCandidateFilter", /*this one too, but anyway, it is no longer recommended for any */
39  "eeBadScFilter" /*this one is useless*/};
40 
41  METbitsToApply = {0, 1, 2, 3, 4, 5, 6, /*7,*/ 8};
42  break;
43  case 2017:
44  case 2018:
45  // filters 6 and 9 always null, to be better investigated!!! filters 7 and 8 not recommended
46  METnames = {"goodVertices", "globalSuperTightHalo2016Filter", "HBHENoiseFilter",
47  "HBHENoiseIsoFilter", "EcalDeadCellTriggerPrimitiveFilter",
48  "BadPFMuonFilter", /*this one destroys Herwig16, for some reason*/
49  "BadPFMuonDzFilter",
50  "BadChargedCandidateFilter",
51  "eeBadScFilter",
52  "hfNoisyHitsFilter",
53  "ecalBadCalibFilter"};
54  METbitsToApply = {0, 1, 2, 3, 4, 5, 6, /*7,*/ 8, /*9,*/ 10};
55  break;
56  default:
57  BOOST_THROW_EXCEPTION( invalid_argument(Form("%d is not (currently) not handled.", year)) );
58  }
59 
60  cout << "MET bits:";
61  for (auto bit: METbitsToApply)
62  cout << ' ' << bit;
63  cout << endl;
64  }
65 
66  void operator() (MET * met, RecEvent * event)
67  {
68  // testing MET filters
69  bool passFilters = true;
70  // BadChargedCandidateFilter is no longer recommended
71  for (size_t ibit = 0; ibit < METnames.size(); ++ibit) {
72 
73  bool bit = met->Bit.at(ibit);
74 
75  if (find(METbitsToApply.begin(), METbitsToApply.end(), ibit) != METbitsToApply.end())
76  passFilters = passFilters && bit;
77  }
78 
79  if (!passFilters)
80  event->weights *= 0;
81  }
82 
83 };
84 
85 }
jmarExample.pt
pt
Definition: jmarExample.py:19
Ntupliser_cfg.year
int year
Definition: Ntupliser_cfg.py:63
DAS::RecEvent
Definition: Event.h:52
Event.h
DAS::MET
Definition: Event.h:84
Jet.h
DAS::MissingET::Filters::METnames
vector< TString > METnames
Definition: Filters.h:23
binnings.h
Darwin::Exceptions
Handling of exceptions.
Definition: darwin.h:36
DAS::MET::Bit
std::vector< bool > Bit
flags for application of MET filters (see n-tupliser config file)
Definition: Event.h:89
DAS::MissingET::Filters::Filters
Filters(int year)
Definition: Filters.h:30
Darwin::Tools
Classes and functions related to the framework.
Definition: Dict_rdict.cxx:990
met
DAS::MET met
Definition: classes.h:28
DAS::MissingET::Filters
Definition: Filters.h:22
DAS::MissingET
Definition: applyMETfilters.cc:20
DAS::MissingET::Filters::METbitsToApply
vector< int > METbitsToApply
Definition: Filters.h:24