13#include "GaudiKernel/SystemOfUnits.h"
20 return StatusCode::SUCCESS;
27 auto translateTokenList = [
this, &idHelper](
const std::vector<std::string>& chNames){
29 std::set<Identifier> transcriptedIds{};
30 for (
const std::string& token : chNames) {
31 if (token.size() != 6) {
32 ATH_MSG_WARNING(
"Wrong format given for "<<token<<
". Expecting 6 characters");
36 const std::string statName = token.substr(0, 3);
37 const unsigned statEta = std::atoi(token.substr(3, 1).c_str()) * (token[4] ==
'A' ? 1 : -1);
38 const unsigned statPhi = std::atoi(token.substr(5, 1).c_str());
45 transcriptedIds.insert(eleId);
47 std::inserter(transcriptedIds, transcriptedIds.end()),
49 return idHelper.stationName(copyMe) == idHelper.stationName(eleId) &&
50 idHelper.stationEta(copyMe) == idHelper.stationEta(eleId) &&
51 idHelper.stationPhi(copyMe) == idHelper.stationPhi(eleId);
54 return transcriptedIds;
57 std::vector <std::string>& selectedSt =
m_selectStat.value();
58 const std::vector <std::string>& excludedSt =
m_excludeStat.value();
59 selectedSt.erase(
std::remove_if(selectedSt.begin(), selectedSt.end(),
60 [&excludedSt](
const std::string& token){
61 return std::ranges::find(excludedSt, token) != excludedSt.end();
62 }), selectedSt.end());
64 if (selectedSt.size()) {
66 std::stringstream sstr{};
70 ATH_MSG_INFO(
"Test only the following stations "<<std::endl<<sstr.str());
72 const std::set<Identifier> excluded = translateTokenList(excludedSt);
76 if (!excluded.count(*itr)) {
81 if (!excluded.empty()) {
82 std::stringstream excluded_report{};
84 excluded_report <<
" *** " <<
m_idHelperSvc->toStringDetEl(
id) << std::endl;
86 ATH_MSG_INFO(
"Test all station except the following excluded ones " << std::endl << excluded_report.str());
89 return StatusCode::SUCCESS;
92 const EventContext& ctx{Gaudi::Hive::currentContext()};
97 return StatusCode::FAILURE;
108 if (reElement->
identify() != test_me) {
110 <<
m_idHelperSvc->toStringDetEl(test_me) <<
". But got instead "
112 return StatusCode::FAILURE;
117 for (
int gasGap = 1 ; gasGap <= reElement->
numberOfLayers(); ++gasGap) {
118 for (
int doubPhi = reElement->
getDoubletPhi(); doubPhi <= reElement->NphiStripPanels(); ++doubPhi) {
119 for (
bool measPhi: {
false,
true}) {
129 <<
", gasGap:"<<gasGap<<
", doubletPhi: "<<doubPhi
130 <<
", measurePhi "<<measPhi<<
", strip: "<<
strip);
136 return StatusCode::FAILURE;
142 if ( (stripPos - globPos3D).
mag() > std::numeric_limits<float>::epsilon()) {
143 ATH_MSG_FATAL(
"Retrieving the strip position in two different ways leads to two distinct results "
145 return StatusCode::FAILURE;
148 const double stripLen = 0.5 *reElement->
StripLength(measPhi) - 1. * Gaudi::Units::cm;
151 <<
" is outside bounds "<<laySurf.
bounds());
152 return StatusCode::FAILURE;
154 if (!laySurf.
insideBounds(locPos2D + stripLen * Amg::Vector2D::UnitY())){
157 return StatusCode::FAILURE;
158 }
if (!laySurf.
insideBounds(locPos2D - stripLen * Amg::Vector2D::UnitY())){
161 return StatusCode::FAILURE;
168 return StatusCode::SUCCESS;
209 for (
int doubPhi = readoutEle->
getDoubletPhi(); doubPhi <= maxDoubPhi; ++doubPhi) {
211 for (
bool measPhi : {
false,
true}) {
212 unsigned int numStrip = readoutEle->
Nstrips(measPhi);
221 <<
" gap: "<<gap<<
" strip: "<<
strip<<
" meas phi: "<<measPhi);
227 return StatusCode::FAILURE;
237 if (
strip != 1)
continue;
249 return m_tree.fill(ctx) ? StatusCode::SUCCESS : StatusCode::FAILURE;
Scalar mag() const
mag method
#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.
MuonVal::VectorBranch< bool > & m_stripPosMeasPhi
MuonVal::ScalarBranch< float > & m_ALineTransZ
MuonVal::ScalarBranch< short > & m_stPhi
MuonVal::ScalarBranch< float > & m_stripEtaPitch
Strip dimensions.
std::set< Identifier > m_testStations
Set of stations to be tested.
MuonVal::ThreeVectorBranch m_stripPos
Strip positions.
MuonVal::ScalarBranch< float > & m_stripEtaLength
MuonVal::ScalarBranch< uint8_t > & m_numRpcLayers
Number of eta & phi gas gaps.
MuonVal::ScalarBranch< float > & m_ALineTransS
Alignment parameters.
MuonVal::ScalarBranch< float > & m_ALineRotS
StatusCode initialize() override
MuonVal::ScalarBranch< float > & m_stripEtaWidth
MuonVal::ScalarBranch< uint8_t > & m_doubletR
Gaudi::Property< std::vector< std::string > > m_selectStat
String should be formated like <stationName><stationEta><A/C><stationPhi>
MuonVal::VectorBranch< uint8_t > & m_stripPosGasGap
MuonVal::ScalarBranch< float > & m_stripPhiWidth
MuonVal::ScalarBranch< uint8_t > & m_numStripsPhi
MuonVal::ScalarBranch< float > & m_stripPhiLength
Gaudi::Property< std::vector< std::string > > m_excludeStat
MuonVal::ScalarBranch< std::string > & m_chamberDesign
MuonVal::ScalarBranch< uint8_t > & m_numPhiPanels
MuonVal::CoordTransformBranch m_alignableNode
MuonVal::ScalarBranch< unsigned short > & m_stIndex
Identifier of the readout element.
MuonVal::VectorBranch< uint8_t > & m_stripDblPhi
MuonVal::ScalarBranch< uint8_t > & m_numStripsEta
Number of strips, strip pitch in eta & phi direction.
StatusCode finalize() override
MuonVal::VectorBranch< uint8_t > & m_stripRotDblPhi
MuonVal::VectorBranch< uint8_t > & m_stripPosNum
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_detMgrKey
MuonDetectorManager from the conditions store.
MuonVal::ScalarBranch< uint8_t > & m_doubletZ
MuonVal::ScalarBranch< float > & m_ALineRotZ
MuonVal::ScalarBranch< float > & m_ALineTransT
MuonVal::MuonTesterTree m_tree
Write a TTree for validation purposes.
MuonVal::TwoVectorBranch m_locPos
MuonVal::ScalarBranch< short > & m_stEta
MuonVal::VectorBranch< bool > & m_stripRotMeasPhi
MuonVal::CoordTransformBranch m_readoutTransform
Transformation of the readout element (Translation, ColX, ColY, ColZ)
MuonVal::ScalarBranch< uint8_t > & m_doubletPhi
MuonVal::VectorBranch< uint8_t > & m_stripRotGasGap
MuonVal::ScalarBranch< float > & m_stripPhiPitch
MuonVal::CoordSystemsBranch m_stripRot
Rotation matrix of the respective layers.
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
StatusCode execute() override
StatusCode dumpToTree(const EventContext &ctx, const RpcReadoutElement *readoutEle)
MuonVal::ScalarBranch< float > & m_ALineRotT
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.
const std::string & getTechnologyName() const
int getStationIndex() const
const Amg::Transform3D & absTransform() const
int getStationPhi() const
int getStationEta() const
const MuonStation * parentMuonStation() const
Identifier identify() const override final
Returns the ATLAS Identifier of the MuonReadOutElement.
double getALine_trat() const
const Amg::Transform3D & getNativeToAmdbLRS() const
double getALine_rott() const
double getALine_rots() const
const GeoAlignableTransform * getGeoTransform() const
double getALine_tras() const
double getALine_rotz() const
double getALine_traz() const
An RpcReadoutElement corresponds to a single RPC module; therefore typicaly a barrel muon station con...
int getDoubletPhi() const
return DoubletPhi value for the given readout element, be aware that one RE can contain two DoubletPh...
virtual bool stripPosition(const Identifier &id, Amg::Vector2D &pos) const override final
strip position If the strip number is outside the range of valid strips, the function will return fal...
int NphiStripPanels() const
returns the number of phi strip panels (1 or 2)
int getDoubletR() const
return DoubletR value for the given readout element
double StripLength(bool measphi) const
returns the strip length for the phi or eta plane
int getDoubletZ() const
return DoubletZ value for the given readout element
Amg::Vector3D stripPos(const Identifier &id) const
int Nstrips(bool measphi) const
returns the number of strips for the phi or eta plane
virtual int numberOfLayers(bool measphi=true) const override final
number of layers in phi/eta projection, same for eta/phi planes
double StripWidth(bool measphi) const
returns the strip width for the phi or eta plane
double StripPitch(bool measphi) const
returns the strip pitch for the phi or eta plane
const_id_iterator detectorElement_begin() const
Iterators over full set of ids.
const_id_iterator detectorElement_end() const
Identifier channelID(int stationName, int stationEta, int stationPhi, int doubletR, int doubletZ, int doubletPhi, int gasGap, int measuresPhi, int strip) const
Identifier elementID(int stationName, int stationEta, int stationPhi, int doubletR) const
int doubletZ(const Identifier &id) const
Abstract Base Class for tracking surfaces.
virtual bool insideBounds(const Amg::Vector2D &locpos, double tol1=0., double tol2=0.) const =0
virtual methods to be overwritten by the inherited surfaces
virtual const SurfaceBounds & bounds() const =0
Surface Bounds method.
virtual void localToGlobal(const Amg::Vector2D &locp, const Amg::Vector3D &mom, Amg::Vector3D &glob) const =0
Specified by each surface type: LocalToGlobal method without dynamic memory allocation.
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.