CMS 3D CMS Logo

CSCSegAlgoRU.h
Go to the documentation of this file.
1 #ifndef CSCSegment_CSCSegAlgoRU_h
2 #define CSCSegment_CSCSegAlgoRU_h
3 
25 #include "CSCSegFit.h"
26 
27 #include <Math/Functions.h>
28 #include <Math/SVector.h>
29 #include <Math/SMatrix.h>
30 
31 #include <vector>
32 
33 
34 class CSCSegFit;
35 
37 
38 public:
39 
40  // Tim tried using map as basic container of all (space-point) RecHit's in a chamber:
41  // The 'key' is a pseudo-layer number (1-6 but with 1 always closest to IP).
42  // The 'value' is a vector of the RecHit's on that layer.
43  // Using the layer number like this removes the need to sort in global z.
44  // Instead we just have to ensure the layer index is correctly adjusted
45  // to enforce the requirement that 'layer 1' is closest in the chamber
46  // to the IP.
47 
49 
50 
51  // 4-dim vector
52  typedef ROOT::Math::SVector<double,6> SVector6;
53 
54  typedef std::vector<int> LayerIndex;
55  typedef std::vector<const CSCRecHit2D*> ChamberHitContainer;
56  typedef std::vector<const CSCRecHit2D*>::const_iterator ChamberHitContainerCIt;
57 
58  // We need to be able to flag a hit as 'used' and so need a container
59  // of bool's. Naively, this would be vector<bool>... but AVOID that since it's
60  // non-standard i.e. packed-bit implementation which is not a standard STL container.
61  // We don't need what it offers and it could lead to unexpected trouble in the future.
62 
63  typedef std::vector<bool> BoolContainer;
64 
66  explicit CSCSegAlgoRU(const edm::ParameterSet& ps);
68  virtual ~CSCSegAlgoRU() {};
69 
74  std::vector<CSCSegment> buildSegments(const ChamberHitContainer& rechits);
75 
76  // std::vector<CSCSegment> assambleRechitsInSegments(const ChamberHitContainer& rechits, int iadd, BoolContainer& used, BoolContainer& used3p, int *recHits_per_layer, const LayerIndex& layerIndex, std::vector<CSCSegment> segments);
77 
81  std::vector<CSCSegment> run(const CSCChamber* aChamber, const ChamberHitContainer& rechits);
82 
83 private:
84 
86  // Could be static at the moment, but in principle one
87  // might like CSCSegmentizer-specific behaviour?
88  bool areHitsCloseInR(const CSCRecHit2D* h1, const CSCRecHit2D* h2) const;
89  bool areHitsCloseInGlobalPhi(const CSCRecHit2D* h1, const CSCRecHit2D* h2) const;
90  bool isHitNearSegment(const CSCRecHit2D* h) const;
91 
95  void tryAddingHitsToSegment(const ChamberHitContainer& rechitsInChamber,
96  const BoolContainer& used, const LayerIndex& layerIndex,
97  const ChamberHitContainerCIt i1, const ChamberHitContainerCIt i2);
98 
103  bool isSegmentGood(const ChamberHitContainer& rechitsInChamber) const;
104 
108  void flagHitsAsUsed(const ChamberHitContainer& rechitsInChamber,BoolContainer& used) const;
109 
111  bool addHit(const CSCRecHit2D* hit, int layer);
112  void updateParameters(void);
113  float fit_r_phi(SVector6 points, int layer) const;
114  float fitX(SVector6 points, SVector6 errors, int ir, int ir2, float &chi2_str);
115  void baseline(int n_seg_min);//function for arasing bad hits in case of bad chi2/NDOF
120  float phiAtZ(float z) const;
121  bool hasHitOnLayer(int layer) const;
122  bool replaceHit(const CSCRecHit2D* h, int layer);
123  void compareProtoSegment(const CSCRecHit2D* h, int layer);
124  void increaseProtoSegment(const CSCRecHit2D* h, int layer, int chi2_factor);
125 
126 
127  // Member variables
128  // ================
129 
131  ChamberHitContainer proto_segment;
133 
134  double theChi2;
137  float uz, vz;
138  float windowScale;
142  float dRMax ;
143  float dPhiMax;
144  float dRIntMax;
145  float dPhiIntMax;
146  float chi2Max;
147  float chi2_str_;
148  float chi2Norm_2D_;
149  float wideSeg;
151  bool debugInfo;
152 
153  std::unique_ptr<CSCSegFit> sfit_;
154  //CSCSegFit* sfit_;
155 
156 };
157 
158 #endif
bool areHitsCloseInR(const CSCRecHit2D *h1, const CSCRecHit2D *h2) const
Utility functions.
float windowScale
Definition: CSCSegAlgoRU.h:138
ROOT::Math::SVector< double, 6 > SVector6
Typedefs.
Definition: CSCSegAlgoRU.h:52
void flagHitsAsUsed(const ChamberHitContainer &rechitsInChamber, BoolContainer &used) const
std::vector< const CSCRecHit2D * >::const_iterator ChamberHitContainerCIt
Definition: CSCSegAlgoRU.h:56
double theChi2
Definition: CSCSegAlgoRU.h:134
LocalVector theDirection
Definition: CSCSegAlgoRU.h:136
bool isSegmentGood(const ChamberHitContainer &rechitsInChamber) const
const std::string myName
Definition: CSCSegAlgoRU.h:132
void updateParameters(void)
float dPhiIntMax
Definition: CSCSegAlgoRU.h:145
virtual ~CSCSegAlgoRU()
Destructor.
Definition: CSCSegAlgoRU.h:68
LocalPoint theOrigin
Definition: CSCSegAlgoRU.h:135
std::vector< CSCSegment > run(const CSCChamber *aChamber, const ChamberHitContainer &rechits)
Definition: CSCSegAlgoRU.cc:55
bool isHitNearSegment(const CSCRecHit2D *h) const
bool replaceHit(const CSCRecHit2D *h, int layer)
ChamberHitContainer proto_segment
Definition: CSCSegAlgoRU.h:131
float fit_r_phi(SVector6 points, int layer) const
std::vector< CSCSegment > buildSegments(const ChamberHitContainer &rechits)
Definition: CSCSegAlgoRU.cc:60
const CSCChamber * theChamber
Definition: CSCSegAlgoRU.h:130
void tryAddingHitsToSegment(const ChamberHitContainer &rechitsInChamber, const BoolContainer &used, const LayerIndex &layerIndex, const ChamberHitContainerCIt i1, const ChamberHitContainerCIt i2)
void compareProtoSegment(const CSCRecHit2D *h, int layer)
CSCSegAlgoRU(const edm::ParameterSet &ps)
Constructor.
Definition: CSCSegAlgoRU.cc:20
std::vector< const CSCRecHit2D * > ChamberHitContainer
Definition: CSCSegAlgoRU.h:55
std::vector< bool > BoolContainer
Definition: CSCSegAlgoRU.h:63
std::vector< int > LayerIndex
Definition: CSCSegAlgoRU.h:54
float phiAtZ(float z) const
bool areHitsCloseInGlobalPhi(const CSCRecHit2D *h1, const CSCRecHit2D *h2) const
float chi2Norm_2D_
Definition: CSCSegAlgoRU.h:148
float fitX(SVector6 points, SVector6 errors, int ir, int ir2, float &chi2_str)
bool hasHitOnLayer(int layer) const
void baseline(int n_seg_min)
Definition: errors.py:1
bool addHit(const CSCRecHit2D *hit, int layer)
Utility functions.
std::unique_ptr< CSCSegFit > sfit_
Definition: CSCSegAlgoRU.h:153
void increaseProtoSegment(const CSCRecHit2D *h, int layer, int chi2_factor)