File indexing completed on 2025-08-06 08:18:07
0001 #ifndef TRACKBASE_ALIGNMENTTRANSFORMATION_H
0002 #define TRACKBASE_ALIGNMENTTRANSFORMATION_H
0003
0004 #include "TrkrDefs.h"
0005 #include "alignmentTransformationContainer.h"
0006
0007 #include <Eigen/Dense>
0008 #include <Eigen/Geometry>
0009
0010 #include <map>
0011 #include <random>
0012
0013 class PHCompositeNode;
0014
0015 class ActsGeometry;
0016
0017 class AlignmentTransformation
0018 {
0019 public:
0020 AlignmentTransformation() = default;
0021
0022 ~AlignmentTransformation() {}
0023
0024 void createMap(PHCompositeNode* topNode);
0025 void createAlignmentTransformContainer(PHCompositeNode* topNode);
0026
0027 void generateRandomPerturbations(Eigen::Vector3d angleDev, Eigen::Vector3d transformDev);
0028
0029 bool perturbMVTX = false;
0030 bool perturbINTT = false;
0031 bool perturbTPC = false;
0032 bool perturbMM = false;
0033
0034 Eigen::Vector3d perturbationAngles = Eigen::Vector3d(0.0, 0.0, 0.0);
0035 Eigen::Vector3d perturbationAnglesGlobal = Eigen::Vector3d(0.0, 0.0, 0.0);
0036 Eigen::Vector3d perturbationTranslation = Eigen::Vector3d(0.0, 0.0, 0.0);
0037
0038 void setMVTXParams(double mvtxDevs[6])
0039 {
0040 mvtxAngleDev(0) = mvtxDevs[0];
0041 mvtxAngleDev(1) = mvtxDevs[1];
0042 mvtxAngleDev(2) = mvtxDevs[2];
0043 mvtxTransDev(0) = mvtxDevs[3];
0044 mvtxTransDev(1) = mvtxDevs[4];
0045 mvtxTransDev(2) = mvtxDevs[5];
0046
0047 perturbMVTX = true;
0048
0049 if (localVerbosity)
0050 {
0051 std::cout << "perturbMVTX: " << perturbMVTX << " MVTX Angle Std Dev: " << mvtxAngleDev << "MVTX Trans Std Dev:" << mvtxTransDev << std::endl;
0052 }
0053 }
0054
0055 void setINTTParams(double inttDevs[6])
0056 {
0057 inttAngleDev(0) = inttDevs[0];
0058 inttAngleDev(1) = inttDevs[1];
0059 inttAngleDev(2) = inttDevs[2];
0060 inttTransDev(0) = inttDevs[3];
0061 inttTransDev(1) = inttDevs[4];
0062 inttTransDev(2) = inttDevs[5];
0063
0064 perturbINTT = true;
0065
0066 if (localVerbosity)
0067 {
0068 std::cout << "perturbINTT: " << perturbINTT << " INTT Angle Std Dev: " << inttAngleDev << "INTT Trans Std Dev:" << inttTransDev << std::endl;
0069 }
0070 }
0071 void setTPCParams(double tpcDevs[6])
0072 {
0073 tpcAngleDev(0) = tpcDevs[0];
0074 tpcAngleDev(1) = tpcDevs[1];
0075 tpcAngleDev(2) = tpcDevs[2];
0076 tpcTransDev(0) = tpcDevs[3];
0077 tpcTransDev(1) = tpcDevs[4];
0078 tpcTransDev(2) = tpcDevs[5];
0079
0080 perturbTPC = true;
0081
0082 if (localVerbosity)
0083 {
0084 std::cout << "perturbTPC: " << perturbTPC << " TPC Angle Std Dev: " << tpcAngleDev << "TPC Trans Std Dev:" << tpcTransDev << std::endl;
0085 }
0086 }
0087 void setMMParams(double mmDevs[6])
0088 {
0089 mmAngleDev(0) = mmDevs[0];
0090 mmAngleDev(1) = mmDevs[1];
0091 mmAngleDev(2) = mmDevs[2];
0092 mmTransDev(0) = mmDevs[3];
0093 mmTransDev(1) = mmDevs[4];
0094 mmTransDev(2) = mmDevs[5];
0095
0096 perturbMM = true;
0097
0098 if (localVerbosity)
0099 {
0100 std::cout << "perturbMM: " << perturbMM << " MM Angle Std Dev: " << mmAngleDev << "MM Trans Std Dev:" << mmTransDev << std::endl;
0101 }
0102 }
0103
0104 void verbosity() { localVerbosity = 1; }
0105 void misalignmentFactor(uint8_t layer, const double factor);
0106 double misalignmentFactor(uint8_t layer)
0107 {
0108 return transformMap->getMisalignmentFactor(layer);
0109 }
0110 void useInttSurveyGeometry(bool sur) { use_intt_survey_geometry = sur; }
0111
0112 private:
0113 Eigen::Vector3d mvtxAngleDev;
0114 Eigen::Vector3d mvtxTransDev;
0115 Eigen::Vector3d inttAngleDev;
0116 Eigen::Vector3d inttTransDev;
0117 Eigen::Vector3d tpcAngleDev;
0118 Eigen::Vector3d tpcTransDev;
0119 Eigen::Vector3d mmAngleDev;
0120 Eigen::Vector3d mmTransDev;
0121
0122 std::default_random_engine generator;
0123
0124 std::string alignmentParamsFile = "./localAlignmentParamsFile.txt";
0125
0126 int localVerbosity = 0;
0127
0128 bool use_intt_survey_geometry = false;
0129
0130 Acts::Transform3 newMakeTransform(const Surface& surf, Eigen::Vector3d& millepedeTranslation, Eigen::Vector3d& sensorAngles, Eigen::Vector3d& sensorAnglesGlobal, bool survey);
0131
0132 alignmentTransformationContainer* transformMap = NULL;
0133 alignmentTransformationContainer* transformMapTransient = NULL;
0134 ActsGeometry* m_tGeometry = NULL;
0135
0136 int getNodes(PHCompositeNode* topNode);
0137 };
0138
0139 #endif