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 
8 
15 
17 public:
18  enum Quality {
19  UsedInFit = 7,
20  PrimaryDz = 6,
21  PrimaryV0 = 5,
22  BTrack = 4,
23  Unused = 3,
24  OtherDz = 2,
27  };
28 
30  : maxDzSigForPrimaryAssignment_(iConfig.getParameter<double>("maxDzSigForPrimaryAssignment")),
31  maxDzForPrimaryAssignment_(iConfig.getParameter<double>("maxDzForPrimaryAssignment")),
32  maxDzErrorForPrimaryAssignment_(iConfig.getParameter<double>("maxDzErrorForPrimaryAssignment")),
33  maxDtSigForPrimaryAssignment_(iConfig.getParameter<double>("maxDtSigForPrimaryAssignment")),
34  maxJetDeltaR_(iConfig.getParameter<double>("maxJetDeltaR")),
35  minJetPt_(iConfig.getParameter<double>("minJetPt")),
36  maxDistanceToJetAxis_(iConfig.getParameter<double>("maxDistanceToJetAxis")),
37  maxDzForJetAxisAssigment_(iConfig.getParameter<double>("maxDzForJetAxisAssigment")),
38  maxDxyForJetAxisAssigment_(iConfig.getParameter<double>("maxDxyForJetAxisAssigment")),
39  maxDxySigForNotReconstructedPrimary_(iConfig.getParameter<double>("maxDxySigForNotReconstructedPrimary")),
40  maxDxyForNotReconstructedPrimary_(iConfig.getParameter<double>("maxDxyForNotReconstructedPrimary")),
41  useTiming_(iConfig.getParameter<bool>("useTiming")),
42  useVertexFit_(iConfig.getParameter<bool>("useVertexFit")),
43  preferHighRanked_(iConfig.getParameter<bool>("preferHighRanked")),
44  fNumOfPUVtxsForCharged_(iConfig.getParameter<unsigned int>("NumOfPUVtxsForCharged")),
45  fDzCutForChargedFromPUVtxs_(iConfig.getParameter<double>("DzCutForChargedFromPUVtxs")),
46  fPtMaxCharged_(iConfig.getParameter<double>("PtMaxCharged")),
47  fEtaMinUseDz_(iConfig.getParameter<double>("EtaMinUseDz")),
48  fOnlyUseFirstDz_(iConfig.getParameter<bool>("OnlyUseFirstDz")) {}
49 
51 
52  std::pair<int, PrimaryVertexAssignment::Quality> chargedHadronVertex(
54  const reco::TrackRef& trackRef,
55  const reco::Track* track,
56  float trackTime,
57  float trackTimeResolution, // <0 if timing not available for this object
59  const TransientTrackBuilder& builder) const;
60 
61  std::pair<int, PrimaryVertexAssignment::Quality> chargedHadronVertex(
63  int iVertex,
64  const reco::Track* track,
65  float trackTime,
66  float trackTimeResolution, // <0 if timing not available for this object
68  const TransientTrackBuilder& builder) const;
69 
70  std::pair<int, PrimaryVertexAssignment::Quality> chargedHadronVertex(
72  const reco::TrackRef& trackRef,
73  float trackTime,
74  float trackTimeResolution, // <0 if timing not available for this object
76  const TransientTrackBuilder& builder) const {
77  return chargedHadronVertex(vertices, trackRef, &(*trackRef), trackTime, trackTimeResolution, jets, builder);
78  }
79 
80  std::pair<int, PrimaryVertexAssignment::Quality> chargedHadronVertex(const reco::VertexCollection& vertices,
83  const TransientTrackBuilder& builder) const {
84  float time = 0, timeResolution = -1;
85  if (useTiming_ && pfcand.isTimeValid()) {
86  time = pfcand.time();
87  timeResolution = pfcand.timeError();
88  }
89  if (pfcand.gsfTrackRef().isNull()) {
90  if (pfcand.trackRef().isNull())
92  else
93  return chargedHadronVertex(vertices, pfcand.trackRef(), time, timeResolution, jets, builder);
94  }
95  return chargedHadronVertex(
96  vertices, reco::TrackRef(), &(*pfcand.gsfTrackRef()), time, timeResolution, jets, builder);
97  }
98 
99  std::pair<int, PrimaryVertexAssignment::Quality> chargedHadronVertex(const reco::VertexCollection& vertices,
102  const TransientTrackBuilder& builder) const {
103  float time = 0, timeResolution = -1;
104  if (useTiming_ && pfcand.timeError() > 0) {
105  time = pfcand.time();
106  timeResolution = pfcand.timeError();
107  }
108  if (!pfcand.hasTrackDetails())
110  else
111  return chargedHadronVertex(
112  vertices,
113  (useVertexFit_ && (pfcand.pvAssociationQuality() >= pat::PackedCandidate::UsedInFitLoose))
114  ? pfcand.vertexRef().key()
115  : -1,
116  &pfcand.pseudoTrack(),
117  time,
119  jets,
120  builder);
121  }
122 
123  std::pair<int, PrimaryVertexAssignment::Quality> chargedHadronVertex(const reco::VertexCollection& vertices,
124  const reco::RecoChargedRefCandidate& chcand,
128  const TransientTrackBuilder& builder) const {
129  float time = 0, timeResolution = -1;
130  if (useTiming_) {
131  time = (*trackTimeTag)[chcand.track()];
132  timeResolution = (*trackTimeResoTag)[chcand.track()];
133  }
134  if (chcand.track().isNull())
136  return chargedHadronVertex(vertices, chcand.track(), time, timeResolution, jets, builder);
137  }
138 
139 private:
145  double minJetPt_;
159 };
160 
161 #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