CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/RecoTracker/TkDetLayers/src/PixelRod.cc

Go to the documentation of this file.
00001 #include "RecoTracker/TkDetLayers/interface/PixelRod.h"
00002 
00003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00004 
00005 #include "TrackingTools/PatternTools/interface/MeasurementEstimator.h"
00006 #include "TrackingTools/DetLayers/interface/DetLayerException.h"
00007 
00008 
00009 using namespace std;
00010 
00011 typedef GeometricSearchDet::DetWithState DetWithState;
00012 
00013 PixelRod::PixelRod(vector<const GeomDet*>& theInputDets):
00014   DetRodOneR(theInputDets.begin(),theInputDets.end())
00015 {
00016   theBinFinder = BinFinderType(theDets.begin(),theDets.end());
00017 
00018   //--------- DEBUG INFO --------------
00019   LogDebug("TkDetLayers") << "==== DEBUG PixelRod ====="; 
00020   for (vector<const GeomDet*>::const_iterator i=theDets.begin();
00021        i != theDets.end(); i++){
00022     LogDebug("TkDetLayers") << "PixelRod's Det pos z,perp,eta,phi: " 
00023                             << (**i).position().z() << " , " 
00024                             << (**i).position().perp() << " , " 
00025                             << (**i).position().eta() << " , " 
00026                             << (**i).position().phi() ;
00027   }
00028   LogDebug("TkDetLayers") << "==== end DEBUG PixelRod ====="; 
00029   //--------------------------------------
00030 
00031 
00032 }
00033 
00034 PixelRod::~PixelRod(){
00035 
00036 } 
00037 
00038 const vector<const GeometricSearchDet*>& 
00039 PixelRod::components() const{
00040   throw DetLayerException("PixelRod doesn't have GeometricSearchDet components");
00041 }
00042  
00043  
00044 pair<bool, TrajectoryStateOnSurface>
00045 PixelRod::compatible( const TrajectoryStateOnSurface& ts, const Propagator&, 
00046                       const MeasurementEstimator&) const{
00047   edm::LogError("TkDetLayers") << "temporary dummy implementation of PixelRod::compatible()!!" ;
00048   return pair<bool,TrajectoryStateOnSurface>();
00049 }
00050 
00051 void
00052 PixelRod::compatibleDetsV( const TrajectoryStateOnSurface& startingState,
00053                           const Propagator& prop, 
00054                           const MeasurementEstimator& est,
00055                           std::vector<DetWithState> & result ) const
00056 {  
00057   typedef MeasurementEstimator::Local2DVector Local2DVector;
00058   TrajectoryStateOnSurface ts = prop.propagate( startingState, specificSurface());
00059   if (!ts.isValid()) return;  
00060 
00061   GlobalPoint startPos = ts.globalPosition();
00062 
00063   int closest = theBinFinder.binIndex(startPos.z());
00064   pair<bool,TrajectoryStateOnSurface> closestCompat = 
00065     theCompatibilityChecker.isCompatible(theDets[closest],startingState, prop, est);
00066 
00067   if ( closestCompat.first) {
00068     result.push_back( DetWithState( theDets[closest], closestCompat.second));
00069   }else{
00070     if(!closestCompat.second.isValid()) return;  // to investigate why this happens
00071   }
00072 
00073   const BoundPlane& closestPlane( theDets[closest]->specificSurface() );
00074 
00075   Local2DVector maxDistance = 
00076     est.maximalLocalDisplacement( closestCompat.second, closestPlane);
00077   
00078   float detHalfLen = theDets[closest]->surface().bounds().length()/2.;
00079   
00080   // explore neighbours
00081   for (size_t idet=closest+1; idet < theDets.size(); idet++) {
00082     LocalPoint nextPos( theDets[idet]->surface().toLocal( closestCompat.second.globalPosition()));
00083     if (fabs(nextPos.y()) < detHalfLen + maxDistance.y()) {
00084       if ( !add(idet, result, startingState, prop, est)) break;
00085     } else {
00086       break;
00087     }
00088   }
00089 
00090   for (int idet=closest-1; idet >= 0; idet--) {
00091     LocalPoint nextPos( theDets[idet]->surface().toLocal( closestCompat.second.globalPosition()));
00092     if (fabs(nextPos.y()) < detHalfLen + maxDistance.y()) {
00093       if ( !add(idet, result, startingState, prop, est)) break;
00094     } else {
00095       break;
00096     }
00097   }
00098 }
00099 
00100 
00101 void
00102 PixelRod::groupedCompatibleDetsV( const TrajectoryStateOnSurface&,
00103                                  const Propagator&,
00104                                  const MeasurementEstimator&,
00105                                  std::vector<DetGroup> &) const
00106 {
00107   LogDebug("TkDetLayers") << "dummy implementation of PixelRod::groupedCompatibleDets()" ;
00108 }
00109 
00110 
00111