ATLAS Offline Software
Loading...
Searching...
No Matches
sTGCAsBuiltData.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
6
7
8std::ostream& operator<<(std::ostream& ostr, const sTGCAsBuiltData::Parameters& par){
9 return ostr << "Offset " << par.offset << " rotxy " << par.rotation << " scale " << par.scale << " nonPara " << par.nonPara << " stripBending " << par.stripBending;
10}
11
12
14 AthMessaging{"sTGCAsBuiltData"},
15 m_idHelperSvc{idHelperSvc} {}
16
17
18
20 bool issTgc = m_idHelperSvc->issTgc(channelId);
21 Identifier asBuiltId = issTgc ? m_idHelperSvc->gasGapId(channelId) : m_idHelperSvc->mmIdHelper().pcbID(channelId);
22
23 ParMap::const_iterator par_itr = m_asBuiltData.find(asBuiltId);
24 if(par_itr == m_asBuiltData.end()){
25 ATH_MSG_WARNING("Missing as built parameters for gas gap " << m_idHelperSvc->toString(channelId));
26 return pos;
27 }
28 Amg::Vector2D correctedPos = pos;
29 Parameters pars = par_itr->second;
30 constexpr double convScale = 1.e-3; // parameters are stored in um and mrad therefore dividing by 1000
31
32 // For the QL3 modules described by the legacy (Run 3) geometry EDM the origin of the local frame is shifted with respect to the actual center of the gap.
33 // Therefore a shift is introduced which stabilizes the as built fit which must also be applied here since the parameters are expressed using the actual center of the gap.
34 float shift = (std::fabs(m_idHelperSvc->stationEta(channelId)) == 3 && m_idHelperSvc->stationNameString(channelId) == "STL" ? 24.74 : 0.0);
35 ATH_MSG_VERBOSE("applying as built parameters for gas gap " << m_idHelperSvc->toString(m_idHelperSvc->gasGapId(channelId)) << " parameters " << pars);
36
37 double correction = pars.offset * convScale + pars.rotation *convScale * pos.y() + pars.scale*convScale*(pos.x() + shift ) + pars.nonPara * convScale * convScale * (pos.x() + shift )*pos.y();
38 // we only want to correct the banana shape for the MM
39 if(!issTgc) correction += pars.stripBending*convScale*convScale*pos.y()*pos.y();
40 correctedPos.x() = pos.x() + correction;
41 return correctedPos;
42}
43
44
45StatusCode sTGCAsBuiltData::setParameters(const Identifier& channelId, const Parameters& pars){
46 const Identifier gasGapId = m_idHelperSvc->gasGapId(channelId);
47 auto insert_itr = m_asBuiltData.insert(std::make_pair(gasGapId, pars));
48 if (!insert_itr.second) {
49 ATH_MSG_ERROR("As built parameters for gasGap "<<m_idHelperSvc->toStringGasGap(gasGapId)
50 <<" has already been stored ");
51 return StatusCode::FAILURE;
52 }
53 return StatusCode::SUCCESS;
54}
55
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
sTGCAsBuiltData(const Muon::IMuonIdHelperSvc *idHelperSvc)
const Muon::IMuonIdHelperSvc * m_idHelperSvc
Amg::Vector2D correctPosition(const Identifier &channelId, const Amg::Vector2D &pos) const
StatusCode setParameters(const Identifier &gasGapId, const Parameters &pars)
Eigen::Matrix< double, 2, 1 > Vector2D
std::ostream & operator<<(std::ostream &ostr, const sTGCAsBuiltData::Parameters &par)