ATLAS Offline Software
Loading...
Searching...
No Matches
MuonGM::MuonDetectorFactoryLite Class Reference

#include <MuonDetectorFactoryLite.h>

Inheritance diagram for MuonGM::MuonDetectorFactoryLite:
Collaboration diagram for MuonGM::MuonDetectorFactoryLite:

Public Member Functions

 MuonDetectorFactoryLite (StoreGateSvc *pDetStore, GeoModelIO::ReadGeoModel *sqliteReader)
 ~MuonDetectorFactoryLite ()
virtual void create (GeoPhysVol *world) override
virtual const MuonDetectorManagergetDetectorManager () const override
MuonDetectorManagergetDetectorManager ()
void setRDBAccess (IRDBAccessSvc *access)

Private Attributes

MuonDetectorManagerm_manager {nullptr}
StoreGateSvcm_pDetStore {nullptr}
IRDBAccessSvcm_pRDBAccess {nullptr}
GeoModelIO::ReadGeoModel * m_sqliteReader

Detailed Description

Definition at line 19 of file MuonDetectorFactoryLite.h.

Constructor & Destructor Documentation

◆ MuonDetectorFactoryLite()

MuonGM::MuonDetectorFactoryLite::MuonDetectorFactoryLite ( StoreGateSvc * pDetStore,
GeoModelIO::ReadGeoModel * sqliteReader )

Definition at line 41 of file MuonDetectorFactoryLite.cxx.

41 :
42 m_pDetStore{pDetStore},
43 m_sqliteReader(sqliteReader) {
44 }
GeoModelIO::ReadGeoModel * m_sqliteReader

◆ ~MuonDetectorFactoryLite()

MuonGM::MuonDetectorFactoryLite::~MuonDetectorFactoryLite ( )
default

Member Function Documentation

◆ create()

void MuonGM::MuonDetectorFactoryLite::create ( GeoPhysVol * world)
overridevirtual

Definition at line 51 of file MuonDetectorFactoryLite.cxx.

51 {
52
53 std::map<std::string, GeoAlignableTransform*> mapAXF = m_sqliteReader->getPublishedNodes<std::string, GeoAlignableTransform*>("MuonSys");
54 std::map<std::string, GeoFullPhysVol*> mapFPV = m_sqliteReader->getPublishedNodes<std::string, GeoFullPhysVol*>("MuonSys");
55
56 MsgStream log(Athena::getMessageSvc(), "MuGM:MuonFactory");
57
58 if (!m_manager) m_manager = new MuonDetectorManager();
59
60
61
62
63
64 // Iterate using iterator in for loop
65 for (const auto& [key, pV] : mapFPV) {
66 if (key.starts_with ("sMD") || key.starts_with ("sTG")) {
67 int /*index1=key[3]-'0',*/ eta=key[5]-'0', ml=key[7]-'0', phi=key[12]-'0';
68
69 char AC=key[13];
70 int ec = AC=='C' ? -1 : 1;
71 std::string vName = pV->getLogVol()->getName();
72 if (key.starts_with("sMD")) {
73 std::string sName = vName.substr(4,4);
74 std::unique_ptr<MuonGM::MMReadoutElement> re = std::make_unique<MuonGM::MMReadoutElement>(pV, sName, ec*eta,phi,ml,m_manager);
75 re->initDesign();
76 m_manager->addMMReadoutElement(std::move(re));
77 }
78 else if (key.starts_with("sTG")) {
79 std::string sName = vName.substr(7,4);
80 std::unique_ptr<sTgcReadoutElement> re = std::make_unique<sTgcReadoutElement>(pV, sName, ec*eta, phi, ml, m_manager);
81 re->initDesign(2.6);
82 m_manager->addsTgcReadoutElement(std::move(re));
83 }
84 }
85 }
86
87
88
89 // here create the MYSQL singleton
91 mysql->set_amdb_from_RDB(true);
92
93 std::unique_ptr<RDBReaderAtlas> dbr;
94 {
95 // We never alter these in the "Lite" workflow
96 std::string oracleTag="";
97 std::string oracleNode="";
98 std::map<std::string, std::string> ascii{};
99 dbr = std::make_unique<RDBReaderAtlas>(m_pDetStore, m_pRDBAccess, oracleTag, oracleNode, ascii);
100
101
102 }
103
104
105
106 // set here the flag deciding whether to include cutouts:
107 // m_includeCutouts = 1 => include cutouts
108 // m_includeCutouts = 0 => no cutouts
109 m_manager->setCutoutsFlag(true);
110 m_manager->setCutoutsBogFlag(true);
111
112
113 StatusCode sc = StatusCode::SUCCESS;
114
115 dbr->setManager(getDetectorManager());
116 sc = dbr->ProcessDB(*mysql);
117 if (sc != StatusCode::SUCCESS) {
118 log << MSG::ERROR << " FAILURE in DB access; Muon node will not be built" << endmsg;
119 return;
120 }
121
122 GeoFullPhysVol *p4 = mapFPV["MuonTreeTop"];
123 m_manager->addTreeTop(p4); // This is the top!
124 log << MSG::INFO << " TreeTop added to the Manager" << endmsg;
125
126 // Look through the map explicitly for Stations
127 std::set<std::string> mappedStations;
128 for (const auto& i: mapFPV) {
129 size_t pos=i.first.find("_Station");
130 if (pos!=std::string::npos) mappedStations.insert(i.first.substr(0,pos));
131 }
132
133 // Boudreau Jan 2024 Keep track of instantiated readout geometries. This is
134 // needed because the muon geometry is rebuild multiple times in current
135 // implementation.
136 std::set<std::string> keyset;
137
138 for (const auto& i: mappedStations) {
139 auto it= mysql->stationMap().find(i);
140 if (it==mysql->stationMap().end()) {
141 throw std::runtime_error("Raw/readout geometry mismatch");
142 }
143
144 Station *station = (*it).second.get();
145 std::string stname(station->GetName(), 0, 3);
146
147 bool isAssembly = false;
148 if (station->GetNrOfCutouts() > 0 && stname.substr(0, 1) != "T")
149 isAssembly = true;
150
151 // BIR have multilayers of diff. length and overall station volume clashes with toroids
152 if (stname == "BIR")
153 isAssembly = true;
154
155 MuonChamberLite l(*mysql, station,&mapFPV,&mapAXF); // here is where we start to create a MuonChamber with all readoutelements
156 l.setKeyset(&keyset);
157
159 AlignPos ap;
160 for ( auto const& [key, position] : *station) {
161 int zi = position.zindex;
162 int fi = position.phiindex;
163
164 // here build the physical volume (tree) associated to the chamber
165 if (stname == "CSL") isAssembly = true;
166
167 // CSL because coffin shape of the station mother volume
168 l.addReadoutLayers(*mysql, getDetectorManager(), zi, fi, position.isMirrored, isAssembly);
169
170 // here define the GeoAlignableTransform associated to the chamber
171 // nominal transform first
172 GeoAlignableTransform *xf = mapAXF[station->GetName()+"_Station_"+std::to_string(zi)+"_"+std::to_string(fi)];
173 // alignment issues and readout geometry for station
174 MuonStation *mst = m_manager->getMuonStation(station->GetName(), zi, fi + 1);
175 if (!mst) {
176 log << MSG::WARNING << "For Station with nameTag=<" << station->GetName() << "> at zi/fi = " << zi << "/" << fi
177 << " no MuonStation found => no possibility to align" << endmsg;
178 continue;
179 }
180 mst->setTransform(xf);
181 GeoTrf::Transform3D tsz_to_szt = GeoTrf::RotateZ3D(-90 * Gaudi::Units::degree) * GeoTrf::RotateY3D(-90 * Gaudi::Units::degree);
182 GeoTrf::Transform3D nativeToAmdbLRS=tsz_to_szt * station->native_to_tsz_frame(*mysql, position);
183 mst->setNativeToAmdbLRS(nativeToAmdbLRS);
184 mst->setNominalAmdbLRSToGlobal(station->tsz_to_global_frame(*mysql, position) * tsz_to_szt.inverse());
185
186 int nAlines = station->CountAlignPos(zi, fi);
187 if (nAlines == 0) {
188 ap.tras = ap.traz = ap.trat = ap.rots = ap.rotz = ap.rott = 0.;
189 ap.jobindex = 0;
190 mst->setDelta_fromAline(ap.tras, ap.traz, ap.trat, ap.rots, ap.rotz, ap.rott);
191 } else if (nAlines > 0) {
192 AlignPosIterator alast;
193 AlignPosIterator afirst = station->getFirstAlignPosInRange(zi, fi, alast);
194
195 for (AlignPosIterator acurrent = afirst; acurrent != alast; ++acurrent) {
196 ap = acurrent->second;
197 if (ap.phiindex != fi || ap.zindex != zi) {
198 log << MSG::ERROR << "Inconsistent AlignedPosition found in the static Geometry DB: aligPos.fi, zi = " << ap.phiindex << ", " << ap.zindex
199 << " for station " << station->GetName() << " at fi/zi = " << fi << "/" << zi << " AlignPos indices fi/zi " << fi << "/" << zi << endmsg;
200 }
201 GeoTrf::Transform3D tsz_to_szt = GeoTrf::RotateZ3D(-90 * Gaudi::Units::degree) * GeoTrf::RotateY3D(-90 * Gaudi::Units::degree);
202 // Keep, for later developments. GeoTrf::Transform3D nominalTransform=station->getNominalTransform(*mysql, position);
203 // Keep, for later developments. GeoTrf::Transform3D native_to_amdbl=tsz_to_szt * station->native_to_tsz_frame(*mysql, position);
204 mst->setTransform(xf);
205 mst->setNativeToAmdbLRS(tsz_to_szt * station->native_to_tsz_frame(*mysql, position));
206 mst->setNominalAmdbLRSToGlobal(station->tsz_to_global_frame(*mysql, position) * tsz_to_szt.inverse());
207 mst->setDeltaAmdbLRS(GeoTrf::Transform3D::Identity());
208 }
209 }
210 } // end loop on positions
211 } // for ( it = sel.begin(); it != sel.end(); it++ ) {
212 delete mysql.get();
213 } // MuonDetectorFactoryLite::create
const boost::regex re(r_e)
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define endmsg
static Double_t sc
void set_amdb_from_RDB(bool)
Definition MYSQL.cxx:268
const StationMap & stationMap() const
Definition MYSQL.cxx:227
static LockedMYSQL GetPointer()
Definition MYSQL.cxx:42
CxxUtils::LockedPointer< MYSQL > LockedMYSQL
Definition MYSQL.h:47
virtual const MuonDetectorManager * getDetectorManager() const override
IMessageSvc * getMessageSvc(bool quiet=false)
::StatusCode StatusCode
StatusCode definition for legacy code.
std::multimap< int, AlignPos, std::less< int > >::const_iterator AlignPosIterator
Definition Station.h:38
std::map< int, Position, std::less< int > >::const_iterator PositionIterator
Definition Station.h:37
l
Printing final latex table to .tex output file.

◆ getDetectorManager() [1/2]

MuonDetectorManager * MuonGM::MuonDetectorFactoryLite::getDetectorManager ( )

Definition at line 49 of file MuonDetectorFactoryLite.cxx.

49{ return m_manager; }

◆ getDetectorManager() [2/2]

const MuonDetectorManager * MuonGM::MuonDetectorFactoryLite::getDetectorManager ( ) const
overridevirtual

Definition at line 48 of file MuonDetectorFactoryLite.cxx.

48{ return m_manager; }

◆ setRDBAccess()

void MuonGM::MuonDetectorFactoryLite::setRDBAccess ( IRDBAccessSvc * access)
inline

Definition at line 48 of file MuonDetectorFactoryLite.h.

access(filename, mode)

Member Data Documentation

◆ m_manager

MuonDetectorManager* MuonGM::MuonDetectorFactoryLite::m_manager {nullptr}
private

Definition at line 41 of file MuonDetectorFactoryLite.h.

41{nullptr};

◆ m_pDetStore

StoreGateSvc* MuonGM::MuonDetectorFactoryLite::m_pDetStore {nullptr}
private

Definition at line 42 of file MuonDetectorFactoryLite.h.

42{nullptr};

◆ m_pRDBAccess

IRDBAccessSvc* MuonGM::MuonDetectorFactoryLite::m_pRDBAccess {nullptr}
private

Definition at line 43 of file MuonDetectorFactoryLite.h.

43{nullptr};

◆ m_sqliteReader

GeoModelIO::ReadGeoModel* MuonGM::MuonDetectorFactoryLite::m_sqliteReader
private

Definition at line 44 of file MuonDetectorFactoryLite.h.


The documentation for this class was generated from the following files: