CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/RecoLocalMuon/CSCSegment/src/CSCSegAlgoST.h

Go to the documentation of this file.
00001 #ifndef CSCSegment_CSCSegAlgoST_h
00002 #define CSCSegment_CSCSegAlgoST_h
00003 
00025 #include <RecoLocalMuon/CSCSegment/src/CSCSegmentAlgorithm.h>
00026 
00027 #include <DataFormats/CSCRecHit/interface/CSCRecHit2D.h>
00028 
00029 #include <deque>
00030 #include <vector>
00031 
00032 class CSCSegAlgoShowering;
00033 class CSCSegAlgoST : public CSCSegmentAlgorithm {
00034 
00035 
00036 public:
00037 
00039 
00040   typedef std::vector<const CSCRecHit2D*> ChamberHitContainer;
00041   typedef std::vector < std::vector<const CSCRecHit2D* > > Segments;
00042   typedef std::deque<bool> BoolContainer;
00043 
00045   explicit CSCSegAlgoST(const edm::ParameterSet& ps);
00047   virtual ~CSCSegAlgoST();
00048 
00053   std::vector<CSCSegment> buildSegments(ChamberHitContainer rechits);
00054 
00059   std::vector<CSCSegment> buildSegments2(ChamberHitContainer rechits);
00060 
00064   std::vector<CSCSegment> run(const CSCChamber* aChamber, ChamberHitContainer rechits); 
00065 
00069   std::vector< std::vector<const CSCRecHit2D*> > clusterHits(const CSCChamber* aChamber, ChamberHitContainer & rechits);
00070 
00071 
00072    /* Build groups of rechits that are separated in strip numbers and Z to save time on the segment finding
00073    */
00074      std::vector< std::vector<const CSCRecHit2D*> > chainHits(const CSCChamber* aChamber, ChamberHitContainer & rechits);
00075 
00076 
00081   std::vector< CSCSegment > prune_bad_hits(const CSCChamber* aChamber, std::vector< CSCSegment > & segments);
00082 
00083 private:
00084 
00086   double theWeight(double coordinate_1, double coordinate_2, double coordinate_3, float layer_1, float layer_2, float layer_3);
00087 
00088   void ChooseSegments(void);
00089 
00090   // siplistic routine - just return the segment with the smallest weight
00091   void ChooseSegments2a(std::vector< ChamberHitContainer > & best_segments, int best_seg);
00092   // copy of Stoyans ChooseSegments adjusted to the case without fake hits
00093   void ChooseSegments2(int best_seg);
00094 
00095   // Choose routine with reduce nr of loops
00096   void ChooseSegments3(int best_seg);
00097   void ChooseSegments3(std::vector< ChamberHitContainer > & best_segments, std::vector< float > & best_weight, int best_seg);
00098   //
00099   void fitSlopes(void);
00100   void fillChiSquared(void);
00101   void fillLocalDirection(void);
00102   void doSlopesAndChi2(void);
00103   // Duplicates are found in ME1/1a only
00104   void findDuplicates(std::vector<CSCSegment>  & segments );
00105 
00106   bool isGoodToMerge(bool isME11a, ChamberHitContainer & newChain, ChamberHitContainer & oldChain);
00107 
00108   CLHEP::HepMatrix derivativeMatrix(void) const;
00109   AlgebraicSymMatrix weightMatrix(void) const;
00110   AlgebraicSymMatrix calculateError(void) const;
00111   void flipErrors(AlgebraicSymMatrix&) const;
00112 
00113   void correctTheCovX(void);
00114   void correctTheCovMatrix(CLHEP::HepMatrix &IC);
00115   // Member variables
00116   const std::string myName; 
00117   const CSCChamber* theChamber;
00118   Segments GoodSegments;
00119 
00120   ChamberHitContainer PAhits_onLayer[6];
00121   ChamberHitContainer Psegments_hits;
00122 
00123   std::vector< ChamberHitContainer > Psegments;
00124   std::vector< ChamberHitContainer > Psegments_noLx;
00125   std::vector< ChamberHitContainer > Psegments_noL1;
00126   std::vector< ChamberHitContainer > Psegments_noL2;
00127   std::vector< ChamberHitContainer > Psegments_noL3;
00128   std::vector< ChamberHitContainer > Psegments_noL4;
00129   std::vector< ChamberHitContainer > Psegments_noL5;
00130   std::vector< ChamberHitContainer > Psegments_noL6;
00131   std::vector< ChamberHitContainer > chosen_Psegments;
00132   std::vector< float > weight_A;
00133   std::vector< float > weight_noLx_A;
00134   std::vector< float > weight_noL1_A;
00135   std::vector< float > weight_noL2_A;
00136   std::vector< float > weight_noL3_A;
00137   std::vector< float > weight_noL4_A;
00138   std::vector< float > weight_noL5_A;
00139   std::vector< float > weight_noL6_A;
00140   std::vector< float > chosen_weight_A;
00141   std::vector< float > curv_A;
00142   std::vector< float > curv_noL1_A;
00143   std::vector< float > curv_noL2_A;
00144   std::vector< float > curv_noL3_A;
00145   std::vector< float > curv_noL4_A;
00146   std::vector< float > curv_noL5_A;
00147   std::vector< float > curv_noL6_A;
00148   std::vector< float > weight_B;
00149   std::vector< float > weight_noL1_B;
00150   std::vector< float > weight_noL2_B;
00151   std::vector< float > weight_noL3_B;
00152   std::vector< float > weight_noL4_B;
00153   std::vector< float > weight_noL5_B;
00154   std::vector< float > weight_noL6_B;
00155 
00156   //ibl
00157 
00158   ChamberHitContainer protoSegment;
00159   float       protoSlope_u;
00160   float       protoSlope_v;
00161   LocalPoint  protoIntercept;           
00162   double      protoChi2;
00163   double      protoNDF;
00164   LocalVector protoDirection;
00165 
00166   // input from .cfi file
00167   bool    debug;
00168   //  int     minLayersApart;
00169   //  double  nSigmaFromSegment;
00170   int     minHitsPerSegment;
00171   //  int     muonsPerChamberMax;
00172   //  double  chi2Max;
00173   double  dXclusBoxMax;
00174   double  dYclusBoxMax;
00175   int     maxRecHitsInCluster;
00176   bool    preClustering;
00177   bool    preClustering_useChaining;
00178   bool    Pruning;
00179   bool    BrutePruning;
00180   double  BPMinImprovement;
00181   bool    onlyBestSegment;
00182   bool    useShowering;
00183 
00184   double  hitDropLimit4Hits;
00185   double  hitDropLimit5Hits;
00186   double  hitDropLimit6Hits;
00187 
00188   float a_yweightPenaltyThreshold[5][5];
00189 
00190   double  yweightPenaltyThreshold;
00191   double  yweightPenalty;
00192 
00193   double  curvePenaltyThreshold;
00194   double  curvePenalty;
00195   CSCSegAlgoShowering* showering_;
00196   //
00198   bool correctCov_;              
00199   double protoChiUCorrection;
00200   std::vector<double> e_Cxx;
00201   double chi2Norm_2D_;               
00202   double chi2Norm_3D_;               
00203   unsigned maxContrIndex;       
00204   bool prePrun_;                 
00205 
00206 
00207   double prePrunLimit_;          
00208 
00209   double condSeed1_, condSeed2_;  
00210   bool covToAnyNumber_;          
00211   bool covToAnyNumberAll_;       
00212   double covAnyNumber_;          
00213   bool passCondNumber;          
00214   bool passCondNumber_2;          
00215 };
00216 
00217 #endif