CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/RecoEgamma/EgammaElectronAlgos/interface/PixelHitMatcher.h

Go to the documentation of this file.
00001 #ifndef PIXELHITMATCHER_H
00002 #define PIXELHITMATCHER_H
00003 
00004 // -*- C++ -*-
00005 //
00006 // Package:    EgammaElectronAlgos
00007 // Class:      PixelHitMatcher
00008 //
00017 //
00018 // Original Author:  Ursula Berthon, Claude Charlot
00019 //         Created:  Mon Mar 27 13:22:06 CEST 2006
00020 // $Id: PixelHitMatcher.h,v 1.31 2011/01/14 21:23:42 chamont Exp $
00021 //
00022 //
00023 
00024 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
00025 #include "TrackingTools/MaterialEffects/interface/PropagatorWithMaterial.h"
00026 
00027 #include "RecoEgamma/EgammaElectronAlgos/interface/BarrelMeasurementEstimator.h"
00028 #include "RecoEgamma/EgammaElectronAlgos/interface/ForwardMeasurementEstimator.h"
00029 #include "RecoEgamma/EgammaElectronAlgos/interface/PixelMatchStartLayers.h"
00030 #include "RecoEgamma/EgammaElectronAlgos/interface/FTSFromVertexToPointFactory.h"
00031 
00032 #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
00033 #include "DataFormats/EgammaReco/interface/ElectronSeed.h"
00034 
00035 #include "RecoTracker/TransientTrackingRecHit/interface/TSiPixelRecHit.h"
00036 #include "RecoTracker/TkDetLayers/interface/GeometricSearchTracker.h"
00037 
00038 #include "CLHEP/Vector/ThreeVector.h"
00039 #include <vector>
00040 #include <limits>
00041 
00046 class MeasurementTracker;
00047 class MagneticField;
00048 class GeometricSearchTracker;
00049 class LayerMeasurements;
00050 class TrackerGeometry;
00051 
00052 class RecHitWithDist
00053  {
00054   public :
00055 
00056     typedef TransientTrackingRecHit::ConstRecHitPointer   ConstRecHitPointer;
00057     typedef TransientTrackingRecHit::RecHitPointer        RecHitPointer;
00058     typedef TransientTrackingRecHit::RecHitContainer      RecHitContainer;
00059 
00060     RecHitWithDist( ConstRecHitPointer rh, float & dphi )
00061      : rh_(rh), dphi_(dphi)
00062      {}
00063 
00064     ConstRecHitPointer recHit() const { return rh_ ; }
00065     float dPhi() const { return dphi_ ; }
00066 
00067     void invert() { dphi_*=-1. ; }
00068 
00069   private :
00070 
00071     ConstRecHitPointer rh_ ;
00072     float dphi_ ;
00073 
00074  } ;
00075 
00076 
00077 class RecHitWithInfo
00078  {
00079   public :
00080 
00081     typedef TransientTrackingRecHit::ConstRecHitPointer   ConstRecHitPointer ;
00082     typedef TransientTrackingRecHit::RecHitPointer        RecHitPointer ;
00083     typedef TransientTrackingRecHit::RecHitContainer      RecHitContainer ;
00084 
00085     RecHitWithInfo( ConstRecHitPointer rh, int subDet =0,
00086        float dRz = std::numeric_limits<float>::infinity(),
00087        float dPhi = std::numeric_limits<float>::infinity() )
00088      : rh_(rh), subDet_(subDet), dRz_(dRz), dPhi_(dPhi)
00089      {}
00090 
00091     ConstRecHitPointer recHit() const { return rh_; }
00092     int subDet() const { return subDet_ ; }
00093     float dRz() const { return dRz_ ; }
00094     float dPhi() const { return dPhi_ ; }
00095 
00096     void invert() { dPhi_*=-1. ; }
00097 
00098   private:
00099 
00100     ConstRecHitPointer rh_;
00101     int subDet_ ;
00102     float dRz_ ;
00103     float dPhi_ ;
00104 
00105  } ;
00106 
00107 class SeedWithInfo
00108  {
00109   public :
00110 
00111     SeedWithInfo( TrajectorySeed seed, unsigned char hitsMask, int subDet2, float dRz2, float dPhi2 , int subDet1, float dRz1, float dPhi1)
00112      : seed_(seed), hitsMask_(hitsMask),
00113        subDet2_(subDet2), dRz2_(dRz2), dPhi2_(dPhi2),
00114        subDet1_(subDet1), dRz1_(dRz1), dPhi1_(dPhi1)
00115      {}
00116 
00117     const TrajectorySeed & seed() const { return seed_ ; }
00118     unsigned char hitsMask() const { return hitsMask_ ; }
00119 
00120     int subDet2() const { return subDet2_ ; }
00121     float dRz2() const { return dRz2_ ; }
00122     float dPhi2() const { return dPhi2_ ; }
00123 
00124     int subDet1() const { return subDet1_ ; }
00125     float dRz1() const { return dRz1_ ; }
00126     float dPhi1() const { return dPhi1_ ; }
00127 
00128   private :
00129 
00130     TrajectorySeed seed_ ;
00131     unsigned char hitsMask_ ;
00132     int subDet2_ ;
00133     float dRz2_ ;
00134     float dPhi2_ ;
00135     int subDet1_ ;
00136     float dRz1_ ;
00137     float dPhi1_ ;
00138  } ;
00139 
00140 class PixelHitMatcher
00141  {
00142   public :
00143 
00144     typedef TransientTrackingRecHit::ConstRecHitPointer   ConstRecHitPointer;
00145     typedef TransientTrackingRecHit::RecHitPointer        RecHitPointer;
00146     typedef TransientTrackingRecHit::RecHitContainer      RecHitContainer;
00147 
00148     PixelHitMatcher
00149      ( float phi1min, float phi1max,
00150        //float phi2min, float phi2max,
00151        float phi2minB, float phi2maxB, float phi2minF, float phi2maxF,
00152                    float z2minB, float z2maxB, float r2minF, float r2maxF,
00153                    float rMinI, float rMaxI, bool searchInTIDTEC ) ;
00154 
00155     virtual ~PixelHitMatcher() ;
00156     void setES( const MagneticField *, const MeasurementTracker * theMeasurementTracker, const TrackerGeometry * trackerGeometry ) ;
00157 
00158     std::vector<std::pair<RecHitWithDist,ConstRecHitPointer> >
00159     compatibleHits(const GlobalPoint& xmeas, const GlobalPoint& vprim, float energy, float charge ) ;
00160 
00161     // compatibleSeeds(edm::Handle<TrajectorySeedCollection> &seeds, const GlobalPoint& xmeas,
00162     std::vector<SeedWithInfo>
00163     compatibleSeeds
00164       ( TrajectorySeedCollection * seeds, const GlobalPoint & xmeas,
00165         const GlobalPoint & vprim, float energy, float charge ) ;
00166 
00167     std::vector<CLHEP::Hep3Vector> predicted1Hits() ;
00168     std::vector<CLHEP::Hep3Vector> predicted2Hits();
00169 
00170     void set1stLayer( float dummyphi1min, float dummyphi1max ) ;
00171     void set1stLayerZRange( float zmin1, float zmax1 ) ;
00172     //void set2ndLayer( float dummyphi2min, float dummyphi2max ) ;
00173     void set2ndLayer( float dummyphi2minB, float dummyphi2maxB, float dummyphi2minF, float dummyphi2maxF ) ;
00174 
00175     float getVertex() ;
00176     void setUseRecoVertex( bool val ) ;
00177 
00178   private :
00179 
00180     RecHitContainer hitsInTrack ;
00181 
00182     std::vector<CLHEP::Hep3Vector> pred1Meas ;
00183     std::vector<CLHEP::Hep3Vector> pred2Meas ;
00184     FTSFromVertexToPointFactory myFTS ;
00185     BarrelMeasurementEstimator meas1stBLayer ;
00186     BarrelMeasurementEstimator meas2ndBLayer ;
00187     ForwardMeasurementEstimator meas1stFLayer ;
00188     ForwardMeasurementEstimator meas2ndFLayer ;
00189     PixelMatchStartLayers startLayers ;
00190     PropagatorWithMaterial * prop1stLayer ;
00191     PropagatorWithMaterial * prop2ndLayer ;
00192     const GeometricSearchTracker * theGeometricSearchTracker ;
00193     const LayerMeasurements * theLayerMeasurements ;
00194     const MagneticField* theMagField ;
00195     const TrackerGeometry * theTrackerGeometry ;
00196 
00197     float vertex_;
00198 
00199     bool searchInTIDTEC_ ;
00200     bool useRecoVertex_ ;
00201     std::vector<std::pair<const GeomDet*, TrajectoryStateOnSurface> >  mapTsos_ ;
00202     std::vector<std::pair<std::pair<const GeomDet*,GlobalPoint>,  TrajectoryStateOnSurface> >  mapTsos2_ ;
00203 
00204 } ;
00205 
00206 #endif
00207 
00208 
00209 
00210 
00211 
00212 
00213 
00214