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 #include <vector>
29 
30 class MuonSegFit;
32 public:
34  float maxETASeeds;
35  float maxPhiSeeds;
38  float maxChi2Prune;
40  float maxTOFDiff;
42  unsigned int minNumberOfHits;
44  };
45 
46  // We need to be able to flag a hit as 'used' and so need a container of bool's.
47  typedef std::vector<bool> BoolContainer;
48  typedef std::vector<std::pair<float, HitAndPositionPtrContainer> > SegmentByMetricContainer;
49 
51  explicit ME0SegAlgoRU(const edm::ParameterSet& ps);
53  ~ME0SegAlgoRU() override{};
54 
58  std::vector<ME0Segment> run(const ME0Chamber* chamber, const HitAndPositionContainer& rechits) override;
59 
60 private:
61  //Look for segments that have at least "n_seg_min" consituents and following the associated paramters
62  void lookForSegments(const SegmentParameters& params,
63  const unsigned int n_seg_min,
65  const std::vector<unsigned int>& recHits_per_layer,
66  BoolContainer& used,
67  std::vector<ME0Segment>& segments) const;
68  //Look for any hits between the two seed hits consistent with a segment
69  void tryAddingHitsToSegment(const float maxTOF,
70  const float maxETA,
71  const float maxPhi,
72  const float maxChi2,
73  std::unique_ptr<MuonSegFit>& current_fit,
74  HitAndPositionPtrContainer& proto_segment,
75  const BoolContainer& used,
76  HitAndPositionContainer::const_iterator i1,
77  HitAndPositionContainer::const_iterator i2) const;
78  //Remove extra hits until the segment passes "maxChi2"
79  void pruneBadHits(const float maxChi2,
80  HitAndPositionPtrContainer& proto_segment,
81  std::unique_ptr<MuonSegFit>& fit,
82  const unsigned int n_seg_min) const;
83  //Remove any overlapping segments by which has the lowset chi2
84  void addUniqueSegments(SegmentByMetricContainer& proto_segments,
85  std::vector<ME0Segment>& segments,
86  BoolContainer& used) const;
87 
88  //Are the two seed hits consistent spatially?
89  bool areHitsCloseInEta(const float maxETA, const bool beamConst, const GlobalPoint& h1, const GlobalPoint& h2) const;
90  bool areHitsCloseInGlobalPhi(const float maxPHI,
91  const unsigned int nLayDisp,
92  const GlobalPoint& h1,
93  const GlobalPoint& h2) const;
94 
95  //Add a hit to a segment
96  std::unique_ptr<MuonSegFit> addHit(HitAndPositionPtrContainer& proto_segment, const HitAndPosition& aHit) const;
97  //Does the segment have any hits on this layer?
98  bool hasHitOnLayer(const HitAndPositionPtrContainer& proto_segment, const unsigned int layer) const;
99  //Produce a new fit
100  std::unique_ptr<MuonSegFit> makeFit(const HitAndPositionPtrContainer& proto_segment) const;
101 
102  //Is this hit consistent in time with the other hits?
103  bool areHitsConsistentInTime(const float maxTOF,
104  const HitAndPositionPtrContainer& proto_segment,
105  const HitAndPosition& h) const;
106  //Is this new hit btw the seeds near the segment fit?
107  bool isHitNearSegment(const float maxETA,
108  const float maxPHI,
109  const std::unique_ptr<MuonSegFit>& fit,
110  const HitAndPositionPtrContainer& proto_segment,
111  const HitAndPosition& h) const;
112  //Return a chi2 for a hit and a predicted segment extrapolation
113  float getHitSegChi2(const std::unique_ptr<MuonSegFit>& fit, const ME0RecHit& hit) const;
114  //Global point of a segment extrapolated to a Z value
115  GlobalPoint globalAtZ(const std::unique_ptr<MuonSegFit>& fit, float z) const;
116 
117  //Try adding a hit instead of another and return new or old, depending on which has the smallest chi2
118  void compareProtoSegment(std::unique_ptr<MuonSegFit>& current_fit,
119  HitAndPositionPtrContainer& current_proto_segment,
120  const HitAndPosition& new_hit) const;
121  //Try adding this hit to the segment, dont if the new chi2 is too big
122  void increaseProtoSegment(const float maxChi2,
123  std::unique_ptr<MuonSegFit>& current_fit,
124  HitAndPositionPtrContainer& current_proto_segment,
125  const HitAndPosition& new_hit) const;
126 
130 
134 
135  //Objects used to produce the segments
137 };
138 
139 #endif
void pruneBadHits(const float maxChi2, HitAndPositionPtrContainer &proto_segment, std::unique_ptr< MuonSegFit > &fit, const unsigned int n_seg_min) const
bool hasHitOnLayer(const HitAndPositionPtrContainer &proto_segment, const unsigned int layer) const
void addUniqueSegments(SegmentByMetricContainer &proto_segments, std::vector< ME0Segment > &segments, BoolContainer &used) const
std::unique_ptr< MuonSegFit > makeFit(const HitAndPositionPtrContainer &proto_segment) const
SegmentParameters displacedParameters
Definition: ME0SegAlgoRU.h:132
std::vector< HitAndPosition > HitAndPositionContainer
constexpr std::array< uint8_t, layerIndexSize > layer
void increaseProtoSegment(const float maxChi2, std::unique_ptr< MuonSegFit > &current_fit, HitAndPositionPtrContainer &current_proto_segment, const HitAndPosition &new_hit) const
std::vector< const HitAndPosition * > HitAndPositionPtrContainer
bool areHitsCloseInEta(const float maxETA, const bool beamConst, const GlobalPoint &h1, const GlobalPoint &h2) const
ME0SegAlgoRU(const edm::ParameterSet &ps)
Constructor.
Definition: ME0SegAlgoRU.cc:25
~ME0SegAlgoRU() override
Destructor.
Definition: ME0SegAlgoRU.h:53
const std::string myName
Definition: ME0SegAlgoRU.h:127
std::vector< bool > BoolContainer
Definition: ME0SegAlgoRU.h:47
bool isHitNearSegment(const float maxETA, const float maxPHI, const std::unique_ptr< MuonSegFit > &fit, const HitAndPositionPtrContainer &proto_segment, const HitAndPosition &h) const
float getHitSegChi2(const std::unique_ptr< MuonSegFit > &fit, const ME0RecHit &hit) const
SegmentParameters stdParameters
Definition: ME0SegAlgoRU.h:131
GlobalPoint globalAtZ(const std::unique_ptr< MuonSegFit > &fit, float z) const
bool areHitsCloseInGlobalPhi(const float maxPHI, const unsigned int nLayDisp, const GlobalPoint &h1, const GlobalPoint &h2) const
bool areHitsConsistentInTime(const float maxTOF, const HitAndPositionPtrContainer &proto_segment, const HitAndPosition &h) const
std::vector< std::pair< float, HitAndPositionPtrContainer > > SegmentByMetricContainer
Definition: ME0SegAlgoRU.h:48
const ME0Chamber * theChamber
Definition: ME0SegAlgoRU.h:136
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
std::vector< ME0Segment > run(const ME0Chamber *chamber, const HitAndPositionContainer &rechits) override
Definition: ME0SegAlgoRU.cc:72
void compareProtoSegment(std::unique_ptr< MuonSegFit > &current_fit, HitAndPositionPtrContainer &current_proto_segment, const HitAndPosition &new_hit) const
std::unique_ptr< MuonSegFit > addHit(HitAndPositionPtrContainer &proto_segment, const HitAndPosition &aHit) const
bool allowWideSegments
Definition: ME0SegAlgoRU.h:129
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
SegmentParameters wideParameters
Definition: ME0SegAlgoRU.h:133
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