00001 #include "DataFormats/TrackingRecHit/interface/KfComponentsHolder.h" 00002 #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h" 00003 #include "FWCore/Utilities/interface/Exception.h" 00004 #include <typeinfo> 00005 00006 template<unsigned int D> 00007 void KfComponentsHolder::genericFill_(const TrackingRecHit &hit) { 00008 typedef typename AlgebraicROOTObject<D,5>::Matrix MatD5; 00009 typedef typename AlgebraicROOTObject<D,D>::SymMatrix SMatDD; 00010 typedef typename AlgebraicROOTObject<D>::Vector VecD; 00011 00012 params<D>() = asSVector<D>(hit.parameters()); 00013 errors<D>() = asSMatrix<D>(hit.parametersError()); 00014 projection<D>() = asSMatrix<D,5>(hit.projectionMatrix()); 00015 00016 const MatD5 & H = projection<D>(); 00017 00018 measuredParams<D>() = H * (*tsosLocalParameters_); 00019 measuredErrors<D>() = ROOT::Math::Similarity(H, (*tsosLocalErrors_)); 00020 } 00021 00022 void KfComponentsHolder::genericFill(const TrackingRecHit &hit) { 00023 switch (hit.dimension()) { 00024 case 1: genericFill_<1>(hit); break; 00025 case 2: genericFill_<2>(hit); break; 00026 case 3: genericFill_<3>(hit); break; 00027 case 4: genericFill_<4>(hit); break; 00028 case 5: genericFill_<5>(hit); break; 00029 default: 00030 throw cms::Exception("Rec hit of invalid dimension (not 1,2,3,4,5)") << 00031 "The dimension was " << hit.dimension() << 00032 ", type is " << typeid(hit).name() << "\n"; 00033 } 00034 00035 } 00036