Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:26:51

0001 #ifndef CosmicMuonTrajectoryBuilder_H
0002 #define CosmicMuonTrajectoryBuilder_H
0003 /** \file CosmicMuonTrajectoryBuilder
0004  *
0005  *  \author Chang Liu  -  Purdue University
0006  */
0007 
0008 #include "RecoMuon/TrackingTools/interface/MuonTrajectoryBuilder.h"
0009 
0010 #include "RecoMuon/TrackingTools/interface/MuonTrajectoryUpdator.h"
0011 #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
0012 #include "DataFormats/Common/interface/Handle.h"
0013 #include "FWCore/Framework/interface/ESHandle.h"
0014 #include "FWCore/Framework/interface/EventSetup.h"
0015 #include "FWCore/Framework/interface/Event.h"
0016 #include "TrackingTools/DetLayers/interface/DetLayer.h"
0017 #include "RecoMuon/TrackingTools/interface/MuonServiceProxy.h"
0018 #include "RecoMuon/MeasurementDet/interface/MuonDetLayerMeasurements.h"
0019 #include "RecoMuon/TransientTrackingRecHit/interface/MuonTransientTrackingRecHit.h"
0020 #include "RecoMuon/CosmicMuonProducer/interface/CosmicMuonSmoother.h"
0021 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0022 #include "DataFormats/DTRecHit/interface/DTRecHitCollection.h"
0023 #include "DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h"
0024 #include "DataFormats/CSCRecHit/interface/CSCRecHit2DCollection.h"
0025 #include "FWCore/Framework/interface/ConsumesCollector.h"
0026 
0027 namespace edm {
0028   class Event;
0029   class EventSetup;
0030 }  // namespace edm
0031 
0032 class Trajectory;
0033 class TrajectoryMeasurement;
0034 class CosmicMuonUtilities;
0035 class DirectMuonNavigation;
0036 class MuonBestMeasurementFinder;
0037 
0038 typedef MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer;
0039 typedef TransientTrackingRecHit::ConstRecHitPointer ConstRecHitPointer;
0040 
0041 class CosmicMuonTrajectoryBuilder : public MuonTrajectoryBuilder {
0042 public:
0043   /// Constructor
0044   CosmicMuonTrajectoryBuilder(const edm::ParameterSet&, const MuonServiceProxy* service, edm::ConsumesCollector& iC);
0045 
0046   /// Destructor
0047   ~CosmicMuonTrajectoryBuilder() override;
0048 
0049   /// build trajectories from seed
0050   TrajectoryContainer trajectories(const TrajectorySeed&) override;
0051 
0052   /// dummy implementation, unused in this class
0053   CandidateContainer trajectories(const TrackCand&) override { return CandidateContainer(); }
0054 
0055   void setEvent(const edm::Event&) override;
0056 
0057   const Propagator* propagator() const { return &*theService->propagator(thePropagatorName); }
0058 
0059   //FIXME
0060   const Propagator* propagatorAlong() const { return &*theService->propagator("SteppingHelixPropagatorAlong"); }
0061 
0062   const Propagator* propagatorOpposite() const { return &*theService->propagator("SteppingHelixPropagatorOpposite"); }
0063 
0064   MuonTrajectoryUpdator* updator() const { return theUpdator; }
0065 
0066   MuonTrajectoryUpdator* backwardUpdator() const { return theBKUpdator; }
0067 
0068   CosmicMuonSmoother* smoother() const { return theSmoother; }
0069 
0070   const CosmicMuonUtilities* utilities() const { return smoother()->utilities(); }
0071 
0072   DirectMuonNavigation* navigation() const { return theNavigation; }
0073 
0074   MuonBestMeasurementFinder* bestMeasurementFinder() const { return theBestMeasurementFinder; }
0075 
0076   double t0(const DTRecSegment4D* deseg) const;
0077 
0078   PropagationDirection checkDirectionByT0(const DTRecSegment4D*, const DTRecSegment4D*) const;
0079 
0080 private:
0081   MuonTransientTrackingRecHit::MuonRecHitContainer unusedHits(const DetLayer*, const TrajectoryMeasurement&) const;
0082 
0083   void buildSecondHalf(Trajectory&);
0084 
0085   void build(const TrajectoryStateOnSurface&, const NavigationDirection&, Trajectory&);
0086 
0087   TrajectoryStateOnSurface intermediateState(const TrajectoryStateOnSurface&) const;
0088 
0089   void selectHits(MuonTransientTrackingRecHit::MuonRecHitContainer&) const;
0090 
0091   /// reverse a trajectory without refit (out the measurements order changed)
0092   void reverseTrajectory(Trajectory&) const;
0093 
0094   /// flip a trajectory with refit (the momentum direction is opposite)
0095   void flipTrajectory(Trajectory&) const;
0096 
0097   /// reverse the propagation direction of a trajectory
0098   void reverseTrajectoryPropagationDirection(Trajectory&) const;
0099 
0100   /// check if the trajectory iterates the same hit more than once
0101   bool selfDuplicate(const Trajectory&) const;
0102 
0103   /// check the direction of trajectory by checking eta spread
0104   void estimateDirection(Trajectory&) const;
0105 
0106   /// check the direction of trajectory by checking the timing
0107   void getDirectionByTime(Trajectory&) const;
0108 
0109   std::vector<TrajectoryMeasurement> findBestMeasurements(const DetLayer*,
0110                                                           const TrajectoryStateOnSurface&,
0111                                                           const Propagator*,
0112                                                           const MeasurementEstimator*);
0113 
0114   void incrementChamberCounters(
0115       const DetLayer* layer, int& dtChambers, int& cscChambers, int& rpcChambers, int& totalChambers);
0116 
0117   DirectMuonNavigation* theNavigation;
0118   edm::ParameterSet theNavigationPSet;
0119 
0120   MuonTrajectoryUpdator* theUpdator;
0121   MuonTrajectoryUpdator* theBKUpdator;
0122   MuonDetLayerMeasurements* theLayerMeasurements;
0123 
0124   const MuonServiceProxy* theService;
0125   CosmicMuonSmoother* theSmoother;
0126 
0127   MuonBestMeasurementFinder* theBestMeasurementFinder;
0128 
0129   std::string thePropagatorName;
0130 
0131   bool theTraversingMuonFlag;
0132   bool theStrict1LegFlag;
0133 
0134   std::string category_;
0135   int theNTraversing;
0136   int theNSuccess;
0137 
0138   unsigned long long theCacheId_DG;
0139   edm::Handle<CSCRecHit2DCollection> cschits_;
0140   edm::Handle<DTRecHitCollection> dthits_;
0141 };
0142 #endif