CMS 3D CMS Logo

PrimaryVertexAssignment.h
Go to the documentation of this file.
1 #ifndef CommonTools_PFCandProducer_PrimaryVertexAssignment_
2 #define CommonTools_PFCandProducer_PrimaryVertexAssignment_
3 
5 
9 
11 
18 
20 public:
21  enum Quality {
22  UsedInFit = 7,
23  PrimaryDz = 6,
24  PrimaryV0 = 5,
25  BTrack = 4,
26  Unused = 3,
27  OtherDz = 2,
30  };
31 
33  : maxDzSigForPrimaryAssignment_(iConfig.getParameter<double>("maxDzSigForPrimaryAssignment")),
34  maxDzForPrimaryAssignment_(iConfig.getParameter<double>("maxDzForPrimaryAssignment")),
35  maxDzErrorForPrimaryAssignment_(iConfig.getParameter<double>("maxDzErrorForPrimaryAssignment")),
36  maxDtSigForPrimaryAssignment_(iConfig.getParameter<double>("maxDtSigForPrimaryAssignment")),
37  maxJetDeltaR_(iConfig.getParameter<double>("maxJetDeltaR")),
38  minJetPt_(iConfig.getParameter<double>("minJetPt")),
39  maxDistanceToJetAxis_(iConfig.getParameter<double>("maxDistanceToJetAxis")),
40  maxDzForJetAxisAssigment_(iConfig.getParameter<double>("maxDzForJetAxisAssigment")),
41  maxDxyForJetAxisAssigment_(iConfig.getParameter<double>("maxDxyForJetAxisAssigment")),
42  maxDxySigForNotReconstructedPrimary_(iConfig.getParameter<double>("maxDxySigForNotReconstructedPrimary")),
43  maxDxyForNotReconstructedPrimary_(iConfig.getParameter<double>("maxDxyForNotReconstructedPrimary")),
44  useTiming_(iConfig.getParameter<bool>("useTiming")),
45  useVertexFit_(iConfig.getParameter<bool>("useVertexFit")),
46  preferHighRanked_(iConfig.getParameter<bool>("preferHighRanked")),
47  fNumOfPUVtxsForCharged_(iConfig.getParameter<unsigned int>("NumOfPUVtxsForCharged")),
48  fDzCutForChargedFromPUVtxs_(iConfig.getParameter<double>("DzCutForChargedFromPUVtxs")),
49  fPtMaxCharged_(iConfig.getParameter<double>("PtMaxCharged")),
50  fEtaMinUseDz_(iConfig.getParameter<double>("EtaMinUseDz")),
51  fOnlyUseFirstDz_(iConfig.getParameter<bool>("OnlyUseFirstDz")) {}
52 
54 
55  std::pair<int, PrimaryVertexAssignment::Quality> chargedHadronVertex(
57  const reco::TrackRef& trackRef,
58  const reco::Track* track,
59  float trackTime,
60  float trackTimeResolution, // <0 if timing not available for this object
62  const TransientTrackBuilder& builder) const;
63 
64  std::pair<int, PrimaryVertexAssignment::Quality> chargedHadronVertex(
66  int iVertex,
67  const reco::Track* track,
68  float trackTime,
69  float trackTimeResolution, // <0 if timing not available for this object
71  const TransientTrackBuilder& builder) const;
72 
73  std::pair<int, PrimaryVertexAssignment::Quality> chargedHadronVertex(
75  const reco::TrackRef& trackRef,
76  float trackTime,
77  float trackTimeResolution, // <0 if timing not available for this object
79  const TransientTrackBuilder& builder) const {
80  return chargedHadronVertex(vertices, trackRef, &(*trackRef), trackTime, trackTimeResolution, jets, builder);
81  }
82 
83  std::pair<int, PrimaryVertexAssignment::Quality> chargedHadronVertex(const reco::VertexCollection& vertices,
86  const TransientTrackBuilder& builder) const {
87  float time = 0, timeResolution = -1;
88  if (useTiming_ && pfcand.isTimeValid()) {
89  time = pfcand.time();
90  timeResolution = pfcand.timeError();
91  }
92  if (pfcand.gsfTrackRef().isNull()) {
93  if (pfcand.trackRef().isNull())
95  else
96  return chargedHadronVertex(vertices, pfcand.trackRef(), time, timeResolution, jets, builder);
97  }
98  return chargedHadronVertex(
99  vertices, reco::TrackRef(), &(*pfcand.gsfTrackRef()), time, timeResolution, jets, builder);
100  }
101 
102  std::pair<int, PrimaryVertexAssignment::Quality> chargedHadronVertex(const reco::VertexCollection& vertices,
105  const TransientTrackBuilder& builder) const {
106  float time = 0, timeResolution = -1;
107  if (useTiming_ && pfcand.timeError() > 0) {
108  time = pfcand.time();
109  timeResolution = pfcand.timeError();
110  }
111  if (!pfcand.hasTrackDetails())
113  else
114  return chargedHadronVertex(
115  vertices,
116  (useVertexFit_ && (pfcand.pvAssociationQuality() >= pat::PackedCandidate::UsedInFitLoose))
117  ? pfcand.vertexRef().key()
118  : -1,
119  &pfcand.pseudoTrack(),
120  time,
122  jets,
123  builder);
124  }
125 
126  std::pair<int, PrimaryVertexAssignment::Quality> chargedHadronVertex(const reco::VertexCollection& vertices,
127  const reco::RecoChargedRefCandidate& chcand,
131  const TransientTrackBuilder& builder) const {
132  float time = 0, timeResolution = -1;
133  if (useTiming_) {
134  time = (*trackTimeTag)[chcand.track()];
135  timeResolution = (*trackTimeResoTag)[chcand.track()];
136  }
137  if (chcand.track().isNull())
139  return chargedHadronVertex(vertices, chcand.track(), time, timeResolution, jets, builder);
140  }
141 
142 private:
148  double minJetPt_;
162 };
163 
164 #endif
std::pair< int, PrimaryVertexAssignment::Quality > chargedHadronVertex(const reco::VertexCollection &vertices, const reco::TrackRef &trackRef, float trackTime, float trackTimeResolution, const edm::View< reco::Candidate > &jets, const TransientTrackBuilder &builder) const
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
std::pair< int, PrimaryVertexAssignment::Quality > chargedHadronVertex(const reco::VertexCollection &vertices, const reco::PFCandidate &pfcand, const edm::View< reco::Candidate > &jets, const TransientTrackBuilder &builder) const
PrimaryVertexAssignment(const edm::ParameterSet &iConfig)
bool isNull() const
Checks for null.
Definition: Ref.h:235
std::pair< int, PrimaryVertexAssignment::Quality > chargedHadronVertex(const reco::VertexCollection &vertices, const reco::TrackRef &trackRef, const reco::Track *track, float trackTime, float trackTimeResolution, const edm::View< reco::Candidate > &jets, const TransientTrackBuilder &builder) const
std::pair< int, PrimaryVertexAssignment::Quality > chargedHadronVertex(const reco::VertexCollection &vertices, const pat::PackedCandidate &pfcand, const edm::View< reco::Candidate > &jets, const TransientTrackBuilder &builder) const
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
std::pair< int, PrimaryVertexAssignment::Quality > chargedHadronVertex(const reco::VertexCollection &vertices, const reco::RecoChargedRefCandidate &chcand, const edm::ValueMap< float > *trackTimeTag, const edm::ValueMap< float > *trackTimeResoTag, const edm::View< reco::Candidate > &jets, const TransientTrackBuilder &builder) const