CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_8_patch3/src/RecoMuon/GlobalTrackingTools/interface/GlobalTrajectoryBuilderBase.h

Go to the documentation of this file.
00001 #ifndef RecoMuon_GlobalTrackingTools_GlobalTrajectoryBuilderBase_H
00002 #define RecoMuon_GlobalTrackingTools_GlobalTrajectoryBuilderBase_H
00003 
00025 #include "FWCore/Framework/interface/ESHandle.h"
00026 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00027 #include "RecoMuon/TrackingTools/interface/MuonTrajectoryBuilder.h"
00028 #include "RecoMuon/TransientTrackingRecHit/interface/MuonTransientTrackingRecHit.h"
00029 
00030 class RectangularEtaPhiTrackingRegion;
00031 class TrajectoryStateOnSurface;
00032 class GlobalMuonTrackMatcher;
00033 class MuonDetLayerMeasurements;
00034 class MuonServiceProxy;
00035 class Trajectory;
00036 class TrackTransformer;
00037 class TrajectoryFitter;
00038 class MuonTrackingRegionBuilder;
00039 class TransientTrackingRecHitBuilder;
00040 class GlobalMuonRefitter;
00041 
00042 namespace edm {class ParameterSet; class Event;}
00043 namespace reco {class TransientTrack;}
00044 
00045 //              ---------------------
00046 //              -- Class Interface --
00047 //              ---------------------
00048 
00049 class GlobalTrajectoryBuilderBase : public MuonTrajectoryBuilder {
00050 
00051   public:
00052 
00053     typedef TransientTrackingRecHit::RecHitContainer RecHitContainer;
00054     typedef TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer;
00055     typedef TransientTrackingRecHit::RecHitPointer RecHitPointer;
00056     typedef TransientTrackingRecHit::ConstRecHitPointer ConstRecHitPointer;
00057 
00058     typedef MuonTransientTrackingRecHit::MuonRecHitPointer MuonRecHitPointer;
00059     typedef MuonTransientTrackingRecHit::ConstMuonRecHitPointer ConstMuonRecHitPointer;
00060     typedef MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer;
00061     typedef MuonTransientTrackingRecHit::ConstMuonRecHitContainer ConstMuonRecHitContainer;
00062 
00063     typedef std::vector<Trajectory> TC;
00064     typedef TC::const_iterator TI;
00065 
00066   public:
00067 
00069     GlobalTrajectoryBuilderBase(const edm::ParameterSet&, const MuonServiceProxy*);
00070           
00072     virtual ~GlobalTrajectoryBuilderBase();
00073 
00075     MuonTrajectoryBuilder::TrajectoryContainer trajectories(const TrajectorySeed&) { return MuonTrajectoryBuilder::TrajectoryContainer(); }
00076 
00078     virtual void setEvent(const edm::Event&);
00079 
00080   protected:
00081 
00082     enum RefitDirection{inToOut,outToIn,undetermined};
00083 
00085     MuonTrajectoryBuilder::CandidateContainer build(const TrackCand&,
00086                                                     MuonTrajectoryBuilder::CandidateContainer&) const;
00087 
00089     virtual std::vector<TrackCand> makeTkCandCollection(const TrackCand&) = 0;
00090 
00092     std::vector<TrackCand> chooseRegionalTrackerTracks(const TrackCand&, 
00093                                                        const std::vector<TrackCand>&);
00094 
00096     RectangularEtaPhiTrackingRegion defineRegionOfInterest(const reco::TrackRef&) const;
00097 
00099     void checkMuonHits(const reco::Track&, 
00100                        ConstRecHitContainer&, 
00101                        ConstRecHitContainer&, 
00102                        std::vector<int>&) const;
00103  
00105     ConstRecHitContainer selectMuonHits(const Trajectory&, 
00106                                         const std::vector<int>&) const;
00107 
00109     ConstRecHitContainer selectTrackerHits(const ConstRecHitContainer&) const;
00110 
00112     void fixTEC(ConstRecHitContainer& all,
00113                 double scl_x,
00114                 double scl_y) const;
00115 
00117     const Trajectory* chooseTrajectory(const std::vector<Trajectory*>&, int) const;
00118 
00120     double trackProbability(const Trajectory&) const;
00121 
00123     void printHits(const ConstRecHitContainer&) const;
00124 
00126     void addTraj(TrackCand&){} 
00127 
00129     RefitDirection checkRecHitsOrdering(const ConstRecHitContainer&) const;
00130 
00132     TransientTrackingRecHit::ConstRecHitContainer
00133     getTransientRecHits(const reco::Track&) const;
00134 
00136     GlobalMuonTrackMatcher* trackMatcher() const { return theTrackMatcher; }
00137 
00139     const MuonServiceProxy* service() const { return theService; }
00140 
00141     struct ComparatorInOut {
00142 
00143       bool operator()(const TransientTrackingRecHit::ConstRecHitPointer& a,
00144                       const TransientTrackingRecHit::ConstRecHitPointer& b) const{ 
00145         bool barrel_a = ( a->det()->subDetector() == GeomDetEnumerators::DT ||
00146                           a->det()->subDetector() == GeomDetEnumerators::RPCBarrel );
00147         
00148         bool barrel_b = ( b->det()->subDetector() == GeomDetEnumerators::DT ||
00149                           b->det()->subDetector() == GeomDetEnumerators::RPCBarrel );
00150         
00151          if ( barrel_a && barrel_b ) return  a->det()->surface().position().perp() < b->det()->surface().position().perp();
00152 
00153         else if ( !barrel_a && !barrel_b ) return  fabs(a->globalPosition().z()) < fabs(b->globalPosition().z());
00154         else if ( barrel_a && !barrel_b  ) return true;
00155         else if ( !barrel_a && barrel_b  ) return false;
00156          //shouldn;t really get here in any case (there's some sense to throw here )
00157          return false;
00158       }
00159     };
00160 
00161   protected:
00162 
00163     std::string theCategory;
00164     float thePtCut;
00165     float thePCut;
00166 
00167   private:
00168 
00169     GlobalMuonTrackMatcher* theTrackMatcher;
00170     MuonDetLayerMeasurements* theLayerMeasurements;
00171     TrackTransformer* theTrackTransformer;
00172     MuonTrackingRegionBuilder* theRegionBuilder;
00173     const MuonServiceProxy* theService;
00174     GlobalMuonRefitter* theGlbRefitter;
00175     unsigned long long theCacheId_TRH;
00176     bool theRPCInTheFit;
00177   
00178     int   theMuonHitsOption;
00179     float theTECxScale;
00180     float theTECyScale;
00181     std::string theTrackerPropagatorName;
00182  
00183     const edm::Event* theEvent;
00184 
00185     std::string theTrackerRecHitBuilderName;
00186     edm::ESHandle<TransientTrackingRecHitBuilder> theTrackerRecHitBuilder;
00187     
00188     std::string theMuonRecHitBuilderName;
00189     edm::ESHandle<TransientTrackingRecHitBuilder> theMuonRecHitBuilder;
00190     
00191 };
00192 #endif