16 #include <Math/SMatrix.h>
17 #include <Math/SVector.h>
21 #include "MessageTools.h"
28 Detector(std::string ID =
"",
bool isDUT =
false);
31 ROC* addROC(
unsigned int ROCPosition,
int ROCID ,
unsigned int rotationDegrees = 0);
51 typedef ROOT::Math::SMatrix<double,3,3> matrix33Def;
52 typedef ROOT::Math::SMatrix<double,4,4> matrix44Def;
53 typedef std::pair<double, double> xyPair ;
54 typedef std::pair<int,int > rowColPair ;
56 void setupVariables (
void);
57 ROC* convertPixelToROC (
unsigned int* detector_row,
unsigned int* detector_col);
58 void convertPixelFromROC (
ROC* roc,
unsigned int* roc_row,
unsigned int* roc_col);
59 void fromGlobalToLocal (
double* x,
double* y,
double* z,
double* xErr,
double* yErr,
double* zErr);
60 void fromGlobalToLocal (
double* x,
double* y,
double* z);
61 double fromLocalToGlobal (
double* x,
double* y,
double* z,
double* xErr,
double* yErr,
double* zErr);
62 void fromLocalToGlobal (
double* x,
double* y,
double* z);
63 void fromLocalToGlobalNoRotation (
double* x,
double* y,
double* xErr,
double* yErr);
64 void flipPositionLocal (
double* x,
double* y,
double* xErr=0,
double* yErr=0 );
65 void flipBackPositionLocal (
double* x,
double* y,
double* xErr=0,
double* yErr=0 );
66 void flipPixel (
unsigned int* row,
unsigned int* col );
67 void flipBackPixel (
unsigned int* row,
unsigned int* col );
68 void flipDistance (
double* deltaX,
double* deltaY );
69 void flipBackDistance (
double* deltaX,
double* deltaY );
71 bool switchXYFromLocaToGlobal (
void);
73 matrix33Def getRotationMatrix ( );
75 unsigned int getNumberOfCols (
bool global =
false ) ;
76 unsigned int getNumberOfRows (
bool global =
false ) ;
77 unsigned int getLastCol (
void ) {
return (this->getNumberOfCols()-1) ;}
78 unsigned int getLastRow (
void ) {
return (this->getNumberOfRows()-1) ;}
79 ROC * getROC (
int chipID ) ;
80 ROC * getROCByPosition (
unsigned int chipPosition) ;
81 ROC * findROC (
unsigned int row,
unsigned int col ) ;
82 unsigned int getNumberOfROCs (
void ) {
return numberOfROCs_ ;}
83 unsigned int getROCPositionLocalX (
int chipID ) ;
84 unsigned int getROCPositionLocalY (
int chipID ) ;
85 unsigned int getROCPositionLocalXFromCol (
unsigned int col ) ;
86 unsigned int getROCPositionLocalYFromRow (
unsigned int row ) ;
87 unsigned int getNumberOfROCsLocalX (
void ) {
return xNumberOfROCs_ ;}
88 unsigned int getNumberOfROCsLocalY (
void ) {
return yNumberOfROCs_ ;}
90 double getPixelCenterLocalX (
unsigned int col ) ;
91 double getPixelCenterLocalY (
unsigned int row ) ;
92 double getPixelLowEdgeLocalX (
unsigned int col ) ;
93 double getPixelLowEdgeLocalY (
unsigned int row ) ;
94 double getPixelPitchLocalX (
unsigned int col ) ;
95 double getPixelPitchLocalY (
unsigned int row ) ;
96 int getPixelColFromLocalX (
double xLocal ) ;
97 int getPixelRowFromLocalY (
double yLocal ) ;
98 rowColPair getPixelCellFromLocal (
double x,
double y ) ;
99 rowColPair getPixelCellFromGlobal (
double x,
double y,
double z ) ;
100 double getAlignmentPredictedGlobal (ROOT::Math::SVector<double,4>& trackPars, matrix33Def& RInv,
double z,
double& predX,
double& predY);
101 void getPredictedGlobal (ROOT::Math::SVector<double,4>& trackPars,
double& predX,
double& predY,
double& predZ) ;
102 void getPredictedLocal (ROOT::Math::SVector<double,4>& trackPars,
double& predX,
double& predY) ;
103 xyPair getTrackErrorsOnPlane (ROOT::Math::SVector<double,4>& trackPars, matrix44Def& AtVAInv) ;
104 xyPair propagateTrackErrors (ROOT::Math::SVector<double,4>& trackPars, matrix44Def& AtVAInv, Detector::matrix33Def& RInv,
double z);
105 std::string getID (
void ) {
return ID_;}
106 double getDetectorLengthX (
bool global =
false ) ;
107 double getDetectorLengthY (
bool global =
false ) ;
109 double getXPositionTotal (
void ) {
return xPosition_+xPositionCorrection_;}
110 double getYPositionTotal (
void ) {
return yPosition_+yPositionCorrection_;}
111 double getZPositionTotal (
void ) {
return zPosition_+zPositionCorrection_;}
112 double getXPosition (
void ) {
return xPosition_ ;}
113 double getXPositionCorrection (
void ) {
return xPositionCorrection_ ;}
114 double getXPositionError (
void ) {
return xPositionError_ ;}
115 double getYPosition (
void ) {
return yPosition_ ;}
116 double getYPositionCorrection (
void ) {
return yPositionCorrection_ ;}
117 double getYPositionError (
void ) {
return yPositionError_ ;}
118 double getZPosition (
void ) {
return zPosition_ ;}
119 double getZPositionCorrection (
void ) {
return zPositionCorrection_ ;}
120 double getZPositionError (
void ) {
return zPositionError_ ;}
121 double getXRotation (
bool global_coordinate =
true ) ;
122 double getXRotationCorrection (
void ) {
return xRotationCorrection_ ;}
123 double getXRotationCorrectionError (
void ) {
return xRotationCorrectionError_;}
124 double getYRotation (
bool global_coordinate =
true ) ;
125 double getYRotationCorrection (
void ) {
return yRotationCorrection_ ;}
126 double getYRotationCorrectionError (
void ) {
return yRotationCorrectionError_;}
127 double getZRotation (
void ) {
return zRotation_ ;}
128 double getZRotationCorrection (
void ) {
return zRotationCorrection_ ;}
129 double getZRotationCorrectionError (
void ) {
return zRotationCorrectionError_;}
131 bool isDUT (
void ) {
return isDUT_ ;}
132 bool isXBackFlipped (
void ) {
return xBackFlipped_ ;}
133 bool isYBackFlipped (
void ) {
return yBackFlipped_ ;}
135 static matrix33Def rotationMatrix (
double alpha,
double beta,
double gamma );
137 void setDUT (
bool isDUT =
true ) {isDUT_=isDUT ;}
139 void setXBackFlipped (
bool isIt ) {xBackFlipped_ = isIt ;}
140 void setYBackFlipped (
bool isIt ) {yBackFlipped_ = isIt ;}
141 void setPosition (
double x,
double y,
double z) {xPosition_ = x; yPosition_ = y; zPosition_ = z;}
142 void setNumberOfROCs (
unsigned int xNumberOfROCs,
unsigned int yNumberOfROCs ) ;
143 void setXNumberOfROCs (
unsigned int xNumberOfROCs) {xNumberOfROCs_=xNumberOfROCs; this->updateNumberOfROCs() ;}
144 void setYNumberOfROCs (
unsigned int yNumberOfROCs) {yNumberOfROCs_=yNumberOfROCs; this->updateNumberOfROCs() ;}
146 void setXPosition (
double x) {xPosition_ = x ;}
147 void setXPositionCorrection (
double xCorr) {xPositionCorrection_ = xCorr ;}
148 void setXPositionError (
double xErr) {xPositionError_ = xErr ;}
149 void setYPosition (
double y) {yPosition_ = y ;}
150 void setYPositionCorrection (
double yCorr) {yPositionCorrection_ = yCorr ;}
151 void setYPositionError (
double yErr) {yPositionError_ = yErr ;}
152 void setZPosition (
double z) {zPosition_ = z ;}
153 void setZPositionCorrection (
double zCorr) {zPositionCorrection_ = zCorr ;}
154 void setZPositionError (
double zErr) {zPositionError_ = zErr ;}
155 void setXRotation (
double xRot) {xRotation_ = xRot ;}
156 void setXRotationCorrection (
double xRotCor) {xRotationCorrection_ = xRotCor ;}
157 void setXRotationCorrectionError (
double xRotCorErr) {xRotationCorrectionError_ = xRotCorErr;}
158 void setYRotation (
double y) {yRotation_ = y ;}
159 void setYRotationCorrection (
double yRotCor) {yRotationCorrection_ = yRotCor ;}
160 void setYRotationCorrectionError (
double yRotCorErr) {yRotationCorrectionError_ = yRotCorErr;}
161 void setZRotation (
double z) {zRotation_ = z ;}
162 void setZRotationCorrection (
double zRotCor) {zRotationCorrection_ = zRotCor ;}
163 void setZRotationCorrectionError (
double zRotCorErr) {zRotationCorrectionError_ = zRotCorErr;}
166 typedef std::map<int, ROC*>::iterator iterator;
167 iterator begin(
void) {
return ROCsChipIDMap_.begin();}
168 iterator end (
void) {
return ROCsChipIDMap_.end(); }
169 void test(
double* x,
double* y,
double* z,
double* xErr,
double* yErr,
double* zErr);
173 void XYZRotation (
double* x,
double* y,
double* z,
double* xErr,
double* yErr,
double* zErr,
bool backward =
false);
174 void XYZRotation (
double* x,
double* y,
double* z,
bool backward =
false);
175 void XRotation (
double* y,
double* z,
double* yErr,
double* zErr,
bool backward =
false);
176 void YRotation (
double* x,
double* z,
double* xErr,
double* zErr,
bool backward =
false);
177 void ZRotation (
double* x,
double* y,
double* xErr,
double* yErr,
bool backward =
false);
178 void XRotation (
double* y,
double* z,
bool backward =
false);
179 void YRotation (
double* x,
double* z,
bool backward =
false);
180 void ZRotation (
double* x,
double* y,
bool backward =
false);
181 void translateXY (
double* x,
double* y,
bool backward =
false);
182 void translateCorrection (
double* x,
double* y,
bool backward =
false);
184 void updateNumberOfROCs (
void){numberOfROCs_=xNumberOfROCs_*yNumberOfROCs_ ;}
186 typedef std::map<int, ROC*> ROCsMapDef ;
187 ROCsMapDef ROCsChipIDMap_ ;
188 ROCsMapDef ROCsPositionMap_ ;
194 double xPositionCorrection_ ;
195 double xPositionError_ ;
197 double yPositionCorrection_ ;
198 double yPositionError_ ;
200 double zPositionCorrection_ ;
201 double zPositionError_ ;
204 unsigned int xNumberOfROCs_ ;
205 unsigned int yNumberOfROCs_ ;
206 unsigned int numberOfROCs_ ;
207 unsigned int numberOfRows_ ;
208 unsigned int numberOfCols_ ;
215 double xRotationCorrection_ ;
216 double xRotationCorrectionError_ ;
218 double yRotationCorrection_ ;
219 double yRotationCorrectionError_ ;
221 double zRotationCorrection_ ;
222 double zRotationCorrectionError_ ;