00001 #ifndef CosmicMuonTrajectoryBuilder_H
00002 #define CosmicMuonTrajectoryBuilder_H
00003
00010 #include "RecoMuon/TrackingTools/interface/MuonTrajectoryBuilder.h"
00011
00012 #include "RecoMuon/TrackingTools/interface/MuonTrajectoryUpdator.h"
00013 #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
00014 #include "DataFormats/Common/interface/Handle.h"
00015 #include "FWCore/Framework/interface/ESHandle.h"
00016 #include "FWCore/Framework/interface/EventSetup.h"
00017 #include "FWCore/Framework/interface/Event.h"
00018 #include "TrackingTools/DetLayers/interface/DetLayer.h"
00019 #include "RecoMuon/TrackingTools/interface/MuonServiceProxy.h"
00020 #include "RecoMuon/MeasurementDet/interface/MuonDetLayerMeasurements.h"
00021 #include "RecoMuon/TransientTrackingRecHit/interface/MuonTransientTrackingRecHit.h"
00022 #include "RecoMuon/CosmicMuonProducer/interface/CosmicMuonSmoother.h"
00023 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00024 #include "DataFormats/DTRecHit/interface/DTRecHitCollection.h"
00025 #include "DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h"
00026 #include "DataFormats/CSCRecHit/interface/CSCRecHit2DCollection.h"
00027
00028 namespace edm {class Event; class EventSetup;}
00029
00030 class Trajectory;
00031 class TrajectoryMeasurement;
00032 class CosmicMuonUtilities;
00033 class DirectMuonNavigation;
00034 class MuonBestMeasurementFinder;
00035
00036 typedef MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer;
00037 typedef TransientTrackingRecHit::ConstRecHitPointer ConstRecHitPointer;
00038
00039 class CosmicMuonTrajectoryBuilder : public MuonTrajectoryBuilder{
00040 public:
00041
00043 CosmicMuonTrajectoryBuilder(const edm::ParameterSet&,const MuonServiceProxy* service);
00044
00046 virtual ~CosmicMuonTrajectoryBuilder();
00047
00049 std::vector<Trajectory*> trajectories(const TrajectorySeed&);
00050
00052 virtual CandidateContainer trajectories(const TrackCand&) {
00053 return CandidateContainer();
00054 }
00055
00056 virtual void setEvent(const edm::Event&);
00057
00058 const Propagator* propagator() const {return &*theService->propagator(thePropagatorName);}
00059
00060
00061 const Propagator* propagatorAlong() const {return &*theService->propagator("SteppingHelixPropagatorAlong");}
00062
00063 const Propagator* propagatorOpposite() const {return &*theService->propagator("SteppingHelixPropagatorOpposite");}
00064
00065 MuonTrajectoryUpdator* updator() const {return theUpdator;}
00066
00067 MuonTrajectoryUpdator* backwardUpdator() const {return theBKUpdator;}
00068
00069 CosmicMuonSmoother* smoother() const {return theSmoother;}
00070
00071 CosmicMuonUtilities* utilities() const {return smoother()->utilities();}
00072
00073 DirectMuonNavigation* navigation() const {return theNavigation;}
00074
00075 MuonBestMeasurementFinder* bestMeasurementFinder() const {return theBestMeasurementFinder;}
00076
00077 double t0(const DTRecSegment4D* deseg) const;
00078
00079 PropagationDirection checkDirectionByT0(const DTRecSegment4D*, const DTRecSegment4D*) const;
00080
00081
00082 private:
00083
00084 MuonTransientTrackingRecHit::MuonRecHitContainer unusedHits(const DetLayer*, const TrajectoryMeasurement&) const;
00085
00086 void buildSecondHalf(Trajectory&);
00087
00088 void build(const TrajectoryStateOnSurface&, const NavigationDirection&, Trajectory&);
00089
00090 TrajectoryStateOnSurface intermediateState(const TrajectoryStateOnSurface&) const;
00091
00092 void selectHits(MuonTransientTrackingRecHit::MuonRecHitContainer&) const;
00093
00095 void reverseTrajectory(Trajectory&) const;
00096
00098 void flipTrajectory(Trajectory&) const;
00099
00101 void reverseTrajectoryPropagationDirection(Trajectory&) const;
00102
00104 bool selfDuplicate(const Trajectory&) const;
00105
00107 void estimateDirection(Trajectory&) const;
00108
00110 void getDirectionByTime(Trajectory&) const;
00111
00112 std::vector<TrajectoryMeasurement> findBestMeasurements(const DetLayer*, const TrajectoryStateOnSurface&, const Propagator*, const MeasurementEstimator*);
00113
00114 void incrementChamberCounters(const DetLayer *layer, int& dtChambers, int& cscChambers, int& rpcChambers, int& totalChambers);
00115
00116 DirectMuonNavigation* theNavigation;
00117 edm::ParameterSet theNavigationPSet;
00118
00119 MuonTrajectoryUpdator* theUpdator;
00120 MuonTrajectoryUpdator* theBKUpdator;
00121 MuonDetLayerMeasurements* theLayerMeasurements;
00122
00123 const MuonServiceProxy* theService;
00124 CosmicMuonSmoother* theSmoother;
00125
00126 MuonBestMeasurementFinder* theBestMeasurementFinder;
00127
00128 std::string thePropagatorName;
00129
00130 bool theTraversingMuonFlag;
00131
00132 std::string category_;
00133 int theNTraversing;
00134 int theNSuccess;
00135
00136 unsigned long long theCacheId_DG;
00137 edm::Handle<CSCRecHit2DCollection> cschits_;
00138 edm::Handle<DTRecHitCollection> dthits_;
00139
00140
00141 };
00142 #endif