21 const MmIdHelper& idHelper{m_idHelperSvc->mmIdHelper()};
23 auto translateTokenList = [
this, &idHelper](
const std::vector<std::string>& chNames){
25 std::set<Identifier> transcriptedIds{};
26 for (
const std::string& token : chNames) {
27 if (token.size() != 6) {
28 ATH_MSG_WARNING(
"Wrong format given for "<<token<<
". Expecting 6 characters");
32 const std::string statName = token.substr(0, 3);
33 const unsigned statEta =
std::atoi(token.substr(3, 1).c_str()) * (token[4] ==
'A' ? 1 : -1);
34 const unsigned statPhi =
std::atoi(token.substr(5, 1).c_str());
41 transcriptedIds.insert(eleId);
44 transcriptedIds.insert(secMlId);
47 return transcriptedIds;
50 std::vector <std::string>& selectedSt = m_selectStat.value();
51 const std::vector <std::string>& excludedSt = m_excludeStat.value();
52 selectedSt.erase(std::remove_if(selectedSt.begin(), selectedSt.end(),
53 [&excludedSt](
const std::string& token){
54 return std::ranges::find(excludedSt, token) != excludedSt.end();
55 }), selectedSt.end());
57 if (selectedSt.size()) {
58 m_testStations = translateTokenList(selectedSt);
59 std::stringstream sstr{};
61 sstr<<
" *** "<<m_idHelperSvc->toString(
id)<<std::endl;
63 ATH_MSG_INFO(
"Test only the following stations "<<std::endl<<sstr.str());
65 const std::set<Identifier> excluded = translateTokenList(excludedSt);
67 for(
auto itr = idHelper.detectorElement_begin();
68 itr!= idHelper.detectorElement_end();++itr){
69 if (!excluded.count(*itr)) {
70 m_testStations.insert(*itr);
74 if (!excluded.empty()) {
75 std::stringstream excluded_report{};
77 excluded_report <<
" *** " << m_idHelperSvc->toStringDetEl(
id) << std::endl;
79 ATH_MSG_INFO(
"Test all station except the following excluded ones " << std::endl << excluded_report.str());
83 return StatusCode::SUCCESS;
87 return StatusCode::SUCCESS;
90 const EventContext& ctx{Gaudi::Hive::currentContext()};
95 for (
const Identifier& test_me : m_testStations) {
96 ATH_MSG_DEBUG(
"Test retrieval of Mm detector element "<<m_idHelperSvc->toStringDetEl(test_me));
102 if (reElement->
identify() != test_me) {
103 ATH_MSG_FATAL(
"Expected to retrieve "<<m_idHelperSvc->toStringDetEl(test_me)
104 <<
". But got instead "<<m_idHelperSvc->toStringDetEl(reElement->
identify()));
105 return StatusCode::FAILURE;
111 ATH_MSG_FATAL(
"Closure test failed for "<<m_idHelperSvc->toStringDetEl(test_me)
113 return StatusCode::FAILURE;
115 const MmIdHelper& id_helper{m_idHelperSvc->mmIdHelper()};
118 const int numStrips = reElement->
numStrips(layerHash);
119 const int fStrip = reElement->
firstStrip(layerHash);
120 const int lStrip = fStrip+numStrips-1;
122 for (
int strip = fStrip; strip < lStrip; ++strip) {
134 const IdentifierHash layHash = reElement->
layerHash(chId);
136 if (backCnv != chId) {
137 ATH_MSG_FATAL(
"The back and forth conversion of "<<m_idHelperSvc->toString(chId)
138 <<
" failed. Got "<<m_idHelperSvc->toString(backCnv));
139 return StatusCode::FAILURE;
141 if (layHash != reElement->
layerHash(channelHash)) {
142 ATH_MSG_FATAL(
"Constructing the layer hash from the identifier "<<
143 m_idHelperSvc->toString(chId)<<
" leads to different layer hashes "<<
144 layHash<<
" vs. "<< reElement->
layerHash(channelHash));
145 return StatusCode::FAILURE;
151 const double stripLen{design.stripLength(strip)};
152 if (stripLen && (design.stripNumber(stripPos2D) != strip ||
153 design.stripNumber(stripPos2D - 0.49 * stripLen * Amg::Vector2D::UnitY()) != strip ||
154 design.stripNumber(stripPos2D + 0.49 * stripLen * Amg::Vector2D::UnitY()) != strip)) {
155 ATH_MSG_FATAL(
"Conversion channel -> strip -> channel failed for "
156 <<m_idHelperSvc->toString(chId)<<
" "<<
Amg::toString(stripPos)<<
", local: "
157 <<
Amg::toString(locStripPos)<<
" got "<<design.stripNumber(stripPos2D)
158 <<
", first strip: "<<fStrip<<std::endl<<design);
159 return StatusCode::FAILURE;
161 ATH_MSG_VERBOSE(
"first strip "<<fStrip<<
", numStrips "<< numStrips <<
", channel "
162 << m_idHelperSvc->toString(chId) <<
", strip position " <<
Amg::toString(stripPos));
165 ATH_CHECK(dumpToTree(ctx,gctx,reElement));
168 return StatusCode::SUCCESS;
170 StatusCode GeoModelMmTest::dumpToTree(
const EventContext& ctx,
193 const MmIdHelper& id_helper{m_idHelperSvc->mmIdHelper()};
197 unsigned int numStrips = reElement->
numStrips(layHash);
198 unsigned int fStrip = reElement->
firstStrip(layHash);
199 unsigned int lStrip = fStrip+numStrips-1;
201 for (
unsigned int strip = fStrip; strip <= lStrip ; ++strip) {
208 <<m_idHelperSvc->toStringDetEl(reElement->
identify())
209 <<
" layer: "<<
layer<<
" strip: "<<strip);
215 if (strip == fStrip) {
217 ATH_MSG_VERBOSE(m_idHelperSvc->toStringGasGap(chId)<<
" "<<
"transform: "
218 <<
Amg::toString(stripLocalToGlob)<<
", perp: "<<stripLocalToGlob.translation().perp());
219 m_stripRot.push_back(stripLocalToGlob);
220 m_stripRotGasGap.push_back(
layer);
221 m_firstStripPos.push_back(design.firstStripPos());
222 m_readoutSide.push_back(reElement->
readoutSide(measHash));
224 m_ActiveWidthS = reElement->
gapLengthS(measHash);
225 m_ActiveWidthL = reElement->
gapLengthL(measHash);
226 m_ActiveHeightR = reElement->
gapHeight(measHash);
227 m_firstStrip.push_back(design.firstStripNumber());
228 m_nStrips.push_back(design.numStrips());
230 CheckVector2D center = design.center(strip);
232 ATH_MSG_WARNING(
"Strip "<<m_idHelperSvc->toString(chId)<<
" is outside bounds "<<design);
235 m_stripLength.push_back(reElement->
stripLength(measHash));
236 m_locStripCenter.push_back(center.value());
237 m_isStereo.push_back(design.hasStereoAngle());
238 m_stripCenter.push_back(reElement->
stripPosition(gctx, measHash));
239 m_stripLeftEdge.push_back(reElement->
leftStripEdge(gctx,measHash));
240 m_stripRightEdge.push_back(reElement->
rightStripEdge(gctx,measHash));
241 m_gasGap.push_back(
layer);
242 m_channel.push_back(strip);
245 return m_tree.fill(ctx) ? StatusCode::SUCCESS : StatusCode::FAILURE;