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::TracksClusteringFromDisplacedSeed ( const edm::ParameterSet params)

Definition at line 5 of file TracksClusteringFromDisplacedSeed.cc.

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 {}

Member Function Documentation

◆ clusters()

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

Definition at line 100 of file TracksClusteringFromDisplacedSeed.cc.

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

References IPTools::absoluteImpactParameter3D(), gather_cfg::cout, mps_fire::i, max3DIPSignificance, max3DIPValue, min3DIPSignificance, min3DIPValue, nearTracks(), vertices_cff::ntracks, MetAnalyzer::pv(), alignCSCRings::s, TracksClusteringFromDisplacedSeed::Cluster::seedingTrack, TracksClusteringFromDisplacedSeed::Cluster::seedPoint, InitialStep_cff::seeds, TrackCollections2monitor_cff::selectedTracks, and TracksClusteringFromDisplacedSeed::Cluster::tracks.

◆ nearTracks()

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 19 of file TracksClusteringFromDisplacedSeed.cc.

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  if (*tt == seed)
33  continue;
34 
35  if (dist.calculate(tt->impactPointState(), seed.impactPointState())) {
36  GlobalPoint ttPoint = dist.points().first;
37  GlobalError ttPointErr = tt->impactPointState().cartesianError().position();
38  GlobalPoint seedPosition = dist.points().second;
39  GlobalError seedPositionErr = seed.impactPointState().cartesianError().position();
41  distanceComputer.distance(VertexState(seedPosition, seedPositionErr), VertexState(ttPoint, ttPointErr));
43 
44  double timeSig = 0.;
45  if (primaryVertex.covariance(3, 3) > 0. && edm::isFinite(seed.timeExt()) && edm::isFinite(tt->timeExt())) {
46  // apply only if time available and being used in vertexing
47  const double tError = std::sqrt(std::pow(seed.dtErrorExt(), 2) + std::pow(tt->dtErrorExt(), 2));
48  timeSig = std::abs(seed.timeExt() - tt->timeExt()) / tError;
49  }
50 
51  float distanceFromPV = (dist.points().second - pv).mag();
52  float distance = dist.distance();
53  GlobalVector trackDir2D(
54  tt->impactPointState().globalDirection().x(), tt->impactPointState().globalDirection().y(), 0.);
55  GlobalVector seedDir2D(
56  seed.impactPointState().globalDirection().x(), seed.impactPointState().globalDirection().y(), 0.);
57  //SK:UNUSED// float dotprodTrackSeed2D = trackDir2D.unit().dot(seedDir2D.unit());
58 
59  float dotprodTrack = (dist.points().first - pv).unit().dot(tt->impactPointState().globalDirection().unit());
60  float dotprodSeed = (dist.points().second - pv).unit().dot(seed.impactPointState().globalDirection().unit());
61 
62  float w = distanceFromPV * distanceFromPV / (pvDistance * distance);
63  bool selected =
64  (m.significance() < clusterMaxSignificance &&
66  ? (dotprodSeed > clusterMinAngleCosine)
67  : (dotprodSeed < clusterMinAngleCosine)) && //Angles between PV-PCAonSeed vectors and seed directions
69  ? (dotprodTrack > clusterMinAngleCosine)
70  : (dotprodTrack < clusterMinAngleCosine)) && //Angles between PV-PCAonTrack vectors and track directions
71  //dotprodTrackSeed2D > clusterMinAngleCosine && //Angle between track and seed
72  //distance*clusterScale*tracks.size() < (distanceFromPV+pvDistance)*(distanceFromPV+pvDistance)/pvDistance && // cut scaling with track density
73  distance * distanceRatio < distanceFromPV && // cut scaling with track density
75  timeSig < maxTimeSignificance); // absolute distance cut
76 
77 #ifdef VTXDEBUG
78  std::cout << tt->trackBaseRef().key() << " : " << (selected ? "+" : " ") << " " << m.significance() << " < "
79  << clusterMaxSignificance << " && " << dotprodSeed << " > " << clusterMinAngleCosine << " && "
80  << dotprodTrack << " > " << clusterMinAngleCosine << " && " << dotprodTrackSeed2D << " > "
81  << clusterMinAngleCosine << " && " << distance * distanceRatio << " < " << distanceFromPV
82  << " crossingtoPV: " << distanceFromPV << " dis*scal " << distance * distanceRatio << " < "
83  << distanceFromPV << " dist: " << distance << " < " << clusterMaxDistance < < < <
84  "timeSig: " << timeSig << std::endl; // cut scaling with track density
85 #endif
86  if (selected) {
87  result.push_back(*tt);
88  seedingPoint =
89  GlobalPoint(cp.x() * w + seedingPoint.x(), cp.y() * w + seedingPoint.y(), cp.z() * w + seedingPoint.z());
90  sumWeights += w;
91  }
92  }
93  }
94 
95  seedingPoint =
96  GlobalPoint(seedingPoint.x() / sumWeights, seedingPoint.y() / sumWeights, seedingPoint.z() / sumWeights);
97  return std::pair<std::vector<reco::TransientTrack>, GlobalPoint>(result, seedingPoint);
98 }

References funct::abs(), IPTools::absoluteImpactParameter3D(), TwoTrackMinimumDistance::calculate(), clusterMaxDistance, clusterMaxSignificance, clusterMinAngleCosine, gather_cfg::cout, CommonMethods::cp(), TwoTrackMinimumDistance::crossingPoint(), VertexDistance3D::distance(), TwoTrackMinimumDistance::distance(), HLT_FULL_cff::distance, distanceRatio, Basic3DVector< T >::dot(), edm::isFinite(), visualization-live-secondInstance_cfg::m, mag(), maxTimeSignificance, TwoTrackMinimumDistance::points(), funct::pow(), BeamMonitor_cff::primaryVertex, MetAnalyzer::pv(), mps_fire::result, fileCollector::seed, mathSSE::sqrt(), PDWG_EXOHSCP_cff::tracks, groupFilesInBlocks::tt, unit(), w, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by clusters().

◆ trackFilter()

bool TracksClusteringFromDisplacedSeed::trackFilter ( const reco::TrackRef track) const
private

Member Data Documentation

◆ clusterMaxDistance

double TracksClusteringFromDisplacedSeed::clusterMaxDistance
private

Definition at line 47 of file TracksClusteringFromDisplacedSeed.h.

Referenced by nearTracks().

◆ clusterMaxSignificance

double TracksClusteringFromDisplacedSeed::clusterMaxSignificance
private

Definition at line 48 of file TracksClusteringFromDisplacedSeed.h.

Referenced by nearTracks().

◆ clusterMinAngleCosine

double TracksClusteringFromDisplacedSeed::clusterMinAngleCosine
private

Definition at line 50 of file TracksClusteringFromDisplacedSeed.h.

Referenced by nearTracks().

◆ distanceRatio

double TracksClusteringFromDisplacedSeed::distanceRatio
private

Definition at line 49 of file TracksClusteringFromDisplacedSeed.h.

Referenced by nearTracks().

◆ max3DIPSignificance

double TracksClusteringFromDisplacedSeed::max3DIPSignificance
private

Definition at line 43 of file TracksClusteringFromDisplacedSeed.h.

Referenced by clusters().

◆ max3DIPValue

double TracksClusteringFromDisplacedSeed::max3DIPValue
private

Definition at line 44 of file TracksClusteringFromDisplacedSeed.h.

Referenced by clusters().

◆ maxTimeSignificance

double TracksClusteringFromDisplacedSeed::maxTimeSignificance
private

Definition at line 51 of file TracksClusteringFromDisplacedSeed.h.

Referenced by nearTracks().

◆ min3DIPSignificance

double TracksClusteringFromDisplacedSeed::min3DIPSignificance
private

Definition at line 45 of file TracksClusteringFromDisplacedSeed.h.

Referenced by clusters().

◆ min3DIPValue

double TracksClusteringFromDisplacedSeed::min3DIPValue
private

Definition at line 46 of file TracksClusteringFromDisplacedSeed.h.

Referenced by clusters().

Vector3DBase
Definition: Vector3DBase.h:8
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
Measurement1D
Definition: Measurement1D.h:11
mps_fire.i
i
Definition: mps_fire.py:428
TwoTrackMinimumDistance::crossingPoint
GlobalPoint crossingPoint() const override
Definition: TwoTrackMinimumDistance.cc:187
groupFilesInBlocks.tt
int tt
Definition: groupFilesInBlocks.py:144
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
IPTools::absoluteImpactParameter3D
std::pair< bool, Measurement1D > absoluteImpactParameter3D(const reco::TransientTrack &transientTrack, const reco::Vertex &vertex)
Definition: IPTools.cc:38
VertexDistance3D::distance
Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override
Definition: VertexDistance3D.cc:17
gather_cfg.cout
cout
Definition: gather_cfg.py:144
TwoTrackMinimumDistance
Definition: TwoTrackMinimumDistance.h:20
TracksClusteringFromDisplacedSeed::min3DIPValue
double min3DIPValue
Definition: TracksClusteringFromDisplacedSeed.h:46
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
vertices_cff.ntracks
ntracks
Definition: vertices_cff.py:34
TracksClusteringFromDisplacedSeed::clusterMaxDistance
double clusterMaxDistance
Definition: TracksClusteringFromDisplacedSeed.h:47
TracksClusteringFromDisplacedSeed::clusterMaxSignificance
double clusterMaxSignificance
Definition: TracksClusteringFromDisplacedSeed.h:48
TwoTrackMinimumDistance::calculate
bool calculate(const TrajectoryStateOnSurface &sta, const TrajectoryStateOnSurface &stb) override
Definition: TwoTrackMinimumDistance.cc:83
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
fileCollector.seed
seed
Definition: fileCollector.py:127
BeamMonitor_cff.primaryVertex
primaryVertex
hltOfflineBeamSpot for HLTMON
Definition: BeamMonitor_cff.py:7
alignCSCRings.s
s
Definition: alignCSCRings.py:92
TracksClusteringFromDisplacedSeed::clusterMinAngleCosine
double clusterMinAngleCosine
Definition: TracksClusteringFromDisplacedSeed.h:50
TracksClusteringFromDisplacedSeed::distanceRatio
double distanceRatio
Definition: TracksClusteringFromDisplacedSeed.h:49
w
const double w
Definition: UKUtility.cc:23
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
TracksClusteringFromDisplacedSeed::nearTracks
std::pair< std::vector< reco::TransientTrack >, GlobalPoint > nearTracks(const reco::TransientTrack &seed, const std::vector< reco::TransientTrack > &tracks, const reco::Vertex &primaryVertex) const
Definition: TracksClusteringFromDisplacedSeed.cc:19
Basic3DVector::dot
T dot(const Basic3DVector &rh) const
Scalar product, or "dot" product, with a vector of same type.
Definition: extBasic3DVector.h:189
VertexDistance3D
Definition: VertexDistance3D.h:13
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Point3DBase< float, GlobalTag >
TracksClusteringFromDisplacedSeed::max3DIPSignificance
double max3DIPSignificance
Definition: TracksClusteringFromDisplacedSeed.h:43
TracksClusteringFromDisplacedSeed::max3DIPValue
double max3DIPValue
Definition: TracksClusteringFromDisplacedSeed.h:44
TwoTrackMinimumDistance::points
std::pair< GlobalPoint, GlobalPoint > points() const override
Definition: TwoTrackMinimumDistance.cc:75
InitialStep_cff.seeds
seeds
Definition: InitialStep_cff.py:230
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
MetAnalyzer.pv
def pv(vc)
Definition: MetAnalyzer.py:7
GlobalErrorBase< double, ErrorMatrixTag >
unit
Basic3DVector unit() const
Definition: Basic3DVectorLD.h:162
TwoTrackMinimumDistance::distance
float distance() const override
Definition: TwoTrackMinimumDistance.cc:189
mag
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Definition: Basic3DVectorLD.h:127
VertexState
Definition: VertexState.h:13
TracksClusteringFromDisplacedSeed::min3DIPSignificance
double min3DIPSignificance
Definition: TracksClusteringFromDisplacedSeed.h:45
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
mps_fire.result
result
Definition: mps_fire.py:311
TracksClusteringFromDisplacedSeed::clusters
std::vector< Cluster > clusters(const reco::Vertex &pv, const std::vector< reco::TransientTrack > &selectedTracks)
Definition: TracksClusteringFromDisplacedSeed.cc:100
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::isFinite
constexpr bool isFinite(T x)
CommonMethods.cp
def cp(fromDir, toDir, listOfFiles, overwrite=False, smallList=False)
Definition: CommonMethods.py:192
HLT_FULL_cff.distance
distance
Definition: HLT_FULL_cff.py:7799
TrackCollections2monitor_cff.selectedTracks
selectedTracks
Definition: TrackCollections2monitor_cff.py:32
TracksClusteringFromDisplacedSeed::maxTimeSignificance
double maxTimeSignificance
Definition: TracksClusteringFromDisplacedSeed.h:51