|
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());
92 ATH_MSG_DEBUG(
"Expected a GeoTrd but got "<<printGeoShape(pvc->getLogVol()->getShape()));
95 std::vector<GeoChildNodeWithTrf>
children{getChildrenWithRef(pvc,
false)};
96 for (
const GeoChildNodeWithTrf& child :
children) {
97 ATH_MSG_VERBOSE(
"Child node "<<child.nodeName<<
" "<<child.volume->getLogVol()->getName());
98 if (child.volume->getLogVol()->getName().find(
"Sensitive") == std::string::npos) {
103 THROW_EXCEPTION(
"number of MM layers > 4: increase transform array size" );
110 const GeoShape* childShape = child.volume->getLogVol()->getShape();
111 while (childShape->typeID() != GeoTrd::getClassTypeID()){
112 auto [opA, opB] = getOps(childShape);
113 ATH_MSG_VERBOSE(
"Operands are "<<printGeoShape(opA)<<
", "<<printGeoShape(opB));
116 const GeoTrd* trd =
dynamic_cast<const GeoTrd*
>(childShape);
117 m_halfX = trd->getZHalfLength();
136 ISvcLocator* svcLocator = Gaudi::svcLocator();
138 if (svcLocator->service(
"GeoDbTagSvc",geoDbTag).isFailure()) {
142 if (svcLocator->service(geoDbTag->getParamSvcName(),accessSvc).isFailure()) {
147 for (
unsigned int ind = 0;
ind < wmmRec->size();
ind++) {
148 std::string WMM_TYPE = (*wmmRec)[
ind]->getString(
"WMM_TYPE");
149 if (sector_l != WMM_TYPE[4]){
155 if (
m_ml != (
int) (WMM_TYPE[12]-
'0')){
158 const double Tck = (*wmmRec)[
ind]->getDouble(
"Tck");
159 const double activeBottomLength = (*wmmRec)[
ind]->getDouble(
"activeBottomLength");
160 const double activeH = (*wmmRec)[
ind]->getDouble(
"activeH");
161 const double activeTopLength = (*wmmRec)[
ind]->getDouble(
"activeTopLength");
162 const double gasTck = (*wmmRec)[
ind]->getDouble(
"gasTck");
163 const int nMissedBottomEta = (*wmmRec)[
ind]->getInt(
"nMissedBottomEta");
164 const int nMissedBottomStereo = (*wmmRec)[
ind]->getInt(
"nMissedBottomStereo");
165 const int nMissedTopEta = (*wmmRec)[
ind]->getInt(
"nMissedTopEta");
166 const int nMissedTopStereo = (*wmmRec)[
ind]->getInt(
"nMissedTopStereo");
170 const double stripPitch = (*wmmRec)[
ind]->getDouble(
"stripPitch");
171 const int totalStrips = (*wmmRec)[
ind]->getInt (
"totalStrips");
172 const double ylFrame = (*wmmRec)[
ind]->getDouble(
"ylFrame");
173 const double ysFrame = (*wmmRec)[
ind]->getDouble(
"ysFrame");
179 m_offset = -0.5*(ylFrame - ysFrame);
185 THROW_EXCEPTION(
"MMReadoutElement -- Max number of strips not a valid value" );
211 <<
", strip pitch " << design.
inputPitch <<
", nstrips " << design.
nch
219 if (m_ml < 1 || m_ml > 2) {
224 ISvcLocator* svcLocator = Gaudi::svcLocator();
226 if (svcLocator->service(
"GeoDbTagSvc",geoDbTag).isFailure()) {
229 if (geoDbTag->getSqliteReader()) {
241 double ylFrame =
mm->ylFrame();
242 double ysFrame =
mm->ysFrame();
251 m_offset = -0.5*(ylFrame - ysFrame);
259 THROW_EXCEPTION(
"MMReadoutElement -- Max number of strips not a valid value" );
306 m_surfaceData->m_layerSurfaces.emplace_back(std::make_unique<Trk::PlaneSurface>(*
this,
id));
321 ATH_MSG_DEBUG(
"MMReadoutElement layer " <<
layer <<
" sAngle " << sAngle <<
" phi direction MM eta strip "
322 << (
m_surfaceData->m_layerTransforms.back().linear() * Amg::Vector3D::UnitY()).phi() );
335 if (gasgap < 1 || gasgap >
m_nlayers)
return false;
338 return strip >= 1 && strip <=
m_etaDesign[gasgap - 1].totalStrips;
377 m_delta = Amg::Transform3D::Identity();
393 double t0 = locPosML.x();
394 double s0 = locPosML.y();
395 double z0 = locPosML.z();
398 double s_rel = s0/(
width/2.);
413 double ds{0.}, dz{0.},
dt{0.};
415 if (bp != 0 ||
bn != 0)
416 dt += 0.5*(s_rel*s_rel - 1)*((bp +
bn) + (bp -
bn)*z_rel);
418 if (sp != 0 || sn != 0)
419 dt += 0.5*(z_rel*z_rel - 1)*((sp + sn) + (sp - sn)*s_rel);
422 dt -= tw*s_rel*z_rel;
432 if (ep != 0 ||
en != 0) {
436 double delta = s_rel*s_rel * ((ep +
en)*s_rel/6 + (ep -
en)/4);
437 double phi = s_rel * ((ep +
en)*s_rel + (ep -
en)) / 2;
456 ATH_MSG_WARNING(
"Unable to get MuonChannelDesign, therefore cannot provide position corrections. Returning." );
460 bool conditionsApplied{
false};
463 #ifndef SIMULATIONBASE
474 ATH_MSG_WARNING(
"As-built corrections are provided only within the active area. Returning." );
491 pos[0] += strip_id.
ilayer%2 ? -2.75 : 2.75;
496 conditionsApplied =
true;
508 if (!conditionsApplied) {
513 conditionsApplied =
true;
519 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
Scalar phi() const
phi method
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
std::vector< ALFA_RawData_p1 > t0
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 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
IRDBAccessSvc is an abstract interface to the athena service that provides the following functionalit...
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 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