21 const TgcIdHelper& idHelper{m_idHelperSvc->tgcIdHelper()};
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() != 7) {
27 ATH_MSG_WARNING(
"Wrong format given for "<<token<<
". Expecting 7 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, 2).c_str());
40 transcriptedIds.insert(eleId);
42 return transcriptedIds;
45 std::vector <std::string>& selectedSt = m_selectStat.value();
46 const std::vector <std::string>& excludedSt = m_excludeStat.value();
47 selectedSt.erase(std::remove_if(selectedSt.begin(), selectedSt.end(),
48 [&excludedSt](
const std::string& token){
49 return std::ranges::find(excludedSt, token) != excludedSt.end();
50 }), selectedSt.end());
52 if (selectedSt.size()) {
53 m_testStations = translateTokenList(selectedSt);
54 std::stringstream sstr{};
56 sstr<<
" *** "<<m_idHelperSvc->toString(
id)<<std::endl;
58 ATH_MSG_INFO(
"Test only the following stations "<<std::endl<<sstr.str());
60 const std::set<Identifier> excluded = translateTokenList(excludedSt);
62 for(
auto itr = idHelper.detectorElement_begin();
63 itr!= idHelper.detectorElement_end();++itr){
64 if (!excluded.count(*itr)) {
65 m_testStations.insert(*itr);
69 if (!excluded.empty()) {
70 std::stringstream excluded_report{};
72 excluded_report <<
" *** " << m_idHelperSvc->toStringDetEl(
id) << std::endl;
74 ATH_MSG_INFO(
"Test all station except the following excluded ones " << std::endl << excluded_report.str());
78 return StatusCode::SUCCESS;
82 return StatusCode::SUCCESS;
85 const EventContext& ctx{Gaudi::Hive::currentContext()};
91 for (
const Identifier& test_me : m_testStations) {
92 ATH_MSG_DEBUG(
"Test retrieval of Tgc detector element "<<m_idHelperSvc->toStringDetEl(test_me));
98 if (reElement->
identify() != test_me) {
99 ATH_MSG_FATAL(
"Expected to retrieve "<<m_idHelperSvc->toStringDetEl(test_me)
100 <<
". But got instead "<<m_idHelperSvc->toStringDetEl(reElement->
identify()));
101 return StatusCode::FAILURE;
108 ATH_MSG_FATAL(
"Closure test failed for "<<m_idHelperSvc->toStringDetEl(test_me)
110 return StatusCode::FAILURE;
112 const TgcIdHelper& id_helper{m_idHelperSvc->tgcIdHelper()};
114 for (
bool isStrip : {
false,
true}) {
116 const unsigned nChan = reElement->
numChannels(layHash);
122 ATH_MSG_DEBUG(
"No valid Identifier constructed from the fields "
123 <<m_idHelperSvc->toStringDetEl(reElement->
identify())
124 <<
"isStrip: "<<(
isStrip ?
"yay" :
"nay")<<
" gasGap: "<<
gasGap<<
132 <<
"failed. Got instead "<<m_idHelperSvc->toString(backCnv));
133 return StatusCode::FAILURE;
136 ATH_MSG_FATAL(
"The cosntruction of the layer hash from the Identifier "<<m_idHelperSvc->toString(
channelId)
137 <<
" gave something else than doing it from the measurement hash "<<measHash<<
". "<<
143 ATH_CHECK(dumpToTree(ctx, gctx, reElement));
145 return StatusCode::SUCCESS;
147 StatusCode GeoModelTgcTest::dumpToTree(
const EventContext& ctx,
168 for (
unsigned strip = 1 ; strip <= reElement->
numStrips(layHash); ++strip) {
174 m_layTans.push_back(localToGlobal);
175 m_layMeasPhi.push_back(
true);
176 m_layNumber.push_back(
gap);
177 m_layShortWidth.push_back(2.*layout.shortHalfHeight());
178 m_layLongWidth.push_back(2.*layout.longHalfHeight());
179 m_layHeight.push_back(2.*layout.halfWidth());
180 m_layNumWires.push_back(0);
182 m_stripGasGap.push_back(
gap);
183 m_stripNum.push_back(strip);
188 const Amg::Vector3D globTop{localToGlobal * sensor->to3D(layout.leftEdge(strip),
true)};
189 const Amg::Vector3D globBot{localToGlobal * sensor->to3D(layout.rightEdge(strip),
true)};
190 m_stripBottom.push_back(globBot);
191 m_stripTop.push_back(globTop);
192 m_locStripTop.push_back(locTop2D);
194 m_locStripBottom.push_back(locBot2D);
198 for (
unsigned gang = 1; gang <= reElement->
numWireGangs(layHash); ++gang) {
203 m_layMeasPhi.push_back(
false);
204 m_layNumber.push_back(
gap);
205 m_layShortWidth.push_back(2.*layout.shortHalfHeight());
206 m_layLongWidth.push_back(2.*layout.longHalfHeight());
207 m_layHeight.push_back(2.*layout.halfWidth());
208 m_layNumWires.push_back(layout.nAllWires());
210 m_gangNum.push_back(gang);
211 m_gangGasGap.push_back(
gap);
213 m_gangNumWires.push_back(layout.numWiresInGroup(gang));
215 m_gangLength.push_back(layout.stripLength(gang));
218 return m_tree.fill(ctx) ? StatusCode::SUCCESS : StatusCode::FAILURE;