|
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/GeoVPhysVol.h>
24 #include "GaudiKernel/SystemOfUnits.h"
25 #include "GeoModelHelpers/getChildNodesWithTrf.h"
26 #include "GeoModelHelpers/StringUtils.h"
27 #include "GeoModelHelpers/GeoShapeUtils.h"
29 #include "GeoModelKernel/GeoFullPhysVol.h"
30 #include "GeoModelKernel/GeoShapeSubtraction.h"
31 #include "GeoModelKernel/GeoTrd.h"
40 #include "GaudiKernel/ISvcLocator.h"
48 #define THROW_EXCEPTION(MSG) \
50 std::stringstream sstr{}; \
51 sstr<<"MMReadoutElement - "<<idHelperSvc()->toStringDetEl(identify())<<" "<<__LINE__<<": "; \
53 throw std::runtime_error(sstr.str()); \
57 template <
class ObjType,
size_t N>
void assign(
const std::vector<ObjType>& in,
58 std::array<ObjType, N>&
out) {
65 using namespace GeoStrUtils;
71 m_passivData(passivData),
74 std::string fixName = (stName[2] ==
'L') ?
"MML" :
"MMS";
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());
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") {
107 THROW_EXCEPTION(
"number of MM layers > 4: increase transform array size" );
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();
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);
188 THROW_EXCEPTION(
"MMReadoutElement -- Max number of strips not a valid value" );
214 <<
", strip pitch " << design.
inputPitch <<
", nstrips " << design.
nch
222 if (m_ml < 1 || m_ml > 2) {
227 SmartIF<IGeoDbTagSvc> geoDbTag{Gaudi::svcLocator()->service(
"GeoDbTagSvc")};
231 if (geoDbTag->getSqliteReader()) {
243 double ylFrame =
mm->ylFrame();
244 double ysFrame =
mm->ysFrame();
257 m_offset = -0.5*(ylFrame - ysFrame);
265 THROW_EXCEPTION(
"MMReadoutElement -- Max number of strips not a valid value" );
312 m_surfaceData->m_layerSurfaces.emplace_back(std::make_unique<Trk::PlaneSurface>(*
this,
id));
327 ATH_MSG_DEBUG(
"MMReadoutElement layer " <<
layer <<
" sAngle " << sAngle <<
" phi direction MM eta strip "
328 << (
m_surfaceData->m_layerTransforms.back().linear() * Amg::Vector3D::UnitY()).phi() );
341 if (gasgap < 1 || gasgap >
m_nlayers)
return false;
344 return strip >= 1 && strip <=
m_etaDesign[gasgap - 1].totalStrips;
383 m_delta = Amg::Transform3D::Identity();
399 double t0 = locPosML.x();
400 double s0 = locPosML.y();
401 double z0 = locPosML.z();
404 double s_rel = s0/(
width/2.);
419 double ds{0.}, dz{0.},
dt{0.};
421 if (bp != 0 ||
bn != 0)
422 dt += 0.5*(s_rel*s_rel - 1)*((bp +
bn) + (bp -
bn)*z_rel);
424 if (sp != 0 || sn != 0)
425 dt += 0.5*(z_rel*z_rel - 1)*((sp + sn) + (sp - sn)*s_rel);
428 dt -= tw*s_rel*z_rel;
438 if (ep != 0 ||
en != 0) {
442 double delta = s_rel*s_rel * ((ep +
en)*s_rel/6 + (ep -
en)/4);
443 double phi = s_rel * ((ep +
en)*s_rel + (ep -
en)) / 2;
462 ATH_MSG_WARNING(
"Unable to get MuonChannelDesign, therefore cannot provide position corrections. Returning." );
466 bool conditionsApplied{
false};
469 #ifndef SIMULATIONBASE
480 ATH_MSG_WARNING(
"As-built corrections are provided only within the active area. Returning." );
497 pos[0] += strip_id.
ilayer%2 ? -2.75 : 2.75;
502 conditionsApplied =
true;
514 if (!conditionsApplied) {
519 conditionsApplied =
true;
525 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.
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
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)
#define THROW_EXCEPTION(MSG)
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
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
Identifier multilayerID(const Identifier &channeldID) const
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
~MMReadoutElement()
destructor
void setIdentifier(const Identifier &id)
Sets the Identifier, hashes & station names.
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
void setLongSsize(double)
void setChamberLayer(int ml)
set methods only to be used by MuonGeoModel
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
void setStationName(const std::string &)
int stationPhi(const Identifier &id) const
Ensure that the ATLAS eigen extensions are properly loaded.
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