![]() |
|
|||
File indexing completed on 2024-09-07 04:37:40
0001 #ifndef CSCSegment_CSCSegAlgoTC_h 0002 #define CSCSegment_CSCSegAlgoTC_h 0003 0004 /** 0005 * \class CSCSegAlgoTC 0006 * 0007 * This is an alternative algorithm for building endcap muon track segments 0008 * out of the rechit's in a CSCChamber. cf. CSCSegmentizerSK.<BR> 0009 * 'TC' = 'Tim Cox' = Try (all) Combinations <BR> 0010 * 0011 * A CSCSegment isa BasicRecHit4D, and is built from 0012 * CSCRhit objects, each of which isa BasicRecHit2D. <BR> 0013 * 0014 * This class is used by the CSCSegmentRecDet. <BR> 0015 * Alternative algorithms can be used for the segment building 0016 * by writing classes like this, and then selecting which one is actually 0017 * used via the CSCSegmentizerBuilder in CSCDetector. <BR> 0018 * 0019 * Ported to CMSSW 2006-04-03: Matteo.Sani@cern.ch <BR> 0020 * 0021 * Replaced least-squares fit by CSCSegFit - Feb 2015 <BR> 0022 * 0023 */ 0024 0025 #include <RecoLocalMuon/CSCSegment/src/CSCSegmentAlgorithm.h> 0026 0027 #include <DataFormats/CSCRecHit/interface/CSCRecHit2D.h> 0028 0029 #include <deque> 0030 #include <vector> 0031 0032 class CSCSegFit; 0033 0034 class CSCSegAlgoTC : public CSCSegmentAlgorithm { 0035 public: 0036 /// Typedefs 0037 typedef std::vector<int> LayerIndex; 0038 typedef std::vector<const CSCRecHit2D*> ChamberHitContainer; 0039 typedef ChamberHitContainer::const_iterator ChamberHitContainerCIt; 0040 0041 // We need to be able to flag a hit as 'used' and so need a container 0042 // of bool's. Naively, this would be vector<bool>... but AVOID that since it's 0043 // non-standard i.e. packed-bit implementation which is not a standard STL container. 0044 // We don't need what it offers and it could lead to unexpected trouble in the future 0045 0046 typedef std::deque<bool> BoolContainer; 0047 0048 /// Constructor 0049 explicit CSCSegAlgoTC(const edm::ParameterSet& ps); 0050 /// Destructor 0051 ~CSCSegAlgoTC() override {} 0052 0053 /** 0054 * Build track segments in this chamber (this is where the actual 0055 * segment-building algorithm hides.) 0056 */ 0057 std::vector<CSCSegment> buildSegments(const ChamberHitContainer& rechits); 0058 0059 /** 0060 * Here we must implement the algorithm 0061 */ 0062 std::vector<CSCSegment> run(const CSCChamber* aChamber, const ChamberHitContainer& rechits) override; 0063 0064 private: 0065 /// Utility functions 0066 0067 bool addHit(const CSCRecHit2D* aHit, int layer); 0068 bool replaceHit(const CSCRecHit2D* h, int layer); 0069 void compareProtoSegment(const CSCRecHit2D* h, int layer); 0070 void increaseProtoSegment(const CSCRecHit2D* h, int layer); 0071 0072 /** 0073 * Return true if the difference in (local) x of two hits is < dRPhiMax 0074 */ 0075 bool areHitsCloseInLocalX(const CSCRecHit2D* h1, const CSCRecHit2D* h2) const; 0076 0077 /** 0078 * Return true if the difference in (global) phi of two hits is < dPhiMax 0079 */ 0080 bool areHitsCloseInGlobalPhi(const CSCRecHit2D* h1, const CSCRecHit2D* h2) const; 0081 0082 bool hasHitOnLayer(int layer) const; 0083 0084 /** 0085 * Return true if hit is near segment. 0086 * 'Near' means deltaphi and rxy*deltaphi are within ranges 0087 * specified by config parameters dPhiFineMax and dRPhiFineMax, 0088 * where rxy = sqrt(x**2+y**2) of the hit in global coordinates. 0089 */ 0090 bool isHitNearSegment(const CSCRecHit2D* h) const; 0091 0092 /** 0093 * Dump global and local coordinate of each rechit in chamber after sort in z 0094 */ 0095 void dumpHits(const ChamberHitContainer& rechits) const; 0096 0097 /** 0098 * Try adding non-used hits to segment 0099 */ 0100 void tryAddingHitsToSegment(const ChamberHitContainer& rechits, 0101 const ChamberHitContainerCIt i1, 0102 const ChamberHitContainerCIt i2); 0103 0104 /** 0105 * Return true if segment is good. 0106 * In this algorithm, this means it shares no hits with any other segment. 0107 * If "SegmentSort=2" also require a minimal chi2 probability of "chi2ndfProbMin". 0108 */ 0109 bool isSegmentGood(std::vector<CSCSegFit*>::iterator is, 0110 const ChamberHitContainer& rechitsInChamber, 0111 BoolContainer& used) const; 0112 0113 /** 0114 * Flag hits on segment as used 0115 */ 0116 void flagHitsAsUsed(std::vector<CSCSegFit*>::iterator is, 0117 const ChamberHitContainer& rechitsInChamber, 0118 BoolContainer& used) const; 0119 0120 /** 0121 * Order segments by quality (chi2/#hits) and select the best, 0122 * requiring that they have unique hits. 0123 */ 0124 void pruneTheSegments(const ChamberHitContainer& rechitsInChamber); 0125 /** 0126 * Sort criterion for segment quality, for use in pruneTheSegments. 0127 */ 0128 void segmentSort(void); 0129 0130 float phiAtZ(float z) const; 0131 0132 void updateParameters(void); 0133 0134 void dumpSegment(const CSCSegment& seg) const; 0135 0136 /// Member variables 0137 // ================ 0138 0139 const CSCChamber* theChamber; 0140 0141 ChamberHitContainer proto_segment; 0142 0143 // Pointer to most recent candidate fit 0144 CSCSegFit* sfit_; 0145 0146 // Store pointers to set of candidate fits 0147 std::vector<CSCSegFit*> candidates; 0148 0149 /** max segment chi squared 0150 */ 0151 float chi2Max; 0152 0153 /** min segment chi squared probability. 0154 * Used ONLY if SegmentSorting is chosen to be 2 0155 */ 0156 float chi2ndfProbMin; 0157 0158 /** max hit deviation in r-phi from the segment axis. 0159 * Function hitNearSegment requires rxy*abs(deltaphi) < dRPhiFineMax. 0160 */ 0161 float dRPhiFineMax; 0162 0163 /** max hit deviation in global phi from the segment axis. 0164 * Function hitNearSegment requires abs(deltaphi) < dPhiFineMax. 0165 */ 0166 float dPhiFineMax; 0167 0168 /** max distance in local x between hits in one segment 0169 * @@ The name is historical! 0170 */ 0171 float dRPhiMax; 0172 0173 /** max distance in global phi between hits in one segment 0174 */ 0175 float dPhiMax; 0176 0177 /** Require end-points of segment are at least minLayersApart 0178 */ 0179 int minLayersApart; 0180 0181 /** Select which segment sorting to use (the higher the segment 0182 * is in the list, the better the segment is supposed to be): 0183 * if value is ==1: Sort segments by Chi2/(#hits on segment) 0184 * if value is ==2: Sort segments first by #hits on segment, 0185 * then by Chi2Probability(Chi2/ndf) 0186 */ 0187 int SegmentSorting; 0188 0189 /** Name of this class 0190 */ 0191 const std::string myName; 0192 bool debugInfo; 0193 }; 0194 0195 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.2.1 LXR engine. The LXR team |
![]() ![]() |