File indexing completed on 2024-04-06 12:26:01
0001 #ifndef CSCSegment_CSCSegFit_h
0002 #define CSCSegment_CSCSegFit_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #include <DataFormats/CSCRecHit/interface/CSCRecHit2D.h>
0022 #include <Geometry/CSCGeometry/interface/CSCChamber.h>
0023
0024 #include <Math/Functions.h>
0025 #include <Math/SVector.h>
0026 #include <Math/SMatrix.h>
0027
0028 #include <vector>
0029
0030 class CSCSegFit {
0031 public:
0032
0033
0034 typedef std::vector<const CSCRecHit2D*> CSCSetOfHits;
0035
0036
0037 typedef ROOT::Math::SMatrix<double, 12, 12, ROOT::Math::MatRepSym<double, 12> > SMatrixSym12;
0038
0039
0040 typedef ROOT::Math::SMatrix<double, 12, 4> SMatrix12by4;
0041
0042
0043 typedef ROOT::Math::SMatrix<double, 4> SMatrix4;
0044 typedef ROOT::Math::SMatrix<double, 4, 4, ROOT::Math::MatRepSym<double, 4> > SMatrixSym4;
0045
0046
0047 typedef ROOT::Math::SMatrix<double, 2, 2, ROOT::Math::MatRepSym<double, 2> > SMatrixSym2;
0048
0049
0050 typedef ROOT::Math::SVector<double, 4> SVector4;
0051
0052
0053
0054
0055 CSCSegFit(const CSCChamber* csc, CSCSetOfHits hits)
0056 : chamber_(csc), hits_(hits), scaleXError_(1.0), fitdone_(false) {}
0057
0058 virtual ~CSCSegFit() {}
0059
0060
0061 void fit(void);
0062
0063 AlgebraicSymMatrix covarianceMatrix(void);
0064
0065
0066
0067 void setScaleXError(double factor) { scaleXError_ = factor; }
0068
0069
0070 float xfit(float z) const;
0071 float yfit(float z) const;
0072
0073
0074 float xdev(float x, float z) const;
0075 float ydev(float y, float z) const;
0076 float Rdev(float x, float y, float z) const;
0077
0078
0079 CSCSetOfHits hits(void) const { return hits_; }
0080 double scaleXError(void) const { return scaleXError_; }
0081 size_t nhits(void) const { return hits_.size(); }
0082 double chi2(void) const { return chi2_; }
0083 int ndof(void) const { return ndof_; }
0084 LocalPoint intercept() const { return intercept_; }
0085 LocalVector localdir() const { return localdir_; }
0086 const CSCChamber* chamber() const { return chamber_; }
0087 bool fitdone() const { return fitdone_; }
0088
0089 private:
0090
0091
0092 void fit2(void);
0093 void fitlsq(void);
0094 void setChi2(void);
0095
0096 protected:
0097
0098
0099
0100 void setOutFromIP(void);
0101
0102 SMatrix12by4 derivativeMatrix(void);
0103 SMatrixSym12 weightMatrix(void);
0104 AlgebraicSymMatrix flipErrors(const SMatrixSym4&);
0105
0106
0107
0108 const CSCChamber* chamber_;
0109 CSCSetOfHits hits_;
0110 float uslope_;
0111 float vslope_;
0112 LocalPoint intercept_;
0113 LocalVector localdir_;
0114 double chi2_;
0115 int ndof_;
0116 double scaleXError_;
0117 bool fitdone_;
0118 };
0119
0120 #endif