File indexing completed on 2024-09-07 04:37:41
0001 #ifndef RecoLocalMuon_GEMSegment_GE0SegAlgoRU_h
0002 #define RecoLocalMuon_GEMSegment_GE0SegAlgoRU_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025 #include <RecoLocalMuon/GEMSegment/plugins/GEMSegmentAlgorithmBase.h>
0026 #include <DataFormats/GEMRecHit/interface/GEMRecHit.h>
0027 #include "MuonSegFit.h"
0028
0029 #include <vector>
0030
0031 class MuonSegFit;
0032 class GE0SegAlgoRU : public GEMSegmentAlgorithmBase {
0033 public:
0034 struct SegmentParameters {
0035 float maxETASeeds;
0036 float maxPhiSeeds;
0037 float maxPhiAdditional;
0038 float maxChi2Additional;
0039 float maxChi2Prune;
0040 float maxChi2GoodSeg;
0041 bool requireCentralBX;
0042 unsigned int minNumberOfHits;
0043 unsigned int maxNumberOfHits;
0044 unsigned int maxNumberOfHitsPerLayer;
0045 bool requireBeamConstr;
0046 };
0047
0048
0049 struct HitAndPosition {
0050 HitAndPosition(const GEMRecHit* rh, const LocalPoint& lp, const GlobalPoint& gp, unsigned int idx)
0051 : rh(rh), lp(lp), gp(gp), layer(rh->gemId().layer()), idx(idx) {}
0052 const GEMRecHit* rh;
0053 LocalPoint lp;
0054 GlobalPoint gp;
0055 unsigned int layer;
0056 unsigned int idx;
0057 };
0058 typedef std::vector<HitAndPosition> HitAndPositionContainer;
0059 typedef std::vector<const HitAndPosition*> HitAndPositionPtrContainer;
0060
0061
0062 typedef std::vector<bool> BoolContainer;
0063 typedef std::vector<std::pair<float, HitAndPositionPtrContainer> > SegmentByMetricContainer;
0064
0065
0066 explicit GE0SegAlgoRU(const edm::ParameterSet& ps);
0067
0068 ~GE0SegAlgoRU() override {}
0069
0070
0071
0072
0073 std::vector<GEMSegment> run(const GEMSuperChamber* chamber, const HitAndPositionContainer& rechits);
0074
0075
0076
0077 std::vector<GEMSegment> run(const GEMEnsemble& ensemble, const std::vector<const GEMRecHit*>& rechits) override;
0078
0079 private:
0080
0081 void lookForSegments(const SegmentParameters& params,
0082 const unsigned int n_seg_min,
0083 const HitAndPositionContainer& rechits,
0084 const std::vector<unsigned int>& recHits_per_layer,
0085 BoolContainer& used,
0086 std::vector<GEMSegment>& segments) const;
0087
0088 void tryAddingHitsToSegment(const float maxETA,
0089 const float maxPhi,
0090 const float maxChi2,
0091 std::unique_ptr<MuonSegFit>& current_fit,
0092 HitAndPositionPtrContainer& proto_segment,
0093 const BoolContainer& used,
0094 HitAndPositionContainer::const_iterator i1,
0095 HitAndPositionContainer::const_iterator i2) const;
0096
0097 void pruneBadHits(const float maxChi2,
0098 HitAndPositionPtrContainer& proto_segment,
0099 std::unique_ptr<MuonSegFit>& fit,
0100 const unsigned int n_seg_min) const;
0101
0102 void addUniqueSegments(SegmentByMetricContainer& proto_segments,
0103 std::vector<GEMSegment>& segments,
0104 BoolContainer& used) const;
0105
0106
0107 bool areHitsCloseInEta(const float maxETA, const bool beamConst, const GlobalPoint& h1, const GlobalPoint& h2) const;
0108 bool areHitsCloseInGlobalPhi(const float maxPHI,
0109 const unsigned int nLayDisp,
0110 const GlobalPoint& h1,
0111 const GlobalPoint& h2) const;
0112
0113
0114 std::unique_ptr<MuonSegFit> addHit(HitAndPositionPtrContainer& proto_segment, const HitAndPosition& aHit) const;
0115
0116 bool hasHitOnLayer(const HitAndPositionPtrContainer& proto_segment, const unsigned int layer) const;
0117
0118 std::unique_ptr<MuonSegFit> makeFit(const HitAndPositionPtrContainer& proto_segment) const;
0119
0120
0121 bool isHitNearSegment(const float maxETA,
0122 const float maxPHI,
0123 const std::unique_ptr<MuonSegFit>& fit,
0124 const HitAndPositionPtrContainer& proto_segment,
0125 const HitAndPosition& h) const;
0126
0127 float getHitSegChi2(const std::unique_ptr<MuonSegFit>& fit, const GEMRecHit& hit) const;
0128
0129 GlobalPoint globalAtZ(const std::unique_ptr<MuonSegFit>& fit, float z) const;
0130
0131
0132 void compareProtoSegment(std::unique_ptr<MuonSegFit>& current_fit,
0133 HitAndPositionPtrContainer& current_proto_segment,
0134 const HitAndPosition& new_hit) const;
0135
0136 void increaseProtoSegment(const float maxChi2,
0137 std::unique_ptr<MuonSegFit>& current_fit,
0138 HitAndPositionPtrContainer& current_proto_segment,
0139 const HitAndPosition& new_hit) const;
0140
0141 const std::string myName;
0142 bool doCollisions;
0143 bool allowWideSegments;
0144
0145 SegmentParameters stdParameters;
0146 SegmentParameters displacedParameters;
0147 SegmentParameters wideParameters;
0148
0149
0150 const GEMSuperChamber* theChamber;
0151 };
0152
0153 #endif