 |
ATLAS Offline Software
|
Go to the documentation of this file.
13 #include <GaudiKernel/IMessageSvc.h>
14 #include <GeoModelKernel/GeoLogVol.h>
15 #include <GeoModelKernel/GeoShape.h>
16 #include <GeoModelKernel/GeoVFullPhysVol.h>
17 #include <GeoModelKernel/GeoDefinitions.h>
24 #include "GaudiKernel/SystemOfUnits.h"
25 #include "GeoModelHelpers/getChildNodesWithTrf.h"
26 #include "GeoModelHelpers/StringUtils.h"
27 #include "GeoModelHelpers/GeoShapeUtils.h"
28 #include "GeoModelHelpers/TransformToStringConverter.h"
30 #include "GeoModelKernel/GeoFullPhysVol.h"
31 #include "GeoModelKernel/GeoShapeSubtraction.h"
32 #include "GeoModelKernel/GeoTrd.h"
41 #include "GaudiKernel/ISvcLocator.h"
49 #define THROW_EXCEPTION_MM(MSG) \
51 std::stringstream sstr{}; \
52 sstr<<"MMReadoutElement - "<<idHelperSvc()->toStringDetEl(identify())<<" "<<__LINE__<<": "; \
54 throw std::runtime_error(sstr.str()); \
58 template <
class ObjType,
size_t N>
void assign(
const std::vector<ObjType>& in,
59 std::array<ObjType, N>&
out) {
66 using namespace GeoStrUtils;
74 std::string fixName = (
stName[2] ==
'L') ?
"MML" :
"MMS";
75 setStationName(fixName);
77 Identifier id =
mgr->mmIdHelper()->channelID(fixName, zi, fi,
mL, 1, 1);
81 if (
mgr->MinimalGeoFlag()) {
84 bool foundShape =
false;
85 const PVConstLink pvc {getMaterialGeom()};
86 const GeoTrd* trd=
dynamic_cast<const GeoTrd *
> (pvc->getLogVol()->getShape());
88 setSsize(2*trd->getYHalfLength1());
89 setLongSsize( 2*trd->getYHalfLength2());
90 setRsize(2*trd->getZHalfLength());
91 setZsize(trd->getXHalfLength1());
94 ATH_MSG_DEBUG(
"Expected a GeoTrd but got "<<printGeoShape(pvc->getLogVol()->getShape()));
97 std::vector<GeoChildNodeWithTrf>
children{getAllSubVolumes(pvc)};
98 for (
const GeoChildNodeWithTrf& child :
children) {
99 ATH_MSG_VERBOSE(
"Child node "<<child.nodeName<<
" "<<child.volume->getLogVol()->getName());
100 if (child.volume->getLogVol()->getName().find(
"Sensitive") == std::string::npos &&
102 child.volume->getLogVol()->getName() !=
"actMicroMegaGas") {
109 m_Xlg[m_nlayers - 1] = child.transform;
114 const GeoShape* childShape = child.volume->getLogVol()->getShape();
115 while (childShape->typeID() != GeoTrd::getClassTypeID()){
116 auto [opA, opB] = getOps(childShape);
117 ATH_MSG_VERBOSE(
"Operands are "<<printGeoShape(opA)<<
", "<<printGeoShape(opB));
120 const GeoTrd* trd =
dynamic_cast<const GeoTrd*
>(childShape);
121 m_halfX = trd->getZHalfLength();
123 m_minHalfY = trd->getYHalfLength1();
124 m_maxHalfY = trd->getYHalfLength2();
140 SmartIF<IGeoDbTagSvc> geoDbTag{Gaudi::svcLocator()->service(
"GeoDbTagSvc")};
144 SmartIF<IRDBAccessSvc> accessSvc{Gaudi::svcLocator()->service(geoDbTag->getParamSvcName())};
150 for (
unsigned int ind = 0; ind < wmmRec->size(); ind++) {
151 std::string WMM_TYPE = (*wmmRec)[ind]->getString(
"WMM_TYPE");
152 if (sector_l != WMM_TYPE[4]){
158 if (
m_ml != (
int) (WMM_TYPE[12]-
'0')){
161 const double Tck = (*wmmRec)[ind]->getDouble(
"Tck");
162 const double activeBottomLength = (*wmmRec)[ind]->getDouble(
"activeBottomLength");
163 const double activeH = (*wmmRec)[ind]->getDouble(
"activeH");
164 const double activeTopLength = (*wmmRec)[ind]->getDouble(
"activeTopLength");
165 const double gasTck = (*wmmRec)[ind]->getDouble(
"gasTck");
166 const int nMissedBottomEta = (*wmmRec)[ind]->getInt(
"nMissedBottomEta");
167 const int nMissedBottomStereo = (*wmmRec)[ind]->getInt(
"nMissedBottomStereo");
168 const int nMissedTopEta = (*wmmRec)[ind]->getInt(
"nMissedTopEta");
169 const int nMissedTopStereo = (*wmmRec)[ind]->getInt(
"nMissedTopStereo");
173 const double stripPitch = (*wmmRec)[ind]->getDouble(
"stripPitch");
174 const int totalStrips = (*wmmRec)[ind]->getInt (
"totalStrips");
175 const double ylFrame = (*wmmRec)[ind]->getDouble(
"ylFrame");
176 const double ysFrame = (*wmmRec)[ind]->getDouble(
"ysFrame");
182 m_offset = -0.5*(ylFrame - ysFrame);
215 <<
", strip pitch " << design.
inputPitch <<
", nstrips " << design.
nch
225 if (m_ml < 1 || m_ml > 2) {
230 SmartIF<IGeoDbTagSvc> geoDbTag{Gaudi::svcLocator()->service(
"GeoDbTagSvc")};
234 if (geoDbTag->getSqliteReader()) {
246 double ylFrame =
mm->ylFrame();
247 double ysFrame =
mm->ysFrame();
260 m_offset = -0.5*(ylFrame - ysFrame);
296 <<
", strip pitch " << design.
inputPitch <<
", nstrips " << design.
nch
318 m_surfaceData->m_layerSurfaces.emplace_back(std::make_unique<Trk::PlaneSurface>(*
this,
id));
333 ATH_MSG_DEBUG(
"MMReadoutElement layer " <<
layer <<
" sAngle " << sAngle <<
" phi direction MM eta strip "
334 << (
m_surfaceData->m_layerTransforms.back().linear() * Amg::Vector3D::UnitY()).phi() );
347 if (gasgap < 1 || gasgap >
m_nlayers)
return false;
350 return strip >= 1 && strip <=
m_etaDesign[gasgap - 1].totalStrips;
391 m_delta = Amg::Transform3D::Identity();
407 double t0 = locPosML.x();
408 double s0 = locPosML.y();
409 double z0 = locPosML.z();
412 double s_rel = s0/(
width/2.);
427 double ds{0.}, dz{0.},
dt{0.};
429 if (bp != 0 ||
bn != 0)
430 dt += 0.5*(s_rel*s_rel - 1)*((bp +
bn) + (bp -
bn)*z_rel);
432 if (sp != 0 || sn != 0)
433 dt += 0.5*(z_rel*z_rel - 1)*((sp + sn) + (sp - sn)*s_rel);
436 dt -= tw*s_rel*z_rel;
446 if (ep != 0 ||
en != 0) {
450 double delta = s_rel*s_rel * ((ep +
en)*s_rel/6 + (ep -
en)/4);
451 double phi = s_rel * ((ep +
en)*s_rel + (ep -
en)) / 2;
470 ATH_MSG_WARNING(
"Unable to get MuonChannelDesign, therefore cannot provide position corrections. Returning." );
474 bool conditionsApplied{
false};
477 #ifndef SIMULATIONBASE
488 ATH_MSG_WARNING(
"As-built corrections are provided only within the active area. Returning." );
505 pos[0] += strip_id.
ilayer%2 ? -2.75 : 2.75;
510 conditionsApplied =
true;
522 if (!conditionsApplied) {
527 conditionsApplied =
true;
533 if (conditionsApplied)
pos = trfToML.inverse()*
pos;
void setDelta(const ALinePar &aline)
virtual bool containsId(const Identifier &id) const override final
function to be used to check whether a given Identifier is contained in the readout element
virtual const Amg::Transform3D & transform() const override
Return local to global transform.
int positionRelativeToStrip(const Amg::Vector2D &lpos, Amg::Vector2D &rel_pos) const
STRIPS ONLY.
Ensure that the Athena extensions are properly loaded.
double firstPos() const
Returns the position of the first strip along the x-axis.
std::vector< double > tokenizeDouble(const std::string &the_str, std::string_view delimiter)
const Amg::Transform3D & absTransform() const
std::array< int, 4 > m_readoutSide
double activeBottomLength
void initDesign()
initialize the design classes for this readout element
std::vector< int > readoutSide
quadrupletIdentifier_t quadruplet
void defineTrapezoid(double HalfShortY, double HalfLongY, double HalfHeight)
set the trapezoid dimensions
Eigen::Matrix< double, 2, 1 > Vector2D
std::vector< int > tokenizeInt(const std::string &the_str, std::string_view delimiter)
Amg::Transform3D getTranslateZ3D(const double Z)
: Returns a shift transformation along the z-axis
const MuonChannelDesign * getDesign(const Identifier &id) const
returns the MuonChannelDesign class for the given identifier
const std::string & stName(StIndex index)
convert StIndex into a string
virtual void fillCache() override final
function to fill tracking cache
std::array< Amg::Transform3D, 4 > m_Xlg
float getParameter(const Parameter p) const
Returns a given parameter.
const NswAsBuilt::StripCalculator * getMMAsBuiltCalculator() const
#define ATH_MSG_VERBOSE(x)
double getLongSsize() const
double hasStereoAngle() const
returns whether the stereo angle is non-zero
Amg::Transform3D getRotateZ3D(double angle)
get a rotation transformation around Z-axis
int multilayer(const Identifier &id) const
const Muon::IMuonIdHelperSvc * idHelperSvc() const
Amg::Vector3D localToGlobalCoords(const Amg::Vector3D &locPos, const Identifier &id) const
simHit local (SD) To Global position - to be used by MuonGeoAdaprors only
std::unique_ptr< SurfaceData > m_surfaceData
Definition of the abstract IRDBAccessSvc interface.
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
const std::string & getStationName() const
#define THROW_EXCEPTION_MM(MSG)
~MMReadoutElement()
destructor
Athena indices of a MM strip.
Eigen::Affine3d Transform3D
const BLinePar * m_BLinePar
void setBLinePar(const BLinePar &bLine)
read B-line (chamber-deformation) parameters
const MuonDetectorManager * manager() const
MMDetectorDescription * Get_MMDetector(char type, int ieta, int iphi, int layer=1, char side='A')
Amg::Transform3D delta() const
Returns the final transformations of the A lines.
void setLongSsize(double)
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
int stationPhi(const Identifier &id) const
std::array< MuonChannelDesign, 4 > m_etaDesign
const MmIdHelper & m_idHelper
int stationEta(const Identifier &id) const
Amg::Transform3D getRotateY3D(double angle)
get a rotation transformation around Y-axis
Eigen::Matrix< double, 3, 1 > Vector3D
std::vector< double > stereoAngle
void posOnDefChamber(Amg::Vector3D &locPosML) const
transform a position (in chamber-frame coordinates) to the deformed-chamber geometry
Definition of the abstract IRDBRecord interface.
int channel(const Identifier &id) const override
int gasGap(const Identifier &id) const override
get the hashes
virtual bool spacePointPosition(const Identifier &phiId, const Identifier &etaId, Amg::Vector2D &pos) const override final
space point position for a given pair of phi and eta identifiers The LocalPosition is expressed in th...
double stereoAngle(const Identifier &id) const
Wrapper to MuonChannelDesign::stereoAngle()
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
#define ATH_MSG_WARNING(x)
double stereoAngle() const
returns the stereo angle
Identifier identify() const override final
Returns the ATLAS Identifier of the MuonReadOutElement.
void setFirstPos(const double pos)
Set the position of the first strip along the x-axis.
Definition of the abstract IRDBRecordset interface.
const ALinePar * m_ALinePar
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channel) const
int getStationPhi() const
int getStationEta() const