CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HLTHcalTowerFilter.cc
Go to the documentation of this file.
1 
12 
16 
17 //
18 // class declaration
19 //
21 {
22 public:
23  explicit HLTHcalTowerFilter(const edm::ParameterSet &);
25  static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
26 
27 private:
28  virtual bool hltFilter(edm::Event &, const edm::EventSetup &, trigger::TriggerFilterObjectWithRefs & filterproduct) const override;
29 
31  edm::InputTag inputTag_; // input tag identifying product
32  double min_E_HB_; // energy threshold for HB in GeV
33  double min_E_HE_; // energy threshold for HE in GeV
34  double min_E_HF_; // energy threshold for HF in GeV
35  int max_N_HB_; // maximum number for HB
36  int max_N_HE_; // maximum number for HB
37  int max_N_HF_; // maximum number for HB
38  int min_N_HF_; // minimum number for HB
39  int min_N_HFM_; // minimum number for HB-
40  int min_N_HFP_; // minimum number for HB+
41 };
42 
43 #include <memory>
44 
50 
51 //
52 // constructors and destructor
53 //
55  inputTag_ (config.getParameter<edm::InputTag>("inputTag")),
56  min_E_HB_ (config.getParameter<double> ("MinE_HB")),
57  min_E_HE_ (config.getParameter<double> ("MinE_HE")),
58  min_E_HF_ (config.getParameter<double> ("MinE_HF")),
59  max_N_HB_ (config.getParameter<int> ("MaxN_HB")),
60  max_N_HE_ (config.getParameter<int> ("MaxN_HE")),
61  max_N_HF_ (config.getParameter<int> ("MaxN_HF")),
62  min_N_HF_ (-1),
63  min_N_HFM_ (-1),
64  min_N_HFP_ (-1)
65 {
66 
67  if (config.existsAs<int>("MinN_HF")){
68  min_N_HF_=config.getParameter<int>("MinN_HF");
69  }
70  if (config.existsAs<int>("MinN_HFM")){
71  min_N_HFM_=config.getParameter<int>("MinN_HFM");
72  }
73  if (config.existsAs<int>("MinN_HFP")){
74  min_N_HFP_=config.getParameter<int>("MinN_HFP");
75  }
76 
77  inputToken_ = consumes<CaloTowerCollection>(inputTag_);
78 }
79 
81 {
82 }
83 
84 void
88  desc.add<edm::InputTag>("inputTag",edm::InputTag("hltTowerMakerForHcal"));
89  desc.add<double>("MinE_HB",1.5);
90  desc.add<double>("MinE_HE",2.5);
91  desc.add<double>("MinE_HF",9.0);
92  desc.add<int>("MaxN_HB",2);
93  desc.add<int>("MaxN_HE",2);
94  desc.add<int>("MaxN_HF",8);
95  desc.add<int>("MinN_HF",-1);
96  desc.add<int>("MinN_HFM",-1);
97  desc.add<int>("MinN_HFP",-1);
98  descriptions.add("hltHcalTowerFilter",desc);
99 }
100 
101 //
102 // member functions
103 //
104 
105 // ------------ method called to produce the data ------------
106 bool
108 {
109  using namespace std;
110  using namespace edm;
111  using namespace reco;
112  using namespace trigger;
113 
114  // The filter object
115  if (saveTags()) filterproduct.addCollectionTag(inputTag_);
116 
117  // get hold of collection of objects
119  event.getByToken(inputToken_, towers);
120 
121  // look at all objects, check cuts and add to filter object
122  int n_HB = 0;
123  int n_HE = 0;
124  int n_HF = 0;
125  int n_HFM = 0;
126  int n_HFP = 0;
127  double abseta = 0.0;
128  double eta = 0.0;
129  for(CaloTowerCollection::const_iterator i = towers->begin(); i != towers->end(); ++i)
130  {
131  eta = i->eta();
132  abseta = std::abs(eta);
133  if(abseta<1.305)
134  {
135  if(i->hadEnergy() >= min_E_HB_)
136  {
137  n_HB++;
138  //edm::Ref<CaloTowerCollection> ref(towers, std::distance(towers->begin(), i));
139  //filterproduct.addObject(TriggerJet, ref);
140  }
141  }
142  else if(abseta>=1.305 && abseta<3)
143  {
144  if(i->hadEnergy() >= min_E_HE_)
145  {
146  n_HE++;
147  //edm::Ref<CaloTowerCollection> ref(towers, std::distance(towers->begin(), i));
148  //filterproduct.addObject(TriggerJet, ref);
149  }
150  }
151  else
152  {
153  if(i->hadEnergy() >= min_E_HF_)
154  {
155  n_HF++;
156  //edm::Ref<CaloTowerCollection> ref(towers, std::distance(towers->begin(), i));
157  //filterproduct.addObject(TriggerJet, ref);
158  if(eta >= 3) { n_HFP++; } else { n_HFM++; }
159  }
160  }
161  }
162 
163  // filter decision
164  bool accept(n_HB<max_N_HB_ && n_HE<max_N_HE_ && n_HF<max_N_HF_ && n_HFP>=min_N_HFP_ && n_HFM>=min_N_HFM_ && n_HF>=min_N_HF_);
165 
166  return accept;
167 }
168 
169 // define as a framework module
172 
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:186
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
std::vector< CaloTower >::const_iterator const_iterator
HLTHcalTowerFilter(const edm::ParameterSet &)
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:24
edm::EDGetTokenT< CaloTowerCollection > inputToken_
virtual bool hltFilter(edm::Event &, const edm::EventSetup &, trigger::TriggerFilterObjectWithRefs &filterproduct) const override
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ParameterDescriptionBase * add(U const &iLabel, T const &value)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
static void makeHLTFilterDescription(edm::ParameterSetDescription &desc)
Definition: HLTFilter.cc:29
void addCollectionTag(const edm::InputTag &collectionTag)
collectionTags
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool saveTags() const
Definition: HLTFilter.h:45
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")