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 
18 
22 
26 
28 namespace reco {
29  namespace modules {
31  template<>
32  struct ParameterAdapter<pat::VertexAssociationSelector> {
35  if (iConfig.existsAs<double>("deltaZ")) assoconf.dZ = iConfig.getParameter<double>("deltaZ");
36  if (iConfig.existsAs<double>("deltaR")) assoconf.dR = iConfig.getParameter<double>("deltaR");
37  if (iConfig.existsAs<double>("sigmasZ")) assoconf.sigmasZ = iConfig.getParameter<double>("sigmasZ");
38  if (iConfig.existsAs<double>("sigmasR")) assoconf.sigmasR = iConfig.getParameter<double>("sigmasR");
39  return pat::VertexAssociationSelector(assoconf);
40  }
41  };
42  }
43 }
44 
45 namespace pat { namespace helper {
47  public:
48  VertexingHelper() : enabled_(false) {}
50 
52  bool enabled() const { return enabled_; }
53 
55  void newEvent(const edm::Event &event) ;
56 
59  void newEvent(const edm::Event &event, const edm::EventSetup & setup) ;
60 
63  template<typename AnyCandRef>
64  pat::VertexAssociation operator()(const AnyCandRef &) const ;
65 
66  private:
68  bool enabled_;
69 
71  bool playback_;
72 
75 
76  //-------- Tools for production of vertex associations -------
80  bool useTracks_;
82 
83  //--------- Tools for reading vertex associations (playback mode) -----
86 
88  reco::TrackBaseRef getTrack_(const reco::Candidate &c) const ;
89 
92  pat::VertexAssociation associate(const reco::Candidate &) const ;
93 
94  }; // class
95 
96  template<typename AnyCandRef>
99  {
100  if (playback_) {
101  const pat::VertexAssociation &assoc = (*vertexAssoMap_)[cand];
102  return assoSelector_(assoc) ? assoc : pat::VertexAssociation();
103  } else {
104  return associate( *cand );
105  }
106 
107  }
108 
109 } }
110 
111 
112 
113 
114 #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:185
edm::Handle< edm::ValueMap< pat::VertexAssociation > > vertexAssoMap_
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:2
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:26
Produces and/or checks pat::VertexAssociation&#39;s.
Definition: event.py:1
pat::VertexAssociationSelector assoSelector_
selector of associations