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::ParameterVector &rParameters, const reco::TrackBase::CovarianceMatrix &recoTrackCovMatrix, const reco::TrackBase::ParameterVector &sParameters)
 basic method where chi2 is computed More...
 
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)
 
double trackAssociationChi2 (const reco::TrackBase::ParameterVector &rParameters, const reco::TrackBase::CovarianceMatrix &recoTrackCovMatrix, const TrackingParticle &trackingParticle, const MagneticField &magfield, const reco::BeamSpot &bs)
 
double trackAssociationChi2 (const reco::TrackBase &track, 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)
inline

◆ hitsToClusterRefs()

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

Definition at line 21 of file trackHitsToClusterRefs.h.

References SiStripRecHit1D::cluster(), SiStripRecHit2D::cluster(), Phase2TrackerRecHit1D::cluster(), SiPixelRecHit::cluster(), VectorHit::cluster(), 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::fillCandidates(), TrackingNtuple::fillSeeds(), TrackingNtuple::fillTracks(), QuickTrackAssociatorByHitsImpl::getDoubleCount(), and QuickTrackAssociatorByHitsImpl::weightedNumberOfTrackClusters().

21  {
22  std::vector<OmniClusterRef> returnValue;
23  for (iter iRecHit = begin; iRecHit != end; ++iRecHit) {
24  const TrackingRecHit *rhit = getHitFromIter(iRecHit);
25  if (trackerHitRTTI::isFromDet(*rhit)) {
26  int subdetid = rhit->geographicalId().subdetId();
27  if (subdetid == PixelSubdetector::PixelBarrel || subdetid == PixelSubdetector::PixelEndcap) {
28  const SiPixelRecHit *pRHit = dynamic_cast<const SiPixelRecHit *>(rhit);
29  if (pRHit && !pRHit->cluster().isNonnull())
30  edm::LogError("TrackAssociator") << ">>> RecHit does not have an associated cluster!"
31  << " file: " << __FILE__ << " line: " << __LINE__;
32  returnValue.push_back(pRHit->omniClusterRef());
33  } else if (subdetid == SiStripDetId::TIB || subdetid == SiStripDetId::TOB || subdetid == SiStripDetId::TID ||
34  subdetid == SiStripDetId::TEC) {
35  const std::type_info &tid = typeid(*rhit);
36  if (tid == typeid(SiStripMatchedRecHit2D)) {
37  const SiStripMatchedRecHit2D *sMatchedRHit = dynamic_cast<const SiStripMatchedRecHit2D *>(rhit);
38  if (!sMatchedRHit->monoHit().cluster().isNonnull() || !sMatchedRHit->stereoHit().cluster().isNonnull())
39  edm::LogError("TrackAssociator") << ">>> RecHit does not have an associated cluster!"
40  << " file: " << __FILE__ << " line: " << __LINE__;
41  returnValue.push_back(sMatchedRHit->monoClusterRef());
42  returnValue.push_back(sMatchedRHit->stereoClusterRef());
43  } else if (tid == typeid(SiStripRecHit2D)) {
44  const SiStripRecHit2D *sRHit = dynamic_cast<const SiStripRecHit2D *>(rhit);
45  if (!sRHit->cluster().isNonnull())
46  edm::LogError("TrackAssociator") << ">>> RecHit does not have an associated cluster!"
47  << " file: " << __FILE__ << " line: " << __LINE__;
48  returnValue.push_back(sRHit->omniClusterRef());
49  } else if (tid == typeid(SiStripRecHit1D)) {
50  const SiStripRecHit1D *sRHit = dynamic_cast<const SiStripRecHit1D *>(rhit);
51  if (!sRHit->cluster().isNonnull())
52  edm::LogError("TrackAssociator") << ">>> RecHit does not have an associated cluster!"
53  << " file: " << __FILE__ << " line: " << __LINE__;
54  returnValue.push_back(sRHit->omniClusterRef());
55  } else if (tid == typeid(Phase2TrackerRecHit1D)) {
56  const Phase2TrackerRecHit1D *ph2Hit = dynamic_cast<const Phase2TrackerRecHit1D *>(rhit);
57  if (!ph2Hit->cluster().isNonnull())
58  edm::LogError("TrackAssociator") << ">>> RecHit does not have an associated cluster!"
59  << " file: " << __FILE__ << " line: " << __LINE__;
60  returnValue.push_back(ph2Hit->omniClusterRef());
61  } else if (tid == typeid(VectorHit)) {
62  const VectorHit *vectorHit = dynamic_cast<const VectorHit *>(rhit);
63  if (!vectorHit->cluster().isNonnull())
64  edm::LogError("TrackAssociator") << ">>> RecHit does not have an associated cluster!"
65  << " file: " << __FILE__ << " line: " << __LINE__;
66  returnValue.push_back(vectorHit->firstClusterRef());
67 
68  } else {
69  auto const &thit = static_cast<BaseTrackerRecHit const &>(*rhit);
70  if (thit.isProjected()) {
71  } else {
72  edm::LogError("TrackAssociator") << ">>> getMatchedClusters: TrackingRecHit not associated to "
73  "any SiStripCluster! subdetid = "
74  << subdetid;
75  }
76  }
77  } else {
78  edm::LogError("TrackAssociator") << ">>> getMatchedClusters: TrackingRecHit not associated to any "
79  "cluster! subdetid = "
80  << subdetid;
81  }
82  }
83  }
84  return returnValue;
85  }
ClusterRef cluster() const
Definition: SiPixelRecHit.h:47
SiStripRecHit2D stereoHit() const
bool isFromDet(TrackingRecHit const &hit)
ClusterRef cluster() const
static constexpr auto TID
Definition: SiStripDetId.h:38
OmniClusterRef const & stereoClusterRef() const
OmniClusterRef const & omniClusterRef() const
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
Log< level::Error, false > LogError
OmniClusterRef const & monoClusterRef() const
ClusterRef cluster() const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
static constexpr auto TOB
Definition: SiStripDetId.h:39
const TrackingRecHit * getHitFromIter(trackingRecHit_iterator iter)
DetId geographicalId() const
static constexpr auto TIB
Definition: SiStripDetId.h:37
SiStripRecHit2D monoHit() const
OmniClusterRef const & firstClusterRef() const override
Definition: VectorHit.h:110
ClusterRef cluster() const
static constexpr auto TEC
Definition: SiStripDetId.h:40
ClusterRef cluster() const
Definition: VectorHit.h:111
Our base class.
Definition: SiPixelRecHit.h:23

◆ trackAssociationChi2() [1/4]

double track_associator::trackAssociationChi2 ( const reco::TrackBase::ParameterVector rParameters,
const reco::TrackBase::CovarianceMatrix recoTrackCovMatrix,
const reco::TrackBase::ParameterVector sParameters 
)

basic method where chi2 is computed

Definition at line 9 of file trackAssociationChi2.cc.

References hltPixelTracks_cff::chi2, reco::deltaPhi(), f, invalidChi2, LogDebug, and funct::sin().

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

11  {
12  double chi2 = invalidChi2;
13 
14  reco::TrackBase::ParameterVector diffParameters = rParameters - sParameters;
15  diffParameters[2] = reco::deltaPhi(diffParameters[2], 0.f);
16  chi2 = ROOT::Math::Dot(diffParameters * recoTrackCovMatrix, diffParameters);
17  chi2 /= 5;
18 
19  LogDebug("TrackAssociator") << "====NEW RECO TRACK WITH PT=" << sin(rParameters[1]) / rParameters[0] << "====\n"
20  << "qoverp sim: " << sParameters[0] << "\n"
21  << "lambda sim: " << sParameters[1] << "\n"
22  << "phi sim: " << sParameters[2] << "\n"
23  << "dxy sim: " << sParameters[3] << "\n"
24  << "dsz sim: " << sParameters[4] << "\n"
25  << ": " /*<< */ << "\n"
26  << "qoverp rec: " << rParameters[0] << "\n"
27  << "lambda rec: " << rParameters[1] << "\n"
28  << "phi rec: " << rParameters[2] << "\n"
29  << "dxy rec: " << rParameters[3] << "\n"
30  << "dsz rec: " << rParameters[4] << "\n"
31  << ": " /*<< */ << "\n"
32  << "chi2: " << chi2 << "\n";
33  return chi2;
34  }
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
math::Vector< dimension >::type ParameterVector
parameter vector
Definition: TrackBase.h:71
double f[11][100]
constexpr double invalidChi2
#define LogDebug(id)

◆ trackAssociationChi2() [2/4]

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 
)

Definition at line 36 of file trackAssociationChi2.cc.

References cms::cuda::bs, ALCARECOTkAlJpsiMuMu_cff::charge, hltPixelTracks_cff::chi2, invalidChi2, volumeBasedMagneticField_160812_cfi::magfield, submitPVValidationJobs::params, trackAssociationChi2(), and reco::trackingParametersAtClosestApproachToBeamSpot().

42  {
43  double chi2 = invalidChi2;
44 
45  std::pair<bool, reco::TrackBase::ParameterVector> params =
47  if (params.first) {
48  return trackAssociationChi2(rParameters, recoTrackCovMatrix, params.second);
49  }
50  return chi2;
51  }
std::pair< bool, reco::TrackBase::ParameterVector > trackingParametersAtClosestApproachToBeamSpot(const Basic3DVector< double > &vertex, const Basic3DVector< double > &momAtVtx, float charge, const MagneticField &magField, const BeamSpot &bs)
constexpr double invalidChi2
double trackAssociationChi2(const reco::TrackBase::ParameterVector &rParameters, const reco::TrackBase::CovarianceMatrix &recoTrackCovMatrix, const reco::TrackBase::ParameterVector &sParameters)
basic method where chi2 is computed

◆ trackAssociationChi2() [3/4]

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 53 of file trackAssociationChi2.cc.

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

57  {
58  const int charge = trackingParticle.charge();
59  if (charge == 0)
60  return invalidChi2;
61 
62  const auto tpMom = trackingParticle.momentum();
63  Basic3DVector<double> momAtVtx(tpMom.x(), tpMom.y(), tpMom.z());
64  Basic3DVector<double> vert(trackingParticle.vertex());
65 
66  return trackAssociationChi2(rParameters, recoTrackCovMatrix, momAtVtx, vert, charge, magfield, bs);
67  }
Vector momentum() const
spatial momentum vector
constexpr double invalidChi2
double trackAssociationChi2(const reco::TrackBase::ParameterVector &rParameters, const reco::TrackBase::CovarianceMatrix &recoTrackCovMatrix, const reco::TrackBase::ParameterVector &sParameters)
basic method where chi2 is computed
Point vertex() const
Parent vertex position.
float charge() const
Electric charge. Note this is taken from the first SimTrack only.

◆ trackAssociationChi2() [4/4]

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

Definition at line 69 of file trackAssociationChi2.cc.

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

72  {
73  auto cov = track.covariance();
74  cov.Invert();
75 
76  return trackAssociationChi2(track.parameters(), cov, trackingParticle, magfield, bs);
77  }
double trackAssociationChi2(const reco::TrackBase::ParameterVector &rParameters, const reco::TrackBase::CovarianceMatrix &recoTrackCovMatrix, const reco::TrackBase::ParameterVector &sParameters)
basic method where chi2 is computed

Variable Documentation

◆ invalidChi2

constexpr double track_associator::invalidChi2 = 10000000000.

Definition at line 7 of file trackAssociationChi2.cc.

Referenced by trackAssociationChi2().