CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HLTSummaryFilter.cc
Go to the documentation of this file.
1 
14 
16 
18 
19 //
20 // constructors and destructor
21 //
23  summaryTag_ (iConfig.getParameter<edm::InputTag>("summary")),
24  memberTag_ (iConfig.getParameter<edm::InputTag>("member" )),
25  cut_ (iConfig.getParameter<std::string> ("cut" )),
26  min_N_ (iConfig.getParameter<int> ("minN" )),
27  select_ (cut_ )
28 {
29  edm::LogInfo("HLTSummaryFilter")
30  << "Summary/member/cut/ncut : "
31  << summaryTag_.encode() << " "
32  << memberTag_.encode() << " "
33  << cut_<< " " << min_N_ ;
34 }
35 
37 {
38 }
39 
40 //
41 // member functions
42 //
43 
44 // ------------ method called to produce the data ------------
45 bool
47 {
48  using namespace std;
49  using namespace edm;
50  using namespace reco;
51  using namespace trigger;
52 
55 
56  if (!summary.isValid()) {
57  LogError("HLTSummaryFilter") << "Trigger summary product "
58  << summaryTag_.encode()
59  << " not found! Filter returns false always";
60  return false;
61  }
62 
63  size_type n(0);
64  size_type index(0);
65 
66  // check if we want to look at a filter and its passing physics objects
67  index=summary->filterIndex(memberTag_);
68  if (index<summary->sizeFilters()) {
69  const Keys& KEYS (summary->filterKeys(index));
70  const size_type n1(KEYS.size());
71  for (size_type i=0; i!=n1; ++i) {
72  const TriggerObject& TO( summary->getObjects().at(KEYS[i]) );
73  if (select_(TO)) n++;
74  }
75  const bool accept(n>=min_N_);
76  LogInfo("HLTSummaryFilter")
77  << " Filter objects: " << n << "/" << n1;
78  return accept;
79  }
80 
81  // check if we want to cut on all physics objects of a full "L3" collection
82  index=summary->collectionIndex(memberTag_);
83  if (index<summary->sizeCollections()) {
84  const Keys& KEYS (summary->collectionKeys());
85  const size_type n0 (index == 0? 0 : KEYS.at(index-1));
86  const size_type n1 (KEYS.at(index));
87  for (size_type i=n0; i!=n1; ++i) {
88  const TriggerObject& TO( summary->getObjects().at(i) );
89  if (select_(TO)) n++;
90  }
91  const bool accept(n>=min_N_);
92  LogInfo("HLTSummaryFilter")
93  << " Collection objects: " << n << "/" <<n1-n0;
94  return accept;
95  }
96 
97  // can't help you, bailing out!
98  const bool accept (false);
99  LogInfo("HLTSummaryFilter") << " Default decision: " << accept;
100  return accept;
101 
102 }
103 
int i
Definition: DBlmapReader.cc:9
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
StringCutObjectSelector< trigger::TriggerObject > select_
HLTSummaryFilter(const edm::ParameterSet &)
edm::InputTag memberTag_
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:22
uint16_t size_type
std::string encode() const
Definition: InputTag.cc:72
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:24
int iEvent
Definition: GenABIO.cc:243
int n0
Definition: AMPTWrapper.h:34
virtual bool hltFilter(edm::Event &, const edm::EventSetup &, trigger::TriggerFilterObjectWithRefs &filterproduct)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
std::vector< size_type > Keys
edm::InputTag summaryTag_