CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSCSegAlgoTC.h
Go to the documentation of this file.
1 #ifndef CSCSegment_CSCSegAlgoTC_h
2 #define CSCSegment_CSCSegAlgoTC_h
3 
28 
30 
31 #include <deque>
32 #include <vector>
33 
34 
36  public:
37 
38  // Tim tried using map as basic container of all (space-point) RecHit's in a chamber:
39  // The 'key' is a pseudo-layer number (1-6 but with 1 always closest to IP).
40  // The 'value' is a vector of the RecHit's on that layer.
41  // Using the layer number like this removes the need to sort in global z.
42  // Instead we just have to ensure the layer index is correctly adjusted
43  // to enforce the requirement that 'layer 1' is closest in the chamber
44  // to the IP.
45  // However a map is very painful to use when handling the original 'SK' algorithm,
46  // particularly when we need to flag a hit as 'used'. Because of this I am now
47  // favouring a pair of vectors, vector<RecHit> and vector<int> for the layer id.
48 
50  typedef std::vector<int> LayerIndex;
51  typedef std::vector<const CSCRecHit2D*> ChamberHitContainer;
52  typedef ChamberHitContainer::const_iterator ChamberHitContainerCIt;
53 
54  // We need to be able to flag a hit as 'used' and so need a container
55  // of bool's. Naively, this would be vector<bool>... but AVOID that since it's
56  // non-standard i.e. packed-bit implementation which is not a standard STL container.
57  // We don't need what it offers and it could lead to unexpected trouble in the future
58 
59  typedef std::deque<bool> BoolContainer;
60 
62  explicit CSCSegAlgoTC(const edm::ParameterSet& ps);
64  virtual ~CSCSegAlgoTC() {};
65 
70  std::vector<CSCSegment> buildSegments(ChamberHitContainer rechits);
71 
75  std::vector<CSCSegment> run(const CSCChamber* aChamber, ChamberHitContainer rechits);
76 
77  private:
78 
80 
81  bool addHit(const CSCRecHit2D* aHit, int layer);
82  bool replaceHit(const CSCRecHit2D* h, int layer);
83  void compareProtoSegment(const CSCRecHit2D* h, int layer);
84  void increaseProtoSegment(const CSCRecHit2D* h, int layer);
86  CLHEP::HepMatrix derivativeMatrix() const;
88  void flipErrors(AlgebraicSymMatrix&) const;
89 
93  bool areHitsCloseInLocalX(const CSCRecHit2D* h1, const CSCRecHit2D* h2) const;
94 
98  bool areHitsCloseInGlobalPhi(const CSCRecHit2D* h1, const CSCRecHit2D* h2) const;
99 
100  bool hasHitOnLayer(int layer) const;
101 
108  bool isHitNearSegment(const CSCRecHit2D* h) const;
109 
113  void dumpHits(const ChamberHitContainer& rechits) const;
114 
119  const ChamberHitContainerCIt i1,
120  const ChamberHitContainerCIt i2);
121 
127  bool isSegmentGood(std::vector<ChamberHitContainer>::iterator is,
128  std::vector<double>::iterator ichi,
129  const ChamberHitContainer& rechitsInChamber,
130  BoolContainer& used) const;
131 
135  void flagHitsAsUsed(std::vector<ChamberHitContainer>::iterator is,
136  const ChamberHitContainer& rechitsInChamber, BoolContainer& used) const;
137 
142  void pruneTheSegments(const ChamberHitContainer& rechitsInChamber);
146  void segmentSort();
147 
148  float phiAtZ(float z) const;
149  void fillLocalDirection();
150  void fillChiSquared();
151  void fitSlopes();
152  void updateParameters();
153 
155  // ================
156 
158  std::vector<ChamberHitContainer> candidates;
159  std::vector<LocalPoint> origins;
160  std::vector<LocalVector> directions;
161  std::vector<AlgebraicSymMatrix> errors;
162  std::vector<double> chi2s;
163 
165  double theChi2;
168  float uz, vz;
169 
172  float chi2Max;
173 
178 
183 
187  float dPhiFineMax;
188 
192  float dRPhiMax;
193 
196  float dPhiMax;
197 
201 
209 
212  const std::string myName;
213  bool debugInfo;
214 };
215 
216 #endif
void fillLocalDirection()
const std::string myName
Definition: CSCSegAlgoTC.h:212
std::vector< AlgebraicSymMatrix > errors
Definition: CSCSegAlgoTC.h:161
std::vector< LocalVector > directions
Definition: CSCSegAlgoTC.h:160
void compareProtoSegment(const CSCRecHit2D *h, int layer)
AlgebraicSymMatrix weightMatrix() const
std::deque< bool > BoolContainer
Definition: CSCSegAlgoTC.h:59
float phiAtZ(float z) const
AlgebraicSymMatrix calculateError() const
double double double z
bool areHitsCloseInLocalX(const CSCRecHit2D *h1, const CSCRecHit2D *h2) const
bool isHitNearSegment(const CSCRecHit2D *h) const
void updateParameters()
void dumpHits(const ChamberHitContainer &rechits) const
std::vector< double > chi2s
Definition: CSCSegAlgoTC.h:162
LocalVector theDirection
Definition: CSCSegAlgoTC.h:167
void fillChiSquared()
void flagHitsAsUsed(std::vector< ChamberHitContainer >::iterator is, const ChamberHitContainer &rechitsInChamber, BoolContainer &used) const
float dRPhiFineMax
Definition: CSCSegAlgoTC.h:182
bool isSegmentGood(std::vector< ChamberHitContainer >::iterator is, std::vector< double >::iterator ichi, const ChamberHitContainer &rechitsInChamber, BoolContainer &used) const
bool areHitsCloseInGlobalPhi(const CSCRecHit2D *h1, const CSCRecHit2D *h2) const
bool addHit(const CSCRecHit2D *aHit, int layer)
Utility functions.
float chi2ndfProbMin
Definition: CSCSegAlgoTC.h:177
void segmentSort()
double theChi2
Definition: CSCSegAlgoTC.h:165
const CSCChamber * theChamber
Member variables.
Definition: CSCSegAlgoTC.h:157
std::vector< CSCSegment > buildSegments(ChamberHitContainer rechits)
Definition: CSCSegAlgoTC.cc:60
ChamberHitContainer proto_segment
Definition: CSCSegAlgoTC.h:164
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
std::vector< const CSCRecHit2D * > ChamberHitContainer
Definition: CSCSegAlgoTC.h:51
std::vector< LocalPoint > origins
Definition: CSCSegAlgoTC.h:159
void tryAddingHitsToSegment(const ChamberHitContainer &rechits, const ChamberHitContainerCIt i1, const ChamberHitContainerCIt i2)
virtual ~CSCSegAlgoTC()
Destructor.
Definition: CSCSegAlgoTC.h:64
void fitSlopes()
bool hasHitOnLayer(int layer) const
CLHEP::HepMatrix derivativeMatrix() const
std::vector< CSCSegment > run(const CSCChamber *aChamber, ChamberHitContainer rechits)
Definition: CSCSegAlgoTC.cc:55
LocalPoint theOrigin
Definition: CSCSegAlgoTC.h:166
CLHEP::HepSymMatrix AlgebraicSymMatrix
std::vector< int > LayerIndex
Typedefs.
Definition: CSCSegAlgoTC.h:50
std::vector< ChamberHitContainer > candidates
Definition: CSCSegAlgoTC.h:158
ChamberHitContainer::const_iterator ChamberHitContainerCIt
Definition: CSCSegAlgoTC.h:52
void increaseProtoSegment(const CSCRecHit2D *h, int layer)
void pruneTheSegments(const ChamberHitContainer &rechitsInChamber)
void flipErrors(AlgebraicSymMatrix &) const
bool replaceHit(const CSCRecHit2D *h, int layer)
CSCSegAlgoTC(const edm::ParameterSet &ps)
Constructor.
Definition: CSCSegAlgoTC.cc:29
float dPhiFineMax
Definition: CSCSegAlgoTC.h:187