CMS 3D CMS Logo

Functions | Variables
track_associator Namespace Reference

Functions

const TrackingRecHitgetHitFromIter (trackingRecHit_iterator iter)
 
template<typename iter >
std::vector< OmniClusterRefhitsToClusterRefs (iter begin, iter end)
 
double trackAssociationChi2 (const reco::TrackBase &track, const TrackingParticle &trackingParticle, const MagneticField &magfield, const reco::BeamSpot &bs)
 
double trackAssociationChi2 (const reco::TrackBase::ParameterVector &rParameters, const reco::TrackBase::CovarianceMatrix &recoTrackCovMatrix, const Basic3DVector< double > &momAtVtx, const Basic3DVector< double > &vert, int charge, const MagneticField &magfield, const reco::BeamSpot &bs)
 basic method where chi2 is computed More...
 
double trackAssociationChi2 (const reco::TrackBase::ParameterVector &rParameters, const reco::TrackBase::CovarianceMatrix &recoTrackCovMatrix, const TrackingParticle &trackingParticle, const MagneticField &magfield, const reco::BeamSpot &bs)
 

Variables

constexpr double invalidChi2 = 10000000000.
 

Function Documentation

◆ getHitFromIter()

const TrackingRecHit * track_associator::getHitFromIter ( trackingRecHit_iterator  iter)

◆ hitsToClusterRefs()

template<typename iter >
std::vector<OmniClusterRef> track_associator::hitsToClusterRefs ( iter  begin,
iter  end 
)

Definition at line 20 of file trackHitsToClusterRefs.h.

20  {
21  std::vector<OmniClusterRef> returnValue;
22  for (iter iRecHit = begin; iRecHit != end; ++iRecHit) {
23  const TrackingRecHit *rhit = getHitFromIter(iRecHit);
24  if (trackerHitRTTI::isFromDet(*rhit)) {
25  int subdetid = rhit->geographicalId().subdetId();
26  if (subdetid == PixelSubdetector::PixelBarrel || subdetid == PixelSubdetector::PixelEndcap) {
27  const SiPixelRecHit *pRHit = dynamic_cast<const SiPixelRecHit *>(rhit);
28  if (pRHit && !pRHit->cluster().isNonnull())
29  edm::LogError("TrackAssociator") << ">>> RecHit does not have an associated cluster!"
30  << " file: " << __FILE__ << " line: " << __LINE__;
31  returnValue.push_back(pRHit->omniClusterRef());
32  } else if (subdetid == SiStripDetId::TIB || subdetid == SiStripDetId::TOB || subdetid == SiStripDetId::TID ||
33  subdetid == SiStripDetId::TEC) {
34  const std::type_info &tid = typeid(*rhit);
35  if (tid == typeid(SiStripMatchedRecHit2D)) {
36  const SiStripMatchedRecHit2D *sMatchedRHit = dynamic_cast<const SiStripMatchedRecHit2D *>(rhit);
37  if (!sMatchedRHit->monoHit().cluster().isNonnull() || !sMatchedRHit->stereoHit().cluster().isNonnull())
38  edm::LogError("TrackAssociator") << ">>> RecHit does not have an associated cluster!"
39  << " file: " << __FILE__ << " line: " << __LINE__;
40  returnValue.push_back(sMatchedRHit->monoClusterRef());
41  returnValue.push_back(sMatchedRHit->stereoClusterRef());
42  } else if (tid == typeid(SiStripRecHit2D)) {
43  const SiStripRecHit2D *sRHit = dynamic_cast<const SiStripRecHit2D *>(rhit);
44  if (!sRHit->cluster().isNonnull())
45  edm::LogError("TrackAssociator") << ">>> RecHit does not have an associated cluster!"
46  << " file: " << __FILE__ << " line: " << __LINE__;
47  returnValue.push_back(sRHit->omniClusterRef());
48  } else if (tid == typeid(SiStripRecHit1D)) {
49  const SiStripRecHit1D *sRHit = dynamic_cast<const SiStripRecHit1D *>(rhit);
50  if (!sRHit->cluster().isNonnull())
51  edm::LogError("TrackAssociator") << ">>> RecHit does not have an associated cluster!"
52  << " file: " << __FILE__ << " line: " << __LINE__;
53  returnValue.push_back(sRHit->omniClusterRef());
54  } else if (tid == typeid(Phase2TrackerRecHit1D)) {
55  const Phase2TrackerRecHit1D *ph2Hit = dynamic_cast<const Phase2TrackerRecHit1D *>(rhit);
56  if (!ph2Hit->cluster().isNonnull())
57  edm::LogError("TrackAssociator") << ">>> RecHit does not have an associated cluster!"
58  << " file: " << __FILE__ << " line: " << __LINE__;
59  returnValue.push_back(ph2Hit->omniClusterRef());
60  } else if (tid == typeid(VectorHit)) {
61  const VectorHit *vectorHit = dynamic_cast<const VectorHit *>(rhit);
62  if (!vectorHit->cluster().isNonnull())
63  edm::LogError("TrackAssociator") << ">>> RecHit does not have an associated cluster!"
64  << " file: " << __FILE__ << " line: " << __LINE__;
65  returnValue.push_back(vectorHit->firstClusterRef());
66 
67  } else {
68  auto const &thit = static_cast<BaseTrackerRecHit const &>(*rhit);
69  if (thit.isProjected()) {
70  } else {
71  edm::LogError("TrackAssociator") << ">>> getMatchedClusters: TrackingRecHit not associated to "
72  "any SiStripCluster! subdetid = "
73  << subdetid;
74  }
75  }
76  } else {
77  edm::LogError("TrackAssociator") << ">>> getMatchedClusters: TrackingRecHit not associated to any "
78  "cluster! subdetid = "
79  << subdetid;
80  }
81  }
82  }
83  return returnValue;
84  }

References SiStripRecHit1D::cluster(), SiStripRecHit2D::cluster(), Phase2TrackerRecHit1D::cluster(), SiPixelRecHit::cluster(), VectorHit::cluster(), mps_fire::end, VectorHit::firstClusterRef(), TrackingRecHit::geographicalId(), getHitFromIter(), trackerHitRTTI::isFromDet(), edm::Ref< C, T, F >::isNonnull(), SiStripMatchedRecHit2D::monoClusterRef(), SiStripMatchedRecHit2D::monoHit(), TrackerSingleRecHit::omniClusterRef(), PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, SiStripMatchedRecHit2D::stereoClusterRef(), SiStripMatchedRecHit2D::stereoHit(), DetId::subdetId(), SiStripDetId::TEC, SiStripDetId::TIB, SiStripDetId::TID, and SiStripDetId::TOB.

Referenced by QuickTrackAssociatorByHitsImpl::associateTrack(), TrackingNtuple::fillSeeds(), TrackingNtuple::fillTracks(), QuickTrackAssociatorByHitsImpl::getDoubleCount(), and QuickTrackAssociatorByHitsImpl::weightedNumberOfTrackClusters().

◆ trackAssociationChi2() [1/3]

double track_associator::trackAssociationChi2 ( const reco::TrackBase track,
const TrackingParticle trackingParticle,
const MagneticField magfield,
const reco::BeamSpot bs 
)

Definition at line 63 of file trackAssociationChi2.cc.

66  {
67  auto cov = track.covariance();
68  cov.Invert();
69 
70  return trackAssociationChi2(track.parameters(), cov, trackingParticle, magfield, bs);
71  }

References cms::cuda::bs, volumeBasedMagneticField_160812_cfi::magfield, HLT_FULL_cff::track, and trackAssociationChi2().

◆ trackAssociationChi2() [2/3]

double track_associator::trackAssociationChi2 ( const reco::TrackBase::ParameterVector rParameters,
const reco::TrackBase::CovarianceMatrix recoTrackCovMatrix,
const Basic3DVector< double > &  momAtVtx,
const Basic3DVector< double > &  vert,
int  charge,
const MagneticField magfield,
const reco::BeamSpot bs 
)

basic method where chi2 is computed

Definition at line 9 of file trackAssociationChi2.cc.

15  {
16  double chi2 = invalidChi2;
17 
18  std::pair<bool, reco::TrackBase::ParameterVector> params =
20  if (params.first) {
21  reco::TrackBase::ParameterVector sParameters = params.second;
22 
23  reco::TrackBase::ParameterVector diffParameters = rParameters - sParameters;
24  diffParameters[2] = reco::deltaPhi(diffParameters[2], 0.f);
25  chi2 = ROOT::Math::Dot(diffParameters * recoTrackCovMatrix, diffParameters);
26  chi2 /= 5;
27 
28  LogDebug("TrackAssociator") << "====NEW RECO TRACK WITH PT="
29  << sin(rParameters[1]) * float(charge) / rParameters[0] << "====\n"
30  << "qoverp sim: " << sParameters[0] << "\n"
31  << "lambda sim: " << sParameters[1] << "\n"
32  << "phi sim: " << sParameters[2] << "\n"
33  << "dxy sim: " << sParameters[3] << "\n"
34  << "dsz sim: " << sParameters[4] << "\n"
35  << ": " /*<< */ << "\n"
36  << "qoverp rec: " << rParameters[0] << "\n"
37  << "lambda rec: " << rParameters[1] << "\n"
38  << "phi rec: " << rParameters[2] << "\n"
39  << "dxy rec: " << rParameters[3] << "\n"
40  << "dsz rec: " << rParameters[4] << "\n"
41  << ": " /*<< */ << "\n"
42  << "chi2: " << chi2 << "\n";
43  }
44  return chi2;
45  }

References cms::cuda::bs, ALCARECOTkAlJpsiMuMu_cff::charge, hltPixelTracks_cff::chi2, reco::deltaPhi(), f, dqmMemoryStats::float, invalidChi2, LogDebug, volumeBasedMagneticField_160812_cfi::magfield, CalibrationSummaryClient_cfi::params, funct::sin(), and reco::trackingParametersAtClosestApproachToBeamSpot().

Referenced by TrackingNtuple::fillTracks(), TrackGenAssociatorByChi2Impl::getChi2(), TrackAssociatorByChi2Impl::getChi2(), and trackAssociationChi2().

◆ trackAssociationChi2() [3/3]

double track_associator::trackAssociationChi2 ( const reco::TrackBase::ParameterVector rParameters,
const reco::TrackBase::CovarianceMatrix recoTrackCovMatrix,
const TrackingParticle trackingParticle,
const MagneticField magfield,
const reco::BeamSpot bs 
)

Definition at line 47 of file trackAssociationChi2.cc.

51  {
52  const int charge = trackingParticle.charge();
53  if (charge == 0)
54  return invalidChi2;
55 
56  const auto tpMom = trackingParticle.momentum();
57  Basic3DVector<double> momAtVtx(tpMom.x(), tpMom.y(), tpMom.z());
58  Basic3DVector<double> vert(trackingParticle.vertex());
59 
60  return trackAssociationChi2(rParameters, recoTrackCovMatrix, momAtVtx, vert, charge, magfield, bs);
61  }

References cms::cuda::bs, ALCARECOTkAlJpsiMuMu_cff::charge, TrackingParticle::charge(), invalidChi2, volumeBasedMagneticField_160812_cfi::magfield, TrackingParticle::momentum(), trackAssociationChi2(), and TrackingParticle::vertex().

Variable Documentation

◆ invalidChi2

constexpr double track_associator::invalidChi2 = 10000000000.
constexpr

Definition at line 7 of file trackAssociationChi2.cc.

Referenced by trackAssociationChi2().

track_associator::getHitFromIter
const TrackingRecHit * getHitFromIter(trackingRecHit_iterator iter)
Definition: trackHitsToClusterRefs.h:15
SiStripRecHit2D::cluster
ClusterRef cluster() const
Definition: SiStripRecHit2D.h:22
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
PixelSubdetector::PixelEndcap
Definition: PixelSubdetector.h:11
PixelSubdetector::PixelBarrel
Definition: PixelSubdetector.h:11
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
reco::deltaPhi
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
track_associator::trackAssociationChi2
double trackAssociationChi2(const reco::TrackBase::ParameterVector &rParameters, const reco::TrackBase::CovarianceMatrix &recoTrackCovMatrix, const Basic3DVector< double > &momAtVtx, const Basic3DVector< double > &vert, int charge, const MagneticField &magfield, const reco::BeamSpot &bs)
basic method where chi2 is computed
Definition: trackAssociationChi2.cc:9
SiStripRecHit2D
Definition: SiStripRecHit2D.h:7
hltPixelTracks_cff.chi2
chi2
Definition: hltPixelTracks_cff.py:25
SiPixelRecHit::cluster
ClusterRef cluster() const
Definition: SiPixelRecHit.h:47
TrackingRecHit::geographicalId
DetId geographicalId() const
Definition: TrackingRecHit.h:120
SiPixelRecHit
Our base class.
Definition: SiPixelRecHit.h:23
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
TrackingParticle::charge
float charge() const
Electric charge. Note this is taken from the first SimTrack only.
Definition: TrackingParticle.h:98
cms::cuda::bs
bs
Definition: HistoContainer.h:127
Phase2TrackerRecHit1D::cluster
CluRef cluster() const
Definition: Phase2TrackerRecHit1D.h:24
mps_fire.end
end
Definition: mps_fire.py:242
reco::TrackBase::ParameterVector
math::Vector< dimension >::type ParameterVector
parameter vector
Definition: TrackBase.h:71
SiStripMatchedRecHit2D::stereoHit
SiStripRecHit2D stereoHit() const
Definition: SiStripMatchedRecHit2D.h:25
TrackingParticle::momentum
Vector momentum() const
spatial momentum vector
Definition: TrackingParticle.h:106
TrackingParticle::vertex
Point vertex() const
Parent vertex position.
Definition: TrackingParticle.h:160
VectorHit::cluster
ClusterRef cluster() const
Definition: VectorHit.h:108
SiStripDetId::TEC
static constexpr auto TEC
Definition: SiStripDetId.h:40
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
VectorHit::firstClusterRef
OmniClusterRef const & firstClusterRef() const override
Definition: VectorHit.h:107
SiStripMatchedRecHit2D::stereoClusterRef
OmniClusterRef const & stereoClusterRef() const
Definition: SiStripMatchedRecHit2D.h:34
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
SiStripMatchedRecHit2D::monoHit
SiStripRecHit2D monoHit() const
Definition: SiStripMatchedRecHit2D.h:26
reco::trackingParametersAtClosestApproachToBeamSpot
std::pair< bool, reco::TrackBase::ParameterVector > trackingParametersAtClosestApproachToBeamSpot(const Basic3DVector< double > &vertex, const Basic3DVector< double > &momAtVtx, float charge, const MagneticField &magField, const BeamSpot &bs)
Definition: trackingParametersAtClosestApproachToBeamSpot.cc:21
trackerHitRTTI::isFromDet
bool isFromDet(TrackingRecHit const &hit)
Definition: trackerHitRTTI.h:36
SiStripDetId::TOB
static constexpr auto TOB
Definition: SiStripDetId.h:39
SiStripRecHit1D::cluster
ClusterRef cluster() const
Definition: SiStripRecHit1D.h:18
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
SiStripRecHit1D
Definition: SiStripRecHit1D.h:8
SiStripMatchedRecHit2D::monoClusterRef
OmniClusterRef const & monoClusterRef() const
Definition: SiStripMatchedRecHit2D.h:35
TrackingRecHit
Definition: TrackingRecHit.h:21
SiStripDetId::TID
static constexpr auto TID
Definition: SiStripDetId.h:38
VectorHit
Definition: VectorHit.h:28
SiStripMatchedRecHit2D
Definition: SiStripMatchedRecHit2D.h:8
SiStripDetId::TIB
static constexpr auto TIB
Definition: SiStripDetId.h:37
track_associator::invalidChi2
constexpr double invalidChi2
Definition: trackAssociationChi2.cc:7
edm::Log
Definition: MessageLogger.h:70
volumeBasedMagneticField_160812_cfi.magfield
magfield
Definition: volumeBasedMagneticField_160812_cfi.py:11
TrackerSingleRecHit::omniClusterRef
OmniClusterRef const & omniClusterRef() const
Definition: TrackerSingleRecHit.h:41
Basic3DVector
Definition: extBasic3DVector.h:30
Phase2TrackerRecHit1D
Definition: Phase2TrackerRecHit1D.h:10