Commit 9df73870 authored by Vakhtang Tsulaia's avatar Vakhtang Tsulaia
Browse files

Merge branch 'MuonDetFac_FixIncludes' into 'master'

MuonGeoModel - Minor style improvements

See merge request atlas/athena!47383
parents 57a157ab ee687c55
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
#ifndef MuonDetectorFactory001_H #ifndef MuonDetectorFactory001_H
#define MuonDetectorFactory001_H #define MuonDetectorFactory001_H
#include "GeoModelKernel/GeoVDetectorFactory.h"
#include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/MuonDetectorManager.h"
///
#include "GeoModelKernel/GeoVDetectorFactory.h"
#include <string> #include <string>
class GeoPhysVol; class GeoPhysVol;
...@@ -35,13 +35,13 @@ namespace MuonGM { ...@@ -35,13 +35,13 @@ namespace MuonGM {
virtual const MuonDetectorManager *getDetectorManager() const override; virtual const MuonDetectorManager *getDetectorManager() const override;
MuonDetectorManager *getDetectorManager(); MuonDetectorManager *getDetectorManager();
inline void setDBAtlasVersion(const std::string& v); inline void setDBAtlasVersion(const std::string&v);
inline void setDBMuonVersion(const std::string& v); inline void setDBMuonVersion(const std::string&v);
inline void setDBkey(const std::string& v); inline void setDBkey(const std::string&v);
inline void setDBnode(const std::string& v); inline void setDBnode(const std::string&v);
inline void setAmdcDb(bool value); inline void setAmdcDb(bool value);
inline void setLayout(const std::string&); inline void setLayout(const std::string& str);
inline void setCutoutsFlag(int); inline void setCutoutsFlag(int);
inline void setCutoutsBogFlag(int); inline void setCutoutsBogFlag(int);
inline void setCtbBisFlag(int); inline void setCtbBisFlag(int);
...@@ -70,55 +70,60 @@ namespace MuonGM { ...@@ -70,55 +70,60 @@ namespace MuonGM {
inline void setABLinesAsciiSideC(const std::string &); inline void setABLinesAsciiSideC(const std::string &);
private: private:
std::string m_DBAtlasVersion;
std::string m_DBMuonVersion;
std::string m_DBkey; std::string m_DBAtlasVersion{};
std::string m_DBnode; std::string m_DBMuonVersion{};
std::string m_DBkey{};
bool m_isAmdcDb; std::string m_DBnode{};
std::string m_layout;
int m_includeCutouts; bool m_isAmdcDb{false};
int m_includeCutoutsBog; std::string m_layout{};
int m_includeCtbBis; int m_includeCutouts{0};
int m_rdb; int m_includeCutoutsBog{0};
int m_controlAlines; int m_includeCtbBis{0};
int m_minimalGeoFlag; int m_rdb{1};
int m_controlCscIntAlines; int m_controlAlines{0};
bool m_dumpAlines; int m_minimalGeoFlag{0};
bool m_dumpCscIntAlines; int m_controlCscIntAlines{0};
bool m_useCscIntAlinesFromGM; bool m_dumpAlines{false};
bool m_dumpCscIntAlines{false};
int m_caching; bool m_useCscIntAlinesFromGM{true};
int m_cacheFillingFlag;
int m_mdtDeformationFlag;
int m_caching{0};
int m_cacheFillingFlag{0};
int m_mdtDeformationFlag{0};
int m_mdtAsBuiltParaFlag; int m_mdtAsBuiltParaFlag;
bool m_dumpMemoryBreakDown; bool m_dumpMemoryBreakDown{false};
int m_enableFineClashFixing; int m_enableFineClashFixing{0};
bool m_hasCSC; bool m_hasCSC{true};
bool m_hasSTgc; bool m_hasSTgc{true};
bool m_hasMM; bool m_hasMM{true};
std::string m_NSWABLinesSideA; std::string m_NSWABLinesSideA{};
std::string m_NSWABLinesSideC; std::string m_NSWABLinesSideC{};
std::vector<std::string> m_selectedStations; std::vector<std::string> m_selectedStations;
std::vector<int> m_selectedStEta; std::vector<int> m_selectedStEta;
std::vector<int> m_selectedStPhi; std::vector<int> m_selectedStPhi;
MuonSystemDescription *m_muon; std::unique_ptr<MuonSystemDescription> m_muon;
MuonDetectorManager *m_manager; MuonDetectorManager* m_manager{nullptr};
StoreGateSvc *m_pDetStore; StoreGateSvc *m_pDetStore{nullptr};
IRDBAccessSvc *m_pRDBAccess; IRDBAccessSvc *m_pRDBAccess{nullptr};
AltAsciiDBMap m_altAsciiDBMap; AltAsciiDBMap m_altAsciiDBMap{};
}; };
void MuonDetectorFactory001::setDBAtlasVersion(const std::string& v) { m_DBAtlasVersion = v; } void MuonDetectorFactory001::setDBAtlasVersion(const std::string&v) { m_DBAtlasVersion = v; }
void MuonDetectorFactory001::setDBMuonVersion(const std::string& v) { m_DBMuonVersion = v; } void MuonDetectorFactory001::setDBMuonVersion(const std::string&v) { m_DBMuonVersion = v; }
void MuonDetectorFactory001::setDBkey(const std::string& v) { m_DBkey = v; } void MuonDetectorFactory001::setDBkey(const std::string&v) { m_DBkey = v; }
void MuonDetectorFactory001::setDBnode(const std::string& v) { m_DBnode = v; } void MuonDetectorFactory001::setDBnode(const std::string&v) { m_DBnode = v; }
void MuonDetectorFactory001::setAmdcDb(bool value) { m_isAmdcDb = value; } void MuonDetectorFactory001::setAmdcDb(bool value) { m_isAmdcDb = value; }
void MuonDetectorFactory001::setLayout(const std::string& str) { m_layout = str; } void MuonDetectorFactory001::setLayout(const std::string&str) { m_layout = str; }
void MuonDetectorFactory001::setCutoutsFlag(int flag) { m_includeCutouts = flag; } void MuonDetectorFactory001::setCutoutsFlag(int flag) { m_includeCutouts = flag; }
void MuonDetectorFactory001::setCutoutsBogFlag(int flag) { m_includeCutoutsBog = flag; } void MuonDetectorFactory001::setCutoutsBogFlag(int flag) { m_includeCutoutsBog = flag; }
void MuonDetectorFactory001::setCtbBisFlag(int flag) { m_includeCtbBis = flag; } void MuonDetectorFactory001::setCtbBisFlag(int flag) { m_includeCtbBis = flag; }
......
...@@ -72,11 +72,9 @@ using namespace GeoXF; ...@@ -72,11 +72,9 @@ using namespace GeoXF;
namespace MuonGM { namespace MuonGM {
MuonDetectorFactory001::MuonDetectorFactory001(StoreGateSvc *pDetStore) MuonDetectorFactory001::MuonDetectorFactory001(StoreGateSvc *pDetStore):
: m_includeCutouts(0), m_includeCutoutsBog(0), m_includeCtbBis(0), m_rdb(1), m_controlAlines(0), m_minimalGeoFlag(0), m_controlCscIntAlines(0), m_dumpAlines(false), m_pDetStore{pDetStore} {
m_dumpCscIntAlines(false), m_useCscIntAlinesFromGM(true), m_caching(0), m_cacheFillingFlag(0), m_mdtDeformationFlag(0), m_mdtAsBuiltParaFlag(0), m_muon = std::make_unique< MuonSystemDescription>("MuonSystem");
m_dumpMemoryBreakDown(false), m_hasCSC(true), m_hasSTgc(true), m_hasMM(true), m_muon(NULL), m_manager(NULL), m_pDetStore(pDetStore), m_pRDBAccess(0) {
m_muon = new MuonSystemDescription("MuonSystem");
m_muon->barrelInnerRadius = 4.30 * Gaudi::Units::m; m_muon->barrelInnerRadius = 4.30 * Gaudi::Units::m;
m_muon->innerRadius = 0.07 * Gaudi::Units::m; m_muon->innerRadius = 0.07 * Gaudi::Units::m;
m_muon->outerRadius = 13.00 * Gaudi::Units::m; m_muon->outerRadius = 13.00 * Gaudi::Units::m;
...@@ -87,18 +85,12 @@ namespace MuonGM { ...@@ -87,18 +85,12 @@ namespace MuonGM {
m_muon->extraZ = 12.9 * Gaudi::Units::m; m_muon->extraZ = 12.9 * Gaudi::Units::m;
m_muon->extraR = 12.5 * Gaudi::Units::m; m_muon->extraR = 12.5 * Gaudi::Units::m;
m_selectedStations = std::vector<std::string>(0);
m_selectedStEta = std::vector<int>(0);
m_selectedStPhi = std::vector<int>(0);
m_enableFineClashFixing = 0;
MsgStream log(Athena::getMessageSvc(), "MuonGeoModel"); MsgStream log(Athena::getMessageSvc(), "MuonGeoModel");
log << MSG::INFO << "MuonDetectorFactory - constructor " log << MSG::INFO << "MuonDetectorFactory - constructor "
<< " MuonSystem OuterRadius " << m_muon->outerRadius << " Length " << m_muon->length << endmsg; << " MuonSystem OuterRadius " << m_muon->outerRadius << " Length " << m_muon->length << endmsg;
} }
MuonDetectorFactory001::~MuonDetectorFactory001() { delete m_muon; } MuonDetectorFactory001::~MuonDetectorFactory001() =default;
const MuonDetectorManager *MuonDetectorFactory001::getDetectorManager() const { return m_manager; } const MuonDetectorManager *MuonDetectorFactory001::getDetectorManager() const { return m_manager; }
MuonDetectorManager *MuonDetectorFactory001::getDetectorManager() { return m_manager; } MuonDetectorManager *MuonDetectorFactory001::getDetectorManager() { return m_manager; }
...@@ -127,7 +119,7 @@ namespace MuonGM { ...@@ -127,7 +119,7 @@ namespace MuonGM {
} // if (m_dumpMemoryBreakDown) { } // if (m_dumpMemoryBreakDown) {
if (!m_manager) if (!m_manager)
m_manager = new MuonDetectorManager(); m_manager = new MuonDetectorManager();
// check consistency of flags coming from the tool // check consistency of flags coming from the tool
m_includeCutouts = 1; m_includeCutouts = 1;
...@@ -241,7 +233,7 @@ namespace MuonGM { ...@@ -241,7 +233,7 @@ namespace MuonGM {
if (log.level() <= MSG::DEBUG) if (log.level() <= MSG::DEBUG)
log << MSG::DEBUG << "calling RDBReaderAtlas with m_altAsciiDBMap" << endmsg; log << MSG::DEBUG << "calling RDBReaderAtlas with m_altAsciiDBMap" << endmsg;
RDBReaderAtlas *dbr = new RDBReaderAtlas(m_pDetStore, m_pRDBAccess, OracleTag, OracleNode, m_dumpAlines, m_useCscIntAlinesFromGM, m_dumpCscIntAlines, &m_altAsciiDBMap); std::unique_ptr<RDBReaderAtlas> dbr =std::make_unique< RDBReaderAtlas>(m_pDetStore, m_pRDBAccess, OracleTag, OracleNode, m_dumpAlines, m_useCscIntAlinesFromGM, m_dumpCscIntAlines, &m_altAsciiDBMap);
dbr->setControlCscIntAlines(m_controlCscIntAlines); dbr->setControlCscIntAlines(m_controlCscIntAlines);
...@@ -255,16 +247,13 @@ namespace MuonGM { ...@@ -255,16 +247,13 @@ namespace MuonGM {
mysql->setControlAlines(m_controlAlines); mysql->setControlAlines(m_controlAlines);
dbr->setGeometryVersion(m_layout); dbr->setGeometryVersion(m_layout);
dbr->setManager(m_manager); dbr->setManager(getDetectorManager());
sc = dbr->ProcessDB(*mysql); sc = dbr->ProcessDB(*mysql);
if (sc != StatusCode::SUCCESS) { if (sc != StatusCode::SUCCESS) {
log << MSG::ERROR << " FAILURE in DB access; Muon node will not be built" << endmsg; log << MSG::ERROR << " FAILURE in DB access; Muon node will not be built" << endmsg;
return; return;
} }
// release memory
delete dbr;
dbr = nullptr;
if (m_dumpMemoryBreakDown) { if (m_dumpMemoryBreakDown) {
umem = GeoPerfUtils::getMem(); umem = GeoPerfUtils::getMem();
ucpu = int(GeoPerfUtils::getCpu() / 100.); ucpu = int(GeoPerfUtils::getCpu() / 100.);
...@@ -462,13 +451,13 @@ namespace MuonGM { ...@@ -462,13 +451,13 @@ namespace MuonGM {
log << MSG::INFO << " Muon Layout " << m_layout << endmsg; log << MSG::INFO << " Muon Layout " << m_layout << endmsg;
std::vector<std::string> slist; std::vector<std::string> slist;
if (m_selectedStations.size() <= 0) if (m_selectedStations.empty())
slist.push_back("*"); slist.push_back("*");
else else
slist = m_selectedStations; slist = m_selectedStations;
// create the fullphysvol map to allow cloning and save memory // create the fullphysvol map to allow cloning and save memory
FPVMAP *savemem = new FPVMAP(); std::unique_ptr<FPVMAP> savemem = std::make_unique< FPVMAP>();
int nstat_ss = 0; int nstat_ss = 0;
int ntpos_ss = 0; int ntpos_ss = 0;
...@@ -504,7 +493,7 @@ namespace MuonGM { ...@@ -504,7 +493,7 @@ namespace MuonGM {
isAssembly = true; isAssembly = true;
MuonChamber l(*mysql, station); // here is where we start to create a MuonChamber with all readoutelements MuonChamber l(*mysql, station); // here is where we start to create a MuonChamber with all readoutelements
l.setFPVMAP(savemem); l.setFPVMAP(savemem.get());
l.setFineClashFixingFlag(m_enableFineClashFixing); l.setFineClashFixingFlag(m_enableFineClashFixing);
PositionIterator pit; PositionIterator pit;
...@@ -567,7 +556,7 @@ namespace MuonGM { ...@@ -567,7 +556,7 @@ namespace MuonGM {
isAssembly = true; isAssembly = true;
// CSL because coffin shape of the station mother volume // CSL because coffin shape of the station mother volume
GeoVPhysVol *pv = l.build(*theMaterialManager, *mysql, m_manager, zi, fi, is_mirrored, isAssembly); GeoVPhysVol *pv = l.build(*theMaterialManager, *mysql, getDetectorManager(), zi, fi, is_mirrored, isAssembly);
if (isAssembly) if (isAssembly)
nAssemblies++; nAssemblies++;
...@@ -602,7 +591,7 @@ namespace MuonGM { ...@@ -602,7 +591,7 @@ namespace MuonGM {
// alignment issues and readout geometry for station // alignment issues and readout geometry for station
MuonStation *mst = m_manager->getMuonStation(station->GetName(), zi, fi + 1); MuonStation *mst = m_manager->getMuonStation(station->GetName(), zi, fi + 1);
if (mst == NULL) { if (!mst) {
log << MSG::WARNING << "For Station with nameTag=<" << station->GetName() << "> at zi/fi = " << zi << "/" << fi log << MSG::WARNING << "For Station with nameTag=<" << station->GetName() << "> at zi/fi = " << zi << "/" << fi
<< " no MuonStation found => no possibility to align" << endmsg; << " no MuonStation found => no possibility to align" << endmsg;
continue; continue;
...@@ -689,10 +678,7 @@ namespace MuonGM { ...@@ -689,10 +678,7 @@ namespace MuonGM {
cpu = ucpu; cpu = ucpu;
} }
// delete the fullphysvol map
delete savemem;
savemem = nullptr;
// delete the station and technology map // delete the station and technology map
delete mysql.get(); delete mysql.get();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment