Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-06-03 00:59:26

0001 #ifndef MRecoMuon_MuonSeedGenerator_RPCSeedPattern_H
0002 #define MRecoMuon_MuonSeedGenerator_RPCSeedPattern_H
0003 
0004 /**  \class RPCSeedPattern
0005  *
0006  *  \author Haiyun.Teng - Peking University
0007  *
0008  *
0009  */
0010 
0011 #include "FWCore/Framework/interface/EventSetup.h"
0012 #include <DataFormats/TrajectorySeed/interface/TrajectorySeed.h>
0013 #include <RecoMuon/TransientTrackingRecHit/interface/MuonTransientTrackingRecHit.h>
0014 #include <MagneticField/Engine/interface/MagneticField.h>
0015 #include <FWCore/Framework/interface/ESHandle.h>
0016 #include <FWCore/ParameterSet/interface/ParameterSet.h>
0017 #include <TrackingTools/TrajectoryParametrization/interface/LocalTrajectoryError.h>
0018 #include <vector>
0019 
0020 #ifndef upper_limit_pt
0021 #define upper_limit_pt 100
0022 #endif
0023 
0024 #ifndef lower_limit_pt
0025 #define lower_limit_pt 3.0
0026 #endif
0027 
0028 class RPCGeometry;
0029 
0030 class RPCSeedPattern {
0031   typedef MuonTransientTrackingRecHit::MuonRecHitPointer MuonRecHitPointer;
0032   typedef MuonTransientTrackingRecHit::ConstMuonRecHitPointer ConstMuonRecHitPointer;
0033   typedef MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer;
0034   typedef MuonTransientTrackingRecHit::ConstMuonRecHitContainer ConstMuonRecHitContainer;
0035 
0036 public:
0037   typedef std::pair<ConstMuonRecHitPointer, ConstMuonRecHitPointer> RPCSegment;
0038   typedef std::pair<TrajectorySeed, double> weightedTrajectorySeed;
0039 
0040 public:
0041   RPCSeedPattern();
0042   ~RPCSeedPattern();
0043   void configure(const edm::ParameterSet& iConfig);
0044   void clear() { theRecHits.clear(); }
0045   void add(const ConstMuonRecHitPointer& hit) { theRecHits.push_back(hit); }
0046   unsigned int nrhit() const { return theRecHits.size(); }
0047 
0048 private:
0049   friend class RPCSeedFinder;
0050   weightedTrajectorySeed seed(const MagneticField& Field, const RPCGeometry& rpcGeom, int& isGoodSeed);
0051   void ThreePointsAlgorithm();
0052   void MiddlePointsAlgorithm();
0053   void SegmentAlgorithm();
0054   void SegmentAlgorithmSpecial(const MagneticField& Field);
0055   bool checkSegment() const;
0056   ConstMuonRecHitPointer FirstRecHit() const;
0057   ConstMuonRecHitPointer BestRefRecHit() const;
0058   LocalTrajectoryError getSpecialAlgorithmErrorMatrix(const ConstMuonRecHitPointer& first,
0059                                                       const ConstMuonRecHitPointer& best);
0060   weightedTrajectorySeed createFakeSeed(int& isGoodSeed, const MagneticField&);
0061   weightedTrajectorySeed createSeed(int& isGoodSeed, const MagneticField&);
0062   double getDistance(const ConstMuonRecHitPointer& precHit, const GlobalVector& Center) const;
0063   bool checkStraightwithThreerecHits(ConstMuonRecHitPointer (&precHit)[3], double MinDeltaPhi) const;
0064   GlobalVector computePtwithThreerecHits(double& pt, double& pt_err, ConstMuonRecHitPointer (&precHit)[3]) const;
0065   bool checkStraightwithSegment(const RPCSegment& Segment1, const RPCSegment& Segment2, double MinDeltaPhi) const;
0066   GlobalVector computePtwithSegment(const RPCSegment& Segment1, const RPCSegment& Segment2) const;
0067   bool checkStraightwithThreerecHits(double (&x)[3], double (&y)[3], double MinDeltaPhi) const;
0068   GlobalVector computePtWithThreerecHits(double& pt, double& pt_err, double (&x)[3], double (&y)[3]) const;
0069 
0070   void checkSimplePattern(const MagneticField& Field);
0071   void checkSegmentAlgorithmSpecial(const MagneticField& Field, const RPCGeometry& rpcGeometry);
0072   double extropolateStep(const GlobalPoint& startPosition,
0073                          const GlobalVector& startMomentum,
0074                          ConstMuonRecHitContainer::const_iterator iter,
0075                          const int ClockwiseDirection,
0076                          double& tracklength,
0077                          const MagneticField& Field,
0078                          const RPCGeometry& rpcGeometry);
0079 
0080   //void computeBestPt(double* pt, double* spt, double& ptmean0, double& sptmean0, unsigned int NumberofPt) const;
0081 
0082   // ----------member data ---------------------------
0083 
0084   // parameters for configuration
0085   double MaxRSD;
0086   double deltaRThreshold;
0087   unsigned int AlgorithmType;
0088   bool autoAlgorithmChoose;
0089   double ZError;
0090   double MinDeltaPhi;
0091   double stepLength;
0092   unsigned int sampleCount;
0093   // Signals for run seed()
0094   bool isConfigured;
0095   // recHits of a pattern
0096   ConstMuonRecHitContainer theRecHits;
0097   // Complex pattern
0098   double MagnecticFieldThreshold;
0099   GlobalVector meanMagneticField2;
0100   bool isStraight2;
0101   GlobalVector Center2;
0102   double meanRadius2;
0103   RPCSegment SegmentRB[2];
0104   GlobalPoint entryPosition;
0105   GlobalPoint leavePosition;
0106   double lastPhi;
0107   double S;
0108   // Simple pattern
0109   bool isStraight;
0110   GlobalVector Center;
0111   double meanRadius;
0112   double meanBz;
0113   double deltaBz;
0114   // Pattern estimation part
0115   bool isPatternChecked;
0116   int isGoodPattern;
0117   int isClockwise;
0118   int isParralZ;
0119   int Charge;
0120   double meanPt;
0121   double meanSpt;
0122   GlobalVector Momentum;
0123 };
0124 
0125 #endif