CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HLTMhtFilter.cc
Go to the documentation of this file.
1 
20 #include <vector>
21 
22 
23 //
24 // constructors and destructor
25 //
27 {
28  inputMhtTag_ = iConfig.getParameter< edm::InputTag > ("inputMhtTag");
29  minMht_ = iConfig.getParameter<double> ("minMht");
30 }
31 
33 
36  desc.add<edm::InputTag>("inputMhtTag",edm::InputTag("hltMht30"));
37  desc.add<bool>("saveTags",false);
38  desc.add<double>("minMht",0.0);
39  descriptions.add("hltMhtFilter",desc);
40 }
41 
42 // ------------ method called to produce the data ------------
43 bool
45 {
46  using namespace std;
47  using namespace edm;
48  using namespace reco;
49  using namespace trigger;
50 
51  // The filter object
52  if (saveTags()) filterproduct.addCollectionTag(inputMhtTag_);
53 
54  METRef ref;
55 
56  Handle<METCollection> recomhts;
57  iEvent.getByLabel(inputMhtTag_,recomhts);
58 
59  // look at all candidates, check cuts and add to filter object
60  int n(0), flag(0);
61  double mht(0);
62 
63 
64  for (METCollection::const_iterator recomht = recomhts->begin(); recomht != recomhts->end(); recomht++) {
65  mht = recomht->pt();
66  }
67 
68  if( mht > minMht_) flag=1;
69 
70  if (flag==1) {
71  for (METCollection::const_iterator recomht = recomhts->begin(); recomht != recomhts->end(); recomht++) {
72  ref = METRef(recomhts,distance(recomhts->begin(),recomht));
73  filterproduct.addObject(TriggerMHT,ref);
74  n++;
75  }
76  }
77 
78  // filter decision
79  bool accept(n>0);
80 
81  return accept;
82 }
T getParameter(std::string const &) const
long int flag
Definition: mlp_lapack.h:47
double minMht_
Definition: HLTMhtFilter.h:31
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: HLTMhtFilter.cc:34
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:22
void addObject(int id, const reco::RecoEcalCandidateRef &ref)
setters for L3 collections: (id=physics type, and Ref&lt;C&gt;)
int iEvent
Definition: GenABIO.cc:243
edm::InputTag inputMhtTag_
Definition: HLTMhtFilter.h:30
ParameterDescriptionBase * add(U const &iLabel, T const &value)
virtual bool hltFilter(edm::Event &, const edm::EventSetup &, trigger::TriggerFilterObjectWithRefs &filterproduct)
Definition: HLTMhtFilter.cc:44
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
void addCollectionTag(const edm::InputTag &collectionTag)
collectionTags
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool saveTags() const
Definition: HLTFilter.h:45
edm::Ref< METCollection > METRef
edm references
Definition: METFwd.h:14
HLTMhtFilter(const edm::ParameterSet &)
Definition: HLTMhtFilter.cc:26