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 
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
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > ttToken_
Definition: helper.py:1
edm::Handle< edm::ValueMap< pat::VertexAssociation > > vertexAssoMap_
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
edm::ESHandle< TransientTrackBuilder > ttBuilder_
Definition: HeavyIon.h:7
static pat::VertexAssociationSelector make(const edm::ParameterSet &iConfig)
bool useTracks_
use tracks inside candidates
reco::TrackBaseRef getTrack_(const reco::Candidate &c) const
Get out the track from the Candidate / RecoCandidate / PFCandidate.
bool enabled() const
returns true if this was given a non dummy configuration
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.
pat::VertexAssociation associate(const reco::Candidate &) const
bool enabled_
true if it has non null configuration
fixed size matrix
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.
Definition: event.py:1
pat::VertexAssociationSelector assoSelector_
selector of associations
pat::VertexAssociation operator()(const AnyCandRef &) const