17 const IdentifierHash measHash)
34 const RpcIdHelper& idHelper{m_idHelperSvc->rpcIdHelper()};
35 auto translateTokenList = [
this, &idHelper](
const std::vector<std::string>& chNames){
37 std::set<Identifier> transcriptedIds{};
38 for (
const std::string& token : chNames) {
39 if (token.size() != 6) {
40 ATH_MSG_WARNING(
"Wrong format given for "<<token<<
". Expecting 6 characters");
44 const std::string statName = token.substr(0, 3);
45 const unsigned statEta =
std::atoi(token.substr(3, 1).c_str()) * (token[4] ==
'A' ? 1 : -1);
46 const unsigned statPhi =
std::atoi(token.substr(5, 1).c_str());
48 const Identifier eleId = idHelper.elementID(statName, statEta, statPhi, 1,
isValid);
53 transcriptedIds.insert(eleId);
54 std::copy_if(idHelper.detectorElement_begin(), idHelper.detectorElement_end(),
55 std::inserter(transcriptedIds, transcriptedIds.end()),
57 return idHelper.stationName(copyMe) == idHelper.stationName(eleId) &&
58 idHelper.stationEta(copyMe) == idHelper.stationEta(eleId) &&
59 idHelper.stationPhi(copyMe) == idHelper.stationPhi(eleId);
62 return transcriptedIds;
65 std::vector <std::string>& selectedSt = m_selectStat.value();
66 const std::vector <std::string>& excludedSt = m_excludeStat.value();
67 selectedSt.erase(std::remove_if(selectedSt.begin(), selectedSt.end(),
68 [&excludedSt](
const std::string& token){
69 return std::ranges::find(excludedSt, token) != excludedSt.end();
70 }), selectedSt.end());
72 if (selectedSt.size()) {
73 m_testStations = translateTokenList(selectedSt);
74 std::stringstream sstr{};
76 sstr<<
" *** "<<m_idHelperSvc->toString(
id)<<std::endl;
78 ATH_MSG_INFO(
"Test only the following stations "<<std::endl<<sstr.str());
80 const std::set<Identifier> excluded = translateTokenList(excludedSt);
82 for(
auto itr = idHelper.detectorElement_begin();
83 itr!= idHelper.detectorElement_end();++itr){
84 if (!excluded.count(*itr)) {
85 m_testStations.insert(*itr);
89 if (!excluded.empty()) {
90 std::stringstream excluded_report{};
92 excluded_report <<
" *** " << m_idHelperSvc->toStringDetEl(
id) << std::endl;
94 ATH_MSG_INFO(
"Test all station except the following excluded ones " << std::endl << excluded_report.str());
98 return StatusCode::SUCCESS;
102 return StatusCode::SUCCESS;
105 const EventContext& ctx{Gaudi::Hive::currentContext()};
111 for (
const Identifier& test_me : m_testStations) {
112 ATH_MSG_DEBUG(
"Test retrieval of Rpc detector element "<<m_idHelperSvc->toStringDetEl(test_me));
118 if (reElement->
identify() != test_me) {
119 ATH_MSG_FATAL(
"Expected to retrieve "<<m_idHelperSvc->toStringDetEl(test_me)
120 <<
". But got instead "<<m_idHelperSvc->toStringDetEl(reElement->
identify()));
121 return StatusCode::FAILURE;
123 ATH_CHECK(dumpToTree(ctx,gctx,reElement));
129 ATH_MSG_FATAL(
"Closure test failed for "<<m_idHelperSvc->toStringDetEl(test_me)
131 return StatusCode::FAILURE;
133 const RpcIdHelper& id_helper{m_idHelperSvc->rpcIdHelper()};
135 for (
int doubPhi = reElement->
doubletPhi(); doubPhi <= reElement->doubletPhiMax(); ++doubPhi) {
136 for (
bool measPhi: {
false,
true}) {
137 unsigned int numStrip = (measPhi ? reElement->
nPhiStrips() :
139 for (
unsigned int strip = 1; strip < numStrip ; ++strip) {
149 const IdentifierHash layHash = reElement->
layerHash(chId);
151 <<
" --> layerHash: "<<
static_cast<unsigned>(layHash));
153 if (backCnv != chId) {
154 ATH_MSG_FATAL(
"The back and forth conversion of "<<m_idHelperSvc->toString(chId)
155 <<
" failed. Got "<<m_idHelperSvc->toString(backCnv));
156 return StatusCode::FAILURE;
158 if (layHash != reElement->
layerHash(measHash)) {
159 ATH_MSG_FATAL(
"Constructing the layer hash from the identifier "<<
160 m_idHelperSvc->toString(chId)<<
" leadds to different layer hashes "<<
161 layHash<<
" vs. "<< reElement->
layerHash(measHash));
162 return StatusCode::FAILURE;
164 ATH_MSG_VERBOSE(
"Channel "<<m_idHelperSvc->toString(chId)<<
" strip position "
165 <<stripPosToString(reElement, gctx, measHash));
171 return StatusCode::SUCCESS;
173 StatusCode GeoModelRpcTest::dumpToTree(
const EventContext& ctx,
185 m_numRpcLayers = reElement->
nGasGaps();
206 const RpcIdHelper& id_helper{m_idHelperSvc->rpcIdHelper()};
209 for (
int doubPhi = reElement->
doubletPhi(); doubPhi <= reElement->doubletPhiMax(); ++doubPhi) {
210 for (
bool measPhi: {
false,
true}) {
211 unsigned int numStrip = (measPhi ? reElement->
nPhiStrips() :
213 for (
unsigned int strip = 1; strip <= numStrip ; ++strip) {
221 <<m_idHelperSvc->toStringDetEl(reElement->
identify())
222 <<
" gap: "<<
gasGap<<
" strip: "<<strip<<
" meas phi: "<<measPhi);
226 const IdentifierHash layHash = reElement->
layerHash(measHash);
228 m_stripPos.push_back(stripPos);
229 m_locStripPos.push_back((reElement->
globalToLocalTrans(gctx, layHash) * stripPos).block<2,1>(0,0));
230 m_stripPosGasGap.push_back(
gasGap);
231 m_stripPosMeasPhi.push_back(measPhi);
232 m_stripPosNum.push_back(strip);
233 m_stripDblPhi.push_back(doubPhi);
235 if (strip != 1)
continue;
237 m_stripRot.push_back(locToGlob);
238 m_stripRotGasGap.push_back(
gasGap);
239 m_stripRotMeasPhi.push_back(measPhi);
240 m_stripRotDblPhi.push_back(doubPhi);
245 return m_tree.fill(ctx) ? StatusCode::SUCCESS : StatusCode::FAILURE;