CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
26 
28 namespace reco {
29  namespace modules {
31  template <>
32  struct ParameterAdapter<pat::VertexAssociationSelector> {
35  if (iConfig.existsAs<double>("deltaZ"))
36  assoconf.dZ = iConfig.getParameter<double>("deltaZ");
37  if (iConfig.existsAs<double>("deltaR"))
38  assoconf.dR = iConfig.getParameter<double>("deltaR");
39  if (iConfig.existsAs<double>("sigmasZ"))
40  assoconf.sigmasZ = iConfig.getParameter<double>("sigmasZ");
41  if (iConfig.existsAs<double>("sigmasR"))
42  assoconf.sigmasR = iConfig.getParameter<double>("sigmasR");
43  return pat::VertexAssociationSelector(assoconf);
44  }
45  };
46  } // namespace modules
47 } // namespace reco
48 
49 namespace pat {
50  namespace helper {
52  public:
55 
57  bool enabled() const { return enabled_; }
58 
60  void newEvent(const edm::Event &event);
61 
64  void newEvent(const edm::Event &event, const edm::EventSetup &setup);
65 
68  template <typename AnyCandRef>
69  pat::VertexAssociation operator()(const AnyCandRef &) const;
70 
71  private:
73  bool enabled_;
74 
76  bool playback_;
77 
80 
81  //-------- Tools for production of vertex associations -------
85  bool useTracks_;
88 
89  //--------- Tools for reading vertex associations (playback mode) -----
92 
95 
99 
100  }; // class
101 
102  template <typename AnyCandRef>
104  if (playback_) {
105  const pat::VertexAssociation &assoc = (*vertexAssoMap_)[cand];
106  return assoSelector_(assoc) ? assoc : pat::VertexAssociation();
107  } else {
108  return associate(*cand);
109  }
110  }
111 
112  } // namespace helper
113 } // namespace pat
114 
115 #endif
const edm::EventSetup & c
edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > ttToken_
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
edm::Handle< edm::ValueMap< pat::VertexAssociation > > vertexAssoMap_
reco::TrackBaseRef getTrack_(const reco::Candidate &c) const
Get out the track from the Candidate / RecoCandidate / PFCandidate.
pat::VertexAssociation operator()(const AnyCandRef &) const
edm::ESHandle< TransientTrackBuilder > ttBuilder_
static pat::VertexAssociationSelector make(const edm::ParameterSet &iConfig)
bool useTracks_
use tracks inside candidates
pat::VertexAssociation associate(const reco::Candidate &) const
edm::EDGetTokenT< reco::VertexCollection > verticesToken_
edm::EDGetTokenT< edm::ValueMap< pat::VertexAssociation > > vertexAssociationsToken_
bool playback_
true if it&#39;s just reading the associations from the event
edm::Handle< reco::VertexCollection > vertexHandle_
void newEvent(const edm::Event &event)
To be called for each new event, reads in the vertex collection.
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
bool enabled() const
returns true if this was given a non dummy configuration
bool enabled_
true if it has non null configuration
float dZ
cuts on Z and transverse distance from the vertex, absolute values or significances ...
Analysis-level structure for vertex-related information.
Definition: Vertexing.h:25
Produces and/or checks pat::VertexAssociation&#39;s.
pat::VertexAssociationSelector assoSelector_
selector of associations