56 return StatusCode::FAILURE;
62 if ( detStore()->retrieve(
m_idHelper).isFailure() ) {
63 msg(MSG::FATAL) <<
" Cannot retrieve SCT Helper " <<
endmsg;
64 return StatusCode::FAILURE;
71 msg(MSG::FATAL) <<
" Cannot retrieve SCT Detector Manager " <<
endmsg;
72 return StatusCode::FAILURE;
86 return StatusCode::FAILURE;
88 return StatusCode::SUCCESS;
96 return StatusCode::SUCCESS;
102 m_alignLevelBarrel = m_alignLevelEndcaps = -1;
103 m_alignLevel = level;
109 if(m_alignLevel == 0) {
110 ATH_MSG_INFO(
"Alignment level for SCT is "<<m_alignLevel);
115 ATH_MSG_INFO(
"Setting up OLD L2 alignment level for SCT");
116 m_alignLevelBarrel = m_alignLevel;
117 m_alignLevelEndcaps = m_alignLevel;
121 if(m_alignLevelBarrel == -1)
122 m_alignLevelBarrel = m_alignLevel;
124 if(m_alignLevelEndcaps == -1)
125 m_alignLevelEndcaps = m_alignLevel;
144 switch(m_alignLevelBarrel) {
145 case 1:
case 2:
case 27:
case 3:
146 ATH_MSG_INFO(
"Alignment level for SCT Barrel is "<<m_alignLevelBarrel);
149 msg(MSG::FATAL)<<
"Alignment level "<<m_alignLevelBarrel<<
" does not exist for SCT Barrel"<<
endmsg;
161 switch(m_alignLevelEndcaps) {
162 case 1:
case 2:
case 25:
case 3:
163 ATH_MSG_INFO(
"Alignment level for SCT Endcaps is "<<m_alignLevelBarrel);
166 msg(MSG::FATAL)<<
"Alignment level "<<m_alignLevelEndcaps<<
" does not exist for SCT Endcaps"<<
endmsg;
189 std::vector<Trk::AlignModule *>::const_iterator imod =
m_alignModuleList.begin();
190 std::vector<Trk::AlignModule *>::const_iterator imod_end =
m_alignModuleList.end();
191 for( ; imod!=imod_end ; ++imod)
209 ATH_MSG_INFO(
"Total number of degrees of freedom: "<<nDoF);
219 if(m_alignLevel == 0)
226 switch(m_alignLevelBarrel) {
244 switch(m_alignLevelEndcaps) {
267 ATH_MSG_INFO(
"Preparing the SCT geometry for L0: the whole SCT");
286 unsigned int sctmaxHash =
m_idHelper->wafer_hash_max();
308 if(msgLvl(MSG::DEBUG)) {
310 msg(MSG::DEBUG)<<
"... SCT barrel element"<<
endmsg;
312 msg(MSG::DEBUG)<<
"... SCT endcap element"<<
endmsg;
317 (*sctIdHashMap)[idHash] = sct;
324 m_alignModuleListPtr->push_back(sct);
326 ATH_MSG_DEBUG(
"SCT L0 module successfully added to the geometry");
335 ATH_MSG_INFO(
"Preparing the SCT Barrel geometry for L1: barrel + 2 endcaps");
341 unsigned int maxHash =
m_idHelper->wafer_hash_max();
351 mod->setIdHash(getNextIDHash());
352 mod->setName(
"SCT Barrel");
353 mod->setIdentifier(
m_idHelper->wafer_id(0,0,0,0,0));
367 for (
int iLayer = 0; iLayer <
m_detManager->numerology().numLayers(); iLayer++) {
371 for (
int iPhi = 0; iPhi <
m_detManager->numerology().numPhiModulesForLayer(iLayer); iPhi++) {
373 for (
int iEta =
m_detManager->numerology().beginEtaModuleForLayer(iLayer); iEta < m_detManager->numerology().endEtaModuleForLayer(iLayer); iEta++) {
376 if (!iEta &&
m_detManager->numerology().skipEtaZeroForLayer(iLayer))
380 for (
int is = 0; is < 2; is++) {
399 m_alignModuleListPtr->push_back(mod);
401 ATH_MSG_DEBUG(
"SCT Barrel successfully added to the geometry");
410 ATH_MSG_INFO(
"Preparing the SCT Endcap geometry for L1: 2 endcaps");
416 unsigned int maxHash =
m_idHelper->wafer_hash_max();
423 for (
int iEndcapIndex = 0; iEndcapIndex <
m_detManager->numerology().numEndcaps(); iEndcapIndex++) {
424 int iSide =
m_detManager->numerology().endcapId(iEndcapIndex);
427 mod->setIdHash(getNextIDHash());
428 mod->setIdentifier(
m_idHelper->wafer_id(iSide,0,0,0,0));
429 if(iEndcapIndex == 0)
430 mod->setName(
"SCT EndCap A");
432 mod->setName(
"SCT EndCap C");
444 for (
int iWheel = 0; iWheel <
m_detManager->numerology().numDisks(); iWheel++) {
448 for (
int iEta = 0; iEta <
m_detManager->numerology().numRingsForDisk(iWheel); iEta++) {
450 for (
int iPhi = 0; iPhi <
m_detManager->numerology().numPhiModulesForDiskRing(iWheel,iEta); iPhi++) {
452 for(
int is=0; is<2; is++) {
473 ATH_MSG_DEBUG(
"Endcap:" << iSide <<
" , CoG (" << translation.x() <<
" , " << translation.y() <<
" , " << translation.z() <<
" ) " );
474 Amg::Transform3D localtoglobal = translation * Amg::RotationMatrix3D::Identity();
476 mod->setGlobalFrameToAlignFrameTransform(localtoglobal.inverse());
478 m_alignModuleListPtr->push_back(mod);
481 ATH_MSG_DEBUG(
"SCT End-caps successfully added to the geometry");
489 ATH_MSG_INFO(
"Preparing the SCT Barrel geometry for L2: 4 layers");
497 unsigned int maxHash =
m_idHelper->wafer_hash_max();
504 for (
int iLayer = 0; iLayer <
m_detManager->numerology().numLayers(); iLayer++) {
510 mod->setIdHash(getNextIDHash());
511 mod->setIdentifier(
m_idHelper->wafer_id(0, iLayer, 0, 0, 0));
513 std::stringstream name;
514 name <<
"SCT/Barrel/Layer_"<<iLayer;
515 mod->setName(name.str());
525 for (
int iPhi = 0; iPhi <
m_detManager->numerology().numPhiModulesForLayer(iLayer); iPhi++) {
527 for (
int iEta =
m_detManager->numerology().beginEtaModuleForLayer(iLayer); iEta < m_detManager->numerology().endEtaModuleForLayer(iLayer); iEta++) {
529 if (!iEta &&
m_detManager->numerology().skipEtaZeroForLayer(iLayer))
532 for (
int is = 0; is < 2; is++) {
550 m_alignModuleListPtr->push_back(mod);
559 ATH_MSG_INFO(
"Preparing the SCT Barrel geometry for L27: 176 staves (ladders)");
572 unsigned int maxHash =
m_idHelper->wafer_hash_max();
579 for (
int iLayer = 0; iLayer <
m_detManager->numerology().numLayers(); iLayer++) {
582 for (
int iPhi = 0; iPhi <
m_detManager->numerology().numPhiModulesForLayer(iLayer); iPhi++) {
587 mod->setIdHash(getNextIDHash());
591 mod->setIdentifier(
m_idHelper->wafer_id(0, iLayer, iPhi, 0, 0));
593 std::stringstream name;
594 name <<
"SCT/Barrel/Layer_"<<iLayer<<
"/PhiStave_"<<iPhi;
595 mod->setName(name.str());
608 for (
int iEta =
m_detManager->numerology().beginEtaModuleForLayer(iLayer); iEta < m_detManager->numerology().endEtaModuleForLayer(iLayer); iEta++) {
610 if (!iEta &&
m_detManager->numerology().skipEtaZeroForLayer(iLayer))
613 for (
int is = 0; is < 2; is++) {
641 ATH_MSG_DEBUG(
" - translation: "<<localToGlobal.translation().x()<<
" "<<localToGlobal.translation().y()<<
" "<<localToGlobal.translation().z());
643 ATH_MSG_DEBUG(
" "<<localToGlobal.rotation()(0,0)<<
" "<<localToGlobal.rotation()(0,1)<<
" "<<localToGlobal.rotation()(0,2));
644 ATH_MSG_DEBUG(
" "<<localToGlobal.rotation()(1,0)<<
" "<<localToGlobal.rotation()(1,1)<<
" "<<localToGlobal.rotation()(1,2));
645 ATH_MSG_DEBUG(
" "<<localToGlobal.rotation()(2,0)<<
" "<<localToGlobal.rotation()(2,1)<<
" "<<localToGlobal.rotation()(2,2));
647 mod->setGlobalFrameToAlignFrameTransform(localToGlobal.inverse());
649 m_alignModuleListPtr->push_back(mod);
659 ATH_MSG_INFO(
"Preparing the SCT Endcap geometry for L2: 2 x 9 disks");
667 unsigned int maxHash =
m_idHelper->wafer_hash_max();
674 for (
int iEndcapIndex = 0; iEndcapIndex <
m_detManager->numerology().numEndcaps(); iEndcapIndex++) {
675 int iSide =
m_detManager->numerology().endcapId(iEndcapIndex);
676 for (
int iWheel = 0; iWheel <
m_detManager->numerology().numDisks(); iWheel++) {
681 mod->setIdHash(getNextIDHash());
682 mod->setIdentifier(
m_idHelper->wafer_id(iSide,iWheel,0,0,0));
684 std::stringstream name;
685 if(iEndcapIndex == 0)
686 name <<
"SCT/EndcapA/Disk_" << iWheel;
688 name <<
"SCT/EndcapC/Disk_" << iWheel;
689 mod->setName(name.str());
699 for (
int iEta = 0; iEta <
m_detManager->numerology().numRingsForDisk(iWheel); iEta++) {
701 for (
int iPhi = 0; iPhi <
m_detManager->numerology().numPhiModulesForDiskRing(iWheel,iEta); iPhi++) {
703 for(
int is=0; is<2; is++) {
723 ATH_MSG_DEBUG(
"Endcap:" << iSide <<
" , disk: " << iWheel <<
" , CoG (" << translation.x() <<
" , " << translation.y() <<
" , " << translation.z() <<
" ) " );
724 Amg::Transform3D localtoglobal = translation * Amg::RotationMatrix3D::Identity();
725 mod->setGlobalFrameToAlignFrameTransform(localtoglobal.inverse());
727 m_alignModuleListPtr->push_back(mod);
737 ATH_MSG_INFO(
"Preparing the SCT Endcap geometry for L25: 2 x 22 rings");
750 unsigned int maxHash =
m_idHelper->wafer_hash_max();
757 for (
int iEndcapIndex = 0; iEndcapIndex <
m_detManager->numerology().numEndcaps(); iEndcapIndex++) {
758 int iSide =
m_detManager->numerology().endcapId(iEndcapIndex);
759 for (
int iWheel = 0; iWheel <
m_detManager->numerology().numDisks(); iWheel++) {
762 for (
int iEta = 0; iEta <
m_detManager->numerology().numRingsForDisk(iWheel); iEta++) {
766 mod->setIdHash(getNextIDHash());
767 mod->setIdentifier(
m_idHelper->wafer_id(iSide,iWheel,iEta,0,0));
769 std::stringstream name;
770 if(iEndcapIndex == 0)
771 name <<
"SCT/EndcapA/Disk_"<<iWheel<<
"/Ring_"<<iEta;
773 name <<
"SCT/EndcapC/Disk_"<<iWheel<<
"/Ring_"<<iEta;
774 mod->setName(name.str());
784 for (
int iPhi = 0; iPhi <
m_detManager->numerology().numPhiModulesForDiskRing(iWheel,iEta); iPhi++) {
786 for(
int is=0; is<2; is++) {
808 ATH_MSG_DEBUG(
"Endcap:" << iSide <<
" , disk: " << iWheel <<
" , CoG (" << translation.x() <<
" , " << translation.y() <<
" , " << translation.z() <<
" ) " );
809 Amg::Transform3D localtoglobal = translation * Amg::RotationMatrix3D::Identity();
810 mod->setGlobalFrameToAlignFrameTransform(localtoglobal.inverse());
812 m_alignModuleListPtr->push_back(mod);
821 ATH_MSG_INFO(
"Preparing the old SCT Barrel geometry for L2: 4 barrel layers + 2 x 9 endcap disks");
825 unsigned int maxHash =
m_idHelper->wafer_hash_max();
833 int iEndcapIndex = 1;
834 int iSide =
m_detManager->numerology().endcapId(iEndcapIndex);
835 for (
int iWheel = 0; iWheel <
m_detManager->numerology().numDisks(); iWheel++) {
840 mod->setIdHash(getNextIDHash());
841 mod->setIdentifier(
m_idHelper->wafer_id(iSide,iWheel,0,0,0));
843 std::stringstream name;
844 name <<
"SCT/EndcapC/Disk_" << iWheel;
845 mod->setName(name.str());
855 for (
int iEta = 0; iEta <
m_detManager->numerology().numRingsForDisk(iWheel); iEta++) {
857 for (
int iPhi = 0; iPhi <
m_detManager->numerology().numPhiModulesForDiskRing(iWheel,iEta); iPhi++) {
859 for(
int is=0; is<2; is++) {
878 ATH_MSG_DEBUG(
"Endcap:" << iSide <<
" , disk: " << iWheel <<
" , CoG (" << translation.x() <<
" , " << translation.y() <<
" , " << translation.z() <<
" ) " );
879 Amg::Transform3D localtoglobal = translation * Amg::RotationMatrix3D::Identity();
880 mod->setGlobalFrameToAlignFrameTransform(localtoglobal.inverse());
882 m_alignModuleListPtr->push_back(mod);
886 for (
int iLayer = 0; iLayer <
m_detManager->numerology().numLayers(); iLayer++) {
892 mod->setIdHash(getNextIDHash());
893 mod->setIdentifier(
m_idHelper->wafer_id(0, iLayer, 0, 0, 0));
895 std::stringstream name;
896 name <<
"SCT/Barrel/Layer_"<<iLayer;
897 mod->setName(name.str());
907 for (
int iPhi = 0; iPhi <
m_detManager->numerology().numPhiModulesForLayer(iLayer); iPhi++) {
909 for (
int iEta =
m_detManager->numerology().beginEtaModuleForLayer(iLayer); iEta < m_detManager->numerology().endEtaModuleForLayer(iLayer); iEta++) {
911 if (!iEta &&
m_detManager->numerology().skipEtaZeroForLayer(iLayer))
914 for (
int is = 0; is < 2; is++) {
932 m_alignModuleListPtr->push_back(mod);
937 iSide =
m_detManager->numerology().endcapId(iEndcapIndex);
938 for (
int iWheel = 0; iWheel <
m_detManager->numerology().numDisks(); iWheel++) {
943 mod->setIdHash(getNextIDHash());
944 mod->setIdentifier(
m_idHelper->wafer_id(iSide,iWheel,0,0,0));
946 std::stringstream name;
947 name <<
"SCT/EndcapA/Disk_" << iWheel;
948 mod->setName(name.str());
958 for (
int iEta = 0; iEta <
m_detManager->numerology().numRingsForDisk(iWheel); iEta++) {
960 for (
int iPhi = 0; iPhi <
m_detManager->numerology().numPhiModulesForDiskRing(iWheel,iEta); iPhi++) {
962 for(
int is=0; is<2; is++) {
981 ATH_MSG_DEBUG(
"Endcap:" << iSide <<
" , disk: " << iWheel <<
" , CoG (" << translation.x() <<
" , " << translation.y() <<
" , " << translation.z() <<
" ) " );
983 Amg::Transform3D localtoglobal = translation * Amg::RotationMatrix3D::Identity();
985 mod->setGlobalFrameToAlignFrameTransform(localtoglobal.inverse());
987 m_alignModuleListPtr->push_back(mod);
996 ATH_MSG_INFO(
"Preparing the SCT Barrel geometry for L3: module (bi-wafer) level");
1002 unsigned int maxHash =
m_idHelper->wafer_hash_max();
1009 for (
int iLayer = 0; iLayer <
m_detManager->numerology().numLayers(); iLayer++) {
1012 for (
int iPhi = 0; iPhi <
m_detManager->numerology().numPhiModulesForLayer(iLayer); iPhi++) {
1014 for (
int iEta =
m_detManager->numerology().beginEtaModuleForLayer(iLayer); iEta < m_detManager->numerology().endEtaModuleForLayer(iLayer); iEta++) {
1016 if (!iEta &&
m_detManager->numerology().skipEtaZeroForLayer(iLayer))
1022 mod->setIdHash(getNextIDHash());
1023 mod->setIdentifier(
m_idHelper->wafer_id(0, iLayer, iPhi, iEta, 0));
1025 std::stringstream name;
1026 name <<
"SCT/Barrel/Layer_"<<iLayer<<
"/Phi_"<<iPhi<<
"/Eta_"<<iEta;
1027 mod->setName(name.str());
1037 for(
int is=0;is<2;is++) {
1064 mod->setGlobalFrameToAlignFrameTransform(element->
moduleTransform().inverse());
1068 m_alignModuleListPtr->push_back(mod);
1080 ATH_MSG_INFO(
"Preparing the SCT Endcap geometry for L3: module (bi-wafer) level");
1086 unsigned int maxHash =
m_idHelper->wafer_hash_max();
1093 for (
int iEndcapIndex = 0; iEndcapIndex <
m_detManager->numerology().numEndcaps(); iEndcapIndex++) {
1094 int iSide =
m_detManager->numerology().endcapId(iEndcapIndex);
1095 for (
int iWheel = 0; iWheel <
m_detManager->numerology().numDisks(); iWheel++) {
1098 for (
int iEta = 0; iEta <
m_detManager->numerology().numRingsForDisk(iWheel); iEta++) {
1100 for (
int iPhi = 0; iPhi <
m_detManager->numerology().numPhiModulesForDiskRing(iWheel,iEta); iPhi++) {
1104 mod->setIdHash(getNextIDHash());
1105 mod->setIdentifier(
m_idHelper->wafer_id(iSide,iWheel,iPhi,iEta,0));
1107 std::stringstream name;
1108 if(iEndcapIndex == 0)
1109 name<<
"SCT/EndcapA";
1111 name<<
"SCT/EndcapC";
1112 name<<
"/Disk_"<<iWheel<<
"/Phi_"<<iPhi<<
"/Eta_"<<iEta;
1113 mod->setName(name.str());
1123 for(
int is=0; is<2; is++) {
1149 mod->setGlobalFrameToAlignFrameTransform(element->
moduleTransform().inverse());
1153 m_alignModuleListPtr->push_back(mod);
1178 for(
unsigned int ipar=0;ipar<fullModPars->
size();++ipar) {
1181 Identifier modID = ((
module->detElementCollection(Trk::AlignModule::SCT))->at(0))->identify();
1184 ATH_MSG_DEBUG(
"SCT barrel module with id "<<AlimodID);
1185 if( (fullModPars->at(ipar)->paramType() == Trk::AlignModule::TransX && m_alignBarrelX)
1186 || (fullModPars->at(ipar)->paramType() == Trk::AlignModule::TransY && m_alignBarrelY)
1187 || (fullModPars->at(ipar)->paramType() == Trk::AlignModule::TransZ && m_alignBarrelZ)
1188 || (fullModPars->at(ipar)->paramType() == Trk::AlignModule::RotX && m_alignBarrelRotX)
1189 || (fullModPars->at(ipar)->paramType() == Trk::AlignModule::RotY && m_alignBarrelRotY)
1190 || (fullModPars->at(ipar)->paramType() == Trk::AlignModule::RotZ && m_alignBarrelRotZ) ) {
1191 ATH_MSG_DEBUG(
"parameter type "<<fullModPars->at(ipar)->paramType()<<
" is now active");
1192 activeModPars->push_back(fullModPars->at(ipar));
1195 ATH_MSG_DEBUG(
"parameter type "<<fullModPars->
at(ipar)->paramType()<<
" is NOT active");
1205 ATH_MSG_DEBUG(
"parameter type "<<fullModPars->
at(ipar)->paramType()<<
" is now active");
1209 ATH_MSG_DEBUG(
"parameter type "<<fullModPars->
at(ipar)->paramType()<<
" is NOT active");
1214 allFullModPars->push_back(fullModPars);
1215 allActiveModPars->push_back(activeModPars);
1221 for(
unsigned int ipar=0;ipar<modPars->
size();++ipar) {
1223 if(
m_idHelper->is_barrel(module->identify()))
1224 switch(modPars->
at(ipar)->paramType()) {
1254 switch(modPars->
at(ipar)->paramType()) {
1292 for(
int i=0;i<nsel;++i)
1308 ATH_MSG_INFO(
"---------------------------------------------------");
1317 Amg::Transform3D localtoglobal = (
module->globalFrameToAlignFrame()).inverse();
1318 ATH_MSG_DEBUG(
" - local to global : "<<std::setprecision(12)<<localtoglobal.translation()<<
" "<<localtoglobal.rotation());
1321 int npars = pars->
size();
1322 ATH_MSG_DEBUG(
" - number of active transform parameters: "<<npars);
1323 for(
int j=0;j<npars;j++)
1324 ATH_MSG_DEBUG(
" * par "<<j<<
" \'"<<(*pars)[j]->dumpType()<<
"\' : sigma = "<<(*pars)[j]->sigma()<<
" , softCut = "<<(*pars)[j]->softCut());
1326 ATH_MSG_INFO(
"---------------------------------------------------");
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_INFO(x,...)
An STL vector of pointers that by default owns its pointed-to elements.
This is an Identifier helper class for the SCT subdetector.
size_t size() const
Number of registered mappings.
const T * at(size_type n) const
Access an element, as an rvalue.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
This is a "hash" representation of an Identifier.
Class to hold geometrical description of a silicon detector element.
bool isStereo() const
Check if it is the stereo side (useful for SCT).
const Amg::Transform3D & moduleTransform() const
Module to global frame transform.
virtual IdentifierHash identifyHash() const override final
identifier hash (inline)
void setIdHash(IdentifierHash id)
Identifier identify() const
void setIdentifier(Identifier identifier)
Set and return identifier of module.
const std::string & name() const
void setName(const std::string &name)
Set and return name of align module (i.e.
void addDetElement(AlignModule::DetectorType detType, const TrkDetElementBase *det, const Amg::Transform3D &transform, Identifier id=Identifier())
used to add a detector element to the align module with a align frame to detector element local frame...
IdentifierHash identifyHash() const
Set and return index of module, used by alignment classes to keep track of order of align module.
Eigen::Matrix< double, 3, 3 > RotationMatrix3D
Eigen::Affine3d Transform3D
Eigen::Translation< double, 3 > Translation3D
@ OWN_ELEMENTS
this data object owns its elements
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
std::vector< AlignModule * > AlignModuleList