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 
14 
15 //
16 // class declaration
17 //
19 {
20 public:
21  explicit HLTHcalTowerFilter(const edm::ParameterSet &);
23 
24 private:
25  virtual bool hltFilter(edm::Event &, const edm::EventSetup &, trigger::TriggerFilterObjectWithRefs & filterproduct);
26 
27  edm::InputTag inputTag_; // input tag identifying product
28  double min_E_HB_; // energy threshold for HB in GeV
29  double min_E_HE_; // energy threshold for HE in GeV
30  double min_E_HF_; // energy threshold for HF in GeV
31  int max_N_HB_; // maximum number for HB
32  int max_N_HE_; // maximum number for HB
33  int max_N_HF_; // maximum number for HB
34  int min_N_HF_; // minimum number for HB
35  int min_N_HFM_; // minimum number for HB-
36  int min_N_HFP_; // minimum number for HB+
37 };
38 
39 #include <memory>
40 
47 
48 //
49 // constructors and destructor
50 //
52  inputTag_ (config.getParameter<edm::InputTag>("inputTag")),
53  min_E_HB_ (config.getParameter<double> ("MinE_HB")),
54  min_E_HE_ (config.getParameter<double> ("MinE_HE")),
55  min_E_HF_ (config.getParameter<double> ("MinE_HF")),
56  max_N_HB_ (config.getParameter<int> ("MaxN_HB")),
57  max_N_HE_ (config.getParameter<int> ("MaxN_HE")),
58  max_N_HF_ (config.getParameter<int> ("MaxN_HF")),
59  min_N_HF_ (-1),
60  min_N_HFM_ (-1),
61  min_N_HFP_ (-1)
62 {
63 
64  if (config.existsAs<int>("MinN_HF")){
65  min_N_HF_=config.getParameter<int>("MinN_HF");
66  }
67  if (config.existsAs<int>("MinN_HFM")){
68  min_N_HFM_=config.getParameter<int>("MinN_HFM");
69  }
70  if (config.existsAs<int>("MinN_HFP")){
71  min_N_HFP_=config.getParameter<int>("MinN_HFP");
72  }
73 
74 }
75 
77 {
78 }
79 
80 //
81 // member functions
82 //
83 
84 // ------------ method called to produce the data ------------
85 bool
87 {
88  using namespace std;
89  using namespace edm;
90  using namespace reco;
91  using namespace trigger;
92 
93  // The filter object
94  if (saveTags()) filterproduct.addCollectionTag(inputTag_);
95 
96  // get hold of collection of objects
98  event.getByLabel(inputTag_, towers);
99 
100  // look at all objects, check cuts and add to filter object
101  int n_HB = 0;
102  int n_HE = 0;
103  int n_HF = 0;
104  int n_HFM = 0;
105  int n_HFP = 0;
106  double abseta = 0.0;
107  double eta = 0.0;
108  for(CaloTowerCollection::const_iterator i = towers->begin(); i != towers->end(); ++i)
109  {
110  eta = i->eta();
111  abseta = std::abs(eta);
112  if(abseta<1.305)
113  {
114  if(i->hadEnergy() >= min_E_HB_)
115  {
116  n_HB++;
117  //edm::Ref<CaloTowerCollection> ref(towers, std::distance(towers->begin(), i));
118  //filterproduct.addObject(TriggerJet, ref);
119  }
120  }
121  else if(abseta>=1.305 && abseta<3)
122  {
123  if(i->hadEnergy() >= min_E_HE_)
124  {
125  n_HE++;
126  //edm::Ref<CaloTowerCollection> ref(towers, std::distance(towers->begin(), i));
127  //filterproduct.addObject(TriggerJet, ref);
128  }
129  }
130  else
131  {
132  if(i->hadEnergy() >= min_E_HF_)
133  {
134  n_HF++;
135  //edm::Ref<CaloTowerCollection> ref(towers, std::distance(towers->begin(), i));
136  //filterproduct.addObject(TriggerJet, ref);
137  if(eta >= 3) { n_HFP++; } else { n_HFM++; }
138  }
139  }
140  }
141 
142  // filter decision
143  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_);
144 
145  return accept;
146 }
147 
148 // define as a framework module
151 
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:187
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
std::vector< CaloTower >::const_iterator const_iterator
#define abs(x)
Definition: mlp_lapack.h:159
T eta() const
HLTHcalTowerFilter(const edm::ParameterSet &)
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:22
virtual bool hltFilter(edm::Event &, const edm::EventSetup &, trigger::TriggerFilterObjectWithRefs &filterproduct)
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
void addCollectionTag(const edm::InputTag &collectionTag)
collectionTags
bool saveTags() const
Definition: HLTFilter.h:45
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")