CMS 3D CMS Logo

ME0SegAlgoRU.h
Go to the documentation of this file.
1 #ifndef ME0Segment_ME0SegAlgoRU_h
2 #define ME0Segment_ME0SegAlgoRU_h
3 
26 #include "MuonSegFit.h"
27 
28 
29 #include <vector>
30 
31 class MuonSegFit;
33 
34 public:
36  float maxETASeeds ;
37  float maxPhiSeeds ;
40  float maxChi2Prune ;
42  float maxTOFDiff ;
44  unsigned int minNumberOfHits;
46 
47  };
48 
49  // We need to be able to flag a hit as 'used' and so need a container of bool's.
50  typedef std::vector<bool> BoolContainer;
51  typedef std::vector<std::pair<float,HitAndPositionPtrContainer> > SegmentByMetricContainer;
52 
54  explicit ME0SegAlgoRU(const edm::ParameterSet& ps);
56  ~ME0SegAlgoRU() override {};
57 
61  std::vector<ME0Segment> run(const ME0Chamber * chamber, const HitAndPositionContainer& rechits) override;
62 
63 private:
64 
65  //Look for segments that have at least "n_seg_min" consituents and following the associated paramters
66  void lookForSegments(const SegmentParameters& params, const unsigned int n_seg_min, const HitAndPositionContainer& rechits, const std::vector<unsigned int>& recHits_per_layer, BoolContainer& used, std::vector<ME0Segment>& segments) const;
67  //Look for any hits between the two seed hits consistent with a segment
68  void tryAddingHitsToSegment( const float maxTOF,const float maxETA, const float maxPhi, const float maxChi2, std::unique_ptr<MuonSegFit>& current_fit, HitAndPositionPtrContainer& proto_segment,
69  const BoolContainer& used, HitAndPositionContainer::const_iterator i1, HitAndPositionContainer::const_iterator i2) const;
70  //Remove extra hits until the segment passes "maxChi2"
71  void pruneBadHits(const float maxChi2, HitAndPositionPtrContainer& proto_segment, std::unique_ptr<MuonSegFit>& fit, const unsigned int n_seg_min) const;
72  //Remove any overlapping segments by which has the lowset chi2
73  void addUniqueSegments(SegmentByMetricContainer& proto_segments, std::vector<ME0Segment>& segments, BoolContainer& used) const;
74 
75  //Are the two seed hits consistent spatially?
76  bool areHitsCloseInEta(const float maxETA, const bool beamConst, const GlobalPoint& h1, const GlobalPoint& h2) const;
77  bool areHitsCloseInGlobalPhi(const float maxPHI, const unsigned int nLayDisp, const GlobalPoint& h1, const GlobalPoint& h2) const;
78 
79  //Add a hit to a segment
80  std::unique_ptr<MuonSegFit> addHit(HitAndPositionPtrContainer& proto_segment, const HitAndPosition& aHit) const;
81  //Does the segment have any hits on this layer?
82  bool hasHitOnLayer(const HitAndPositionPtrContainer& proto_segment, const unsigned int layer) const;
83  //Produce a new fit
84  std::unique_ptr<MuonSegFit> makeFit(const HitAndPositionPtrContainer& proto_segment) const;
85 
86  //Is this hit consistent in time with the other hits?
87  bool areHitsConsistentInTime(const float maxTOF, const HitAndPositionPtrContainer& proto_segment, const HitAndPosition& h) const;
88  //Is this new hit btw the seeds near the segment fit?
89  bool isHitNearSegment(const float maxETA, const float maxPHI, const std::unique_ptr<MuonSegFit>& fit, const HitAndPositionPtrContainer& proto_segment, const HitAndPosition& h) const;
90  //Return a chi2 for a hit and a predicted segment extrapolation
91  float getHitSegChi2(const std::unique_ptr<MuonSegFit>& fit, const ME0RecHit& hit) const;
92  //Global point of a segment extrapolated to a Z value
93  GlobalPoint globalAtZ(const std::unique_ptr<MuonSegFit>& fit, float z) const;
94 
95  //Try adding a hit instead of another and return new or old, depending on which has the smallest chi2
96  void compareProtoSegment(std::unique_ptr<MuonSegFit>& current_fit, HitAndPositionPtrContainer& current_proto_segment, const HitAndPosition& new_hit) const;
97  //Try adding this hit to the segment, dont if the new chi2 is too big
98  void increaseProtoSegment(const float maxChi2, std::unique_ptr<MuonSegFit>& current_fit, HitAndPositionPtrContainer& current_proto_segment, const HitAndPosition& new_hit) const;
99 
100 
104 
108 
109  //Objects used to produce the segments
111 };
112 
113 #endif
void lookForSegments(const SegmentParameters &params, const unsigned int n_seg_min, const HitAndPositionContainer &rechits, const std::vector< unsigned int > &recHits_per_layer, BoolContainer &used, std::vector< ME0Segment > &segments) const
bool areHitsCloseInGlobalPhi(const float maxPHI, const unsigned int nLayDisp, const GlobalPoint &h1, const GlobalPoint &h2) const
std::vector< std::pair< float, HitAndPositionPtrContainer > > SegmentByMetricContainer
Definition: ME0SegAlgoRU.h:51
SegmentParameters displacedParameters
Definition: ME0SegAlgoRU.h:106
void increaseProtoSegment(const float maxChi2, std::unique_ptr< MuonSegFit > &current_fit, HitAndPositionPtrContainer &current_proto_segment, const HitAndPosition &new_hit) const
std::unique_ptr< MuonSegFit > makeFit(const HitAndPositionPtrContainer &proto_segment) const
std::vector< HitAndPosition > HitAndPositionContainer
std::vector< const HitAndPosition * > HitAndPositionPtrContainer
void tryAddingHitsToSegment(const float maxTOF, const float maxETA, const float maxPhi, const float maxChi2, std::unique_ptr< MuonSegFit > &current_fit, HitAndPositionPtrContainer &proto_segment, const BoolContainer &used, HitAndPositionContainer::const_iterator i1, HitAndPositionContainer::const_iterator i2) const
void addUniqueSegments(SegmentByMetricContainer &proto_segments, std::vector< ME0Segment > &segments, BoolContainer &used) const
GlobalPoint globalAtZ(const std::unique_ptr< MuonSegFit > &fit, float z) const
ME0SegAlgoRU(const edm::ParameterSet &ps)
Constructor.
Definition: ME0SegAlgoRU.cc:27
~ME0SegAlgoRU() override
Destructor.
Definition: ME0SegAlgoRU.h:56
const std::string myName
Definition: ME0SegAlgoRU.h:101
std::vector< bool > BoolContainer
Definition: ME0SegAlgoRU.h:50
void pruneBadHits(const float maxChi2, HitAndPositionPtrContainer &proto_segment, std::unique_ptr< MuonSegFit > &fit, const unsigned int n_seg_min) const
bool areHitsConsistentInTime(const float maxTOF, const HitAndPositionPtrContainer &proto_segment, const HitAndPosition &h) const
void compareProtoSegment(std::unique_ptr< MuonSegFit > &current_fit, HitAndPositionPtrContainer &current_proto_segment, const HitAndPosition &new_hit) const
float getHitSegChi2(const std::unique_ptr< MuonSegFit > &fit, const ME0RecHit &hit) const
SegmentParameters stdParameters
Definition: ME0SegAlgoRU.h:105
bool isHitNearSegment(const float maxETA, const float maxPHI, const std::unique_ptr< MuonSegFit > &fit, const HitAndPositionPtrContainer &proto_segment, const HitAndPosition &h) const
bool hasHitOnLayer(const HitAndPositionPtrContainer &proto_segment, const unsigned int layer) const
const ME0Chamber * theChamber
Definition: ME0SegAlgoRU.h:110
std::vector< ME0Segment > run(const ME0Chamber *chamber, const HitAndPositionContainer &rechits) override
Definition: ME0SegAlgoRU.cc:79
bool areHitsCloseInEta(const float maxETA, const bool beamConst, const GlobalPoint &h1, const GlobalPoint &h2) const
bool allowWideSegments
Definition: ME0SegAlgoRU.h:103
SegmentParameters wideParameters
Definition: ME0SegAlgoRU.h:107
std::unique_ptr< MuonSegFit > addHit(HitAndPositionPtrContainer &proto_segment, const HitAndPosition &aHit) const