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 
17 
19  public:
21 
23  maxDzSigForPrimaryAssignment_(iConfig.getParameter<double>("maxDzSigForPrimaryAssignment")),
24  maxDzForPrimaryAssignment_(iConfig.getParameter<double>("maxDzForPrimaryAssignment")),
25  maxDzErrorForPrimaryAssignment_(iConfig.getParameter<double>("maxDzErrorForPrimaryAssignment")),
26  maxDtSigForPrimaryAssignment_(iConfig.getParameter<double>("maxDtSigForPrimaryAssignment")),
27  maxJetDeltaR_(iConfig.getParameter<double>("maxJetDeltaR")),
28  minJetPt_(iConfig.getParameter<double>("minJetPt")),
29  maxDistanceToJetAxis_(iConfig.getParameter<double>("maxDistanceToJetAxis")),
30  maxDzForJetAxisAssigment_(iConfig.getParameter<double>("maxDzForJetAxisAssigment")),
31  maxDxyForJetAxisAssigment_(iConfig.getParameter<double>("maxDxyForJetAxisAssigment")),
32  maxDxySigForNotReconstructedPrimary_(iConfig.getParameter<double>("maxDxySigForNotReconstructedPrimary")),
33  maxDxyForNotReconstructedPrimary_(iConfig.getParameter<double>("maxDxyForNotReconstructedPrimary")),
34  useTiming_(iConfig.getParameter<bool>("useTiming")),
35  preferHighRanked_(iConfig.getParameter<bool>("preferHighRanked"))
36  {}
37 
39 
40  std::pair<int,PrimaryVertexAssignment::Quality> chargedHadronVertex(const reco::VertexCollection& vertices,
41  const reco::TrackRef& trackRef,
42  const reco::Track * track,
43  float trackTime,
44  float trackTimeResolution, // <0 if timing not available for this object
46  const TransientTrackBuilder & builder) const;
47 
48  std::pair<int,PrimaryVertexAssignment::Quality> chargedHadronVertex(const reco::VertexCollection& vertices,
49  const reco::TrackRef& trackRef,
50  float trackTime,
51  float trackTimeResolution, // <0 if timing not available for this object
52  const edm::View<reco::Candidate> & jets,
53  const TransientTrackBuilder & builder) const
54  {
55  return chargedHadronVertex(vertices,trackRef,&(*trackRef),trackTime,trackTimeResolution,jets,builder);
56  }
57 
58  std::pair<int,PrimaryVertexAssignment::Quality> chargedHadronVertex( const reco::VertexCollection& vertices,
60  const edm::View<reco::Candidate>& jets,
61  const TransientTrackBuilder& builder) const {
62  float time = 0, timeResolution = -1;
63  if (useTiming_ && pfcand.isTimeValid()) {
64  time = pfcand.time(); timeResolution = pfcand.timeError();
65  }
66  if(pfcand.gsfTrackRef().isNull())
67  {
68  if(pfcand.trackRef().isNull())
69  return std::pair<int,PrimaryVertexAssignment::Quality>(-1,PrimaryVertexAssignment::Unassigned);
70  else
71  return chargedHadronVertex(vertices,pfcand.trackRef(),time,timeResolution,jets,builder);
72  }
73  return chargedHadronVertex(vertices,reco::TrackRef(),&(*pfcand.gsfTrackRef()),time,timeResolution,jets,builder);
74  }
75  std::pair<int,PrimaryVertexAssignment::Quality> chargedHadronVertex( const reco::VertexCollection& vertices,
76  const reco::RecoChargedRefCandidate& chcand,
79  const edm::View<reco::Candidate>& jets,
80  const TransientTrackBuilder& builder) const {
81  float time = 0, timeResolution = -1;
82  if (useTiming_) {
83  time = (*trackTimeTag)[chcand.track()];
84  timeResolution = (*trackTimeResoTag)[chcand.track()];
85  }
86  if(chcand.track().isNull())
87  return std::pair<int,PrimaryVertexAssignment::Quality>(-1,PrimaryVertexAssignment::Unassigned);
88  return chargedHadronVertex(vertices,chcand.track(),time,timeResolution,jets,builder);
89  }
90 
91 
92  private :
97  double maxJetDeltaR_;
98  double minJetPt_;
106 };
107 
108 #endif
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
float time() const
Definition: PFCandidate.h:421
PrimaryVertexAssignment(const edm::ParameterSet &iConfig)
reco::TrackRef trackRef() const
Definition: PFCandidate.cc:442
bool isTimeValid() const
do we have a valid time information
Definition: PFCandidate.h:419
vector< PseudoJet > jets
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 reco::TrackRef &trackRef, float trackTime, float trackTimeResolution, const edm::View< reco::Candidate > &jets, const TransientTrackBuilder &builder) const
bool isNull() const
Checks for null.
Definition: Ref.h:250
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
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:40
reco::GsfTrackRef gsfTrackRef() const
Definition: PFCandidate.cc:480
float timeError() const
Definition: PFCandidate.h:423