12#include "GeoModelKernel/GeoDefinitions.h"
14#include "GaudiKernel/SystemOfUnits.h"
20 return StatusCode::SUCCESS;
28 auto translateTokenList = [
this, &idHelper](
const std::vector<std::string>& chNames){
30 std::set<Identifier> transcriptedIds{};
31 for (
const std::string& token : chNames) {
32 if (token.size() != 6) {
33 ATH_MSG_WARNING(
"Wrong format given for "<<token<<
". Expecting 6 characters");
37 const std::string statName = token.substr(0, 3);
38 const unsigned statEta = std::atoi(token.substr(3, 1).c_str()) * (token[4] ==
'A' ? 1 : -1);
39 const unsigned statPhi = std::atoi(token.substr(5, 1).c_str());
46 transcriptedIds.insert(eleId);
49 transcriptedIds.insert(secMlId);
52 return transcriptedIds;
55 std::vector <std::string>& selectedSt =
m_selectStat.value();
56 const std::vector <std::string>& excludedSt =
m_excludeStat.value();
57 selectedSt.erase(
std::remove_if(selectedSt.begin(), selectedSt.end(),
58 [&excludedSt](
const std::string& token){
59 return std::ranges::find(excludedSt, token) != excludedSt.end();
60 }), selectedSt.end());
62 if (selectedSt.size()) {
64 std::stringstream sstr{};
68 ATH_MSG_INFO(
"Test only the following stations "<<std::endl<<sstr.str());
70 const std::set<Identifier> excluded = translateTokenList(excludedSt);
74 if (!excluded.count(*itr)) {
79 if (!excluded.empty()) {
80 std::stringstream excluded_report{};
82 excluded_report <<
" *** " <<
m_idHelperSvc->toStringDetEl(
id) << std::endl;
84 ATH_MSG_INFO(
"Test all station except the following excluded ones " << std::endl << excluded_report.str());
87 return StatusCode::SUCCESS;
91 const EventContext& ctx{Gaudi::Hive::currentContext()};
96 return StatusCode::FAILURE;
111 <<
m_idHelperSvc->toStringDetEl(test_me) <<
". But got instead "
113 return StatusCode::FAILURE;
115 for (
int gasGap = 1; gasGap <= 4; ++gasGap) {
119 for (
int channel=fStrip; channel<=lStrip; ++channel) {
121 bool is_valid{
false};
123 gasGap, channel, is_valid);
132 const double stripLength = 0.49 * reElement->
stripLength(strip_id);
134 design.
channelNumber(locPos + stripLength *Amg::Vector2D::UnitY()) != channel ||
135 design.
channelNumber(locPos - stripLength *Amg::Vector2D::UnitY()) != channel ){
136 ATH_MSG_FATAL(
"Conversion of channel -> strip -> channel failed for "
140 return StatusCode::FAILURE;
147 return StatusCode::SUCCESS;
159 const int multilayer = id_helper.
multilayer(detElId);
165 const Amg::Transform3D permute{GeoTrf::GeoRotation{90.*Gaudi::Units::deg,90.*Gaudi::Units::deg, 0.}};
171 for (
int gasgap = 1; gasgap <= 4; ++gasgap) {
177 for (
int channel=fStrip; channel<=lStrip; ++channel) {
179 bool is_valid{
false};
181 gasgap, channel, is_valid);
182 if (!is_valid)
continue;
190 strip_leftEdge{Amg::Vector3D::Zero()},
191 strip_rightEdge{Amg::Vector3D::Zero()};
194 l_left{Amg::Vector2D::Zero()},
195 l_right{Amg::Vector2D::Zero()};
199 if (!design.
leftEdge(channel, l_left) || !design.
center(channel, l_cen) ||
224 if (channel != fStrip)
continue;
226 <<
", "<<roEl->
transform(strip_id).translation().perp());
235 return m_tree.fill(ctx) ? StatusCode::SUCCESS : StatusCode::FAILURE;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channel) const
Identifier elementID(int stationName, int stationEta, int stationPhi) const
Identifier multilayerID(const Identifier &channeldID) const
int channel(const Identifier &id) const override
int gasGap(const Identifier &id) const override
get the hashes
int multilayer(const Identifier &id) const
MuonVal::VectorBranch< uint > & m_channel
MuonVal::ThreeVectorBranch m_stripRightEdge
MuonVal::TwoVectorBranch m_firstStripPos
MuonVal::ScalarBranch< int > & m_stationName
MuonVal::VectorBranch< unsigned > & m_nStrips
MuonVal::VectorBranch< unsigned > & m_firstStrip
StatusCode execute() override
MuonVal::VectorBranch< float > & m_stripLength
MuonVal::ScalarBranch< unsigned short > & m_stationIndex
MuonVal::CoordTransformBranch m_readoutTransform
Transformation of the readout element (Translation, ColX, ColY, ColZ)
StatusCode dumpToTree(const EventContext &ctx, const MuonGM::MMReadoutElement *detEl)
MuonVal::ScalarBranch< float > & m_ActiveWidthS
MuonVal::VectorBranch< bool > & m_isStereo
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
MuonVal::TwoVectorBranch m_locStripCenter
MuonVal::CoordTransformBranch m_alignableNode
MuonVal::ScalarBranch< short > & m_stationEta
Gaudi::Property< std::vector< std::string > > m_selectStat
String should be formated like MM<L or S><1 or 2><A/C><layer> Example string MML1A6 ,...
MuonVal::ScalarBranch< float > & m_ActiveHeightR
MuonVal::ScalarBranch< float > & m_moduleWidthL
MuonVal::ScalarBranch< short > & m_multilayer
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_detMgrKey
MuonDetectorManager from the conditions store.
MuonVal::VectorBranch< short > & m_gasGap
MuonVal::VectorBranch< int > & m_readoutSide
MuonVal::VectorBranch< float > & m_stripActiveLength
StatusCode finalize() override
MuonVal::CoordSystemsBranch m_stripRot
Rotation matrix of the respective strip layers.
MuonVal::ScalarBranch< float > & m_ActiveWidthL
MuonVal::ThreeVectorBranch m_stripCenter
StatusCode initialize() override
MuonVal::VectorBranch< uint8_t > & m_stripRotGasGap
MuonVal::ScalarBranch< float > & m_stStripPitch
MuonVal::MuonTesterTree m_tree
MuonVal::VectorBranch< float > & m_stripActiveLengthRight
MuonVal::ThreeVectorBranch m_stripLeftEdge
Gaudi::Property< std::vector< std::string > > m_excludeStat
MuonVal::ScalarBranch< float > & m_moduleHeight
MuonVal::VectorBranch< float > & m_stripActiveLengthLeft
MuonVal::ScalarBranch< float > & m_moduleWidthS
MuonVal::ScalarBranch< short > & m_stationPhi
std::set< Identifier > m_testStations
Set of stations to be tested.
An MMReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station con...
const Amg::Transform3D & getDelta() const
read A-line parameters and include the chamber rotation/translation in the local-to-global (ATLAS) re...
int numberOfMissingTopStrips(const Identifier &layerId) const
Number of missing bottom and top strips (not read out)
const std::array< int, 4 > & getReadoutSide() const
double stripActiveLengthRight(const Identifier &id) const
virtual Amg::Transform3D AmdbLRSToGlobalTransform() const override final
int numberOfMissingBottomStrips(const Identifier &layerId) const
double stripActiveLength(const Identifier &id) const
double stripActiveLengthLeft(const Identifier &id) const
double stripLength(const Identifier &id) const
strip length Wrappers to MuonChannelDesign::channelLength() taking into account the passivated width
const MuonChannelDesign * getDesign(const Identifier &id) const
returns the MuonChannelDesign class for the given identifier
bool stripGlobalPosition(const Identifier &id, Amg::Vector3D &gpos) const
virtual const Trk::PlaneSurface & surface() const override
access to chamber surface (phi orientation), uses the first gas gap
virtual const Amg::Transform3D & transform() const override
Return local to global transform.
int getStationIndex() const
int getStationPhi() const
int getStationEta() const
double getLongSsize() const
Identifier identify() const override final
Returns the ATLAS Identifier of the MuonReadOutElement.
const_id_iterator detectorElement_begin() const
Iterators over full set of ids.
int stationName(const Identifier &id) const
const_id_iterator detectorElement_end() const
virtual void localToGlobal(const Amg::Vector2D &locp, const Amg::Vector3D &mom, Amg::Vector3D &glob) const override final
Specified for PlaneSurface: LocalToGlobal method without dynamic memory allocation.
virtual bool globalToLocal(const Amg::Vector3D &glob, const Amg::Vector3D &mom, Amg::Vector2D &loc) const override final
Specified for PlaneSurface: GlobalToLocal method without dynamic memory allocation - boolean checks i...
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
Ensure that the Athena extensions are properly loaded.
DataModel_detail::iterator< DVL > remove_if(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end, Predicate pred)
Specialization of remove_if for DataVector/List.
bool center(int channel, Amg::Vector2D &pos) const
STRIPS ONLY: Returns the center on the strip.
bool leftEdge(int channel, Amg::Vector2D &pos) const
STRIPS ONLY: Returns the left edge of the strip.
int numberOfMissingBottomStrips() const
Returns the number of missing bottom strips.
bool rightEdge(int channel, Amg::Vector2D &pos) const
STRIPS ONLY: Returns the right edge of the strip.
double hasStereoAngle() const
returns whether the stereo angle is non-zero
double firstPos() const
Returns the position of the first strip along the x-axis.
int channelNumber(const Amg::Vector2D &pos) const
calculate local channel number, range 1=nstrips like identifiers. Returns -1 if out of range