Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:26:12

0001 #ifndef RecoMuon_StandAloneTrackFinder_StandAloneMuonFilter_H
0002 #define RecoMuon_StandAloneTrackFinder_StandAloneMuonFilter_H
0003 
0004 /** \class StandAloneMuonFilter
0005  *  The inward-outward fitter (starts from seed state).
0006  *
0007  *  \author R. Bellan - INFN Torino <riccardo.bellan@cern.ch>
0008  *          D. Trocino - INFN Torino <daniele.trocino@to.infn.it>
0009  *
0010  *           Modified by C. Calabria & A. Sharma
0011  *  Modified by D. Nash
0012  */
0013 
0014 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
0015 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
0016 #include "TrackingTools/DetLayers/interface/NavigationDirection.h"
0017 #include "DataFormats/TrajectorySeed/interface/PropagationDirection.h"
0018 
0019 #include "RecoMuon/TrackingTools/interface/MuonBestMeasurementFinder.h"
0020 #include "FWCore/Framework/interface/ConsumesCollector.h"
0021 
0022 class Propagator;
0023 class DetLayer;
0024 class MuonTrajectoryUpdator;
0025 class Trajectory;
0026 class MuonDetLayerMeasurements;
0027 class MeasurementEstimator;
0028 class MuonServiceProxy;
0029 
0030 namespace edm {
0031   class ParameterSet;
0032   class EventSetup;
0033   class Event;
0034 }  // namespace edm
0035 
0036 class StandAloneMuonFilter {
0037 public:
0038   /// Constructor
0039   StandAloneMuonFilter(const edm::ParameterSet &par, const MuonServiceProxy *service, edm::ConsumesCollector &iC);
0040 
0041   /// Destructor
0042   virtual ~StandAloneMuonFilter();
0043 
0044   // Operations
0045 
0046   /// Perform the inner-outward fitting
0047   void refit(const TrajectoryStateOnSurface &initialState, const DetLayer *, Trajectory &trajectory);
0048 
0049   /// the last free trajectory state
0050   FreeTrajectoryState lastUpdatedFTS() const { return *theLastUpdatedTSOS.freeTrajectoryState(); }
0051 
0052   /// the last but one free trajectory state
0053   FreeTrajectoryState lastButOneUpdatedFTS() const { return *theLastButOneUpdatedTSOS.freeTrajectoryState(); }
0054 
0055   /// the Trajectory state on the last compatible surface
0056   TrajectoryStateOnSurface lastCompatibleTSOS() const { return theLastCompatibleTSOS; }
0057 
0058   /// the Trajectory state on the last surface of the fitting
0059   TrajectoryStateOnSurface lastUpdatedTSOS() const { return theLastUpdatedTSOS; }
0060 
0061   /// the Trajectory state on the last surface of the fitting
0062   TrajectoryStateOnSurface lastButOneUpdatedTSOS() const { return theLastButOneUpdatedTSOS; }
0063 
0064   void reset();
0065 
0066   /// Pass the Event to the algo at each event
0067   virtual void setEvent(const edm::Event &event);
0068 
0069   int getTotalChamberUsed() const { return totalChambers; }
0070   int getDTChamberUsed() const { return dtChambers; }
0071   int getCSCChamberUsed() const { return cscChambers; }
0072   int getRPCChamberUsed() const { return rpcChambers; }
0073   int getGEMChamberUsed() const { return gemChambers; }
0074   int getME0ChamberUsed() const { return me0Chambers; }
0075 
0076   int getTotalCompatibleChambers() const { return totalCompatibleChambers; }
0077   int getDTCompatibleChambers() const { return dtCompatibleChambers; }
0078   int getCSCCompatibleChambers() const { return cscCompatibleChambers; }
0079   int getRPCCompatibleChambers() const { return rpcCompatibleChambers; }
0080   int getGEMCompatibleChambers() const { return gemCompatibleChambers; }
0081   int getME0CompatibleChambers() const { return me0CompatibleChambers; }
0082 
0083   inline bool goodState() const {
0084     return totalChambers >= 2 && ((dtChambers + cscChambers + gemChambers + me0Chambers) > 0 || onlyRPC());
0085   }
0086 
0087   inline bool isCompatibilitySatisfied() const {
0088     return totalCompatibleChambers >= 2 &&
0089            ((dtCompatibleChambers + cscCompatibleChambers + gemCompatibleChambers + me0CompatibleChambers) > 0 ||
0090             onlyRPC());
0091   }
0092 
0093   /// return the layer used for the refit
0094   std::vector<const DetLayer *> layers() const { return theDetLayers; }
0095 
0096   /// return the last det layer
0097   const DetLayer *lastDetLayer() const { return theDetLayers.back(); }
0098 
0099   /// Return the propagation direction
0100   PropagationDirection propagationDirection() const;
0101 
0102   /// Return the fit direction
0103   NavigationDirection fitDirection() const { return theFitDirection; }
0104 
0105   /// True if there are only the RPC measurements
0106   bool onlyRPC() const { return theRPCLoneliness; }
0107 
0108   /// access at the estimator
0109   MeasurementEstimator *estimator() const { return theEstimator; }
0110 
0111   /// access at the propagator
0112   const Propagator *propagator() const;
0113 
0114   /// access at the muon updator
0115   MuonTrajectoryUpdator *updator() const { return theMuonUpdator; }
0116 
0117   void createDefaultTrajectory(const Trajectory &, Trajectory &);
0118 
0119 protected:
0120 private:
0121   /// Set the last compatible TSOS
0122   void setLastCompatibleTSOS(TrajectoryStateOnSurface tsos) { theLastCompatibleTSOS = tsos; }
0123 
0124   /// Set the last TSOS
0125   void setLastUpdatedTSOS(TrajectoryStateOnSurface tsos) { theLastUpdatedTSOS = tsos; }
0126 
0127   /// Set the last but one TSOS
0128   void setLastButOneUpdatedTSOS(TrajectoryStateOnSurface tsos) { theLastButOneUpdatedTSOS = tsos; }
0129 
0130   /// Increment the DT,CSC,RPC counters
0131   void incrementChamberCounters(const DetLayer *layer);
0132   void incrementCompatibleChamberCounters(const DetLayer *layer);
0133 
0134   /// Set the rigth Navigation
0135   std::vector<const DetLayer *> compatibleLayers(const DetLayer *initialLayer,
0136                                                  const FreeTrajectoryState &fts,
0137                                                  PropagationDirection propDir);
0138 
0139   bool update(const DetLayer *layer, const TrajectoryMeasurement *meas, Trajectory &trajectory);
0140 
0141   std::vector<TrajectoryMeasurement> findBestMeasurements(const DetLayer *layer, const TrajectoryStateOnSurface &tsos);
0142 
0143   /// the trajectory state on the last compatible surface
0144   TrajectoryStateOnSurface theLastCompatibleTSOS;
0145   /// the trajectory state on the last available surface
0146   TrajectoryStateOnSurface theLastUpdatedTSOS;
0147   /// the trajectory state on the last but one available surface
0148   TrajectoryStateOnSurface theLastButOneUpdatedTSOS;
0149 
0150   /// The Measurement extractor
0151   MuonDetLayerMeasurements *theMeasurementExtractor;
0152 
0153   /// The Estimator
0154   MeasurementEstimator *theEstimator;
0155 
0156   /// the muon updator (it doesn't inhert from an updator, but it has one!)
0157   MuonTrajectoryUpdator *theMuonUpdator;
0158   /// its name
0159   std::string theMuonUpdatorName;
0160 
0161   /// The best measurement finder: search for the best measurement among the TMs available
0162   MuonBestMeasurementFinder *theBestMeasurementFinder;
0163   /// Access to the best measurement finder
0164   MuonBestMeasurementFinder *bestMeasurementFinder() const { return theBestMeasurementFinder; }
0165 
0166   /// The max allowed chi2 to accept a rechit in the fit
0167   double theMaxChi2;
0168   /// The errors of the trajectory state are multiplied by nSigma
0169   /// to define acceptance of BoundPlane and maximalLocalDisplacement
0170   double theNSigma;
0171 
0172   /// the propagation direction
0173   NavigationDirection theFitDirection;
0174 
0175   /// the det layer used in the reconstruction
0176   std::vector<const DetLayer *> theDetLayers;
0177 
0178   /// the propagator name
0179   std::string thePropagatorName;
0180 
0181   /// Navigation type
0182   /// "Direct","Standard"
0183   std::string theNavigationType;
0184 
0185   /// True if there are only the RPC measurements
0186   bool theRPCLoneliness;
0187 
0188   int totalChambers;
0189   int dtChambers;
0190   int cscChambers;
0191   int rpcChambers;
0192   int gemChambers;
0193   int me0Chambers;
0194 
0195   int totalCompatibleChambers;
0196   int dtCompatibleChambers;
0197   int cscCompatibleChambers;
0198   int rpcCompatibleChambers;
0199   int gemCompatibleChambers;
0200   int me0CompatibleChambers;
0201 
0202   const MuonServiceProxy *theService;
0203   bool theOverlappingChambersFlag;
0204 };
0205 #endif