CMS 3D CMS Logo

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 >, GlobalPointnearTracks (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 distanceRatio
 
double max3DIPSignificance
 
double max3DIPValue
 
double maxTimeSignificance
 
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  max3DIPSignificance(params.getParameter<double>("seedMax3DIPSignificance")),
8  max3DIPValue(params.getParameter<double>("seedMax3DIPValue")),
9  min3DIPSignificance(params.getParameter<double>("seedMin3DIPSignificance")),
10  min3DIPValue(params.getParameter<double>("seedMin3DIPValue")),
11  clusterMaxDistance(params.getParameter<double>("clusterMaxDistance")),
12  clusterMaxSignificance(params.getParameter<double>("clusterMaxSignificance")), //3
13  distanceRatio(params.getParameter<double>("distanceRatio")),//was clusterScale/densityFactor
14  clusterMinAngleCosine(params.getParameter<double>("clusterMinAngleCosine")), //0.0
15  maxTimeSignificance(params.getParameter<double>("maxTimeSignificance"))
16 
17 {
18 
19 }
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 95 of file TracksClusteringFromDisplacedSeed.cc.

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

99 {
100  using namespace reco;
101  std::vector<TransientTrack> seeds;
102  for(std::vector<TransientTrack>::const_iterator it = selectedTracks.begin(); it != selectedTracks.end(); it++){
103  std::pair<bool,Measurement1D> ip = IPTools::absoluteImpactParameter3D(*it,pv);
104  if(ip.first && ip.second.value() >= min3DIPValue && ip.second.significance() >= min3DIPSignificance && ip.second.value() <= max3DIPValue && ip.second.significance() <= max3DIPSignificance)
105  {
106 #ifdef VTXDEBUG
107  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;
108 #endif
109  seeds.push_back(*it);
110  }
111 
112  }
113 
114  std::vector< Cluster > clusters;
115  int i = 0;
116  for(std::vector<TransientTrack>::const_iterator s = seeds.begin();
117  s != seeds.end(); ++s, ++i)
118  {
119 #ifdef VTXDEBUG
120  std::cout << "Seed N. "<<i << std::endl;
121 #endif // VTXDEBUG
122  std::pair<std::vector<reco::TransientTrack>,GlobalPoint> ntracks = nearTracks(*s,selectedTracks,pv);
123 // std::cout << ntracks.first.size() << " " << ntracks.first.size() << std::endl;
124 // if(ntracks.first.size() == 0 || ntracks.first.size() > maxNTracks ) continue;
125  ntracks.first.push_back(*s);
126  Cluster aCl;
127  aCl.seedingTrack = *s;
128  aCl.seedPoint = ntracks.second;
129  aCl.tracks = ntracks.first;
130  clusters.push_back(aCl);
131  }
132 
133 return clusters;
134 }
std::pair< std::vector< reco::TransientTrack >, GlobalPoint > nearTracks(const reco::TransientTrack &seed, const std::vector< reco::TransientTrack > &tracks, const reco::Vertex &primaryVertex) const
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
fixed size matrix
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 21 of file TracksClusteringFromDisplacedSeed.cc.

References funct::abs(), IPTools::absoluteImpactParameter3D(), TwoTrackMinimumDistance::calculate(), TrajectoryStateOnSurface::cartesianError(), clusterMaxDistance, clusterMaxSignificance, clusterMinAngleCosine, gather_cfg::cout, SimDataFormats::CaloAnalysis::cp, TwoTrackMinimumDistance::crossingPoint(), SoftLeptonByDistance_cfi::distance, VertexDistance3D::distance(), TwoTrackMinimumDistance::distance(), distanceRatio, reco::TransientTrack::dtErrorExt(), TrajectoryStateOnSurface::globalDirection(), reco::TransientTrack::impactPointState(), edm::isFinite(), funct::m, mag(), maxTimeSignificance, TwoTrackMinimumDistance::points(), CartesianTrajectoryError::position(), reco::Vertex::position(), funct::pow(), MetAnalyzer::pv(), mps_fire::result, Measurement1D::significance(), mathSSE::sqrt(), reco::TransientTrack::timeExt(), groupFilesInBlocks::tt, csvLumiCalc::unit, Vector3DBase< T, FrameTag >::unit(), w, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), CaloParticle::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by clusters().

22 {
23  VertexDistance3D distanceComputer;
24  GlobalPoint pv(primaryVertex.position().x(),primaryVertex.position().y(),primaryVertex.position().z());
25  std::vector<reco::TransientTrack> result;
27  GlobalPoint seedingPoint;
28  float sumWeights=0;
29  std::pair<bool,Measurement1D> ipSeed = IPTools::absoluteImpactParameter3D(seed,primaryVertex);
30  float pvDistance = ipSeed.second.value();
31  for(std::vector<reco::TransientTrack>::const_iterator tt = tracks.begin();tt!=tracks.end(); ++tt ) {
32 
33  if(*tt==seed) continue;
34 
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  double timeSig = 0.;
45  if( edm::isFinite(seed.timeExt()) && edm::isFinite(tt->timeExt()) ) { // apply only if time available
46  const double tError = std::sqrt( std::pow(seed.dtErrorExt(),2) + std::pow(tt->dtErrorExt(),2) );
47  timeSig = std::abs( seed.timeExt() - tt->timeExt() ) / tError;
48  }
49 
50  float distanceFromPV = (dist.points().second-pv).mag();
51  float distance = dist.distance();
52  GlobalVector trackDir2D(tt->impactPointState().globalDirection().x(),tt->impactPointState().globalDirection().y(),0.);
54  //SK:UNUSED// float dotprodTrackSeed2D = trackDir2D.unit().dot(seedDir2D.unit());
55 
56  float dotprodTrack = (dist.points().first-pv).unit().dot(tt->impactPointState().globalDirection().unit());
57  float dotprodSeed = (dist.points().second-pv).unit().dot(seed.impactPointState().globalDirection().unit());
58 
59  float w = distanceFromPV*distanceFromPV/(pvDistance*distance);
60  bool selected = (m.significance() < clusterMaxSignificance &&
61  dotprodSeed > clusterMinAngleCosine && //Angles between PV-PCAonSeed vectors and seed directions
62  dotprodTrack > clusterMinAngleCosine && //Angles between PV-PCAonTrack vectors and track directions
63  //dotprodTrackSeed2D > clusterMinAngleCosine && //Angle between track and seed
64  //distance*clusterScale*tracks.size() < (distanceFromPV+pvDistance)*(distanceFromPV+pvDistance)/pvDistance && // cut scaling with track density
65  distance*distanceRatio < distanceFromPV && // cut scaling with track density
66  distance < clusterMaxDistance &&
67  timeSig < maxTimeSignificance); // absolute distance cut
68 
69 #ifdef VTXDEBUG
70  std::cout << tt->trackBaseRef().key() << " : " << (selected?"+":" ")<< " " << m.significance() << " < " << clusterMaxSignificance << " && " <<
71  dotprodSeed << " > " << clusterMinAngleCosine << " && " <<
72  dotprodTrack << " > " << clusterMinAngleCosine << " && " <<
73  dotprodTrackSeed2D << " > " << clusterMinAngleCosine << " && " <<
74  distance*distanceRatio << " < " << distanceFromPV << " crossingtoPV: " << distanceFromPV << " dis*scal " << distance*distanceRatio << " < " << distanceFromPV << " dist: " << distance << " < " << clusterMaxDistance <<
75  << "timeSig: " << timeSig << std::endl; // cut scaling with track density
76 #endif
77  if(selected)
78  {
79  result.push_back(*tt);
80  seedingPoint = GlobalPoint(cp.x()*w+seedingPoint.x(),cp.y()*w+seedingPoint.y(),cp.z()*w+seedingPoint.z());
81  sumWeights+=w;
82  }
83  }
84  }
85 
86  seedingPoint = GlobalPoint(seedingPoint.x()/sumWeights,seedingPoint.y()/sumWeights,seedingPoint.z()/sumWeights);
87  return std::pair<std::vector<reco::TransientTrack>,GlobalPoint>(result,seedingPoint);
88 
89 }
std::pair< GlobalPoint, GlobalPoint > points() const override
const double w
Definition: UKUtility.cc:23
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
double timeExt() const
const Point & position() const
position
Definition: Vertex.h:109
bool isFinite(T x)
bool calculate(const TrajectoryStateOnSurface &sta, const TrajectoryStateOnSurface &stb) override
Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override
T sqrt(T t)
Definition: SSEVec.h:18
T z() const
Definition: PV3DBase.h:64
def pv(vc)
Definition: MetAnalyzer.py:6
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
GlobalPoint crossingPoint() const override
float y() const
Same as rapidity().
Definition: CaloParticle.h:174
Vector3DBase unit() const
Definition: Vector3DBase.h:57
double significance() const
Definition: Measurement1D.h:32
float distance() const override
const GlobalError position() const
Position error submatrix.
double dtErrorExt() const
TrajectoryStateOnSurface impactPointState() const
T x() const
Definition: PV3DBase.h:62
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
GlobalVector globalDirection() const
bool TracksClusteringFromDisplacedSeed::trackFilter ( const reco::TrackRef track) const
private

Member Data Documentation

double TracksClusteringFromDisplacedSeed::clusterMaxDistance
private

Definition at line 51 of file TracksClusteringFromDisplacedSeed.h.

Referenced by nearTracks().

double TracksClusteringFromDisplacedSeed::clusterMaxSignificance
private

Definition at line 52 of file TracksClusteringFromDisplacedSeed.h.

Referenced by nearTracks().

double TracksClusteringFromDisplacedSeed::clusterMinAngleCosine
private

Definition at line 54 of file TracksClusteringFromDisplacedSeed.h.

Referenced by nearTracks().

double TracksClusteringFromDisplacedSeed::distanceRatio
private

Definition at line 53 of file TracksClusteringFromDisplacedSeed.h.

Referenced by nearTracks().

double TracksClusteringFromDisplacedSeed::max3DIPSignificance
private

Definition at line 47 of file TracksClusteringFromDisplacedSeed.h.

Referenced by clusters().

double TracksClusteringFromDisplacedSeed::max3DIPValue
private

Definition at line 48 of file TracksClusteringFromDisplacedSeed.h.

Referenced by clusters().

double TracksClusteringFromDisplacedSeed::maxTimeSignificance
private

Definition at line 55 of file TracksClusteringFromDisplacedSeed.h.

Referenced by nearTracks().

double TracksClusteringFromDisplacedSeed::min3DIPSignificance
private

Definition at line 49 of file TracksClusteringFromDisplacedSeed.h.

Referenced by clusters().

double TracksClusteringFromDisplacedSeed::min3DIPValue
private

Definition at line 50 of file TracksClusteringFromDisplacedSeed.h.

Referenced by clusters().