File indexing completed on 2025-06-26 23:26:40
0001
0002 #include "DataFormats/TrackerRecHit2D/interface/BaseTrackerRecHit.h"
0003 #include "DataFormats/TrackerRecHit2D/interface/OmniClusterRef.h"
0004 #include "DataFormats/TrackingRecHit/interface/KfComponentsHolder.h"
0005 #include "DataFormats/Math/interface/ProjectMatrix.h"
0006 #include "FWCore/Utilities/interface/Exception.h"
0007
0008 namespace {
0009 #if defined(DO_THROW_UNINITIALIZED) || defined(DO_INTERNAL_CHECKS_BTR)
0010 inline void throwExceptionUninitialized(const char *where) {
0011 throw cms::Exception("BaseTrackerRecHit")
0012 << "Trying to access " << where
0013 << " for a RecHit that was read from disk, but since CMSSW_2_1_X local positions are transient.\n"
0014 << "If you want to get coarse position/error estimation from disk, please set: "
0015 "ComputeCoarseLocalPositionFromDisk = True \n "
0016 << " to the TransientTrackingRecHitBuilder you are using from "
0017 "RecoTracker/TransientTrackingRecHit/python/TTRHBuilders_cff.py";
0018 }
0019 #endif
0020 void obsolete() { throw cms::Exception("BaseTrackerRecHit") << "CLHEP is obsolete for Tracker Hits"; }
0021 }
0022
0023 #if !defined(VI_DEBUG) && defined(DO_INTERNAL_CHECKS_BTR)
0024 void BaseTrackerRecHit::check() const {
0025 if (!hasPositionAndError())
0026 throwExceptionUninitialized("localPosition or Error");
0027 }
0028 #endif
0029
0030 bool BaseTrackerRecHit::hasPositionAndError() const {
0031
0032
0033 return det();
0034 }
0035
0036 void BaseTrackerRecHit::getKfComponents1D(KfComponentsHolder &holder) const {
0037 #if defined(DO_THROW_UNINITIALIZED)
0038 if (!hasPositionAndError())
0039 throwExceptionUninitialized("getKfComponents");
0040 #endif
0041 AlgebraicVector1 &pars = holder.params<1>();
0042 pars[0] = pos_.x();
0043
0044 AlgebraicSymMatrix11 &errs = holder.errors<1>();
0045 errs(0, 0) = err_.xx();
0046
0047 ProjectMatrix<double, 5, 1> &pf = holder.projFunc<1>();
0048 pf.index[0] = 3;
0049
0050 holder.measuredParams<1>() = AlgebraicVector1(holder.tsosLocalParameters().At(3));
0051 holder.measuredErrors<1>() = holder.tsosLocalErrors().Sub<AlgebraicSymMatrix11>(3, 3);
0052 }
0053
0054 void BaseTrackerRecHit::getKfComponents2D(KfComponentsHolder &holder) const {
0055 #if defined(DO_THROW_UNINITIALIZED)
0056 if (!hasPositionAndError())
0057 throwExceptionUninitialized("getKfComponents");
0058 #endif
0059 AlgebraicVector2 &pars = holder.params<2>();
0060 pars[0] = pos_.x();
0061 pars[1] = pos_.y();
0062
0063 AlgebraicSymMatrix22 &errs = holder.errors<2>();
0064 errs(0, 0) = err_.xx();
0065 errs(0, 1) = err_.xy();
0066 errs(1, 1) = err_.yy();
0067
0068 ProjectMatrix<double, 5, 2> &pf = holder.projFunc<2>();
0069 pf.index[0] = 3;
0070 pf.index[1] = 4;
0071
0072 holder.measuredParams<2>() = AlgebraicVector2(&holder.tsosLocalParameters().At(3), 2);
0073 holder.measuredErrors<2>() = holder.tsosLocalErrors().Sub<AlgebraicSymMatrix22>(3, 3);
0074 }
0075
0076
0077 AlgebraicVector BaseTrackerRecHit::parameters() const {
0078 obsolete();
0079 return AlgebraicVector();
0080 }
0081
0082 AlgebraicSymMatrix BaseTrackerRecHit::parametersError() const {
0083 obsolete();
0084 return AlgebraicSymMatrix();
0085 }
0086
0087 AlgebraicMatrix BaseTrackerRecHit::projectionMatrix() const {
0088 obsolete();
0089 return AlgebraicMatrix();
0090 }