File indexing completed on 2024-09-07 04:37:39
0001 #ifndef CSCSegment_CSCSegAlgoRU_h
0002 #define CSCSegment_CSCSegAlgoRU_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023 #include <RecoLocalMuon/CSCSegment/src/CSCSegmentAlgorithm.h>
0024 #include <DataFormats/CSCRecHit/interface/CSCRecHit2D.h>
0025 #include "CSCSegFit.h"
0026
0027 #include <Math/Functions.h>
0028 #include <Math/SVector.h>
0029 #include <Math/SMatrix.h>
0030
0031 #include <vector>
0032
0033 class CSCSegFit;
0034
0035 class CSCSegAlgoRU : public CSCSegmentAlgorithm {
0036 public:
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048 typedef ROOT::Math::SVector<double, 6> SVector6;
0049
0050 typedef std::vector<int> LayerIndex;
0051 typedef std::vector<const CSCRecHit2D*> ChamberHitContainer;
0052 typedef std::vector<const CSCRecHit2D*>::const_iterator ChamberHitContainerCIt;
0053
0054
0055
0056
0057
0058
0059 typedef std::vector<bool> BoolContainer;
0060
0061
0062 explicit CSCSegAlgoRU(const edm::ParameterSet& ps);
0063
0064 ~CSCSegAlgoRU() override {}
0065
0066
0067
0068
0069
0070 std::vector<CSCSegment> buildSegments(const CSCChamber* aChamber, const ChamberHitContainer& rechits) const;
0071
0072
0073
0074
0075
0076
0077 std::vector<CSCSegment> run(const CSCChamber* aChamber, const ChamberHitContainer& rechits) override {
0078 return buildSegments(aChamber, rechits);
0079 }
0080
0081 private:
0082 struct AlgoState {
0083 const CSCChamber* aChamber = nullptr;
0084 float windowScale = 0;
0085 int strip_iadd = 0;
0086 int chi2D_iadd = 0;
0087 std::unique_ptr<CSCSegFit> sfit = nullptr;
0088 ChamberHitContainer proto_segment;
0089
0090
0091 bool doCollisions;
0092 float dRMax;
0093 float dPhiMax;
0094 float dRIntMax;
0095 float dPhiIntMax;
0096 float chi2Max;
0097 float chi2_str_;
0098 float chi2Norm_2D_;
0099 };
0100
0101
0102
0103 bool areHitsCloseInR(const AlgoState& aState, const CSCRecHit2D* h1, const CSCRecHit2D* h2) const;
0104 bool areHitsCloseInGlobalPhi(const AlgoState& aState, const CSCRecHit2D* h1, const CSCRecHit2D* h2) const;
0105 bool isHitNearSegment(const AlgoState& aState, const CSCRecHit2D* h) const;
0106
0107
0108
0109
0110 void tryAddingHitsToSegment(AlgoState& aState,
0111 const ChamberHitContainer& rechitsInChamber,
0112 const BoolContainer& used,
0113 const LayerIndex& layerIndex,
0114 const ChamberHitContainerCIt i1,
0115 const ChamberHitContainerCIt i2) const;
0116
0117
0118
0119
0120
0121 bool isSegmentGood(const AlgoState& aState, const ChamberHitContainer& rechitsInChamber) const;
0122
0123
0124
0125
0126 void flagHitsAsUsed(const AlgoState& aState, const ChamberHitContainer& rechitsInChamber, BoolContainer& used) const;
0127
0128
0129 bool addHit(AlgoState& aState, const CSCRecHit2D* hit, int layer) const;
0130 void updateParameters(AlgoState& aState) const;
0131 float fit_r_phi(const AlgoState& aState, const SVector6& points, int layer) const;
0132 float fitX(const AlgoState& aState, SVector6 points, SVector6 errors, int ir, int ir2, float& chi2_str) const;
0133 void baseline(AlgoState& aState, int n_seg_min) const;
0134
0135
0136
0137
0138 float phiAtZ(const AlgoState& aState, float z) const;
0139 bool hasHitOnLayer(const AlgoState& aState, int layer) const;
0140 bool replaceHit(AlgoState& aState, const CSCRecHit2D* h, int layer) const;
0141 void compareProtoSegment(AlgoState& aState, const CSCRecHit2D* h, int layer) const;
0142 void increaseProtoSegment(AlgoState& aState, const CSCRecHit2D* h, int layer, int chi2_factor) const;
0143
0144
0145
0146
0147 const std::string myName;
0148
0149 double theChi2;
0150 LocalPoint theOrigin;
0151 LocalVector theDirection;
0152 float uz, vz;
0153 bool doCollisions;
0154 float dRMax;
0155 float dPhiMax;
0156 float dRIntMax;
0157 float dPhiIntMax;
0158 float chi2Max;
0159 float chi2_str_;
0160 float chi2Norm_2D_;
0161 float wideSeg;
0162 int minLayersApart;
0163 bool debugInfo;
0164 };
0165
0166 #endif