CMS 3D CMS Logo

PVObjectSelector.h
Go to the documentation of this file.
1 #ifndef Analysis_AnalysisFilters_interface_PVObjectSelector_h
2 #define Analysis_AnalysisFilters_interface_PVObjectSelector_h
3 
4 #ifndef __GCCXML__
6 #endif
9 
12 
13 #include <vector>
14 #include <string>
15 
16 // make a selector for this selection
17 class PVObjectSelector : public Selector<reco::Vertex> {
18 public:
20 
21 #ifndef __GCCXML__
23 #endif
24 
26  push_back("PV NDOF", params.getParameter<double>("minNdof"));
27  push_back("PV Z", params.getParameter<double>("maxZ"));
28  push_back("PV RHO", params.getParameter<double>("maxRho"));
29  set("PV NDOF");
30  set("PV Z");
31  set("PV RHO");
32 
33  indexNDOF_ = index_type(&bits_, "PV NDOF");
34  indexZ_ = index_type(&bits_, "PV Z");
35  indexRho_ = index_type(&bits_, "PV RHO");
36 
37  if (params.exists("cutsToIgnore"))
38  setIgnoredCuts(params.getParameter<std::vector<std::string> >("cutsToIgnore"));
39 
41  }
42 
43  bool operator()(reco::Vertex const& pv, pat::strbitset& ret) override {
44  if (pv.isFake())
45  return false;
46 
47  if (pv.ndof() >= cut(indexNDOF_, double()) || ignoreCut(indexNDOF_)) {
49  if (fabs(pv.z()) <= cut(indexZ_, double()) || ignoreCut(indexZ_)) {
51  if (fabs(pv.position().Rho()) <= cut(indexRho_, double()) || ignoreCut(indexRho_)) {
53  }
54  }
55  }
56 
57  setIgnored(ret);
58 
59  return (bool)ret;
60  }
61 
63 
64 private:
68 };
69 
70 #endif
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:373
Handle.h
Selector< reco::Vertex >::setIgnored
void setIgnored(pat::strbitset &ret)
set ignored bits
Definition: Selector.h:181
Selector
Functor that operates on <T>
Definition: Selector.h:22
Selector< reco::Vertex >::bits_
pat::strbitset bits_
the bitset indexed by strings
Definition: Selector.h:241
Selector< reco::Vertex >::index_type
pat::strbitset::index_type index_type
Definition: Selector.h:25
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
PVObjectSelector::indexRho_
index_type indexRho_
Definition: PVObjectSelector.h:67
Selector< reco::Vertex >::retInternal_
pat::strbitset retInternal_
internal ret if users don't care about return bits
Definition: Selector.h:242
Selector< reco::Vertex >::ignoreCut
bool ignoreCut(std::string const &s) const
ignore the cut at index "s"
Definition: Selector.h:127
pat::strbitset::index_type
Definition: strbitset.h:25
PVObjectSelector::PVObjectSelector
PVObjectSelector(edm::ParameterSet const &params)
Definition: PVObjectSelector.h:25
PVObjectSelector::indexZ_
index_type indexZ_
Definition: PVObjectSelector.h:66
PVObjectSelector::indexNDOF_
index_type indexNDOF_
Definition: PVObjectSelector.h:65
EventBase.h
Utilities.operator
operator
Definition: Utilities.py:24
PVObjectSelector
Definition: PVObjectSelector.h:17
Selector< reco::Vertex >::push_back
virtual void push_back(std::string const &s)
This is the registration of an individual cut string.
Definition: Selector.h:42
Vertex.h
PVObjectSelector::PVObjectSelector
PVObjectSelector()
Definition: PVObjectSelector.h:19
Selector< reco::Vertex >::getBitTemplate
pat::strbitset getBitTemplate() const
Get an empty bitset with the proper names.
Definition: Selector.h:168
PVObjectSelector::operator()
bool operator()(reco::Vertex const &pv, pat::strbitset &ret) override
This provides the interface for base classes to select objects.
Definition: PVObjectSelector.h:43
edm::ParameterSet
Definition: ParameterSet.h:47
Selector< reco::Vertex >::passCut
void passCut(pat::strbitset &ret, std::string const &s)
Passing cuts.
Definition: Selector.h:142
MetAnalyzer.pv
def pv(vc)
Definition: MetAnalyzer.py:7
Selector< reco::Vertex >::setIgnoredCuts
void setIgnoredCuts(std::vector< std::string > const &bitsToIgnore)
set the bits to ignore from a vector
Definition: Selector.h:131
pat::strbitset
Definition: strbitset.h:23
Selector< reco::Vertex >::cut
int cut(index_type const &i, int val) const
Access the int cut values at index "s".
Definition: Selector.h:158
Selector< reco::Vertex >::set
void set(std::string const &s, bool val=true)
Set a given selection cut, on or off.
Definition: Selector.h:93
PVObjectSelector::PVObjectSelector
PVObjectSelector(edm::ParameterSet const &params, edm::ConsumesCollector &&iC)
Definition: PVObjectSelector.h:22
ConsumesCollector.h
Selector.h
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
reco::Vertex
Definition: Vertex.h:35