00001 #include "DataFormats/TrackerRecHit2D/interface/BaseSiTrackerRecHit2DLocalPos.h"
00002 #include "FWCore/Utilities/interface/Exception.h"
00003
00004 bool BaseSiTrackerRecHit2DLocalPos::hasPositionAndError() const {
00005 return (err_.xx() != 0) || (err_.yy() != 0) || (err_.xy() != 0) ||
00006 (pos_.x() != 0) || (pos_.y() != 0) || (pos_.z() != 0);
00007 }
00008
00009 LocalPoint BaseSiTrackerRecHit2DLocalPos::localPosition() const {
00010 if (!hasPositionAndError()) throw cms::Exception("BaseSiTrackerRecHit2DLocalPos") <<
00011 "Trying to access the localPosition of a RecHit that was read from disk, but since CMSSW_2_1_X localPosition is transient.\n";
00012 return pos_;
00013 }
00014
00015 LocalError BaseSiTrackerRecHit2DLocalPos::localPositionError() const{
00016 if (!hasPositionAndError()) throw cms::Exception("BaseSiTrackerRecHit2DLocalPos") <<
00017 "Trying to access the localPositionError of a RecHit that was read from disk, but since CMSSW_2_1_X localPositionError is transient.\n";
00018 return err_;
00019 }
00020
00021
00022 void
00023 BaseSiTrackerRecHit2DLocalPos::getKfComponents( KfComponentsHolder & holder ) const
00024 {
00025 if (!hasPositionAndError()) throw cms::Exception("BaseSiTrackerRecHit2DLocalPos") <<
00026 "Trying to access the KfComponents of a RecHit that was read from disk, but since CMSSW_2_1_X local positions are transient.\n";
00027
00028 AlgebraicVector2 & pars = holder.params<2>();
00029 pars[0] = pos_.x();
00030 pars[1] = pos_.y();
00031
00032 AlgebraicSymMatrix22 & errs = holder.errors<2>();
00033 errs(0,0) = err_.xx();
00034 errs(0,1) = err_.xy();
00035 errs(1,1) = err_.yy();
00036
00037
00038 AlgebraicMatrix25 & proj = holder.projection<2>();
00039 proj(0,3) = 1;
00040 proj(1,4) = 1;
00041
00042 holder.measuredParams<2>() = AlgebraicVector2( & holder.tsosLocalParameters().At(3), 2 );
00043 holder.measuredErrors<2>() = holder.tsosLocalErrors().Sub<AlgebraicSymMatrix22>( 3, 3 );
00044
00045
00046
00047
00048
00049
00050 }