CMS 3D CMS Logo

HLTMhtFilter.cc
Go to the documentation of this file.
1 
10 
16 
17 
18 // Constructor
20  minMht_ ( iConfig.getParameter<std::vector<double> >("minMht") ),
21  mhtLabels_ ( iConfig.getParameter<std::vector<edm::InputTag> >("mhtLabels") ),
22  nOrs_ ( mhtLabels_.size() ) { // number of settings to .OR.
23  if (!(mhtLabels_.size() == minMht_.size()) ||
24  mhtLabels_.empty() ) {
25  nOrs_ = (minMht_.size() < nOrs_ ? minMht_.size() : nOrs_);
26  edm::LogError("HLTMhtFilter") << "inconsistent module configuration!";
27  }
28 
29  for(unsigned int i=0; i<nOrs_; ++i) {
30  m_theMhtToken.push_back(consumes<reco::METCollection>(mhtLabels_[i]));
31  }
32 
33 }
34 
35 // Destructor
36 HLTMhtFilter::~HLTMhtFilter() = default;
37 
38 // Fill descriptions
40  std::vector<edm::InputTag> tmp1(1, edm::InputTag("hltMhtProducer"));
41  std::vector<double> tmp2(1, 0.);
44  desc.add<std::vector<edm::InputTag> >("mhtLabels", tmp1);
45  tmp2[0] = 70; desc.add<std::vector<double> >("minMht", tmp2);
46  descriptions.add("hltMhtFilter", desc);
47 }
48 
49 // Make filter decision
51 
52  reco::METRef mhtref;
53 
54  bool accept = false;
55 
56  // Take the .OR. of all sets of requirements
57  for (unsigned int i = 0; i < nOrs_; ++i) {
58 
59  // Create the reference to the output filter objects
60  if (saveTags()) filterproduct.addCollectionTag(mhtLabels_[i]);
61 
63  iEvent.getByToken(m_theMhtToken[i], hmht);
64  double mht = 0;
65  if (!hmht->empty()) mht = hmht->front().pt();
66 
67  // Check if the event passes this cut set
68  accept = accept || (mht > minMht_[i]);
69  // In principle we could break if accepted, but in order to save
70  // for offline analysis all possible decisions we keep looping here
71  // in term of timing this will not matter much; typically 1 or 2 cut-sets
72  // will be checked only
73 
74  // Store the ref (even if it is not accepted)
75  mhtref = reco::METRef(hmht, 0);
76 
77  filterproduct.addObject(trigger::TriggerMHT, mhtref); // save as TriggerMHT object
78  }
79 
80  return accept;
81 }
size
Write out results.
std::vector< double > minMht_
Minimum MHT requirements.
Definition: HLTMhtFilter.h:35
~HLTMhtFilter() override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
std::vector< edm::InputTag > mhtLabels_
Input reco::MET collections to retrieve MHT.
Definition: HLTMhtFilter.h:38
std::vector< edm::EDGetTokenT< reco::METCollection > > m_theMhtToken
number of pairs of MHT
Definition: HLTMhtFilter.h:42
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: HLTMhtFilter.cc:39
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
void addObject(int id, const reco::RecoEcalCandidateRef &ref)
setters for L3 collections: (id=physics type, and Ref<C>)
int iEvent
Definition: GenABIO.cc:224
HLTMhtFilter(const edm::ParameterSet &iConfig)
Definition: HLTMhtFilter.cc:19
bool hltFilter(edm::Event &iEvent, const edm::EventSetup &iSetup, trigger::TriggerFilterObjectWithRefs &filterproduct) const override
Definition: HLTMhtFilter.cc:50
unsigned int nOrs_
Definition: HLTMhtFilter.h:40
ParameterDescriptionBase * add(U const &iLabel, T const &value)
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
HLT enums.
edm::Ref< METCollection > METRef
edm references
Definition: METFwd.h:13