CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/RecoMuon/GlobalTrackingTools/interface/GlobalMuonRefitter.h

Go to the documentation of this file.
00001 #ifndef RecoMuon_GlobalTrackingTools_GlobalMuonRefitter_H
00002 #define RecoMuon_GlobalTrackingTools_GlobalMuonRefitter_H
00003 
00015 #include "DataFormats/Common/interface/Handle.h"
00016 
00017 #include "FWCore/Framework/interface/ESHandle.h"
00018 #include "FWCore/Utilities/interface/InputTag.h"
00019 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00020 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00021 
00022 #include "RecoMuon/TrackingTools/interface/MuonTrajectoryBuilder.h"
00023 #include "RecoMuon/TransientTrackingRecHit/interface/MuonTransientTrackingRecHit.h"
00024 #include "TrackingTools/TrackRefitter/interface/TrackTransformer.h"
00025 #include "DataFormats/DTRecHit/interface/DTRecHitCollection.h"
00026 #include "DataFormats/CSCRecHit/interface/CSCSegmentCollection.h"
00027 
00028 namespace edm {class Event;}
00029 namespace reco {class TransientTrack;}
00030 
00031 class TrajectoryStateOnSurface;
00032 class TrackerTopology;
00033 
00034 class MuonDetLayerMeasurements;
00035 class MuonServiceProxy;
00036 class Trajectory;
00037 
00038 class TrajectoryFitter;
00039 
00040 class GlobalMuonRefitter {
00041 
00042   public:
00043 
00044     typedef TransientTrackingRecHit::RecHitContainer RecHitContainer;
00045     typedef TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer;
00046     typedef TransientTrackingRecHit::RecHitPointer RecHitPointer;
00047     typedef TransientTrackingRecHit::ConstRecHitPointer ConstRecHitPointer;
00048 
00049     typedef MuonTransientTrackingRecHit::MuonRecHitPointer MuonRecHitPointer;
00050     typedef MuonTransientTrackingRecHit::ConstMuonRecHitPointer ConstMuonRecHitPointer;
00051     typedef MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer;
00052     typedef MuonTransientTrackingRecHit::ConstMuonRecHitContainer ConstMuonRecHitContainer;
00053 
00054     typedef std::vector<Trajectory> TC;
00055     typedef TC::const_iterator TI;
00056 
00057     enum subDetector { PXB = 1, PXF = 2, TIB = 3, TID = 4, TOB = 5, TEC = 6 };
00058 
00059   public:
00060 
00062     GlobalMuonRefitter(const edm::ParameterSet&, const MuonServiceProxy*);
00063           
00065     virtual ~GlobalMuonRefitter();
00066 
00068     virtual void setEvent(const edm::Event&);
00069 
00071     void setServices(const edm::EventSetup&);
00072 
00074     std::vector<Trajectory> refit(const reco::Track& globalTrack, const int theMuonHitsOption, 
00075                                   const TrackerTopology *tTopo) const;
00076 
00078     std::vector<Trajectory> refit(const reco::Track& globalTrack,
00079                                   const reco::TransientTrack track,
00080                                   const TransientTrackingRecHit::ConstRecHitContainer& allRecHitsTemp,
00081                                   const int theMuonHitsOption,
00082                                   const TrackerTopology *tTopo) const;
00083 
00085     std::vector<Trajectory> transform(const reco::Track& newTrack,
00086                                       const reco::TransientTrack track,
00087                                       const TransientTrackingRecHit::ConstRecHitContainer& recHitsForReFit) const;
00088     
00089     // get rid of selected station RecHits
00090     ConstRecHitContainer getRidOfSelectStationHits(const ConstRecHitContainer& hits,
00091                                                    const TrackerTopology *tTopo) const;
00092 
00093 
00094   protected:
00095 
00096     enum RefitDirection{insideOut,outsideIn,undetermined};
00097     
00099     void checkMuonHits(const reco::Track&, ConstRecHitContainer&, 
00100                        std::map<DetId, int> &) const;
00101 
00103     void getFirstHits(const reco::Track&, ConstRecHitContainer&, 
00104                        ConstRecHitContainer&) const;
00105  
00107     ConstRecHitContainer selectMuonHits(const Trajectory&, 
00108                                         const std::map<DetId, int> &) const;
00109  
00111     void printHits(const ConstRecHitContainer&) const;
00112 
00113     RefitDirection checkRecHitsOrdering(const ConstRecHitContainer&) const;
00114 
00115     const MuonServiceProxy* service() const { return theService; }
00116 
00117   protected:
00118     std::string theCategory;
00119     bool theTkTrajsAvailableFlag;
00120     float thePtCut;
00121 
00122   private:
00123   
00124     int   theMuonHitsOption;
00125     float theProbCut;
00126     int   theHitThreshold;
00127     float theDTChi2Cut;
00128     float theCSCChi2Cut;
00129     float theRPCChi2Cut;
00130     bool  theCosmicFlag;
00131 
00132     edm::InputTag theDTRecHitLabel;
00133     edm::InputTag theCSCRecHitLabel;
00134     edm::Handle<DTRecHitCollection>    theDTRecHits;
00135     edm::Handle<CSCRecHit2DCollection> theCSCRecHits;
00136 
00137     int   theSkipStation;
00138     int   theTrackerSkipSystem;
00139     int   theTrackerSkipSection;
00140 
00141     unsigned long long theCacheId_TRH;        
00142 
00143     std::string thePropagatorName;
00144   
00145     bool theRPCInTheFit;
00146 
00147     double theRescaleErrorFactor;
00148 
00149     RefitDirection theRefitDirection;
00150 
00151     std::vector<int> theDYTthrs;
00152 
00153     std::string theFitterName;
00154     edm::ESHandle<TrajectoryFitter> theFitter;
00155   
00156     std::string theTrackerRecHitBuilderName;
00157     edm::ESHandle<TransientTrackingRecHitBuilder> theTrackerRecHitBuilder;
00158   
00159     std::string theMuonRecHitBuilderName;
00160     edm::ESHandle<TransientTrackingRecHitBuilder> theMuonRecHitBuilder;
00161 
00162     const MuonServiceProxy* theService;
00163     const edm::Event* theEvent;
00164 };
00165 #endif