#include <Alignment/MuonStandaloneAlgorithm/interface/PointForAlignment.h>
Definition at line 24 of file PointForAlignment.h.
PointForAlignment::PointForAlignment | ( | ) |
PointForAlignment::~PointForAlignment | ( | ) |
TMatrixD PointForAlignment::alignmentMatrix | ( | ) |
Definition at line 86 of file PointForAlignment.cc.
References theAlignmentMatrix.
00086 {return theAlignmentMatrix;}
void PointForAlignment::calculateAlignmentCoeff | ( | ) |
Definition at line 160 of file PointForAlignment.cc.
References localDirection(), localPosition(), NDOFAlign, NDOFCoor, phi, station, subDet, theAlignmentMatrix, theta, validPoint, PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), y, PV3DBase< T, PVType, FrameType >::z(), and z.
Referenced by setPointForAlignment().
00160 { 00161 00162 double tanphi = localDirection().z()/localDirection().x(); 00163 double phi = TMath::ATan2(localDirection().z(),localDirection().x()); 00164 double cosphi = TMath::Cos(phi); 00165 double sinphi = TMath::Sin(phi); 00166 double tantheta = localDirection().z()/localDirection().y(); 00167 double theta = TMath::ATan2(localDirection().z(),localDirection().y()); 00168 double costheta = TMath::Cos(theta); 00169 double sintheta = TMath::Sin(theta); 00170 theAlignmentMatrix.ResizeTo(NDOFCoor, NDOFAlign); 00171 if(station != 4 && subDet == 1) { 00172 if(tanphi == 0.0 || tantheta == 0.0) { 00173 validPoint = false; 00174 return; 00175 } 00176 //X 00177 theAlignmentMatrix(0,0) = 1.0; 00178 theAlignmentMatrix(0,1) = 0.0; 00179 theAlignmentMatrix(0,2) = -1.0/tanphi; 00180 theAlignmentMatrix(0,3) = -localPosition().y(); 00181 theAlignmentMatrix(0,4) = localPosition().x()/tanphi; 00182 theAlignmentMatrix(0,5) = -1.0/tanphi*localPosition().y(); 00183 //Z 00184 theAlignmentMatrix(1,0) = 0.0; 00185 theAlignmentMatrix(1,1) = 1.0; 00186 theAlignmentMatrix(1,2) = -1.0/tantheta; 00187 theAlignmentMatrix(1,3) = localPosition().x(); 00188 theAlignmentMatrix(1,4) = localPosition().x()/tantheta; 00189 theAlignmentMatrix(1,5) = -localPosition().y()/tantheta; 00190 //Phi 00191 theAlignmentMatrix(2,0) = 0.0; theAlignmentMatrix(2,1) = 0.0; 00192 theAlignmentMatrix(2,2) = 0.0; theAlignmentMatrix(2,3) = 0.0; 00193 theAlignmentMatrix(2,4) = cosphi*cosphi; theAlignmentMatrix(2,5) = cosphi*sinphi/tantheta; 00194 //theta 00195 theAlignmentMatrix(3,0) = 0.0; theAlignmentMatrix(3,1) = 0.0; 00196 theAlignmentMatrix(3,2) = 0.0; theAlignmentMatrix(3,3) = 0.0; 00197 theAlignmentMatrix(3,4) = costheta*sintheta/tanphi; theAlignmentMatrix(3,5) = costheta*costheta; 00198 } else { 00199 if(tanphi == 0.0) { 00200 validPoint = false; 00201 return; 00202 } 00203 //X 00204 theAlignmentMatrix(0,0) = 1.0; 00205 theAlignmentMatrix(0,1) = 0.0; 00206 theAlignmentMatrix(0,2) = -1.0/tanphi; 00207 theAlignmentMatrix(0,3) = 0.0; 00208 theAlignmentMatrix(0,4) = localPosition().x()/tanphi; 00209 theAlignmentMatrix(0,5) = 0.0; 00210 //Z 00211 theAlignmentMatrix(1,0) = 0.0; 00212 theAlignmentMatrix(1,1) = 0.0; 00213 theAlignmentMatrix(1,2) = 0.0; 00214 theAlignmentMatrix(1,3) = 0.0; 00215 theAlignmentMatrix(1,4) = 0.0; 00216 theAlignmentMatrix(1,5) = 0.0; 00217 //Phi 00218 theAlignmentMatrix(2,0) = 0.0; theAlignmentMatrix(2,1) = 0.0; 00219 theAlignmentMatrix(2,2) = 0.0; theAlignmentMatrix(2,3) = 0.0; 00220 theAlignmentMatrix(2,4) = cosphi*cosphi; theAlignmentMatrix(2,5) = 0.0; 00221 //theta 00222 theAlignmentMatrix(3,0) = 0.0; theAlignmentMatrix(3,1) = 0.0; 00223 theAlignmentMatrix(3,2) = 0.0; theAlignmentMatrix(3,3) = 0.0; 00224 theAlignmentMatrix(3,4) = 0.0; theAlignmentMatrix(3,5) = 0.0; 00225 } 00226 }
void PointForAlignment::calculateErrors | ( | ) |
Definition at line 120 of file PointForAlignment.cc.
References GenMuonPlsPt100GeV_cfg::cout, CovMatrix, CovMatrixInit, e, lat::endl(), NDOFCoor, station, subDet, theErrors, and validPoint.
Referenced by setPointForAlignment().
00120 { 00121 00122 theErrors.ResizeTo(NDOFCoor, NDOFCoor); 00123 CovMatrix.ResizeTo(NDOFCoor, NDOFCoor); 00124 TMatrixD unit(NDOFCoor, NDOFCoor); 00125 unit.UnitMatrix(); 00126 TMatrixD comparison(NDOFCoor, NDOFCoor); 00127 double crosscheck; 00128 double det; 00129 if(station != 4 && subDet == 1) { 00130 CovMatrix = CovMatrixInit; 00131 theErrors = CovMatrix; 00132 theErrors.Invert(&det); 00133 comparison = unit - CovMatrix*theErrors; 00134 crosscheck = comparison.E2Norm(); 00135 } else { 00136 CovMatrix.ResizeTo(NDOFCoor/2, NDOFCoor/2); 00137 TMatrixD checkMatrix(NDOFCoor/2, NDOFCoor/2); 00138 CovMatrix(0,0) = CovMatrixInit(0,0); 00139 CovMatrix(0,1) = CovMatrixInit(0,2); 00140 CovMatrix(1,0) = CovMatrixInit(2,0); 00141 CovMatrix(1,1) = CovMatrixInit(2,2); 00142 checkMatrix = CovMatrix; 00143 CovMatrix.Invert(&det); 00144 comparison.ResizeTo(NDOFCoor/2, NDOFCoor/2); 00145 unit.ResizeTo(NDOFCoor/2, NDOFCoor/2); 00146 unit.UnitMatrix(); 00147 theErrors(0,0) = CovMatrix(0,0); 00148 theErrors(0,2) = CovMatrix(0,1); 00149 theErrors(2,0) = CovMatrix(1,0); 00150 theErrors(2,2) = CovMatrix(1,1); 00151 comparison = unit - CovMatrix*checkMatrix; 00152 crosscheck = comparison.E2Norm(); 00153 } 00154 if(TMath::Abs(det) < 1.e-30 || crosscheck > 1.0e-15) { 00155 validPoint = false; 00156 std::cout << "<PointForAlignment> Not valid point" << std::endl; 00157 } 00158 }
void PointForAlignment::calculateResiduals | ( | ) |
Definition at line 97 of file PointForAlignment.cc.
References localDirection(), localPosition(), NDOFCoor, predictedLocalDirection(), predictedLocalPosition(), residualPhi(), residualRPhi(), residualTheta(), residualZ(), station, subDet, theResidualPhi, theResidualRPhi, theResiduals, theResidualTheta, theResidualZ, PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), y, and z.
Referenced by setPointForAlignment().
00097 { 00098 00099 //Calculation of residuals 00100 if(station != 4 && subDet == 1) { 00101 theResidualRPhi = localPosition().x() - predictedLocalPosition().x(); 00102 theResidualZ = localPosition().y()-predictedLocalPosition().y(); 00103 theResidualPhi = TMath::ATan2(localDirection().z(),localDirection().x())-TMath::ATan2(predictedLocalDirection().z(),predictedLocalDirection().x()); 00104 theResidualTheta = TMath::ATan2(localDirection().z(), localDirection().y())-TMath::ATan2(predictedLocalDirection().z(), predictedLocalDirection().y()); 00105 } else { 00106 theResidualRPhi = localPosition().x() - predictedLocalPosition().x(); 00107 theResidualZ = 0; 00108 theResidualPhi = TMath::ATan2(localDirection().z(),localDirection().x())-TMath::ATan2(predictedLocalDirection().z(),predictedLocalDirection().x()); 00109 theResidualTheta = 0; 00110 } 00111 00112 theResiduals.ResizeTo(NDOFCoor,1); 00113 theResiduals(0,0) = residualRPhi(); 00114 theResiduals(1,0) = residualZ(); 00115 theResiduals(2,0) = residualPhi(); 00116 theResiduals(3,0) = residualTheta(); 00117 00118 }
TMatrixD PointForAlignment::derivatives | ( | void | ) |
Definition at line 80 of file PointForAlignment.cc.
References theDerivatives.
00080 {return theDerivatives;}
TMatrixD PointForAlignment::errors | ( | ) |
GlobalVector PointForAlignment::globalDirection | ( | ) |
Definition at line 66 of file PointForAlignment.cc.
References theGlobalDirection.
00066 {return theGlobalDirection;}
GlobalPoint PointForAlignment::globalPosition | ( | ) |
Definition at line 64 of file PointForAlignment.cc.
References theGlobalPosition.
00064 {return theGlobalPosition;}
LocalVector PointForAlignment::localDirection | ( | ) |
Definition at line 70 of file PointForAlignment.cc.
References theLocalDirection.
Referenced by calculateAlignmentCoeff(), and calculateResiduals().
00070 {return theLocalDirection;}
LocalPoint PointForAlignment::localPosition | ( | ) |
Definition at line 68 of file PointForAlignment.cc.
References theLocalPosition.
Referenced by calculateAlignmentCoeff(), and calculateResiduals().
00068 {return theLocalPosition;}
bool PointForAlignment::pointIsValid | ( | ) |
Definition at line 229 of file PointForAlignment.cc.
References validPoint.
00229 {return validPoint;}
GlobalVector PointForAlignment::predictedGlobalDirection | ( | ) |
Definition at line 74 of file PointForAlignment.cc.
References thePredictedGlobalDirection.
00074 {return thePredictedGlobalDirection;}
GlobalPoint PointForAlignment::predictedGlobalPosition | ( | ) |
Definition at line 72 of file PointForAlignment.cc.
References thePredictedGlobalPosition.
00072 {return thePredictedGlobalPosition;}
LocalVector PointForAlignment::predictedLocalDirection | ( | ) |
Definition at line 78 of file PointForAlignment.cc.
References thePredictedLocalDirection.
Referenced by calculateResiduals().
00078 {return thePredictedLocalDirection;}
LocalPoint PointForAlignment::predictedLocalPosition | ( | ) |
Definition at line 76 of file PointForAlignment.cc.
References thePredictedLocalPosition.
Referenced by calculateResiduals().
00076 {return thePredictedLocalPosition;}
long PointForAlignment::rawId | ( | ) |
TMatrixD PointForAlignment::residual | ( | ) |
Definition at line 82 of file PointForAlignment.cc.
References theResiduals.
00082 {return theResiduals;}
double PointForAlignment::residualPhi | ( | ) | [private] |
Definition at line 92 of file PointForAlignment.cc.
References theResidualPhi.
Referenced by calculateResiduals().
00092 {return theResidualPhi;}
double PointForAlignment::residualRPhi | ( | ) | [private] |
Definition at line 88 of file PointForAlignment.cc.
References theResidualRPhi.
Referenced by calculateResiduals().
00088 {return theResidualRPhi;}
double PointForAlignment::residualTheta | ( | ) | [private] |
Definition at line 94 of file PointForAlignment.cc.
References theResidualTheta.
Referenced by calculateResiduals().
00094 {return theResidualTheta;}
double PointForAlignment::residualZ | ( | ) | [private] |
Definition at line 90 of file PointForAlignment.cc.
References theResidualZ.
Referenced by calculateResiduals().
00090 {return theResidualZ;}
void PointForAlignment::setPointForAlignment | ( | long | rawId_, | |
int | subDet_M, | |||
int | station_M, | |||
GlobalPoint | globalPosition_M, | |||
GlobalVector | globalDirection_M, | |||
LocalPoint | localPosition_M, | |||
LocalError | localPositionError_M, | |||
LocalVector | localDirection_M, | |||
LocalError | localDirectionError_M, | |||
GlobalPoint | globalPosition_P, | |||
GlobalVector | globalDirection_P, | |||
LocalPoint | localPosition_P, | |||
LocalVector | localDirection_P, | |||
TMatrixD | theDerivatives_, | |||
TMatrixD | CovMatrix_m | |||
) |
Definition at line 15 of file PointForAlignment.cc.
References calculateAlignmentCoeff(), calculateErrors(), calculateResiduals(), CovMatrixInit, station, subDet, theDerivatives, theGlobalDirection, theGlobalPosition, theLocalDirection, theLocalDirectionError, theLocalPosition, theLocalPositionError, thePredictedGlobalDirection, thePredictedGlobalPosition, thePredictedLocalDirection, thePredictedLocalPosition, theRawId, theResiduals, and validPoint.
00015 { 00016 00017 //The rawId of the detector 00018 theRawId = rawId_; 00019 subDet = subDet_M; 00020 station = station_M; 00021 00022 //Position and orientation vectors 00023 theGlobalPosition = globalPosition_M; 00024 theGlobalDirection = globalDirection_M; 00025 theLocalPosition = localPosition_M; 00026 theLocalPositionError = localPositionError_M; 00027 theLocalDirection = localDirection_M; 00028 theLocalDirectionError = localDirectionError_M; 00029 //Position and orientation predicted vectors 00030 thePredictedGlobalPosition = globalPosition_P; 00031 thePredictedGlobalDirection = globalDirection_P; 00032 thePredictedLocalPosition = localPosition_P; 00033 thePredictedLocalDirection = localDirection_P; 00034 00035 //Jacobian 00036 theDerivatives.ResizeTo(theDerivatives_.GetNrows(), theDerivatives_.GetNcols()); 00037 theDerivatives = theDerivatives_; 00038 00039 //Covariance Matrix 00040 CovMatrixInit.ResizeTo(CovMatrix_m.GetNrows(), CovMatrix_m.GetNcols()); 00041 CovMatrixInit = CovMatrix_m; 00042 00043 calculateErrors(); 00044 calculateResiduals(); 00045 calculateAlignmentCoeff(); 00046 00047 if(TMath::Abs(theResiduals(0,0)) < 5.0 && TMath::Abs(theResiduals(1,0)) < 8.0 && TMath::Abs(theResiduals(2,0)) < 1.0 && TMath::Abs(theResiduals(3,0) < 1.0)) { 00048 validPoint = true; 00049 } else { 00050 validPoint = false; 00051 } 00052 00053 if(TMath::Abs(theDerivatives(1,0)/theDerivatives(0,0)) > 0.1 || 00054 TMath::Abs(theDerivatives(1,1)/theDerivatives(0,1)) > 0.1 || 00055 TMath::Abs(theDerivatives(1,3)/theDerivatives(0,3)) > 0.1 || 00056 TMath::Abs(theDerivatives(0,2)/theDerivatives(1,2)) > 0.1 || 00057 TMath::Abs(theDerivatives(0,4)/theDerivatives(1,4)) > 0.1) validPoint = false; 00058 }
TMatrixD PointForAlignment::CovMatrix [private] |
TMatrixD PointForAlignment::CovMatrixInit [private] |
Definition at line 100 of file PointForAlignment.h.
Referenced by calculateErrors(), and setPointForAlignment().
const int PointForAlignment::NDOFAlign = 6 [static, private] |
const int PointForAlignment::NDOFChamber = 4 [static, private] |
Definition at line 109 of file PointForAlignment.h.
const int PointForAlignment::NDOFCoor = 4 [static, private] |
Definition at line 110 of file PointForAlignment.h.
Referenced by calculateAlignmentCoeff(), calculateErrors(), and calculateResiduals().
const int PointForAlignment::NDOFTrack = 5 [static, private] |
Definition at line 107 of file PointForAlignment.h.
int PointForAlignment::station [private] |
Definition at line 81 of file PointForAlignment.h.
Referenced by calculateAlignmentCoeff(), calculateErrors(), calculateResiduals(), and setPointForAlignment().
int PointForAlignment::subDet [private] |
Definition at line 80 of file PointForAlignment.h.
Referenced by calculateAlignmentCoeff(), calculateErrors(), calculateResiduals(), and setPointForAlignment().
TMatrixD PointForAlignment::theAlignmentMatrix [private] |
Definition at line 98 of file PointForAlignment.h.
Referenced by alignmentMatrix(), and calculateAlignmentCoeff().
TMatrixD PointForAlignment::theDerivatives [private] |
Definition at line 94 of file PointForAlignment.h.
Referenced by derivatives(), and setPointForAlignment().
TMatrixD PointForAlignment::theErrors [private] |
Definition at line 84 of file PointForAlignment.h.
Referenced by globalDirection(), and setPointForAlignment().
Definition at line 83 of file PointForAlignment.h.
Referenced by globalPosition(), and setPointForAlignment().
Definition at line 87 of file PointForAlignment.h.
Referenced by localDirection(), and setPointForAlignment().
Definition at line 85 of file PointForAlignment.h.
Referenced by localPosition(), and setPointForAlignment().
Definition at line 90 of file PointForAlignment.h.
Referenced by predictedGlobalDirection(), and setPointForAlignment().
Definition at line 89 of file PointForAlignment.h.
Referenced by predictedGlobalPosition(), and setPointForAlignment().
Definition at line 92 of file PointForAlignment.h.
Referenced by predictedLocalDirection(), and setPointForAlignment().
Definition at line 91 of file PointForAlignment.h.
Referenced by predictedLocalPosition(), and setPointForAlignment().
long PointForAlignment::theRawId [private] |
Definition at line 79 of file PointForAlignment.h.
Referenced by rawId(), and setPointForAlignment().
double PointForAlignment::theResidualPhi [private] |
Definition at line 104 of file PointForAlignment.h.
Referenced by calculateResiduals(), and residualPhi().
double PointForAlignment::theResidualRPhi [private] |
Definition at line 102 of file PointForAlignment.h.
Referenced by calculateResiduals(), and residualRPhi().
TMatrixD PointForAlignment::theResiduals [private] |
Definition at line 96 of file PointForAlignment.h.
Referenced by calculateResiduals(), residual(), and setPointForAlignment().
TMatrixD PointForAlignment::theResidualsError [private] |
Definition at line 97 of file PointForAlignment.h.
double PointForAlignment::theResidualTheta [private] |
Definition at line 105 of file PointForAlignment.h.
Referenced by calculateResiduals(), and residualTheta().
double PointForAlignment::theResidualZ [private] |
Definition at line 103 of file PointForAlignment.h.
Referenced by calculateResiduals(), and residualZ().
bool PointForAlignment::validPoint [private] |
Definition at line 112 of file PointForAlignment.h.
Referenced by calculateAlignmentCoeff(), calculateErrors(), pointIsValid(), and setPointForAlignment().