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 
23 
24 template <class OColl>
26 public:
27  explicit HLTCountNumberOfObject(const edm::ParameterSet& iConfig)
28  : HLTFilter(iConfig),
29  src_(iConfig.getParameter<edm::InputTag>("src")),
30  minN_(iConfig.getParameter<int>("MinN")),
31  maxN_(iConfig.getParameter<int>("MaxN")) {
32  srcToken_ = consumes<OColl>(src_);
33  }
34 
36 
37  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
40  desc.add<edm::InputTag>("src", edm::InputTag(""));
41  desc.add<int>("MinN", 0);
42  desc.add<int>("MaxN", 99999);
44  }
45 
46 private:
48  const edm::EventSetup&,
49  trigger::TriggerFilterObjectWithRefs& filterproduct) const override {
50  edm::Handle<OColl> oHandle;
51  iEvent.getByToken(srcToken_, oHandle);
52  int s = oHandle->size();
53  bool answer = true;
54  if (minN_ != -1)
55  answer = answer && (s >= minN_);
56  if (maxN_ != -1)
57  answer = answer && (s <= maxN_);
58  LogDebug("HLTCountNumberOfObject") << module(iEvent) << " sees: " << s
59  << " objects. Filtere answer is: " << (answer ? "true" : "false");
60 
61  return answer;
62  }
63 
66  int minN_, maxN_;
67 };
68 
69 #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:89301
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:66
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
HLTCountNumberOfObject::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: HLTCountNumberOfObject.h:37
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:47
iEvent
int iEvent
Definition: GenABIO.cc:224
HLTCountNumberOfObject::maxN_
int maxN_
Definition: HLTCountNumberOfObject.h:66
edm::EventSetup
Definition: EventSetup.h:58
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
Frameworkfwd.h
HLTCountNumberOfObject::src_
edm::InputTag src_
Definition: HLTCountNumberOfObject.h:64
HLTFilter::makeHLTFilterDescription
static void makeHLTFilterDescription(edm::ParameterSetDescription &desc)
Definition: HLTFilter.cc:25
HLTCountNumberOfObject::HLTCountNumberOfObject
HLTCountNumberOfObject(const edm::ParameterSet &iConfig)
Definition: HLTCountNumberOfObject.h:27
HLTFilter::module
int module(edm::Event const &) const
Definition: HLTFilter.cc:47
ParameterSet.h
HLTCountNumberOfObject::~HLTCountNumberOfObject
~HLTCountNumberOfObject() override
Definition: HLTCountNumberOfObject.h:35
edm::Event
Definition: Event.h:73
HLTCountNumberOfObject
Definition: HLTCountNumberOfObject.h:25
edm::InputTag
Definition: InputTag.h:15
HLTCountNumberOfObject::srcToken_
edm::EDGetTokenT< OColl > srcToken_
Definition: HLTCountNumberOfObject.h:65