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 
26 
28 
29 #include <deque>
30 #include <vector>
31 
32 
34  public:
35 
36  // Tim tried using map as basic container of all (space-point) RecHit's in a chamber:
37  // The 'key' is a pseudo-layer number (1-6 but with 1 always closest to IP).
38  // The 'value' is a vector of the RecHit's on that layer.
39  // Using the layer number like this removes the need to sort in global z.
40  // Instead we just have to ensure the layer index is correctly adjusted
41  // to enforce the requirement that 'layer 1' is closest in the chamber
42  // to the IP.
43  // However a map is very painful to use when handling the original 'SK' algorithm,
44  // particularly when we need to flag a hit as 'used'. Because of this I am now
45  // favouring a pair of vectors, vector<RecHit> and vector<int> for the layer id.
46 
48  typedef std::vector<int> LayerIndex;
49  typedef std::vector<const CSCRecHit2D*> ChamberHitContainer;
50  typedef ChamberHitContainer::const_iterator ChamberHitContainerCIt;
51 
52  // We need to be able to flag a hit as 'used' and so need a container
53  // of bool's. Naively, this would be vector<bool>... but AVOID that since it's
54  // non-standard i.e. packed-bit implementation which is not a standard STL container.
55  // We don't need what it offers and it could lead to unexpected trouble in the future
56 
57  typedef std::deque<bool> BoolContainer;
58 
60  explicit CSCSegAlgoTC(const edm::ParameterSet& ps);
62  virtual ~CSCSegAlgoTC() {};
63 
68  std::vector<CSCSegment> buildSegments(const ChamberHitContainer& rechits);
69 
73  std::vector<CSCSegment> run(const CSCChamber* aChamber, const ChamberHitContainer& rechits);
74 
75  private:
76 
78 
79  bool addHit(const CSCRecHit2D* aHit, int layer);
80  bool replaceHit(const CSCRecHit2D* h, int layer);
81  void compareProtoSegment(const CSCRecHit2D* h, int layer);
82  void increaseProtoSegment(const CSCRecHit2D* h, int layer);
84  CLHEP::HepMatrix derivativeMatrix() const;
86  void flipErrors(AlgebraicSymMatrix&) const;
87 
91  bool areHitsCloseInLocalX(const CSCRecHit2D* h1, const CSCRecHit2D* h2) const;
92 
96  bool areHitsCloseInGlobalPhi(const CSCRecHit2D* h1, const CSCRecHit2D* h2) const;
97 
98  bool hasHitOnLayer(int layer) const;
99 
106  bool isHitNearSegment(const CSCRecHit2D* h) const;
107 
111  void dumpHits(const ChamberHitContainer& rechits) const;
112 
117  const ChamberHitContainerCIt i1,
118  const ChamberHitContainerCIt i2);
119 
125  bool isSegmentGood(std::vector<ChamberHitContainer>::iterator is,
126  std::vector<double>::iterator ichi,
127  const ChamberHitContainer& rechitsInChamber,
128  BoolContainer& used) const;
129 
133  void flagHitsAsUsed(std::vector<ChamberHitContainer>::iterator is,
134  const ChamberHitContainer& rechitsInChamber, BoolContainer& used) const;
135 
140  void pruneTheSegments(const ChamberHitContainer& rechitsInChamber);
144  void segmentSort();
145 
146  float phiAtZ(float z) const;
147  void fillLocalDirection();
148  void fillChiSquared();
149  void fitSlopes();
150  void updateParameters();
151 
153  // ================
154 
156  std::vector<ChamberHitContainer> candidates;
157  std::vector<LocalPoint> origins;
158  std::vector<LocalVector> directions;
159  std::vector<AlgebraicSymMatrix> errors;
160  std::vector<double> chi2s;
161 
163  double theChi2;
166  float uz, vz;
167 
170  float chi2Max;
171 
176 
181 
185  float dPhiFineMax;
186 
190  float dRPhiMax;
191 
194  float dPhiMax;
195 
199 
207 
211  bool debugInfo;
212 };
213 
214 #endif
void fillLocalDirection()
const std::string myName
Definition: CSCSegAlgoTC.h:210
std::vector< AlgebraicSymMatrix > errors
Definition: CSCSegAlgoTC.h:159
std::vector< LocalVector > directions
Definition: CSCSegAlgoTC.h:158
void compareProtoSegment(const CSCRecHit2D *h, int layer)
AlgebraicSymMatrix weightMatrix() const
std::deque< bool > BoolContainer
Definition: CSCSegAlgoTC.h:57
float phiAtZ(float z) const
AlgebraicSymMatrix calculateError() const
float float float z
std::vector< CSCSegment > buildSegments(const ChamberHitContainer &rechits)
Definition: CSCSegAlgoTC.cc:58
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:160
LocalVector theDirection
Definition: CSCSegAlgoTC.h:165
void fillChiSquared()
void flagHitsAsUsed(std::vector< ChamberHitContainer >::iterator is, const ChamberHitContainer &rechitsInChamber, BoolContainer &used) const
float dRPhiFineMax
Definition: CSCSegAlgoTC.h:180
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
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:175
void segmentSort()
double theChi2
Definition: CSCSegAlgoTC.h:163
const CSCChamber * theChamber
Member variables.
Definition: CSCSegAlgoTC.h:155
std::vector< CSCSegment > run(const CSCChamber *aChamber, const ChamberHitContainer &rechits)
Definition: CSCSegAlgoTC.cc:53
ChamberHitContainer proto_segment
Definition: CSCSegAlgoTC.h:162
std::vector< const CSCRecHit2D * > ChamberHitContainer
Definition: CSCSegAlgoTC.h:49
std::vector< LocalPoint > origins
Definition: CSCSegAlgoTC.h:157
void tryAddingHitsToSegment(const ChamberHitContainer &rechits, const ChamberHitContainerCIt i1, const ChamberHitContainerCIt i2)
virtual ~CSCSegAlgoTC()
Destructor.
Definition: CSCSegAlgoTC.h:62
void fitSlopes()
bool hasHitOnLayer(int layer) const
CLHEP::HepMatrix derivativeMatrix() const
LocalPoint theOrigin
Definition: CSCSegAlgoTC.h:164
CLHEP::HepSymMatrix AlgebraicSymMatrix
std::vector< int > LayerIndex
Typedefs.
Definition: CSCSegAlgoTC.h:48
std::vector< ChamberHitContainer > candidates
Definition: CSCSegAlgoTC.h:156
ChamberHitContainer::const_iterator ChamberHitContainerCIt
Definition: CSCSegAlgoTC.h:50
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:27
float dPhiFineMax
Definition: CSCSegAlgoTC.h:185