21 const RpcIdHelper& idHelper{m_idHelperSvc->rpcIdHelper()};
22 auto translateTokenList = [
this, &idHelper](
const std::vector<std::string>& chNames){
24 std::set<Identifier> transcriptedIds{};
25 for (
const std::string& token : chNames) {
26 if (token.size() != 6) {
27 ATH_MSG_WARNING(
"Wrong format given for "<<token<<
". Expecting 6 characters");
31 const std::string statName = token.substr(0, 3);
32 const unsigned statEta =
std::atoi(token.substr(3, 1).c_str()) * (token[4] ==
'A' ? 1 : -1);
33 const unsigned statPhi =
std::atoi(token.substr(5, 1).c_str());
35 const Identifier eleId = idHelper.elementID(statName, statEta, statPhi, 1,
isValid);
40 transcriptedIds.insert(eleId);
41 std::copy_if(idHelper.detectorElement_begin(), idHelper.detectorElement_end(),
42 std::inserter(transcriptedIds, transcriptedIds.end()),
44 return idHelper.stationName(copyMe) == idHelper.stationName(eleId) &&
45 idHelper.stationEta(copyMe) == idHelper.stationEta(eleId) &&
46 idHelper.stationPhi(copyMe) == idHelper.stationPhi(eleId);
49 return transcriptedIds;
52 std::vector <std::string>& selectedSt = m_selectStat.value();
53 const std::vector <std::string>& excludedSt = m_excludeStat.value();
54 selectedSt.erase(std::remove_if(selectedSt.begin(), selectedSt.end(),
55 [&excludedSt](
const std::string& token){
56 return std::ranges::find(excludedSt, token) != excludedSt.end();
57 }), selectedSt.end());
59 if (selectedSt.size()) {
60 m_testStations = translateTokenList(selectedSt);
61 std::stringstream sstr{};
63 sstr<<
" *** "<<m_idHelperSvc->toString(
id)<<std::endl;
65 ATH_MSG_INFO(
"Test only the following stations "<<std::endl<<sstr.str());
67 const std::set<Identifier> excluded = translateTokenList(excludedSt);
69 for(
auto itr = idHelper.detectorElement_begin();
70 itr!= idHelper.detectorElement_end();++itr){
71 if (!excluded.count(*itr)) {
72 m_testStations.insert(*itr);
76 if (!excluded.empty()) {
77 std::stringstream excluded_report{};
79 excluded_report <<
" *** " << m_idHelperSvc->toStringDetEl(
id) << std::endl;
81 ATH_MSG_INFO(
"Test all station except the following excluded ones " << std::endl << excluded_report.str());
85 return StatusCode::SUCCESS;
89 return StatusCode::SUCCESS;
92 const EventContext& ctx{Gaudi::Hive::currentContext()};
98 for (
const Identifier& test_me : m_testStations) {
99 ATH_MSG_DEBUG(
"Test retrieval of Rpc detector element "<<m_idHelperSvc->toStringDetEl(test_me));
105 if (reElement->
identify() != test_me) {
106 ATH_MSG_FATAL(
"Expected to retrieve "<<m_idHelperSvc->toStringDetEl(test_me)
107 <<
". But got instead "<<m_idHelperSvc->toStringDetEl(reElement->
identify()));
108 return StatusCode::FAILURE;
110 ATH_CHECK(dumpToTree(ctx,gctx,reElement));
116 ATH_MSG_FATAL(
"Closure test failed for "<<m_idHelperSvc->toStringDetEl(test_me)
118 return StatusCode::FAILURE;
120 const RpcIdHelper& id_helper{m_idHelperSvc->rpcIdHelper()};
122 for (
int doubPhi = reElement->
doubletPhi(); doubPhi <= reElement->doubletPhiMax(); ++doubPhi) {
123 for (
bool measPhi: {
false,
true}) {
124 unsigned int numStrip = (measPhi ? reElement->
nPhiStrips() :
126 for (
unsigned int strip = 1; strip < numStrip ; ++strip) {
136 const IdentifierHash layHash = reElement->
layerHash(chId);
138 <<
" --> layerHash: "<<
static_cast<unsigned>(layHash));
140 if (backCnv != chId) {
141 ATH_MSG_FATAL(
"The back and forth conversion of "<<m_idHelperSvc->toString(chId)
142 <<
" failed. Got "<<m_idHelperSvc->toString(backCnv));
143 return StatusCode::FAILURE;
145 if (layHash != reElement->
layerHash(measHash)) {
146 ATH_MSG_FATAL(
"Constructing the layer hash from the identifier "<<
147 m_idHelperSvc->toString(chId)<<
" leadds to different layer hashes "<<
148 layHash<<
" vs. "<< reElement->
layerHash(measHash));
149 return StatusCode::FAILURE;
151 ATH_MSG_VERBOSE(
"Channel "<<m_idHelperSvc->toString(chId)<<
" strip position "
158 return StatusCode::SUCCESS;
160 StatusCode GeoModelRpcTest::dumpToTree(
const EventContext& ctx,
172 m_numRpcLayers = reElement->
nGasGaps();
193 const RpcIdHelper& id_helper{m_idHelperSvc->rpcIdHelper()};
196 for (
int doubPhi = reElement->
doubletPhi(); doubPhi <= reElement->doubletPhiMax(); ++doubPhi) {
197 for (
bool measPhi: {
false,
true}) {
198 unsigned int numStrip = (measPhi ? reElement->
nPhiStrips() :
200 for (
unsigned int strip = 1; strip <= numStrip ; ++strip) {
208 <<m_idHelperSvc->toStringDetEl(reElement->
identify())
209 <<
" gap: "<<
gasGap<<
" strip: "<<strip<<
" meas phi: "<<measPhi);
213 const IdentifierHash layHash = reElement->
layerHash(measHash);
215 m_stripPos.push_back(stripPos);
216 m_locStripPos.push_back((reElement->
globalToLocalTrans(gctx, layHash) * stripPos).block<2,1>(0,0));
217 m_stripPosGasGap.push_back(
gasGap);
218 m_stripPosMeasPhi.push_back(measPhi);
219 m_stripPosNum.push_back(strip);
220 m_stripDblPhi.push_back(doubPhi);
222 if (strip != 1)
continue;
224 m_stripRot.push_back(locToGlob);
225 m_stripRotGasGap.push_back(
gasGap);
226 m_stripRotMeasPhi.push_back(measPhi);
227 m_stripRotDblPhi.push_back(doubPhi);
232 return m_tree.fill(ctx) ? StatusCode::SUCCESS : StatusCode::FAILURE;