CMS 3D CMS Logo

HLTSinglet.cc
Go to the documentation of this file.
1 
12 
19 
20 #include "HLTSinglet.h"
21 
23 
24 // extract the candidate type
25 template <typename T>
26 int getObjectType(const T&) {
27  return 0;
28 }
29 
30 // specialize for type l1extra::L1EmParticle
31 template <typename T>
32 int getObjectType(const l1extra::L1EmParticle& candidate) {
33  switch (candidate.type()) {
38  default:
39  return 0;
40  }
41 }
42 
43 // specialize for type l1extra::L1EtMissParticle
44 template <typename T>
46  switch (candidate.type()) {
48  return trigger::TriggerL1ETM;
50  return trigger::TriggerL1HTM;
51  default:
52  return 0;
53  }
54 }
55 
56 // specialize for type l1extra::L1JetParticle
57 template <typename T>
58 int getObjectType(const l1extra::L1JetParticle& candidate) {
59  switch (candidate.type()) {
66  default:
67  return 0;
68  }
69 }
70 
71 //
72 // constructors and destructor
73 //
74 template <typename T>
76  : HLTFilter(iConfig),
77  inputTag_(iConfig.template getParameter<edm::InputTag>("inputTag")),
78  inputToken_(consumes<std::vector<T>>(inputTag_)),
79  triggerType_(iConfig.template getParameter<int>("triggerType")),
80  min_N_(iConfig.template getParameter<int>("MinN")),
81  min_E_(iConfig.template getParameter<double>("MinE")),
82  min_Pt_(iConfig.template getParameter<double>("MinPt")),
83  min_Mass_(iConfig.template getParameter<double>("MinMass")),
84  max_Mass_(iConfig.template getParameter<double>("MaxMass")),
85  min_Eta_(iConfig.template getParameter<double>("MinEta")),
86  max_Eta_(iConfig.template getParameter<double>("MaxEta")) {
87  LogDebug("") << "Input/ptcut/etacut/ncut : " << inputTag_.encode() << " " << min_E_ << " " << min_Pt_ << " "
88  << min_Mass_ << " " << max_Mass_ << " " << min_Eta_ << " " << max_Eta_ << " " << min_N_;
89 }
90 
91 template <typename T>
92 HLTSinglet<T>::~HLTSinglet() = default;
93 
94 template <typename T>
97  makeHLTFilterDescription(desc);
98  desc.add<edm::InputTag>("inputTag", edm::InputTag("hltCollection"));
99  desc.add<int>("triggerType", 0);
100  desc.add<double>("MinE", -1.0);
101  desc.add<double>("MinPt", -1.0);
102  desc.add<double>("MinMass", -1.0);
103  desc.add<double>("MaxMass", -1.0);
104  desc.add<double>("MinEta", -1.0);
105  desc.add<double>("MaxEta", -1.0);
106  desc.add<int>("MinN", 1);
107  descriptions.add(defaultModuleLabel<HLTSinglet<T>>(), desc);
108 }
109 
110 //
111 // member functions
112 //
113 
114 // ------------ method called to produce the data ------------
115 template <typename T>
117  const edm::EventSetup& iSetup,
118  trigger::TriggerFilterObjectWithRefs& filterproduct) const {
119  using namespace std;
120  using namespace edm;
121  using namespace reco;
122  using namespace trigger;
123 
124  typedef vector<T> TCollection;
125  typedef Ref<TCollection> TRef;
126 
127  // All HLT filters must create and fill an HLT filter object,
128  // recording any reconstructed physics objects satisfying (or not)
129  // this HLT filter, and place it in the Event.
130 
131  // The filter object
132  if (saveTags())
133  filterproduct.addCollectionTag(inputTag_);
134 
135  // Ref to Candidate object to be recorded in filter object
136  TRef ref;
137 
138  // get hold of collection of objects
140  iEvent.getByToken(inputToken_, objects);
141 
142  // look at all objects, check cuts and add to filter object
143  int n(0);
144  typename TCollection::const_iterator i(objects->begin());
145  for (; i != objects->end(); i++) {
146  if ((i->energy() >= min_E_) && (i->pt() >= min_Pt_) && (i->mass() >= min_Mass_) &&
147  ((max_Mass_ < 0.0) || (i->mass() <= max_Mass_)) && ((min_Eta_ < 0.0) || (std::abs(i->eta()) >= min_Eta_)) &&
148  ((max_Eta_ < 0.0) || (std::abs(i->eta()) <= max_Eta_))) {
149  n++;
150  ref = TRef(objects, distance(objects->begin(), i));
151  int tid = getObjectType<T>(*i);
152  if (tid == 0)
153  tid = triggerType_;
154  filterproduct.addObject(tid, ref);
155  }
156  }
157 
158  // filter decision
159  bool accept(n >= min_N_);
160 
161  return accept;
162 }
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:235
trigger::TriggerFilterObjectWithRefs
Definition: TriggerFilterObjectWithRefs.h:35
Handle.h
trigger::TriggerL1HTM
Definition: TriggerTypeDefs.h:39
mps_fire.i
i
Definition: mps_fire.py:428
getObjectType
int getObjectType(const T &)
Definition: HLTSinglet.cc:26
MessageLogger.h
l1extra::L1JetParticle::kCentral
Definition: L1JetParticle.h:30
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
trigger::TriggerL1IsoEG
Definition: TriggerTypeDefs.h:32
trigger::TriggerL1ForJet
Definition: TriggerTypeDefs.h:34
HLTSinglet::min_E_
const double min_E_
Definition: HLTSinglet.h:40
HLTSinglet.h
edm
HLT enums.
Definition: AlignableModifier.h:19
HLTSinglet::min_N_
const int min_N_
Definition: HLTSinglet.h:39
objects
Definition: __init__.py:1
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89353
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
trigger::TriggerFilterObjectWithRefs::addCollectionTag
void addCollectionTag(const edm::InputTag &collectionTag)
collectionTags
Definition: TriggerFilterObjectWithRefs.h:55
HLTSinglet::min_Pt_
const double min_Pt_
Definition: HLTSinglet.h:41
TriggerFilterObjectWithRefs.h
l1extra::L1EmParticle::kNonIsolated
Definition: L1EmParticle.h:30
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
edm::Handle
Definition: AssociativeIterator.h:50
HLTSinglet::hltFilter
bool hltFilter(edm::Event &, const edm::EventSetup &, trigger::TriggerFilterObjectWithRefs &filterproduct) const override
Definition: HLTSinglet.cc:116
l1extra::L1JetParticle::type
JetType type() const
Definition: L1JetParticle.h:46
HLTFilter
Definition: HLTFilter.h:28
l1extra::L1EtMissParticle
Definition: L1EtMissParticle.h:27
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
HLTSinglet::~HLTSinglet
~HLTSinglet() override
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
l1extra::L1EmParticle
Definition: L1EmParticle.h:28
l1extra::L1EtMissParticle::kMET
Definition: L1EtMissParticle.h:29
HLTSinglet::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: HLTSinglet.cc:95
l1extra::L1JetParticle::kForward
Definition: L1JetParticle.h:30
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
HLTSinglet::inputTag_
const edm::InputTag inputTag_
Definition: HLTSinglet.h:36
BeamBkgSkim_cff.saveTags
saveTags
Definition: BeamBkgSkim_cff.py:9
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::ParameterSet
Definition: ParameterSet.h:47
defaultModuleLabel
std::string defaultModuleLabel()
Definition: defaultModuleLabel.h:16
l1extra::L1EmParticle::type
EmType type() const
Definition: L1EmParticle.h:46
l1extra::L1JetParticle
Definition: L1JetParticle.h:28
l1extra::L1EtMissParticle::type
EtMissType type() const
Definition: L1EtMissParticle.h:57
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
l1extra::L1EmParticle::kIsolated
Definition: L1EmParticle.h:30
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
edm::InputTag::encode
std::string encode() const
Definition: InputTag.cc:159
HLTSinglet::min_Eta_
const double min_Eta_
Definition: HLTSinglet.h:44
edm::EventSetup
Definition: EventSetup.h:57
L1EmParticle.h
svgfig.template
def template(fileName, svg, replaceme="REPLACEME")
Definition: svgfig.py:521
hgcalPerformanceValidation.objects
objects
Definition: hgcalPerformanceValidation.py:695
HLTSinglet::max_Mass_
const double max_Mass_
Definition: HLTSinglet.h:43
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
std
Definition: JetResolutionObject.h:76
Ref.h
trigger::TriggerL1NoIsoEG
Definition: TriggerTypeDefs.h:31
HLTSinglet::HLTSinglet
HLTSinglet(const edm::ParameterSet &)
Definition: HLTSinglet.cc:75
trigger::TriggerL1TauJet
Definition: TriggerTypeDefs.h:35
T
long double T
Definition: Basic3DVectorLD.h:48
HLTSinglet::max_Eta_
const double max_Eta_
Definition: HLTSinglet.h:45
trigger::TriggerL1ETM
Definition: TriggerTypeDefs.h:36
l1extra::L1EtMissParticle::kMHT
Definition: L1EtMissParticle.h:29
trigger
Definition: HLTPrescaleTableCond.h:8
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HLTSinglet
Definition: HLTSinglet.h:26
trigger::TriggerL1CenJet
Definition: TriggerTypeDefs.h:33
L1EtMissParticle.h
ParameterSet.h
HLTSinglet::min_Mass_
const double min_Mass_
Definition: HLTSinglet.h:42
edm::Event
Definition: Event.h:73
HLT_FULL_cff.distance
distance
Definition: HLT_FULL_cff.py:7799
L1JetParticle.h
edm::InputTag
Definition: InputTag.h:15
l1extra::L1JetParticle::kTau
Definition: L1JetParticle.h:30