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
ME0SegAlgoRU::SegmentParameters::maxTOFDiff
float maxTOFDiff
Definition: ME0SegAlgoRU.h:40
ME0SegAlgoRU::isHitNearSegment
bool isHitNearSegment(const float maxETA, const float maxPHI, const std::unique_ptr< MuonSegFit > &fit, const HitAndPositionPtrContainer &proto_segment, const HitAndPosition &h) const
Definition: ME0SegAlgoRU.cc:397
ME0SegAlgoRU::theChamber
const ME0Chamber * theChamber
Definition: ME0SegAlgoRU.h:136
ME0SegAlgoRU::pruneBadHits
void pruneBadHits(const float maxChi2, HitAndPositionPtrContainer &proto_segment, std::unique_ptr< MuonSegFit > &fit, const unsigned int n_seg_min) const
Definition: ME0SegAlgoRU.cc:458
ME0RecHit.h
testProducerWithPsetDescEmpty_cfi.i2
i2
Definition: testProducerWithPsetDescEmpty_cfi.py:46
ME0SegAlgoRU::SegmentParameters::maxETASeeds
float maxETASeeds
Definition: ME0SegAlgoRU.h:34
ME0SegAlgoRU::SegmentParameters::requireCentralBX
bool requireCentralBX
Definition: ME0SegAlgoRU.h:41
ME0SegmentAlgorithmBase::HitAndPositionContainer
std::vector< HitAndPosition > HitAndPositionContainer
Definition: ME0SegmentAlgorithmBase.h:35
ME0SegAlgoRU::SegmentParameters::maxPhiSeeds
float maxPhiSeeds
Definition: ME0SegAlgoRU.h:35
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
ME0SegmentAlgorithmBase
Definition: ME0SegmentAlgorithmBase.h:23
ME0SegAlgoRU::stdParameters
SegmentParameters stdParameters
Definition: ME0SegAlgoRU.h:131
ME0SegAlgoRU::allowWideSegments
bool allowWideSegments
Definition: ME0SegAlgoRU.h:129
ME0SegAlgoRU::makeFit
std::unique_ptr< MuonSegFit > makeFit(const HitAndPositionPtrContainer &proto_segment) const
Definition: ME0SegAlgoRU.cc:443
testProducerWithPsetDescEmpty_cfi.i1
i1
Definition: testProducerWithPsetDescEmpty_cfi.py:45
beam_dqm_sourceclient-live_cfg.maxChi2
maxChi2
Definition: beam_dqm_sourceclient-live_cfg.py:147
ME0SegAlgoRU::increaseProtoSegment
void increaseProtoSegment(const float maxChi2, std::unique_ptr< MuonSegFit > &current_fit, HitAndPositionPtrContainer &current_proto_segment, const HitAndPosition &new_hit) const
Definition: ME0SegAlgoRU.cc:541
ME0SegAlgoRU::areHitsConsistentInTime
bool areHitsConsistentInTime(const float maxTOF, const HitAndPositionPtrContainer &proto_segment, const HitAndPosition &h) const
Definition: ME0SegAlgoRU.cc:416
ME0SegAlgoRU::SegmentParameters::requireBeamConstr
bool requireBeamConstr
Definition: ME0SegAlgoRU.h:43
HLT_FULL_cff.maxPhi
maxPhi
Definition: HLT_FULL_cff.py:52995
ME0SegAlgoRU::addHit
std::unique_ptr< MuonSegFit > addHit(HitAndPositionPtrContainer &proto_segment, const HitAndPosition &aHit) const
Definition: ME0SegAlgoRU.cc:436
ME0SegmentAlgorithmBase::HitAndPositionPtrContainer
std::vector< const HitAndPosition * > HitAndPositionPtrContainer
Definition: ME0SegmentAlgorithmBase.h:36
ME0SegAlgoRU::SegmentByMetricContainer
std::vector< std::pair< float, HitAndPositionPtrContainer > > SegmentByMetricContainer
Definition: ME0SegAlgoRU.h:48
ME0SegAlgoRU::areHitsCloseInEta
bool areHitsCloseInEta(const float maxETA, const bool beamConst, const GlobalPoint &h1, const GlobalPoint &h2) const
Definition: ME0SegAlgoRU.cc:374
ME0SegAlgoRU::areHitsCloseInGlobalPhi
bool areHitsCloseInGlobalPhi(const float maxPHI, const unsigned int nLayDisp, const GlobalPoint &h1, const GlobalPoint &h2) const
Definition: ME0SegAlgoRU.cc:386
ME0SegAlgoRU::getHitSegChi2
float getHitSegChi2(const std::unique_ptr< MuonSegFit > &fit, const ME0RecHit &hit) const
Definition: ME0SegAlgoRU.cc:480
DDAxes::z
HI_PhotonSkim_cff.rechits
rechits
Definition: HI_PhotonSkim_cff.py:76
h
ME0SegAlgoRU::displacedParameters
SegmentParameters displacedParameters
Definition: ME0SegAlgoRU.h:132
Point3DBase< float, GlobalTag >
ME0SegAlgoRU
Definition: ME0SegAlgoRU.h:31
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
edm::ParameterSet
Definition: ParameterSet.h:47
MuonSegFit
Definition: MuonSegFit.h:34
ME0SegAlgoRU::SegmentParameters::maxChi2Prune
float maxChi2Prune
Definition: ME0SegAlgoRU.h:38
ME0SegAlgoRU::compareProtoSegment
void compareProtoSegment(std::unique_ptr< MuonSegFit > &current_fit, HitAndPositionPtrContainer &current_proto_segment, const HitAndPosition &new_hit) const
Definition: ME0SegAlgoRU.cc:503
ME0SegAlgoRU::SegmentParameters
Definition: ME0SegAlgoRU.h:33
ME0Chamber
Definition: ME0Chamber.h:10
ME0SegAlgoRU::tryAddingHitsToSegment
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
Definition: ME0SegAlgoRU.cc:335
ME0SegAlgoRU::SegmentParameters::maxPhiAdditional
float maxPhiAdditional
Definition: ME0SegAlgoRU.h:36
ME0SegAlgoRU::hasHitOnLayer
bool hasHitOnLayer(const HitAndPositionPtrContainer &proto_segment, const unsigned int layer) const
Definition: ME0SegAlgoRU.cc:496
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ME0SegAlgoRU::addUniqueSegments
void addUniqueSegments(SegmentByMetricContainer &proto_segments, std::vector< ME0Segment > &segments, BoolContainer &used) const
Definition: ME0SegAlgoRU.cc:268
ME0SegAlgoRU::~ME0SegAlgoRU
~ME0SegAlgoRU() override
Destructor.
Definition: ME0SegAlgoRU.h:53
ME0SegmentAlgorithmBase.h
ME0RecHit
Definition: ME0RecHit.h:16
ME0SegAlgoRU::SegmentParameters::maxChi2Additional
float maxChi2Additional
Definition: ME0SegAlgoRU.h:37
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
ME0SegAlgoRU::wideParameters
SegmentParameters wideParameters
Definition: ME0SegAlgoRU.h:133
ME0SegAlgoRU::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< ME0Segment > &segments) const
Definition: ME0SegAlgoRU.cc:175
ME0SegAlgoRU::globalAtZ
GlobalPoint globalAtZ(const std::unique_ptr< MuonSegFit > &fit, float z) const
Definition: ME0SegAlgoRU.cc:430
ME0SegAlgoRU::SegmentParameters::maxChi2GoodSeg
float maxChi2GoodSeg
Definition: ME0SegAlgoRU.h:39
ME0SegAlgoRU::BoolContainer
std::vector< bool > BoolContainer
Definition: ME0SegAlgoRU.h:47
ME0SegAlgoRU::doCollisions
bool doCollisions
Definition: ME0SegAlgoRU.h:128
ME0SegAlgoRU::ME0SegAlgoRU
ME0SegAlgoRU(const edm::ParameterSet &ps)
Constructor.
Definition: ME0SegAlgoRU.cc:25
ME0SegAlgoRU::SegmentParameters::minNumberOfHits
unsigned int minNumberOfHits
Definition: ME0SegAlgoRU.h:42
MuonSegFit.h
fit
Definition: CombinedChiSquaredLikelihood.h:6
HLT_FULL_cff.maxETA
maxETA
Definition: HLT_FULL_cff.py:50885
hit
Definition: SiStripHitEffFromCalibTree.cc:88
ME0SegAlgoRU::myName
const std::string myName
Definition: ME0SegAlgoRU.h:127
ME0SegAlgoRU::run
std::vector< ME0Segment > run(const ME0Chamber *chamber, const HitAndPositionContainer &rechits) override
Definition: ME0SegAlgoRU.cc:72