CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/RecoLocalMuon/CSCSegment/src/CSCSegAlgoSK.h

Go to the documentation of this file.
00001 #ifndef CSCSegment_CSCSegAlgoSK_h
00002 #define CSCSegment_CSCSegAlgoSK_h
00003 
00029 #include <RecoLocalMuon/CSCSegment/src/CSCSegmentAlgorithm.h>
00030 #include <DataFormats/CSCRecHit/interface/CSCRecHit2D.h>
00031 
00032 //#include <DataFormats/GeometryVector/interface/GlobalPoint.h>
00033 
00034 #include <deque>
00035 #include <vector>
00036 
00037 class CSCSegAlgoSK : public CSCSegmentAlgorithm {
00038 
00039 public:
00040 
00041     // Tim tried using map as basic container of all (space-point) RecHit's in a chamber:
00042     // The 'key' is a pseudo-layer number (1-6 but with 1 always closest to IP).
00043     // The 'value' is a vector of the RecHit's on that layer.
00044     // Using the layer number like this removes the need to sort in global z.
00045     // Instead we just have to ensure the layer index is correctly adjusted 
00046     // to enforce the requirement that 'layer 1' is closest in the chamber
00047     // to the IP.
00048     
00050     
00051     typedef std::vector<int> LayerIndex;
00052     typedef std::vector<const CSCRecHit2D*> ChamberHitContainer;
00053     typedef std::vector<const CSCRecHit2D*>::const_iterator ChamberHitContainerCIt;
00054 
00055     // We need to be able to flag a hit as 'used' and so need a container
00056     // of bool's. Naively, this would be vector<bool>... but AVOID that since it's
00057     // non-standard i.e. packed-bit implementation which is not a standard STL container. 
00058     // We don't need what it offers and it could lead to unexpected trouble in the future.
00059 
00060     typedef std::deque<bool> BoolContainer;
00061     
00063     explicit CSCSegAlgoSK(const edm::ParameterSet& ps);
00065     virtual ~CSCSegAlgoSK() {};
00066 
00071     std::vector<CSCSegment> buildSegments(ChamberHitContainer rechits);
00072 
00076     std::vector<CSCSegment> run(const CSCChamber* aChamber, ChamberHitContainer rechits); 
00077 
00078 private:
00079 
00081     // Could be static at the moment, but in principle one
00082     // might like CSCSegmentizer-specific behaviour?
00083     bool areHitsCloseInLocalX(const CSCRecHit2D* h1, const CSCRecHit2D* h2) const;
00084     bool areHitsCloseInGlobalPhi(const CSCRecHit2D* h1, const CSCRecHit2D* h2) const;
00085     bool isHitNearSegment(const CSCRecHit2D* h) const;
00086 
00090     void dumpHits(const ChamberHitContainer& rechits) const;
00091 
00095     void tryAddingHitsToSegment(const ChamberHitContainer& rechitsInChamber,
00096         BoolContainer used, LayerIndex layerIndex,
00097         const ChamberHitContainerCIt i1, const ChamberHitContainerCIt i2);
00098 
00103     bool isSegmentGood(const ChamberHitContainer& rechitsInChamber) const;
00104 
00108     void flagHitsAsUsed(const ChamberHitContainer& rechitsInChamber, BoolContainer& used) const;
00109         
00111     bool addHit(const CSCRecHit2D* hit, int layer);
00112     void updateParameters(void);
00113     void fitSlopes(void);
00114     void fillChiSquared(void);
00119     void fillLocalDirection(void);
00120     float phiAtZ(float z) const;
00121     bool hasHitOnLayer(int layer) const;
00122     bool replaceHit(const CSCRecHit2D* h, int layer);
00123     void compareProtoSegment(const CSCRecHit2D* h, int layer);
00124     void increaseProtoSegment(const CSCRecHit2D* h, int layer);
00125     CLHEP::HepMatrix derivativeMatrix(void) const;
00126     AlgebraicSymMatrix weightMatrix(void) const;
00127     AlgebraicSymMatrix calculateError(void) const;
00128     void flipErrors(AlgebraicSymMatrix&) const;
00129                 
00130     // Member variables
00131     // ================
00132 
00133     const CSCChamber* theChamber;
00134     ChamberHitContainer proto_segment;
00135     const std::string myName; 
00136                 
00137     double theChi2;
00138     LocalPoint theOrigin;
00139     LocalVector theDirection;
00140     float uz, vz;
00141     float windowScale;
00142     float dRPhiMax ;
00143     float dPhiMax;
00144     float dRPhiFineMax;
00145     float dPhiFineMax;
00146     float chi2Max;
00147     float wideSeg;
00148     int minLayersApart;
00149     bool debugInfo;
00150 };
00151 
00152 #endif