CMS 3D CMS Logo

HLTSmartSinglet.cc
Go to the documentation of this file.
1 
11 #include "HLTSmartSinglet.h"
12 
14 
17 
19 
21 
22 //
23 // constructors and destructor
24 //
25 template <typename T>
27  : HLTFilter(iConfig),
28  inputTag_(iConfig.template getParameter<edm::InputTag>("inputTag")),
29  inputToken_(consumes<std::vector<T>>(inputTag_)),
30  triggerType_(iConfig.template getParameter<int>("triggerType")),
31  cut_(iConfig.template getParameter<std::string>("cut")),
32  min_N_(iConfig.template getParameter<int>("MinN")),
33  select_(cut_) {
34  LogDebug("") << "Input/tyre/cut/ncut : " << inputTag_.encode() << " " << triggerType_ << " " << cut_ << " " << min_N_;
35 }
36 
37 template <typename T>
39 
40 template <typename T>
43  makeHLTFilterDescription(desc);
44  desc.add<edm::InputTag>("inputTag", edm::InputTag("hltCollection"));
45  desc.add<int>("triggerType", 0);
46  desc.add<std::string>("cut", "1>0");
47  desc.add<int>("MinN", 1);
48  descriptions.add(defaultModuleLabel<HLTSmartSinglet<T>>(), desc);
49 }
50 
51 //
52 // member functions
53 //
54 
55 // ------------ method called to produce the data ------------
56 template <typename T>
58  const edm::EventSetup& iSetup,
59  trigger::TriggerFilterObjectWithRefs& filterproduct) const {
60  using namespace std;
61  using namespace edm;
62  using namespace reco;
63  using namespace trigger;
64 
65  typedef vector<T> TCollection;
66  typedef Ref<TCollection> TRef;
67 
68  // All HLT filters must create and fill an HLT filter object,
69  // recording any reconstructed physics objects satisfying (or not)
70  // this HLT filter, and place it in the Event.
71 
72  // The filter object
73  if (saveTags())
74  filterproduct.addCollectionTag(inputTag_);
75 
76  // Ref to Candidate object to be recorded in filter object
77  TRef ref;
78 
79  // get hold of collection of objects
81  iEvent.getByToken(inputToken_, objects);
82 
83  // look at all objects, check cuts and add to filter object
84  int n(0);
85  typename TCollection::const_iterator i(objects->begin());
86  for (; i != objects->end(); i++) {
87  if (select_(*i)) {
88  n++;
89  ref = TRef(objects, distance(objects->begin(), i));
90  filterproduct.addObject(triggerType_, ref);
91  }
92  }
93 
94  // filter decision
95  bool accept(n >= min_N_);
96 
97  return accept;
98 }
defaultModuleLabel.h
trigger::TriggerRefsCollections::addObject
void addObject(int id, const reco::RecoEcalCandidateRef &ref)
setters for L3 collections: (id=physics type, and Ref<C>)
Definition: TriggerRefsCollections.h:302
trigger::TriggerFilterObjectWithRefs
Definition: TriggerFilterObjectWithRefs.h:35
Handle.h
mps_fire.i
i
Definition: mps_fire.py:355
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
MessageLogger.h
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
HLTSmartSinglet::HLTSmartSinglet
HLTSmartSinglet(const edm::ParameterSet &)
Definition: HLTSmartSinglet.cc:26
HLTSmartSinglet::triggerType_
int triggerType_
Definition: HLTSmartSinglet.h:42
edm
HLT enums.
Definition: AlignableModifier.h:19
objects
Definition: __init__.py:1
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
trigger::TriggerFilterObjectWithRefs::addCollectionTag
void addCollectionTag(const edm::InputTag &collectionTag)
collectionTags
Definition: TriggerFilterObjectWithRefs.h:55
HLTSmartSinglet::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: HLTSmartSinglet.cc:41
HLT_2018_cff.distance
distance
Definition: HLT_2018_cff.py:6417
TriggerFilterObjectWithRefs.h
HLTSmartSinglet::min_N_
int min_N_
Definition: HLTSmartSinglet.h:44
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
edm::Handle
Definition: AssociativeIterator.h:50
HLTFilter
Definition: HLTFilter.h:28
edm::Ref
Definition: AssociativeIterator.h:58
accept
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
HLTSmartSinglet
Definition: HLTSmartSinglet.h:30
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
BeamBkgSkim_cff.saveTags
saveTags
Definition: BeamBkgSkim_cff.py:9
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::ParameterSet
Definition: ParameterSet.h:36
defaultModuleLabel
std::string defaultModuleLabel()
Definition: defaultModuleLabel.h:16
HLTSmartSinglet::inputTag_
edm::InputTag inputTag_
Definition: HLTSmartSinglet.h:40
HLTSmartSinglet.h
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::InputTag::encode
std::string encode() const
Definition: InputTag.cc:159
edm::EventSetup
Definition: EventSetup.h:57
svgfig.template
def template(fileName, svg, replaceme="REPLACEME")
Definition: svgfig.py:521
HLTSmartSinglet::cut_
std::string cut_
Definition: HLTSmartSinglet.h:43
std
Definition: JetResolutionObject.h:76
Ref.h
T
long double T
Definition: Basic3DVectorLD.h:48
trigger
Definition: HLTPrescaleTableCond.h:8
ParameterSet.h
HLTSmartSinglet::hltFilter
bool hltFilter(edm::Event &, const edm::EventSetup &, trigger::TriggerFilterObjectWithRefs &filterproduct) const override
Definition: HLTSmartSinglet.cc:57
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
HLTSmartSinglet::~HLTSmartSinglet
~HLTSmartSinglet() override