diff --git a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/CMakeLists.txt b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/CMakeLists.txt index 7a465d0ba9e12c9f05fa569528239d150a7d4c25..9336481fc566e6483cbb9554de48aedb63acc983 100644 --- a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/CMakeLists.txt +++ b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/CMakeLists.txt @@ -12,7 +12,7 @@ atlas_add_component( InDetAlignGenAlgs src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthContainers AthenaBaseComps GeoPrimitives Identifier EventPrimitives xAODEventInfo GaudiKernel StoreGateLib TRT_ConditionsServicesLib TrkParameters TrkFitterUtils AthenaKernel AtlasDetDescr DetDescrConditions IdDictDetDescr InDetIdentifier InDetReadoutGeometry TRT_ReadoutGeometry InDetPrepRawData InDetRIO_OnTrack TrkPseudoMeasurementOnTrack TrkRIO_OnTrack TrkTrack TrkTrackSummary TrkExInterfaces TrkFitterInterfaces TrkToolInterfaces InDetAlignGenToolsLib RegistrationServicesLib ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthContainers AthenaBaseComps GeoPrimitives Identifier EventPrimitives xAODEventInfo GaudiKernel StoreGateLib TRT_ConditionsServicesLib TrkParameters TrkFitterUtils AthenaKernel AtlasDetDescr DetDescrConditions IdDictDetDescr SCT_ReadoutGeometry InDetIdentifier InDetReadoutGeometry TRT_ReadoutGeometry InDetPrepRawData InDetRIO_OnTrack TrkPseudoMeasurementOnTrack TrkRIO_OnTrack TrkTrack TrkTrackSummary TrkExInterfaces TrkFitterInterfaces TrkToolInterfaces InDetAlignGenToolsLib RegistrationServicesLib ) # Install files from the package: atlas_install_joboptions( share/*.py ) diff --git a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/CreateMisalignAlg.cxx b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/CreateMisalignAlg.cxx index 3952620203852301daa85795b18a282fef6e7b4b..9cebbdd645c63c0e25fff00435b7c4f911808935 100644 --- a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/CreateMisalignAlg.cxx +++ b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/CreateMisalignAlg.cxx @@ -44,6 +44,10 @@ + +#include "SCT_ReadoutGeometry/StripStereoAnnulusDesign.h" + + namespace{ std::string commonAlignmentOutput(const HepGeom::Transform3D & initialAlignment){ std::ostringstream os; @@ -180,9 +184,12 @@ namespace InDetAlignment ATH_CHECK( nt->addItem("LayerDisc" ,m_AlignResults_Identifier_LayerDisc) ); ATH_CHECK( nt->addItem("Phi" ,m_AlignResults_Identifier_Phi) ); ATH_CHECK( nt->addItem("Eta" ,m_AlignResults_Identifier_Eta) ); - ATH_CHECK( nt->addItem("center_x" ,m_AlignResults_center_x) ); - ATH_CHECK( nt->addItem("center_y" ,m_AlignResults_center_y) ); - ATH_CHECK( nt->addItem("center_z" ,m_AlignResults_center_z) ); + ATH_CHECK( nt->addItem("center_x" ,m_Initial_center_x ) ); + ATH_CHECK( nt->addItem("center_y" ,m_Initial_center_y ) ); + ATH_CHECK( nt->addItem("center_z" ,m_Initial_center_z ) ); + ATH_CHECK( nt->addItem("misaligned_global_x" ,m_Global_center_x ) ); + ATH_CHECK( nt->addItem("misaligned_global_y" ,m_Global_center_y ) ); + ATH_CHECK( nt->addItem("misaligned_global_z" ,m_Global_center_z ) ); } else { // did not manage to book the N tuple.... msg(MSG::ERROR) << "Failed to book InitialAlignment ntuple." << endmsg; } @@ -622,7 +629,8 @@ namespace InDetAlignment } else if (m_MisalignmentMode == 2) { - // randomly misalign modules at L3 + + // randomly misalign modules at L3 Rndm::Numbers RandMisX(randsvc, Rndm::Gauss(m_Misalign_x,m_RndmMisalignWidth_x*ScaleFactor)); Rndm::Numbers RandMisY(randsvc, Rndm::Gauss(m_Misalign_y,m_RndmMisalignWidth_y*ScaleFactor)); Rndm::Numbers RandMisZ(randsvc, Rndm::Gauss(m_Misalign_z,m_RndmMisalignWidth_z*ScaleFactor)); @@ -889,7 +897,7 @@ namespace InDetAlignment double alpha, beta, gamma; m_IDAlignDBTool->extractAlphaBetaGamma(alignmentTrafoAmg, alpha, beta, gamma); - + m_AlignResults_x = alignmentTrafo.getTranslation().x(); m_AlignResults_y = alignmentTrafo.getTranslation().y(); m_AlignResults_z = alignmentTrafo.getTranslation().z(); @@ -897,11 +905,53 @@ namespace InDetAlignment m_AlignResults_beta = beta; m_AlignResults_gamma = gamma; - m_AlignResults_center_x = center.x(); - m_AlignResults_center_y = center.y(); - m_AlignResults_center_z = center.z(); - - if (m_idHelper->is_sct(ModuleID)) { + + HepGeom::Transform3D LocalaGlobal = HepGeom::Transform3D(); + LocalaGlobal = Amg::EigenTransformToCLHEP(SiModule->moduleTransform()); + HepGeom::Point3D<double> alignedPosLocal(m_AlignResults_x,m_AlignResults_y,m_AlignResults_z); + + + + + m_Initial_center_x = center.x() ; + m_Initial_center_y = center.y() ; + m_Initial_center_z = center.z() ; + + HepGeom::Point3D<double> alignedPosGlobal = LocalaGlobal * alignedPosLocal; + + // Global Misalignment HERE + if (m_idHelper->is_sct(ModuleID)) { + // non-zero local center position gives additional radial shift of SCT endcap + const InDetDD::StripStereoAnnulusDesign *p_design_check = dynamic_cast<const InDetDD::StripStereoAnnulusDesign*>(&(SiModule->design())); + if (p_design_check){ + Amg::Vector3D SCT_Center = p_design_check->sensorCenter(); + double radialShift_x = SCT_Center[0]; // in sensor frame, x direction + double radialShift_y = SCT_Center[1]; // in sensor frame, y direction + HepGeom::Transform3D radial_shift = HepGeom::Translate3D(radialShift_x,radialShift_y,0); // the additional radial shift applied as translation + HepGeom::Transform3D LocalaaGlobal = LocalaGlobal * radial_shift; // apply additional radial shift + HepGeom::Point3D<double> SCT_endcap_alignedPosGlobal = LocalaaGlobal * alignedPosLocal; // corrected global transformation + m_Global_center_x = SCT_endcap_alignedPosGlobal.x(); + m_Global_center_z = SCT_endcap_alignedPosGlobal.z(); + m_Global_center_y = SCT_endcap_alignedPosGlobal.y(); + } + + else { // no additional radial shift for SCT barrel + m_Global_center_x = alignedPosGlobal.x(); + m_Global_center_y = alignedPosGlobal.y(); + m_Global_center_z = alignedPosGlobal.z(); + + } + + } + + else { // no additional radial shift for non-SCT elements + m_Global_center_x = alignedPosGlobal.x(); + m_Global_center_y = alignedPosGlobal.y(); + m_Global_center_z = alignedPosGlobal.z(); + } + + + if (m_idHelper->is_sct(ModuleID)) { m_AlignResults_Identifier_ID = 2; m_AlignResults_Identifier_PixelSCT = 2; m_AlignResults_Identifier_BarrelEC = m_sctIdHelper->barrel_ec(ModuleID); diff --git a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/CreateMisalignAlg.h b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/CreateMisalignAlg.h index dd6735c084320b8cbe06baeaeeaa1579974fb330..3ba6ae92dd4d29ecf46eeb6b72bf0dc00e767931 100644 --- a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/CreateMisalignAlg.h +++ b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/CreateMisalignAlg.h @@ -125,9 +125,14 @@ private: NTuple::Item<long> m_AlignResults_Identifier_Phi; //!< ID information for this module NTuple::Item<long> m_AlignResults_Identifier_Eta; //!< ID information for this module - NTuple::Item<double> m_AlignResults_center_x; //!< Initial global center of module - NTuple::Item<double> m_AlignResults_center_y; //!< Initial global center of module - NTuple::Item<double> m_AlignResults_center_z; //!< Initial global center of module + NTuple::Item<double> m_Initial_center_x; //!< Initial global center of module + NTuple::Item<double> m_Initial_center_y; //!< Initial global center of module + NTuple::Item<double> m_Initial_center_z; //!< Initial global center of module + + + NTuple::Item<double> m_Global_center_x; //!< Misaligned global center of module + NTuple::Item<double> m_Global_center_y; //!< Misaligned global center of module + NTuple::Item<double> m_Global_center_z; //!< Misaligned global center of module // Member Functions