43 auto translateTokenList = [
this, &idHelper](
const std::vector<std::string>& chNames){
45 std::set<Identifier> transcriptedIds{};
46 for (
const std::string& token : chNames) {
47 if (token.size() != 6) {
48 ATH_MSG_WARNING(
"Wrong format given for "<<token<<
". Expecting 6 characters");
52 const std::string statName = token.substr(0, 3);
53 const unsigned statEta = std::atoi(token.substr(3, 1).c_str()) * (token[4] ==
'A' ? 1 : -1);
54 const unsigned statPhi = std::atoi(token.substr(5, 1).c_str());
61 transcriptedIds.insert(eleId);
63 std::inserter(transcriptedIds, transcriptedIds.end()),
65 return idHelper.stationName(copyMe) == idHelper.stationName(eleId) &&
66 idHelper.stationEta(copyMe) == idHelper.stationEta(eleId) &&
67 idHelper.stationPhi(copyMe) == idHelper.stationPhi(eleId);
70 return transcriptedIds;
73 std::vector <std::string>& selectedSt =
m_selectStat.value();
74 const std::vector <std::string>& excludedSt =
m_excludeStat.value();
75 selectedSt.erase(
std::remove_if(selectedSt.begin(), selectedSt.end(),
76 [&excludedSt](
const std::string& token){
77 return std::ranges::find(excludedSt, token) != excludedSt.end();
78 }), selectedSt.end());
80 if (selectedSt.size()) {
82 std::stringstream sstr{};
86 ATH_MSG_INFO(
"Test only the following stations "<<std::endl<<sstr.str());
88 const std::set<Identifier> excluded = translateTokenList(excludedSt);
92 if (!excluded.count(*itr)) {
97 if (!excluded.empty()) {
98 std::stringstream excluded_report{};
100 excluded_report <<
" *** " <<
m_idHelperSvc->toStringDetEl(
id) << std::endl;
102 ATH_MSG_INFO(
"Test all station except the following excluded ones " << std::endl << excluded_report.str());
106 return StatusCode::SUCCESS;
110 return StatusCode::SUCCESS;
115 const bool measPhi)
const {
120 const std::string chName = std::format(
"{:}{:}{:}{:}R{:}Z{:}P{:}{:}",
126 idHelper.
doubletPhi(detId), measPhi ?
"Phi" :
"Eta");
128 canvas->expandPad(-design->halfWidth(), -design->shortHalfHeight());
129 canvas->expandPad(design->halfWidth(), design->shortHalfHeight());
130 canvas->setAxisTitles(
"x [mm]",
"y [mm]");
131 canvas->setRangeScale(1.1);
133 canvas->add(
drawBox(Amg::Vector3D::Zero(),
134 2.*design->halfWidth(),
135 2.*design->shortHalfHeight(),
137 constexpr int oddFill = 3315;
138 constexpr int evenFill = 3351;
142 design->stripWidth(),
143 2.*design->shortHalfHeight(),
strip % 2 ? kBlue: kRed,
144 strip % 2 ? oddFill : evenFill));
147 measPhi ?
"phi" :
"eta"), 0.2, 0.05));
150 const EventContext& ctx{Gaudi::Hive::currentContext()};
163 if (reElement->
identify() != test_me) {
166 return StatusCode::FAILURE;
179 return StatusCode::FAILURE;
182 for (
unsigned gasGap = 1; gasGap <= reElement->
nGasGaps(); ++gasGap) {
183 for (
int doubPhi = reElement->
doubletPhi(); doubPhi <= reElement->doubletPhiMax(); ++doubPhi) {
184 for (
bool measPhi: {
false,
true}) {
185 unsigned numStrip = (measPhi ? reElement->
nPhiStrips() :
198 ATH_MSG_VERBOSE(
"gasGap: "<<gasGap<<
", doubletPhi: "<<doubPhi<<
", measPhi: "<<measPhi
199 <<
" --> layerHash: "<<
static_cast<unsigned>(layHash));
201 if (backCnv != chId) {
204 return StatusCode::FAILURE;
206 if (layHash != reElement->
layerHash(measHash)) {
207 ATH_MSG_FATAL(
"Constructing the layer hash from the identifier "<<
208 m_idHelperSvc->toString(chId)<<
" leadds to different layer hashes "<<
209 layHash<<
" vs. "<< reElement->
layerHash(measHash));
210 return StatusCode::FAILURE;
213 <<stripPosToString(reElement, gctx, measHash));
219 return StatusCode::SUCCESS;
259 for (
unsigned gasGap = 1; gasGap <= reElement->
nGasGaps(); ++gasGap) {
260 for (
int doubPhi = reElement->
doubletPhi(); doubPhi <= reElement->doubletPhiMax(); ++doubPhi) {
261 for (
bool measPhi: {
false,
true}) {
262 unsigned numStrip = (measPhi ? reElement->
nPhiStrips() :
273 <<
" gap: "<<gasGap<<
" strip: "<<
strip<<
" meas phi: "<<measPhi);
286 if (
strip != 1)
continue;
297 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.
const ServiceHandle< StoreGateSvc > & detStore() const
This is a "hash" representation of an Identifier.
MuonVal::VectorBranch< bool > & m_stripRotMeasPhi
MuonVal::ScalarBranch< uint8_t > & m_doubletPhi
StatusCode execute() override
Gaudi::Property< bool > m_visualStrips
Flag toggling whether the strip planes shall be printed.
void visualizeStripPanel(const EventContext &ctx, const StripDesignPtr &design, const Identifier &detId, const bool measPhi) const
Draw the strips in the panel on a Canvas.
MuonVal::ScalarBranch< float > & m_stripEtaLength
MuonVal::VectorBranch< uint8_t > & m_stripRotGasGap
MuonVal::VectorBranch< uint8_t > & m_stripPosGasGap
MuonVal::MuonTesterTree m_tree
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
MuonVal::ScalarBranch< float > & m_stripPhiLength
StatusCode finalize() override
MuonVal::ScalarBranch< float > & m_envelopeHeight
Box dimension.
ServiceHandle< MuonValR4::IRootVisualizationService > m_visualSvc
Service handle of the visualization service.
MuonVal::CoordSystemsBranch m_stripRot
Rotation matrix of the respective layers.
MuonVal::ScalarBranch< float > & m_stripPhiWidth
MuonVal::ScalarBranch< uint8_t > & m_numStripsPhi
MuonVal::ScalarBranch< float > & m_envelopeLength
MuonVal::VectorBranch< uint8_t > & m_stripDblPhi
Gaudi::Property< std::vector< std::string > > m_selectStat
String should be formated like <stationName><stationEta><A/C><stationPhi>
MuonVal::ScalarBranch< uint8_t > & m_doubletZ
MuonValR4::IRootVisualizationService::ClientToken m_clientToken
Token to be presented to the visualization service.
MuonVal::ScalarBranch< uint8_t > & m_numPhiPanels
MuonVal::ScalarBranch< short > & m_stEta
MuonVal::ScalarBranch< uint8_t > & m_numRpcLayers
Number of eta & phi gas gaps.
MuonVal::ScalarBranch< uint8_t > & m_numStripsEta
Number of strips, strip pitch in eta & phi direction.
const MuonDetectorManager * m_detMgr
Gaudi::Property< std::vector< std::string > > m_excludeStat
MuonVal::VectorBranch< bool > & m_stripPosMeasPhi
MuonVal::TwoVectorBranch m_locStripPos
MuonVal::ScalarBranch< uint8_t > & m_doubletR
MuonVal::ScalarBranch< float > & m_envelopeWidth
StatusCode dumpToTree(const EventContext &ctx, const ActsTrk::GeometryContext &gctx, const RpcReadoutElement *readoutEle)
SG::ReadHandleKey< ActsTrk::GeometryContext > m_geoCtxKey
MuonVal::ScalarBranch< unsigned short > & m_stIndex
Identifier of the readout element.
MuonVal::ScalarBranch< std::string > & m_chamberDesign
MuonVal::VectorBranch< uint8_t > & m_stripPosNum
MuonVal::CoordTransformBranch m_readoutTransform
Transformation of the readout element (Translation, ColX, ColY, ColZ)
MuonVal::ScalarBranch< float > & m_stripEtaPitch
Strip dimensions.
MuonVal::ThreeVectorBranch m_stripPos
Strip positions.
MuonVal::ScalarBranch< float > & m_stripEtaWidth
MuonVal::CoordTransformBranch m_alignableNode
MuonVal::ScalarBranch< float > & m_stripPhiPitch
MuonVal::ScalarBranch< uint8_t > & m_numGasGapsPhi
MuonVal::VectorBranch< uint8_t > & m_stripRotDblPhi
std::set< Identifier > m_testStations
Set of stations to be tested.
MuonVal::ScalarBranch< short > & m_stPhi
StatusCode initialize() override
int stationEta() const
Returns the stationEta (positive A site, negative O site)
const Amg::Transform3D & localToGlobalTrans(const ActsTrk::GeometryContext &ctx) const
Returns the local to global transformation into the ATLAS coordinate system.
const std::string & chamberDesign() const
The chamber design refers to the construction parameters of a readout element.
Identifier identify() const override final
Return the athena identifier.
int stationName() const
Returns the stationName (BIS, BOS, etc) encoded into the integer.
int stationPhi() const
Returns the stationPhi (1-8) -> sector (2*phi - (isSmall))
const GeoAlignableTransform * alignableTransform() const
Returnsthe alignable transform of the readout element.
Amg::Transform3D globalToLocalTrans(const ActsTrk::GeometryContext &ctx) const
Transformations to translate between local <-> global coordinates.
unsigned nPhiStrips() const
Number of strips measuring the phi coordinate.
IdentifierHash measurementHash(const Identifier &measId) const override final
Constructs the identifier hash from the full measurement Identifier.
int doubletR() const
Returns the doublet R field of the MuonReadoutElement identifier.
int doubletZ() const
Returns the doublet Z field of the MuonReadoutElement identifier.
int doubletPhi() const
Returns the doublet Phi field of the MuonReadoutElement identifier.
double stripPhiLength() const
Returns the length of a phi strip.
IdentifierHash layerHash(const Identifier &measId) const override final
double stripEtaWidth() const
Strip width in eta.
Identifier measurementId(const IdentifierHash &measHash) const override final
Converts the measurement hash back to the full Identifier.
double stripPhiPitch() const
Strip pitch in phi.
unsigned nEtaStrips() const
Number of strips measuring the eta coordinate.
double stripEtaPitch() const
Strip pitch in eta.
const parameterBook & getParameters() const
Amg::Vector3D stripPosition(const ActsTrk::GeometryContext &ctx, const Identifier &measId) const
Returns the position of the strip center.
int nPhiPanels() const
Returns the number of phi panels (1 or 2)
double stripPhiWidth() const
Strip width in phi.
unsigned nGasGaps() const
Returns the number of gasgaps described by this ReadOutElement (usally 2 or 3)
double stripEtaLength() const
Returns the length of an eta strip.
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 doubletPhi(const Identifier &id) const
int doubletR(const Identifier &id) const
int doubletZ(const Identifier &id) const
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
bool doesNotDeform(const Amg::Transform3D &trans)
Checks whether the linear part of the transformation rotates or stetches any of the basis vectors.
Amg::Transform3D getRotateZ3D(double angle)
get a rotation transformation around Z-axis
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
The ReadoutGeomCnvAlg converts the Run4 Readout geometry build from the GeoModelXML into the legacy M...
GeoModel::TransientConstSharedPtr< StripDesign > StripDesignPtr
Lightweight algorithm to read xAOD MDT sim hits and (fast-digitised) drift circles from SG and fill a...
constexpr int hollowFilling
Filling codes for hollow / fullFilling / hatched filling.
std::unique_ptr< TLatex > drawLabel(const std::string &text, const double xPos, const double yPos, const unsigned int fontSize=18)
Create a TLatex label,.
std::unique_ptr< TBox > drawBox(const Amg::Vector3D &boxCenter, const double boxWidth, const double boxHeight, const int color=kGreen+2, const int fillStyle=hollowFilling, const int view=objViewEta)
Creates a box for drawing, e.g strip measurements.
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
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.
double halfLength
RPC panel dimensions.
double halfThickness
Half thickness of the Rpc module.
double halfWidth
Elongation within the sector.