CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
TrackVertexArbitration Class Reference

#include <TrackVertexArbitratration.h>

Public Member Functions

 TrackVertexArbitration (const edm::ParameterSet &params)
 
reco::VertexCollection trackVertexArbitrator (edm::Handle< reco::BeamSpot > &beamSpot, const reco::Vertex &pv, edm::ESHandle< TransientTrackBuilder > &trackBuilder, const edm::RefVector< reco::TrackCollection > &selectedTracks, reco::VertexCollection &secondaryVertices)
 

Private Member Functions

bool trackFilterArbitrator (const reco::TrackRef &track) const
 

Private Attributes

edm::InputTag beamSpotCollection
 
double distCut
 
double dLenFraction
 
double dRCut
 
edm::InputTag primaryVertexCollection
 
edm::InputTag secondaryVertexCollection
 
double sigCut
 
edm::InputTag trackCollection
 

Detailed Description

Definition at line 39 of file TrackVertexArbitratration.h.

Constructor & Destructor Documentation

TrackVertexArbitration::TrackVertexArbitration ( const edm::ParameterSet params)

Definition at line 5 of file TrackVertexArbitratration.cc.

5  :
6  primaryVertexCollection (params.getParameter<edm::InputTag>("primaryVertices")),
7  secondaryVertexCollection (params.getParameter<edm::InputTag>("secondaryVertices")),
8  trackCollection (params.getParameter<edm::InputTag>("tracks")),
9  beamSpotCollection (params.getParameter<edm::InputTag>("beamSpot")),
10  dRCut (params.getParameter<double>("dRCut")),
11  distCut (params.getParameter<double>("distCut")),
12  sigCut (params.getParameter<double>("sigCut")),
13  dLenFraction (params.getParameter<double>("dLenFraction"))
14 {
15 
16 }
T getParameter(std::string const &) const

Member Function Documentation

bool TrackVertexArbitration::trackFilterArbitrator ( const reco::TrackRef track) const
private

Definition at line 18 of file TrackVertexArbitratration.cc.

Referenced by trackVertexArbitrator().

19 {
20  if (track->hitPattern().trackerLayersWithMeasurement() < 4)
21  return false;
22  if (track->pt() < 0.4 )
23  return false;
24  if (track->hitPattern().numberOfValidPixelHits() < 1)
25  return false;
26 
27  return true;
28 }
reco::VertexCollection TrackVertexArbitration::trackVertexArbitrator ( edm::Handle< reco::BeamSpot > &  beamSpot,
const reco::Vertex pv,
edm::ESHandle< TransientTrackBuilder > &  trackBuilder,
const edm::RefVector< reco::TrackCollection > &  selectedTracks,
reco::VertexCollection secondaryVertices 
)

Definition at line 34 of file TrackVertexArbitratration.cc.

References IPTools::absoluteImpactParameter3D(), IPTools::absoluteTransverseImpactParameter(), gather_cfg::cout, Geom::deltaR(), distCut, dLenFraction, PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, dRCut, TransientVertex::isValid(), edm::Ref< C, T, F >::key(), reco::Vertex::p4(), reco::Vertex::position(), dt_dqm_sourceclient_common_cff::reco, reco::Track::residualX(), reco::Track::residualY(), TrackCollections2monitor_cff::selectedTracks, reco::TransientTrack::setBeamSpot(), sigCut, edm::RefVector< C, T, F >::size(), reco::TransientTrack::track(), trackFilterArbitrator(), groupFilesInBlocks::tt, Measurement1D::value(), AdaptiveVertexFitter::vertex(), and w().

Referenced by TrackVertexArbitrator::produce().

40 {
41  using namespace reco;
42 
43  //std::cout << "PV: " << pv.position() << std::endl;
44  VertexDistance3D dist;
45 
46  double sigmacut = 3.0;
47  double Tini = 256.;
48  double ratio = 0.25;
49 
50  AdaptiveVertexFitter theAdaptiveFitter(
51  GeometricAnnealing(sigmacut, Tini, ratio),
56 
57 
58 
59  reco::VertexCollection recoVertices;
60 
61  VertexDistance3D vdist;
62 
63 for(std::vector<reco::Vertex>::const_iterator sv = secondaryVertices.begin();
64  sv != secondaryVertices.end(); ++sv) {
65 /* recoVertices->push_back(*sv);
66 
67 
68  for(std::vector<reco::Vertex>::iterator sv = recoVertices->begin();
69  sv != recoVertices->end(); ++sv) {
70 */
71  GlobalPoint ppv(pv.position().x(),pv.position().y(),pv.position().z());
72  GlobalPoint ssv(sv->position().x(),sv->position().y(),sv->position().z());
73  GlobalVector flightDir = ssv-ppv;
74 // std::cout << "Vertex : " << sv-secondaryVertices->begin() << " " << sv->position() << std::endl;
75  Measurement1D dlen= vdist.distance(pv,*sv);
76  std::vector<reco::TransientTrack> selTracks;
77  for(unsigned int itrack = 0; itrack < selectedTracks.size(); itrack++){
78  TrackRef ref = (selectedTracks)[itrack];
79 
80  //for(TrackCollection::const_iterator track = tracks->begin();
81  // track != tracks->end(); ++track) {
82 
83  // TrackRef ref(tracks, track - tracks->begin());
84  if (!trackFilterArbitrator(ref)) continue;
85 
86  TransientTrack tt = trackBuilder->build(ref);
87  tt.setBeamSpot(*beamSpot);
88  float w = sv->trackWeight(ref);
89  std::pair<bool,Measurement1D> ipv = IPTools::absoluteImpactParameter3D(tt,pv);
90  std::pair<bool,Measurement1D> itpv = IPTools::absoluteTransverseImpactParameter(tt,pv);
91  std::pair<bool,Measurement1D> isv = IPTools::absoluteImpactParameter3D(tt,*sv);
92  float dR = Geom::deltaR(flightDir,tt.track()); //.eta(), flightDir.phi(), tt.track().eta(), tt.track().phi());
93 
94  if( w > 0 || ( isv.second.significance() < sigCut && isv.second.value() < distCut && isv.second.value() < dlen.value()*dLenFraction ) )
95  {
96 
97  if(( isv.second.value() < ipv.second.value() ) && isv.second.value() < distCut && isv.second.value() < dlen.value()*dLenFraction
98  && dR < dRCut )
99  {
100 #ifdef VTXDEBUG
101  if(w > 0.5) std::cout << " = ";
102  else std::cout << " + ";
103 #endif
104  selTracks.push_back(tt);
105  } else
106  {
107 #ifdef VTXDEBUG
108  if(w > 0.5 && isv.second.value() > ipv.second.value() ) std::cout << " - ";
109  else std::cout << " ";
110 #endif
111  //add also the tracks used in previous fitting that are still closer to Sv than Pv
112  if(w > 0.5 && isv.second.value() <= ipv.second.value() && dR < dRCut) {
113  selTracks.push_back(tt);
114 #ifdef VTXDEBUG
115  std::cout << " = ";
116 #endif
117  }
118  if(w > 0.5 && isv.second.value() <= ipv.second.value() && dR >= dRCut) {
119 #ifdef VTXDEBUG
120  std::cout << " - ";
121 #endif
122 
123  }
124 
125 
126  }
127 #ifdef VTXDEBUG
128 
129  std::cout << "t : " << itrack << " ref " << ref.key() << " w: " << w
130  << " svip: " << isv.second.significance() << " " << isv.second.value()
131  << " pvip: " << ipv.second.significance() << " " << ipv.second.value() << " res " << tt.track().residualX(0) << "," << tt.track().residualY(0)
132  << " tpvip: " << itpv.second.significance() << " " << itpv.second.value() << " dr: " << dR << std::endl;
133 #endif
134 
135  }
136  else
137  {
138 #ifdef VTXDEBUG
139 
140  std::cout << " . t : " << itrack << " ref " << ref.key()<< " w: " << w
141  << " svip: " << isv.second.significance() << " " << isv.second.value()
142  << " pvip: " << ipv.second.significance() << " " << ipv.second.value() << " dr: " << dR << std::endl;
143 #endif
144 
145  }
146  }
147 
148  if(selTracks.size() >= 2)
149  {
150  TransientVertex singleFitVertex;
151  singleFitVertex = theAdaptiveFitter.vertex(selTracks,ssv);
152  if(singleFitVertex.isValid()) { recoVertices.push_back(reco::Vertex(singleFitVertex));
153 
154 #ifdef VTXDEBUG
155  const reco::Vertex & extVertex = recoVertices.back();
156  GlobalVector vtxDir = GlobalVector(extVertex.p4().X(),extVertex.p4().Y(),extVertex.p4().Z());
157 
158 
159  std::cout << " pointing : " << Geom::deltaR(extVertex.position() - pv.position(), vtxDir) << std::endl;
160 #endif
161  }
162  }
163  }
164  return recoVertices;
165 }
void setBeamSpot(const reco::BeamSpot &beamSpot)
std::pair< bool, Measurement1D > absoluteImpactParameter3D(const reco::TransientTrack &transientTrack, const reco::Vertex &vertex)
Definition: IPTools.cc:37
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
const Point & position() const
position
Definition: Vertex.h:92
double residualX(int position) const
Definition: Track.cc:14
bool trackFilterArbitrator(const reco::TrackRef &track) const
const Track & track() const
math::XYZTLorentzVectorD p4(float mass=0.13957018, float minWeight=0.5) const
Returns the four momentum of the sum of the tracks, assuming the given mass for the decay products...
Definition: Vertex.cc:112
key_type key() const
Accessor for product key.
Definition: Ref.h:266
double value() const
Definition: Measurement1D.h:28
std::pair< bool, Measurement1D > absoluteTransverseImpactParameter(const reco::TransientTrack &transientTrack, const reco::Vertex &vertex)
Definition: IPTools.cc:43
double residualY(int position) const
Definition: Track.cc:19
double deltaR(const Vector1 &v1, const Vector2 &v2)
Definition: VectorUtil.h:84
size_type size() const
Size of the RefVector.
Definition: RefVector.h:89
tuple cout
Definition: gather_cfg.py:121
T w() const
bool isValid() const
Global3DVector GlobalVector
Definition: GlobalVector.h:10

Member Data Documentation

edm::InputTag TrackVertexArbitration::beamSpotCollection
private

Definition at line 59 of file TrackVertexArbitratration.h.

double TrackVertexArbitration::distCut
private

Definition at line 61 of file TrackVertexArbitratration.h.

Referenced by trackVertexArbitrator().

double TrackVertexArbitration::dLenFraction
private

Definition at line 63 of file TrackVertexArbitratration.h.

Referenced by trackVertexArbitrator().

double TrackVertexArbitration::dRCut
private

Definition at line 60 of file TrackVertexArbitratration.h.

Referenced by trackVertexArbitrator().

edm::InputTag TrackVertexArbitration::primaryVertexCollection
private

Definition at line 56 of file TrackVertexArbitratration.h.

edm::InputTag TrackVertexArbitration::secondaryVertexCollection
private

Definition at line 57 of file TrackVertexArbitratration.h.

double TrackVertexArbitration::sigCut
private

Definition at line 62 of file TrackVertexArbitratration.h.

Referenced by trackVertexArbitrator().

edm::InputTag TrackVertexArbitration::trackCollection
private

Definition at line 58 of file TrackVertexArbitratration.h.