CMS 3D CMS Logo

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

#include <TracksClusteringFromDisplacedSeed.h>

Classes

struct  Cluster
 

Public Member Functions

std::vector< Clusterclusters (const reco::Vertex &pv, const std::vector< reco::TransientTrack > &selectedTracks)
 
 TracksClusteringFromDisplacedSeed (const edm::ParameterSet &params)
 

Private Member Functions

std::pair< std::vector
< reco::TransientTrack >
, GlobalPoint
nearTracks (const reco::TransientTrack &seed, const std::vector< reco::TransientTrack > &tracks, const reco::Vertex &primaryVertex) const
 
bool trackFilter (const reco::TrackRef &track) const
 

Private Attributes

double clusterMaxDistance
 
double clusterMaxSignificance
 
double clusterMinAngleCosine
 
double clusterScale
 
double min3DIPSignificance
 
double min3DIPValue
 

Detailed Description

Definition at line 25 of file TracksClusteringFromDisplacedSeed.h.

Constructor & Destructor Documentation

TracksClusteringFromDisplacedSeed::TracksClusteringFromDisplacedSeed ( const edm::ParameterSet params)

Definition at line 5 of file TracksClusteringFromDisplacedSeed.cc.

5  :
6 // maxNTracks(params.getParameter<unsigned int>("maxNTracks")),
7  min3DIPSignificance(params.getParameter<double>("seedMin3DIPSignificance")),
8  min3DIPValue(params.getParameter<double>("seedMin3DIPValue")),
9  clusterMaxDistance(params.getParameter<double>("clusterMaxDistance")),
10  clusterMaxSignificance(params.getParameter<double>("clusterMaxSignificance")), //3
11  clusterScale(params.getParameter<double>("clusterScale")),//10.
12  clusterMinAngleCosine(params.getParameter<double>("clusterMinAngleCosine")) //0.0
13 
14 {
15 
16 }
T getParameter(std::string const &) const

Member Function Documentation

std::vector< TracksClusteringFromDisplacedSeed::Cluster > TracksClusteringFromDisplacedSeed::clusters ( const reco::Vertex pv,
const std::vector< reco::TransientTrack > &  selectedTracks 
)

Definition at line 88 of file TracksClusteringFromDisplacedSeed.cc.

References IPTools::absoluteImpactParameter3D(), gather_cfg::cout, i, min3DIPSignificance, min3DIPValue, nearTracks(), dt_dqm_sourceclient_common_cff::reco, alignCSCRings::s, TracksClusteringFromDisplacedSeed::Cluster::seedingTrack, TracksClusteringFromDisplacedSeed::Cluster::seedPoint, and TracksClusteringFromDisplacedSeed::Cluster::tracks.

92 {
93  using namespace reco;
94  std::vector<TransientTrack> seeds;
95  for(std::vector<TransientTrack>::const_iterator it = selectedTracks.begin(); it != selectedTracks.end(); it++){
96  std::pair<bool,Measurement1D> ip = IPTools::absoluteImpactParameter3D(*it,pv);
97  if(ip.first && ip.second.value() >= min3DIPValue && ip.second.significance() >= min3DIPSignificance)
98  {
99 #ifdef VTXDEBUG
100  std::cout << "new seed " << it-selectedTracks.begin() << " ref " << it->trackBaseRef().key() << " " << ip.second.value() << " " << ip.second.significance() << " " << it->track().hitPattern().trackerLayersWithMeasurement() << " " << it->track().pt() << " " << it->track().eta() << std::endl;
101 #endif
102  seeds.push_back(*it);
103  }
104 
105  }
106 
107  std::vector< Cluster > clusters;
108  int i = 0;
109  for(std::vector<TransientTrack>::const_iterator s = seeds.begin();
110  s != seeds.end(); ++s, ++i)
111  {
112 #ifdef VTXDEBUG
113  std::cout << "Seed N. "<<i << std::endl;
114 #endif // VTXDEBUG
115  std::pair<std::vector<reco::TransientTrack>,GlobalPoint> ntracks = nearTracks(*s,selectedTracks,pv);
116 // std::cout << ntracks.first.size() << " " << ntracks.first.size() << std::endl;
117 // if(ntracks.first.size() == 0 || ntracks.first.size() > maxNTracks ) continue;
118  ntracks.first.push_back(*s);
119  Cluster aCl;
120  aCl.seedingTrack = *s;
121  aCl.seedPoint = ntracks.second;
122  aCl.tracks = ntracks.first;
123  clusters.push_back(aCl);
124  }
125 
126 return clusters;
127 }
std::pair< std::vector< reco::TransientTrack >, GlobalPoint > nearTracks(const reco::TransientTrack &seed, const std::vector< reco::TransientTrack > &tracks, const reco::Vertex &primaryVertex) const
int i
Definition: DBlmapReader.cc:9
std::vector< Cluster > clusters(const reco::Vertex &pv, const std::vector< reco::TransientTrack > &selectedTracks)
std::pair< bool, Measurement1D > absoluteImpactParameter3D(const reco::TransientTrack &transientTrack, const reco::Vertex &vertex)
Definition: IPTools.cc:37
tuple cout
Definition: gather_cfg.py:121
std::pair< std::vector< reco::TransientTrack >, GlobalPoint > TracksClusteringFromDisplacedSeed::nearTracks ( const reco::TransientTrack seed,
const std::vector< reco::TransientTrack > &  tracks,
const reco::Vertex primaryVertex 
) const
private

Definition at line 18 of file TracksClusteringFromDisplacedSeed.cc.

References IPTools::absoluteImpactParameter3D(), TrajectoryStateOnSurface::cartesianError(), clusterMaxDistance, clusterMaxSignificance, clusterMinAngleCosine, clusterScale, gather_cfg::cout, CommonMethods::cp(), VertexDistance3D::distance(), TrajectoryStateOnSurface::globalDirection(), reco::TransientTrack::impactPointState(), m, mag(), CartesianTrajectoryError::position(), reco::Vertex::position(), query::result, Measurement1D::significance(), mathSSE::sqrt(), groupFilesInBlocks::tt, csvLumiCalc::unit, Vector3DBase< T, FrameTag >::unit(), w(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by clusters().

19 {
20  VertexDistance3D distanceComputer;
21  GlobalPoint pv(primaryVertex.position().x(),primaryVertex.position().y(),primaryVertex.position().z());
22  std::vector<reco::TransientTrack> result;
23  TwoTrackMinimumDistance dist;
24  GlobalPoint seedingPoint;
25  float sumWeights=0;
26  std::pair<bool,Measurement1D> ipSeed = IPTools::absoluteImpactParameter3D(seed,primaryVertex);
27  float pvDistance = ipSeed.second.value();
28 // float densityFactor = 2./sqrt(20.*tracks.size()); // assuming all tracks being in 2 narrow jets of cone 0.3
29  float densityFactor = 2./sqrt(20.*80); // assuming 80 tracks being in 2 narrow jets of cone 0.3
30  for(std::vector<reco::TransientTrack>::const_iterator tt = tracks.begin();tt!=tracks.end(); ++tt ) {
31 
32  if(*tt==seed) continue;
33 
34  std::pair<bool,Measurement1D> ip = IPTools::absoluteImpactParameter3D(*tt,primaryVertex);
35  if(dist.calculate(tt->impactPointState(),seed.impactPointState()))
36  {
37  GlobalPoint ttPoint = dist.points().first;
38  GlobalError ttPointErr = tt->impactPointState().cartesianError().position();
39  GlobalPoint seedPosition = dist.points().second;
40  GlobalError seedPositionErr = seed.impactPointState().cartesianError().position();
41  Measurement1D m = distanceComputer.distance(VertexState(seedPosition,seedPositionErr), VertexState(ttPoint, ttPointErr));
42  GlobalPoint cp(dist.crossingPoint());
43 
44 
45  float distanceFromPV = (dist.points().second-pv).mag();
46  float distance = dist.distance();
47  GlobalVector trackDir2D(tt->impactPointState().globalDirection().x(),tt->impactPointState().globalDirection().y(),0.);
49  //SK:UNUSED// float dotprodTrackSeed2D = trackDir2D.unit().dot(seedDir2D.unit());
50 
51  float dotprodTrack = (dist.points().first-pv).unit().dot(tt->impactPointState().globalDirection().unit());
52  float dotprodSeed = (dist.points().second-pv).unit().dot(seed.impactPointState().globalDirection().unit());
53 
54  float w = distanceFromPV*distanceFromPV/(pvDistance*distance);
55  bool selected = (m.significance() < clusterMaxSignificance &&
56  dotprodSeed > clusterMinAngleCosine && //Angles between PV-PCAonSeed vectors and seed directions
57  dotprodTrack > clusterMinAngleCosine && //Angles between PV-PCAonTrack vectors and track directions
58 // dotprodTrackSeed2D > clusterMinAngleCosine && //Angle between track and seed
59  // distance*clusterScale*tracks.size() < (distanceFromPV+pvDistance)*(distanceFromPV+pvDistance)/pvDistance && // cut scaling with track density
60  distance*clusterScale < densityFactor*distanceFromPV && // cut scaling with track density
61  distance < clusterMaxDistance); // absolute distance cut
62 
63 #ifdef VTXDEBUG
64  std::cout << tt->trackBaseRef().key() << " : " << (selected?"+":" ")<< " " << m.significance() << " < " << clusterMaxSignificance << " && " <<
65  dotprodSeed << " > " << clusterMinAngleCosine << " && " <<
66  dotprodTrack << " > " << clusterMinAngleCosine << " && " <<
67  dotprodTrackSeed2D << " > " << clusterMinAngleCosine << " && " <<
68  distance*clusterScale << " < " << densityFactor*distanceFromPV << " crossingtoPV: " << distanceFromPV << " dis*scal " << distance*clusterScale << " < " << densityFactor*distanceFromPV << " dist: " << distance << " < " << clusterMaxDistance << std::endl; // cut scaling with track density
69 #endif
70  if(selected)
71  {
72  result.push_back(*tt);
73  seedingPoint = GlobalPoint(cp.x()*w+seedingPoint.x(),cp.y()*w+seedingPoint.y(),cp.z()*w+seedingPoint.z());
74  sumWeights+=w;
75  }
76  }
77  }
78 
79  seedingPoint = GlobalPoint(seedingPoint.x()/sumWeights,seedingPoint.y()/sumWeights,seedingPoint.z()/sumWeights);
80  return std::pair<std::vector<reco::TransientTrack>,GlobalPoint>(result,seedingPoint);
81 
82 }
virtual Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
const CartesianTrajectoryError cartesianError() const
std::pair< bool, Measurement1D > absoluteImpactParameter3D(const reco::TransientTrack &transientTrack, const reco::Vertex &vertex)
Definition: IPTools.cc:37
T y() const
Definition: PV3DBase.h:63
const Point & position() const
position
Definition: Vertex.h:92
string unit
Definition: csvLumiCalc.py:46
T sqrt(T t)
Definition: SSEVec.h:48
T z() const
Definition: PV3DBase.h:64
tuple result
Definition: query.py:137
Vector3DBase unit() const
Definition: Vector3DBase.h:57
double significance() const
Definition: Measurement1D.h:32
const GlobalError position() const
Position error submatrix.
tuple tracks
Definition: testEve_cfg.py:39
tuple cout
Definition: gather_cfg.py:121
TrajectoryStateOnSurface impactPointState() const
T w() const
T x() const
Definition: PV3DBase.h:62
GlobalVector globalDirection() const
bool TracksClusteringFromDisplacedSeed::trackFilter ( const reco::TrackRef track) const
private

Member Data Documentation

double TracksClusteringFromDisplacedSeed::clusterMaxDistance
private

Definition at line 49 of file TracksClusteringFromDisplacedSeed.h.

Referenced by nearTracks().

double TracksClusteringFromDisplacedSeed::clusterMaxSignificance
private

Definition at line 50 of file TracksClusteringFromDisplacedSeed.h.

Referenced by nearTracks().

double TracksClusteringFromDisplacedSeed::clusterMinAngleCosine
private

Definition at line 52 of file TracksClusteringFromDisplacedSeed.h.

Referenced by nearTracks().

double TracksClusteringFromDisplacedSeed::clusterScale
private

Definition at line 51 of file TracksClusteringFromDisplacedSeed.h.

Referenced by nearTracks().

double TracksClusteringFromDisplacedSeed::min3DIPSignificance
private

Definition at line 47 of file TracksClusteringFromDisplacedSeed.h.

Referenced by clusters().

double TracksClusteringFromDisplacedSeed::min3DIPValue
private

Definition at line 48 of file TracksClusteringFromDisplacedSeed.h.

Referenced by clusters().