7 #include <GaudiKernel/IMessageSvc.h>
8 #include <GeoModelKernel/GeoDefinitions.h>
9 #include <GeoModelKernel/GeoLogVol.h>
10 #include <GeoModelKernel/GeoVFullPhysVol.h>
11 #include <GeoModelKernel/GeoVPhysVol.h>
23 #include "GaudiKernel/MsgStream.h"
24 #include "GeoModelKernel/GeoFullPhysVol.h"
48 if (
mgr->MinimalGeoFlag() == 0) {
49 if (GeoFullPhysVol* pvc =
dynamic_cast<GeoFullPhysVol*
>(
pv)) {
50 unsigned int nchildvol = pvc->getNChildVols();
52 std::string::size_type npos;
53 for (
unsigned ich = 0; ich < nchildvol; ich++) {
54 PVConstLink
pc = pvc->getChildVol(ich);
55 std::string childname = (
pc->getLogVol())->
getName();
56 int nch1 =
pc->getNChildVols();
58 for (
int ngv = 0; ngv < nch1; ngv++) {
59 PVConstLink pcgv =
pc->getChildVol(ngv);
60 std::string childname1 = (pcgv->getLogVol())->
getName();
62 if ((npos = childname1.find(
"CscArCO2")) != std::string::npos) {
63 const GeoTrf::Vector3D trans = (pvc->getXToChildVol(ich) *
pc->getXToChildVol(ngv)).translation();
70 std::stringstream error_str{};
71 error_str<<__FILE__<<
":"<<__LINE__<<
" - Cannot performa dynamic cast!";
72 throw std::runtime_error(error_str.str());
81 for (
unsigned int i = 0;
i < 4; ++
i) {
82 for (
unsigned int j = 0; j < 3; ++j) {
86 for (
unsigned int i = 0;
i < 4; ++
i) {
87 for (
unsigned int j = 0; j < 3; ++j) {
142 if (
log.level() <=
MSG::VERBOSE)
log <<
"CscReadoutElement::wireLayerPos got localWireLayerPos " << localP <<
endmsg;
144 return cscTrans * localP;
193 return (realLength * sWidth / (lWidth - sWidth));
201 double shortLength = bigLength - (lWidth - gslWidth) *
std::tan(alpha) / 2.;
202 return (shortLength * sWidth / (lWidth - sWidth));
251 return cscTrans * localP;
257 return cscTrans * localP;
301 double gslWidth{0.}, sLength{0.};
307 bigWidth = 2 * (chamberLength + 0.5 * smallWidth /
std::tan(
beta) + 0.5 * gslWidth *
std::tan(alpha)) /
317 sLength = 2.0 * (effectiveLength / 2.0 +
pos) *
std::tan(
beta) + smallWidth;
320 sLength = chamberLength;
324 double shortLength = chamberLength - (bigWidth - gslWidth) *
std::tan(alpha) / 2.;
325 sLength = chamberLength - 2.0 *
diff * shortLength / (bigWidth - smallWidth);
327 sLength = chamberLength * (1.0 - 2.0 *
diff / (bigWidth - smallWidth));
330 return (sLength - epsilon);
336 double epsilon = 0.0;
344 double bigWidth = 2 * (bigLength + 0.5 * smallWidth /
std::tan(
beta) + 0.5 * gslWidth *
std::tan(alpha)) /
346 double shortLength = bigLength - (bigWidth - gslWidth) *
std::tan(alpha) / 2.;
351 double z0 = shortLength - bigLength / 2;
356 epsilon = 2.0 * (corr1 + corr2);
359 if (epsilon < 0.0) epsilon = 0.0;
372 return transfPtr_internalgeo * nominalLP;
380 double x = stripPlane.x();
381 double y = stripPlane.y();
382 double z = stripPlane.z();
389 double epsilon = 0.0;
390 double lengthOfStrip =
stripLength(chamberLayer, measPhi, strip, epsilon);
397 z = stripWidth * (strip - 0.5 -
nStrips / 2.0);
401 y = stripWidth * (strip - 0.5 -
nStrips / 2.0);
403 y = -stripWidth * (strip - 0.5 -
nStrips / 2.0);
415 double x = wireLayerPosition.x();
416 double y = wireLayerPosition.y();
417 double z = wireLayerPosition.z();
436 transfPtr_internalgeo *=
442 return transfPtr_internalgeo * nominalLCP;
449 return cscTrans.inverse() * globalP;
456 return cscTrans * localP;
467 int strip = idh->
strip(
id);
471 double pos = stripWidth * (strip - 0.5 -
nStrips / 2.0);
472 if (eta > 0 && measPhi)
pos *= -1;
478 if (measPhi != 0 && measPhi != 1)
throw std::runtime_error (
"CscReadoutElement::localStripLayerPos bad measPhi");
481 double x = wireLayerPosition.x();
482 double y = wireLayerPosition.y();
483 double z = wireLayerPosition.z();
485 if (wireLayer == 1 || wireLayer == 3) {
487 x = wireLayerPosition.x() + anodeCathodeDis;
489 x = wireLayerPosition.x() - anodeCathodeDis;
492 x = wireLayerPosition.x() - anodeCathodeDis;
494 x = wireLayerPosition.x() + anodeCathodeDis;
506 if (measPhi == 0)
return 1.0;
517 double sinstero = (posStrip.y() * etaAxis.x() - posStrip.x() * etaAxis.y()) / (posStrip.perp() * etaAxis.perp());
525 constexpr std::array<int, 2> eta{1, -1};
526 constexpr std::array<int, 2> maxStrips{192, 48};
527 int chamberLayer = 1;
529 for (
int measPhi = 0; measPhi < 2; ++measPhi) {
530 for (
int ieta = 0; ieta < 2; ++ieta) {
531 for (
int ilayer = 1; ilayer <= wireLayer; ++ilayer) {
532 int strips[3] = {1, maxStrips[measPhi] / 2, maxStrips[measPhi]};
533 for (
int i = 0;
i < 3;
i++) {
534 int istrip = strips[
i];
537 log <<
MSG::VERBOSE <<
"the nominal positions = " << npos.x() <<
" " << npos.y() <<
" " << npos.z() <<
endmsg;
552 int strip = idh->
strip(
id);
569 return cscTrans * localP;
575 const int wlayer = idh.
wireLayer(
x.identify());
576 const bool notAllowedLayer = (wlayer > 4 || wlayer <1);
579 if (idh.elementID(
x.identify()) != idh.elementID(
identify()) || notAllowedLayer) {
581 <<
"Inconsistent CSC int. Aline assignment - Internal alignment will not be applied ");
589 m_cscIntRot[wlayer - 1][0] =
x.getParameter(Parameter::rotS);
590 m_cscIntRot[wlayer - 1][1] =
x.getParameter(Parameter::rotZ);
591 m_cscIntRot[wlayer - 1][2] =
x.getParameter(Parameter::rotT);
593 for (
unsigned int j = 0; j < 3; ++j) {
594 ATH_MSG_DEBUG(
"<CscReadoutElement::setCscInternalAlignmentPar()>: m_cscIntTransl[" << (wlayer - 1) <<
"][" << j
596 ATH_MSG_DEBUG(
"<CscReadoutElement::setCscInternalAlignmentPar()>: m_cscIntRot[" << (wlayer - 1) <<
"][" << j
621 surfaceTRotation.col(0) = muonTRotation.col(1);
622 surfaceTRotation.col(1) = muonTRotation.col(2);
623 surfaceTRotation.col(2) = muonTRotation.col(0);
624 if (measPhi == 0) surfaceTRotation = surfaceTRotation *
Amg::AngleAxis3D(
M_PI / 2., Amg::Vector3D::UnitZ());
631 log <<
MSG::DEBUG <<
"nominalTransform+++++++++++Original Tranformation ++++++++++++++++++++++" <<
endmsg;
632 log <<
MSG::DEBUG << (transfPtr_orig)(0, 0) <<
" " << (transfPtr_orig)(0, 1) <<
" " << (transfPtr_orig)(0, 2) <<
" "
633 << (transfPtr_orig)(0, 3) <<
endmsg;
634 log <<
MSG::DEBUG << (transfPtr_orig)(1, 0) <<
" " << (transfPtr_orig)(1, 1) <<
" " << (transfPtr_orig)(1, 2) <<
" "
635 << (transfPtr_orig)(1, 3) <<
endmsg;
636 log <<
MSG::DEBUG << (transfPtr_orig)(2, 0) <<
" " << (transfPtr_orig)(2, 1) <<
" " << (transfPtr_orig)(2, 2) <<
" "
637 << (transfPtr_orig)(2, 3) <<
endmsg;
641 return transfPtr_orig;
664 if (
log.level() <= MSG::WARNING)
log << MSG::WARNING <<
"calling fillCache on an already filled cache" <<
endmsg;
673 for (
int mp = 1; mp >= 0; --mp) {
681 surfaceTRotation.col(0) = muonTRotation.col(1);
682 surfaceTRotation.col(1) = muonTRotation.col(2);
683 surfaceTRotation.col(2) = muonTRotation.col(0);
684 if (mp == 0) surfaceTRotation = surfaceTRotation *
Amg::AngleAxis3D(
M_PI / 2., Amg::Vector3D::UnitZ());
687 transfPtr_orig.pretranslate(trans3D.translation());
690 transfPtr_internalgeo *=
696 transfPtr_internalgeo *=
704 m_surfaceData->m_layerSurfaces.emplace_back(std::make_unique<Trk::PlaneSurface>(*
this,
id));
725 if (wireLayer < 1 || wireLayer >
Ngasgaps())
return false;
730 if (channel < 1 || channel >
NetaStrips(wireLayer))
return false;
731 }
else if (measPhi == 1) {
732 if (channel < 1 || channel >
NphiStrips(wireLayer))
return false;
741 if (
log.level() <= MSG::WARNING)
log << MSG::WARNING <<
" distanceToReadout::dummy routine " <<
endmsg;
747 if (
log.level() <= MSG::WARNING)
log << MSG::WARNING <<
" stripNumber::dummy routine " <<
endmsg;
756 if (
log.level() <= MSG::WARNING)