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 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)
 
double trackAssociationChi2 (const reco::TrackBase &track, const TrackingParticle &trackingParticle, const MagneticField &magfield, const reco::BeamSpot &bs)
 

Variables

double invalidChi2 = 10000000000.
 

Function Documentation

const TrackingRecHit* track_associator::getHitFromIter ( trackingRecHit_iterator  iter)
template<typename iter >
std::vector<OmniClusterRef> track_associator::hitsToClusterRefs ( iter  begin,
iter  end 
)

Definition at line 23 of file trackHitsToClusterRefs.h.

References SiStripRecHit1D::cluster(), Phase2TrackerRecHit1D::cluster(), SiStripRecHit2D::cluster(), SiPixelRecHit::cluster(), end, TrackingRecHit::geographicalId(), getHitFromIter(), edm::Ref< C, T, F >::isNonnull(), TrackingRecHit::isValid(), 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().

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

References vertices_cff::chi2, reco::deltaPhi(), f, objects.autophobj::float, invalidChi2, LogDebug, funct::sin(), and reco::trackingParametersAtClosestApproachToBeamSpot().

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

15  {
16 
17  double chi2 = invalidChi2;
18 
19  std::pair<bool,reco::TrackBase::ParameterVector> params = reco::trackingParametersAtClosestApproachToBeamSpot(vert, momAtVtx, charge, magfield, bs);
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=" << sin(rParameters[1])*float(charge)/rParameters[0] << "====\n"
29  << "qoverp sim: " << sParameters[0] << "\n"
30  << "lambda sim: " << sParameters[1] << "\n"
31  << "phi sim: " << sParameters[2] << "\n"
32  << "dxy sim: " << sParameters[3] << "\n"
33  << "dsz sim: " << sParameters[4] << "\n"
34  << ": " /*<< */ << "\n"
35  << "qoverp rec: " << rParameters[0] << "\n"
36  << "lambda rec: " << rParameters[1] << "\n"
37  << "phi rec: " << rParameters[2] << "\n"
38  << "dxy rec: " << rParameters[3] << "\n"
39  << "dsz rec: " << rParameters[4] << "\n"
40  << ": " /*<< */ << "\n"
41  << "chi2: " << chi2 << "\n";
42 
43  }
44  return chi2;
45  }
#define LogDebug(id)
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:22
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
math::Vector< dimension >::type ParameterVector
parameter vector
Definition: TrackBase.h:74
double f[11][100]
std::pair< bool, reco::TrackBase::ParameterVector > trackingParametersAtClosestApproachToBeamSpot(const Basic3DVector< double > &vertex, const Basic3DVector< double > &momAtVtx, float charge, const MagneticField &magField, const BeamSpot &bs)
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.

References ALCARECOTkAlJpsiMuMu_cff::charge, TrackingParticle::charge(), invalidChi2, TrackingParticle::momentum(), trackAssociationChi2(), and TrackingParticle::vertex().

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  }
Vector momentum() const
spatial momentum vector
float charge() const
Electric charge. Note this is taken from the first SimTrack only.
Point vertex() const
Parent vertex position.
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
double track_associator::trackAssociationChi2 ( const reco::TrackBase track,
const TrackingParticle trackingParticle,
const MagneticField magfield,
const reco::BeamSpot bs 
)

Definition at line 64 of file trackAssociationChi2.cc.

References reco::TrackBase::covariance(), reco::TrackBase::parameters(), and trackAssociationChi2().

67  {
68  auto cov = track.covariance();
69  cov.Invert();
70 
71  return trackAssociationChi2(track.parameters(), cov, trackingParticle, magfield, bs);
72  }
CovarianceMatrix covariance() const
return track covariance matrix
Definition: TrackBase.h:731
ParameterVector parameters() const
Track parameters with one-to-one correspondence to the covariance matrix.
Definition: TrackBase.h:725
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

Variable Documentation

double track_associator::invalidChi2 = 10000000000.

Definition at line 7 of file trackAssociationChi2.cc.

Referenced by trackAssociationChi2().