CMS 3D CMS Logo

HLTCountNumberOfObject.h
Go to the documentation of this file.
1 #ifndef HLTrigger_HLTCountNumberOfObject_H
2 
8 // system include files
9 #include <memory>
10 
11 // user include files
14 
17 
19 
21 
25 
26 template <class OColl>
28 public:
29  explicit HLTCountNumberOfObject(const edm::ParameterSet& iConfig)
30  : HLTFilter(iConfig),
31  src_(iConfig.getParameter<edm::InputTag>("src")),
32  minN_(iConfig.getParameter<int>("MinN")),
33  maxN_(iConfig.getParameter<int>("MaxN")) {
34  srcToken_ = consumes<OColl>(src_);
35  }
36 
38 
39  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
42  desc.add<edm::InputTag>("src", edm::InputTag(""));
43  desc.add<int>("MinN", 0);
44  desc.add<int>("MaxN", 99999);
46  }
47 
48 private:
50  const edm::EventSetup&,
51  trigger::TriggerFilterObjectWithRefs& filterproduct) const override {
52  edm::Handle<OColl> oHandle;
53  iEvent.getByToken(srcToken_, oHandle);
54  int s = oHandle->size();
55  bool answer = true;
56  if (minN_ != -1)
57  answer = answer && (s >= minN_);
58  if (maxN_ != -1)
59  answer = answer && (s <= maxN_);
60  LogDebug("HLTCountNumberOfObject") << module(iEvent) << " sees: " << s
61  << " objects. Filtere answer is: " << (answer ? "true" : "false");
62 
63  return answer;
64  }
65 
68  int minN_, maxN_;
69 };
70 
71 #endif
defaultModuleLabel.h
trigger::TriggerFilterObjectWithRefs
Definition: TriggerFilterObjectWithRefs.h:35
edm::EDGetTokenT< OColl >
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
EDFilter.h
TriggerFilterObjectWithRefs.h
edm::Handle
Definition: AssociativeIterator.h:50
HLTFilter
Definition: HLTFilter.h:28
HLTCountNumberOfObject::minN_
int minN_
Definition: HLTCountNumberOfObject.h:68
MessageLogger.h
MakerMacros.h
alignCSCRings.s
s
Definition: alignCSCRings.py:92
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
HLTFilter.h
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
submit.answer
answer
Definition: submit.py:45
HLTCountNumberOfObject::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: HLTCountNumberOfObject.h:39
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
edm::ParameterSet
Definition: ParameterSet.h:47
defaultModuleLabel
std::string defaultModuleLabel()
Definition: defaultModuleLabel.h:16
Event.h
createfilelist.int
int
Definition: createfilelist.py:10
HLTCountNumberOfObject::hltFilter
bool hltFilter(edm::Event &iEvent, const edm::EventSetup &, trigger::TriggerFilterObjectWithRefs &filterproduct) const override
Definition: HLTCountNumberOfObject.h:49
iEvent
int iEvent
Definition: GenABIO.cc:224
HLTCountNumberOfObject::maxN_
int maxN_
Definition: HLTCountNumberOfObject.h:68
edm::EventSetup
Definition: EventSetup.h:58
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
Frameworkfwd.h
HLTCountNumberOfObject::src_
edm::InputTag src_
Definition: HLTCountNumberOfObject.h:66
HLTFilter::makeHLTFilterDescription
static void makeHLTFilterDescription(edm::ParameterSetDescription &desc)
Definition: HLTFilter.cc:25
HLTCountNumberOfObject::HLTCountNumberOfObject
HLTCountNumberOfObject(const edm::ParameterSet &iConfig)
Definition: HLTCountNumberOfObject.h:29
HLTFilter::module
int module(edm::Event const &) const
Definition: HLTFilter.cc:47
ParameterSet.h
HLTCountNumberOfObject::~HLTCountNumberOfObject
~HLTCountNumberOfObject() override
Definition: HLTCountNumberOfObject.h:37
edm::Event
Definition: Event.h:73
HLTCountNumberOfObject
Definition: HLTCountNumberOfObject.h:27
edm::InputTag
Definition: InputTag.h:15
HLTCountNumberOfObject::srcToken_
edm::EDGetTokenT< OColl > srcToken_
Definition: HLTCountNumberOfObject.h:67