Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef RecoMuon_MuonSeedBuilder_H
0002 #define RecoMuon_MuonSeedBuilder_H
0003 
0004 /** \class MuonSeedBuilder
0005  *
0006  * Algorith to build TrajectorySeed for muon standalone reconstruction.
0007  * The segments are sorted out to make a protoTrack (vector of matching segments in different 
0008  * stations a.k.a. layers), for DT+overlap and CSC regions, in that order.  
0009  * The protoTrack is then passed to the seed creator to create CSC, overlap and/or DT seeds.
0010  *
0011  * \author Shih-Chuan Kao, Dominique Fortin - UCR
0012  *
0013  */
0014 
0015 #include <FWCore/ParameterSet/interface/ParameterSet.h>
0016 #include <RecoMuon/MeasurementDet/interface/MuonDetLayerMeasurements.h>
0017 #include <DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h>
0018 #include "FWCore/Framework/interface/ConsumesCollector.h"
0019 
0020 #include <vector>
0021 
0022 class DetLayer;
0023 class MuonDetLayerGeometry;
0024 class MagneticField;
0025 class MuonSeedCreator;
0026 class MuonSeedCleaner;
0027 
0028 typedef std::vector<TrajectorySeed> SeedContainer;
0029 
0030 class MuonSeedBuilder {
0031 public:
0032   typedef MuonTransientTrackingRecHit::MuonRecHitContainer SegmentContainer;
0033   typedef std::deque<bool> BoolContainer;
0034 
0035   /// Constructor
0036   explicit MuonSeedBuilder(const edm::ParameterSet&, edm::ConsumesCollector&);
0037 
0038   /// Destructor
0039   ~MuonSeedBuilder();
0040 
0041   // Operations
0042 
0043   /// Cache pointer to geometry
0044   void setGeometry(const MuonDetLayerGeometry* lgeom) { muonLayers = lgeom; }
0045 
0046   /// Cache pointer to Magnetic field
0047   void setBField(const MagneticField* theField) { BField = theField; }
0048 
0049   /// Build seed collection
0050   int build(edm::Event& event, const edm::EventSetup& eventSetup, TrajectorySeedCollection& seeds);
0051 
0052   std::vector<int> badSeedLayer;
0053 
0054 private:
0055   /// Find segment which matches protoTrack for endcap only
0056   bool foundMatchingSegment(int type,
0057                             SegmentContainer& protoTrack,
0058                             SegmentContainer& segments,
0059                             BoolContainer& usedSeg,
0060                             float& eta_temp,
0061                             float& phi_temp,
0062                             int& lastLayer,
0063                             bool& showeringBefore);
0064 
0065   /// cleaning the seeds
0066   std::vector<TrajectorySeed> seedCleaner(const edm::EventSetup& eventSetup, std::vector<TrajectorySeed>& seeds);
0067 
0068   /// calculate the eta error from global R error
0069   double etaError(const GlobalPoint gp, double rErr);
0070 
0071   /// identify the showering layer
0072   bool IdentifyShowering(SegmentContainer& segs,
0073                          BoolContainer& usedSeg,
0074                          float& eta_last,
0075                          float& phi_last,
0076                          int layer,
0077                          int& NShoweringSegments);
0078 
0079   /// group the seeds
0080   //std::vector<SeedContainer> GroupSeeds( std::vector<TrajectorySeed>& seeds );
0081   /// pick the seed by better parameter error
0082   //TrajectorySeed BetterDirection( std::vector<TrajectorySeed>& seeds ) ;
0083   //TrajectorySeed BetterChi2( std::vector<TrajectorySeed>& seeds );
0084   /// filter out the bad pt seeds, if all are bad pt seeds then keep all
0085   //bool MomentumFilter(std::vector<TrajectorySeed>& seeds );
0086 
0087   /// collect long seeds
0088   //SeedContainer LengthFilter(std::vector<TrajectorySeed>& seeds );
0089   /// pick the seeds w/ 1st layer information and w/ more than 1 segments
0090   //SeedContainer SeedCandidates( std::vector<TrajectorySeed>& seeds, bool good );
0091   /// check overlapping segment for seeds
0092   //unsigned int OverlapSegments( TrajectorySeed seed1, TrajectorySeed seed2 );
0093 
0094   /// retrieve number of rechits& normalized chi2 of associated segments of a seed
0095   //int NRecHitsFromSegment( const TrackingRecHit& rhit );
0096   //int NRecHitsFromSegment( MuonTransientTrackingRecHit *rhit );
0097   //int NRecHitsFromSegment( const MuonTransientTrackingRecHit& rhit );
0098   //double NChi2OfSegment( const TrackingRecHit& rhit );
0099 
0100   /// retrieve seed global position
0101   //GlobalPoint SeedPosition( TrajectorySeed seed );
0102   /// retrieve seed global momentum
0103   //GlobalVector SeedMomentum( TrajectorySeed seed );
0104 
0105   // This Producer private debug flag
0106   bool debug;
0107 
0108   // Enable the DT measurement
0109   bool enableDTMeasurement;
0110 
0111   // Enable the CSC measurement
0112   bool enableCSCMeasurement;
0113 
0114   // Minimum # of hits to consider a CSC Segment;
0115   int minCSCHitsPerSegment;
0116 
0117   // Minimum # of hits to consider a DT Segment;
0118   int minDTHitsPerSegment;
0119 
0120   // Maximum distance from initial segment
0121   float maxDeltaEtaCSC;
0122   float maxDeltaPhiCSC;
0123   float maxDeltaEtaOverlap;
0124   float maxDeltaPhiOverlap;
0125   float maxDeltaEtaDT;
0126   float maxDeltaPhiDT;
0127 
0128   // Number of Segments from a shower
0129   int NShowerSeg;
0130   SegmentContainer ShoweringSegments;
0131   std::vector<int> ShoweringLayers;
0132   /// Name of the DT segment collection
0133   edm::InputTag theDTSegmentLabel;
0134 
0135   /// Name of the CSC segment collection
0136   edm::InputTag theCSCSegmentLabel;
0137 
0138   /// Create seed according to region (CSC, DT, Overlap)
0139   MuonSeedCreator* muonSeedCreate_;
0140   MuonSeedCleaner* muonSeedClean_;
0141 
0142   // Cache geometry for current event
0143   const MuonDetLayerGeometry* muonLayers;
0144 
0145   // Cache Magnetic Field for current event
0146   const MagneticField* BField;
0147 
0148   // Minimum separation when we can distinguish between 2 muon seeds
0149   // (to suppress combinatorics)
0150   float maxEtaResolutionDT;
0151   float maxEtaResolutionCSC;
0152   float maxPhiResolutionDT;
0153   float maxPhiResolutionCSC;
0154   float theMinMomentum;
0155 
0156   MuonDetLayerMeasurements* muonMeasurements;
0157 };
0158 #endif