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:
52  VertexingHelper() : enabled_(false) {}
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 
92  reco::TrackBaseRef getTrack_(const reco::Candidate &c) const;
93 
96  pat::VertexAssociation associate(const reco::Candidate &) const;
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
T getParameter(std::string const &) const
Definition: helper.py:1
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:160
edm::Handle< edm::ValueMap< pat::VertexAssociation > > vertexAssoMap_
pat::VertexAssociation operator()(const AnyCandRef &) const
edm::ESHandle< TransientTrackBuilder > ttBuilder_
Definition: HeavyIon.h:7
static pat::VertexAssociationSelector make(const edm::ParameterSet &iConfig)
bool useTracks_
use tracks inside candidates
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_
bool enabled() const
returns true if this was given a non dummy configuration
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