CMS 3D CMS Logo

VertexingHelper.h
Go to the documentation of this file.
1 #ifndef PhysicsTools_PatAlgos_interface_VertexingHelper_h
2 #define PhysicsTools_PatAlgos_interface_VertexingHelper_h
3 
17 
21 
25 
27 namespace reco {
28  namespace modules {
30  template <>
31  struct ParameterAdapter<pat::VertexAssociationSelector> {
34  if (iConfig.existsAs<double>("deltaZ"))
35  assoconf.dZ = iConfig.getParameter<double>("deltaZ");
36  if (iConfig.existsAs<double>("deltaR"))
37  assoconf.dR = iConfig.getParameter<double>("deltaR");
38  if (iConfig.existsAs<double>("sigmasZ"))
39  assoconf.sigmasZ = iConfig.getParameter<double>("sigmasZ");
40  if (iConfig.existsAs<double>("sigmasR"))
41  assoconf.sigmasR = iConfig.getParameter<double>("sigmasR");
42  return pat::VertexAssociationSelector(assoconf);
43  }
44  };
45  } // namespace modules
46 } // namespace reco
47 
48 namespace pat {
49  namespace helper {
51  public:
54 
56  bool enabled() const { return enabled_; }
57 
59  void newEvent(const edm::Event &event);
60 
63  void newEvent(const edm::Event &event, const edm::EventSetup &setup);
64 
67  template <typename AnyCandRef>
68  pat::VertexAssociation operator()(const AnyCandRef &) const;
69 
70  private:
72  bool enabled_;
73 
75  bool playback_;
76 
79 
80  //-------- Tools for production of vertex associations -------
84  bool useTracks_;
86 
87  //--------- Tools for reading vertex associations (playback mode) -----
90 
93 
97 
98  }; // class
99 
100  template <typename AnyCandRef>
102  if (playback_) {
103  const pat::VertexAssociation &assoc = (*vertexAssoMap_)[cand];
104  return assoSelector_(assoc) ? assoc : pat::VertexAssociation();
105  } else {
106  return associate(*cand);
107  }
108  }
109 
110  } // namespace helper
111 } // namespace pat
112 
113 #endif
pat::VertexAssociationSelector::Config::sigmasR
float sigmasR
Definition: VertexAssociationSelector.h:17
funct::false
false
Definition: Factorize.h:34
pat::VertexAssociationSelector
Definition: VertexAssociationSelector.h:9
pat::helper::VertexingHelper::vertexAssociationsToken_
edm::EDGetTokenT< edm::ValueMap< pat::VertexAssociation > > vertexAssociationsToken_
Definition: VertexingHelper.h:88
ESHandle.h
modules
Definition: ZHLTMatchFilter.cc:17
edm::EDGetTokenT< reco::VertexCollection >
pat::helper::VertexingHelper::vertexHandle_
edm::Handle< reco::VertexCollection > vertexHandle_
Definition: VertexingHelper.h:82
pat::helper::VertexingHelper::verticesToken_
edm::EDGetTokenT< reco::VertexCollection > verticesToken_
Definition: VertexingHelper.h:81
edm::ParameterSet::existsAs
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:160
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
pat::VertexAssociationSelector::Config::sigmasZ
float sigmasZ
Definition: VertexAssociationSelector.h:17
edm::Handle< reco::VertexCollection >
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
VertexAssociationSelector.h
trackingPlots.assoc
assoc
Definition: trackingPlots.py:183
pat::helper::VertexingHelper::useTracks_
bool useTracks_
use tracks inside candidates
Definition: VertexingHelper.h:84
reco::modules::ParameterAdapter< pat::VertexAssociationSelector >::make
static pat::VertexAssociationSelector make(const edm::ParameterSet &iConfig)
Definition: VertexingHelper.h:32
pat::helper::VertexingHelper::vertexAssoMap_
edm::Handle< edm::ValueMap< pat::VertexAssociation > > vertexAssoMap_
Definition: VertexingHelper.h:89
edm::ESHandle< TransientTrackBuilder >
pat::helper::VertexingHelper::getTrack_
reco::TrackBaseRef getTrack_(const reco::Candidate &c) const
Get out the track from the Candidate / RecoCandidate / PFCandidate.
Definition: VertexingHelper.cc:88
pat::helper::VertexingHelper::playback_
bool playback_
true if it's just reading the associations from the event
Definition: VertexingHelper.h:75
pat::helper::VertexingHelper::assoSelector_
pat::VertexAssociationSelector assoSelector_
selector of associations
Definition: VertexingHelper.h:78
pat::helper::VertexingHelper
Produces and/or checks pat::VertexAssociation's.
Definition: VertexingHelper.h:50
pat::helper::VertexingHelper::operator()
pat::VertexAssociation operator()(const AnyCandRef &) const
Definition: VertexingHelper.h:101
pat::helper::VertexingHelper::newEvent
void newEvent(const edm::Event &event)
To be called for each new event, reads in the vertex collection.
Definition: VertexingHelper.cc:38
TransientTrackBuilder.h
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
helper
Definition: helper.py:1
pat::helper::VertexingHelper::ttBuilder_
edm::ESHandle< TransientTrackBuilder > ttBuilder_
Definition: VertexingHelper.h:85
cand
Definition: decayParser.h:34
pat::VertexAssociationSelector::Config::dR
float dR
Definition: VertexAssociationSelector.h:17
pat::VertexAssociationSelector::Config::dZ
float dZ
cuts on Z and transverse distance from the vertex, absolute values or significances
Definition: VertexAssociationSelector.h:17
pat::VertexAssociationSelector::Config
Definition: VertexAssociationSelector.h:14
edm::EventSetup
Definition: EventSetup.h:57
pat
Definition: HeavyIon.h:7
Vertexing.h
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
ParameterAdapter.h
pat::VertexAssociation
Analysis-level structure for vertex-related information.
Definition: Vertexing.h:25
reco::Candidate
Definition: Candidate.h:27
ValueMap.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
pat::helper::VertexingHelper::enabled
bool enabled() const
returns true if this was given a non dummy configuration
Definition: VertexingHelper.h:56
pat::helper::VertexingHelper::associate
pat::VertexAssociation associate(const reco::Candidate &) const
Definition: VertexingHelper.cc:52
pat::helper::VertexingHelper::VertexingHelper
VertexingHelper()
Definition: VertexingHelper.h:52
EventSetup.h
edm::RefToBase< reco::Track >
pat::helper::VertexingHelper::enabled_
bool enabled_
true if it has non null configuration
Definition: VertexingHelper.h:72
ConsumesCollector.h
ParameterSet.h
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
edm::ConsumesCollector
Definition: ConsumesCollector.h:39
reco::modules::ParameterAdapter
Definition: ParameterAdapter.h:12