CMS 3D CMS Logo

GE0SegAlgoRU.h
Go to the documentation of this file.
1 #ifndef RecoLocalMuon_GEMSegment_GE0SegAlgoRU_h
2 #define RecoLocalMuon_GEMSegment_GE0SegAlgoRU_h
3 
27 #include "MuonSegFit.h"
28 
29 #include <vector>
30 
31 class MuonSegFit;
33 public:
35  float maxETASeeds;
36  float maxPhiSeeds;
39  float maxChi2Prune;
42  unsigned int minNumberOfHits;
43  unsigned int maxNumberOfHits;
46  };
47 
48  // originally from ME0SegmentAlgorithmBase
49  struct HitAndPosition {
50  HitAndPosition(const GEMRecHit* rh, const LocalPoint& lp, const GlobalPoint& gp, unsigned int idx)
51  : rh(rh), lp(lp), gp(gp), layer(rh->gemId().layer()), idx(idx) {}
52  const GEMRecHit* rh;
55  unsigned int layer;
56  unsigned int idx;
57  };
58  typedef std::vector<HitAndPosition> HitAndPositionContainer;
59  typedef std::vector<const HitAndPosition*> HitAndPositionPtrContainer;
60 
61  // We need to be able to flag a hit as 'used' and so need a container of bool's.
62  typedef std::vector<bool> BoolContainer;
63  typedef std::vector<std::pair<float, HitAndPositionPtrContainer> > SegmentByMetricContainer;
64 
66  explicit GE0SegAlgoRU(const edm::ParameterSet& ps);
68  ~GE0SegAlgoRU() override{};
69 
73  std::vector<GEMSegment> run(const GEMSuperChamber* chamber, const HitAndPositionContainer& rechits);
74  // The original ME0SegAlgoRU used the run(..) function above, we
75  // implement a small wrapper to use with GEMSegments fairly
76  // transparently
77  std::vector<GEMSegment> run(const GEMEnsemble& ensemble, const std::vector<const GEMRecHit*>& rechits) override;
78 
79 private:
80  //Look for segments that have at least "n_seg_min" consituents and following the associated paramters
81  void lookForSegments(const SegmentParameters& params,
82  const unsigned int n_seg_min,
84  const std::vector<unsigned int>& recHits_per_layer,
85  BoolContainer& used,
86  std::vector<GEMSegment>& segments) const;
87  //Look for any hits between the two seed hits consistent with a segment
88  void tryAddingHitsToSegment(const float maxETA,
89  const float maxPhi,
90  const float maxChi2,
91  std::unique_ptr<MuonSegFit>& current_fit,
92  HitAndPositionPtrContainer& proto_segment,
93  const BoolContainer& used,
94  HitAndPositionContainer::const_iterator i1,
95  HitAndPositionContainer::const_iterator i2) const;
96  //Remove extra hits until the segment passes "maxChi2"
97  void pruneBadHits(const float maxChi2,
98  HitAndPositionPtrContainer& proto_segment,
99  std::unique_ptr<MuonSegFit>& fit,
100  const unsigned int n_seg_min) const;
101  //Remove any overlapping segments by which has the lowset chi2
102  void addUniqueSegments(SegmentByMetricContainer& proto_segments,
103  std::vector<GEMSegment>& segments,
104  BoolContainer& used) const;
105 
106  //Are the two seed hits consistent spatially?
107  bool areHitsCloseInEta(const float maxETA, const bool beamConst, const GlobalPoint& h1, const GlobalPoint& h2) const;
108  bool areHitsCloseInGlobalPhi(const float maxPHI,
109  const unsigned int nLayDisp,
110  const GlobalPoint& h1,
111  const GlobalPoint& h2) const;
112 
113  //Add a hit to a segment
114  std::unique_ptr<MuonSegFit> addHit(HitAndPositionPtrContainer& proto_segment, const HitAndPosition& aHit) const;
115  //Does the segment have any hits on this layer?
116  bool hasHitOnLayer(const HitAndPositionPtrContainer& proto_segment, const unsigned int layer) const;
117  //Produce a new fit
118  std::unique_ptr<MuonSegFit> makeFit(const HitAndPositionPtrContainer& proto_segment) const;
119 
120  //Is this new hit btw the seeds near the segment fit?
121  bool isHitNearSegment(const float maxETA,
122  const float maxPHI,
123  const std::unique_ptr<MuonSegFit>& fit,
124  const HitAndPositionPtrContainer& proto_segment,
125  const HitAndPosition& h) const;
126  //Return a chi2 for a hit and a predicted segment extrapolation
127  float getHitSegChi2(const std::unique_ptr<MuonSegFit>& fit, const GEMRecHit& hit) const;
128  //Global point of a segment extrapolated to a Z value
129  GlobalPoint globalAtZ(const std::unique_ptr<MuonSegFit>& fit, float z) const;
130 
131  //Try adding a hit instead of another and return new or old, depending on which has the smallest chi2
132  void compareProtoSegment(std::unique_ptr<MuonSegFit>& current_fit,
133  HitAndPositionPtrContainer& current_proto_segment,
134  const HitAndPosition& new_hit) const;
135  //Try adding this hit to the segment, dont if the new chi2 is too big
136  void increaseProtoSegment(const float maxChi2,
137  std::unique_ptr<MuonSegFit>& current_fit,
138  HitAndPositionPtrContainer& current_proto_segment,
139  const HitAndPosition& new_hit) const;
140 
144 
148 
149  //Objects used to produce the segments
151 };
152 
153 #endif
GE0SegAlgoRU::SegmentParameters::maxChi2Prune
float maxChi2Prune
Definition: GE0SegAlgoRU.h:39
testProducerWithPsetDescEmpty_cfi.i2
i2
Definition: testProducerWithPsetDescEmpty_cfi.py:46
GE0SegAlgoRU::compareProtoSegment
void compareProtoSegment(std::unique_ptr< MuonSegFit > &current_fit, HitAndPositionPtrContainer &current_proto_segment, const HitAndPosition &new_hit) const
Definition: GE0SegAlgoRU.cc:497
GE0SegAlgoRU::~GE0SegAlgoRU
~GE0SegAlgoRU() override
Destructor.
Definition: GE0SegAlgoRU.h:68
GE0SegAlgoRU::myName
const std::string myName
Definition: GE0SegAlgoRU.h:141
GEMRecHit.h
GE0SegAlgoRU::HitAndPositionContainer
std::vector< HitAndPosition > HitAndPositionContainer
Definition: GE0SegAlgoRU.h:58
GEMSuperChamber
Definition: GEMSuperChamber.h:19
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
GE0SegAlgoRU::isHitNearSegment
bool isHitNearSegment(const float maxETA, const float maxPHI, const std::unique_ptr< MuonSegFit > &fit, const HitAndPositionPtrContainer &proto_segment, const HitAndPosition &h) const
Definition: GE0SegAlgoRU.cc:407
GE0SegAlgoRU::SegmentParameters::minNumberOfHits
unsigned int minNumberOfHits
Definition: GE0SegAlgoRU.h:42
GE0SegAlgoRU::areHitsCloseInGlobalPhi
bool areHitsCloseInGlobalPhi(const float maxPHI, const unsigned int nLayDisp, const GlobalPoint &h1, const GlobalPoint &h2) const
Definition: GE0SegAlgoRU.cc:396
GE0SegAlgoRU::addUniqueSegments
void addUniqueSegments(SegmentByMetricContainer &proto_segments, std::vector< GEMSegment > &segments, BoolContainer &used) const
Definition: GE0SegAlgoRU.cc:287
testProducerWithPsetDescEmpty_cfi.i1
i1
Definition: testProducerWithPsetDescEmpty_cfi.py:45
GE0SegAlgoRU
Definition: GE0SegAlgoRU.h:32
beam_dqm_sourceclient-live_cfg.maxChi2
maxChi2
Definition: beam_dqm_sourceclient-live_cfg.py:147
GE0SegAlgoRU::SegmentParameters::maxPhiSeeds
float maxPhiSeeds
Definition: GE0SegAlgoRU.h:36
GE0SegAlgoRU::hasHitOnLayer
bool hasHitOnLayer(const HitAndPositionPtrContainer &proto_segment, const unsigned int layer) const
Definition: GE0SegAlgoRU.cc:490
GE0SegAlgoRU::wideParameters
SegmentParameters wideParameters
Definition: GE0SegAlgoRU.h:147
GE0SegAlgoRU::doCollisions
bool doCollisions
Definition: GE0SegAlgoRU.h:142
HLT_FULL_cff.maxPhi
maxPhi
Definition: HLT_FULL_cff.py:52995
GE0SegAlgoRU::HitAndPosition::rh
const GEMRecHit * rh
Definition: GE0SegAlgoRU.h:52
GE0SegAlgoRU::displacedParameters
SegmentParameters displacedParameters
Definition: GE0SegAlgoRU.h:146
GE0SegAlgoRU::HitAndPosition::HitAndPosition
HitAndPosition(const GEMRecHit *rh, const LocalPoint &lp, const GlobalPoint &gp, unsigned int idx)
Definition: GE0SegAlgoRU.h:50
GE0SegAlgoRU::lookForSegments
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< GEMSegment > &segments) const
Definition: GE0SegAlgoRU.cc:200
GE0SegAlgoRU::SegmentByMetricContainer
std::vector< std::pair< float, HitAndPositionPtrContainer > > SegmentByMetricContainer
Definition: GE0SegAlgoRU.h:63
GE0SegAlgoRU::makeFit
std::unique_ptr< MuonSegFit > makeFit(const HitAndPositionPtrContainer &proto_segment) const
Definition: GE0SegAlgoRU.cc:437
GE0SegAlgoRU::SegmentParameters::maxETASeeds
float maxETASeeds
Definition: GE0SegAlgoRU.h:35
DDAxes::z
GE0SegAlgoRU::addHit
std::unique_ptr< MuonSegFit > addHit(HitAndPositionPtrContainer &proto_segment, const HitAndPosition &aHit) const
Definition: GE0SegAlgoRU.cc:430
GEMSegmentAlgorithmBase::GEMEnsemble
std::pair< const GEMSuperChamber *, std::map< uint32_t, const GEMEtaPartition * > > GEMEnsemble
Definition: GEMSegmentAlgorithmBase.h:25
HI_PhotonSkim_cff.rechits
rechits
Definition: HI_PhotonSkim_cff.py:76
h
Point3DBase< float, LocalTag >
GE0SegAlgoRU::globalAtZ
GlobalPoint globalAtZ(const std::unique_ptr< MuonSegFit > &fit, float z) const
Definition: GE0SegAlgoRU.cc:424
GE0SegAlgoRU::pruneBadHits
void pruneBadHits(const float maxChi2, HitAndPositionPtrContainer &proto_segment, std::unique_ptr< MuonSegFit > &fit, const unsigned int n_seg_min) const
Definition: GE0SegAlgoRU.cc:452
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
GE0SegAlgoRU::GE0SegAlgoRU
GE0SegAlgoRU(const edm::ParameterSet &ps)
Constructor.
Definition: GE0SegAlgoRU.cc:26
GE0SegAlgoRU::increaseProtoSegment
void increaseProtoSegment(const float maxChi2, std::unique_ptr< MuonSegFit > &current_fit, HitAndPositionPtrContainer &current_proto_segment, const HitAndPosition &new_hit) const
Definition: GE0SegAlgoRU.cc:535
edm::ParameterSet
Definition: ParameterSet.h:47
GE0SegAlgoRU::HitAndPositionPtrContainer
std::vector< const HitAndPosition * > HitAndPositionPtrContainer
Definition: GE0SegAlgoRU.h:59
GE0SegAlgoRU::SegmentParameters::maxPhiAdditional
float maxPhiAdditional
Definition: GE0SegAlgoRU.h:37
GE0SegAlgoRU::SegmentParameters::maxChi2Additional
float maxChi2Additional
Definition: GE0SegAlgoRU.h:38
MuonSegFit
Definition: MuonSegFit.h:34
GE0SegAlgoRU::SegmentParameters::maxChi2GoodSeg
float maxChi2GoodSeg
Definition: GE0SegAlgoRU.h:40
GE0SegAlgoRU::HitAndPosition::gp
GlobalPoint gp
Definition: GE0SegAlgoRU.h:54
GE0SegAlgoRU::allowWideSegments
bool allowWideSegments
Definition: GE0SegAlgoRU.h:143
GE0SegAlgoRU::BoolContainer
std::vector< bool > BoolContainer
Definition: GE0SegAlgoRU.h:62
GE0SegAlgoRU::HitAndPosition
Definition: GE0SegAlgoRU.h:49
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
GE0SegAlgoRU::tryAddingHitsToSegment
void tryAddingHitsToSegment(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
Definition: GE0SegAlgoRU.cc:348
GEMSegmentAlgorithmBase
Definition: GEMSegmentAlgorithmBase.h:23
GE0SegAlgoRU::SegmentParameters
Definition: GE0SegAlgoRU.h:34
GE0SegAlgoRU::SegmentParameters::maxNumberOfHits
unsigned int maxNumberOfHits
Definition: GE0SegAlgoRU.h:43
GE0SegAlgoRU::SegmentParameters::maxNumberOfHitsPerLayer
unsigned int maxNumberOfHitsPerLayer
Definition: GE0SegAlgoRU.h:44
GE0SegAlgoRU::SegmentParameters::requireBeamConstr
bool requireBeamConstr
Definition: GE0SegAlgoRU.h:45
GE0SegAlgoRU::HitAndPosition::layer
unsigned int layer
Definition: GE0SegAlgoRU.h:55
GE0SegAlgoRU::HitAndPosition::idx
unsigned int idx
Definition: GE0SegAlgoRU.h:56
GE0SegAlgoRU::stdParameters
SegmentParameters stdParameters
Definition: GE0SegAlgoRU.h:145
GE0SegAlgoRU::SegmentParameters::requireCentralBX
bool requireCentralBX
Definition: GE0SegAlgoRU.h:41
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
GEMRecHit
Definition: GEMRecHit.h:14
GE0SegAlgoRU::getHitSegChi2
float getHitSegChi2(const std::unique_ptr< MuonSegFit > &fit, const GEMRecHit &hit) const
Definition: GE0SegAlgoRU.cc:474
GE0SegAlgoRU::HitAndPosition::lp
LocalPoint lp
Definition: GE0SegAlgoRU.h:53
GEMSegmentAlgorithmBase.h
GE0SegAlgoRU::areHitsCloseInEta
bool areHitsCloseInEta(const float maxETA, const bool beamConst, const GlobalPoint &h1, const GlobalPoint &h2) const
Definition: GE0SegAlgoRU.cc:384
GE0SegAlgoRU::run
std::vector< GEMSegment > run(const GEMSuperChamber *chamber, const HitAndPositionContainer &rechits)
Definition: GE0SegAlgoRU.cc:98
GE0SegAlgoRU::theChamber
const GEMSuperChamber * theChamber
Definition: GE0SegAlgoRU.h:150
MuonSegFit.h
fit
Definition: CombinedChiSquaredLikelihood.h:6
HLT_FULL_cff.maxETA
maxETA
Definition: HLT_FULL_cff.py:50885
hit
Definition: SiStripHitEffFromCalibTree.cc:88