Skip to content
Snippets Groups Projects
Commit 9e5b4e4d authored by Johannes Junggeburth's avatar Johannes Junggeburth :dog2:
Browse files

Ensure that the MuonReadout geometry is included first and minor code-clean up

parent 049372e6
No related branches found
No related tags found
5 merge requests!69091Fix correlated smearing bug in JER in JetUncertainties in 22.0,!58791DataQualityConfigurations: Modify L1Calo config for web display,!51674Fixing hotSpotInHIST for Run3 HIST,!50012RecExConfig: Adjust log message levels from GetRunNumber and GetLBNumber,!47383MuonGeoModel - Minor style improvements
......@@ -5,9 +5,9 @@
#ifndef MuonDetectorFactory001_H
#define MuonDetectorFactory001_H
#include "GeoModelKernel/GeoVDetectorFactory.h"
#include "MuonReadoutGeometry/MuonDetectorManager.h"
///
#include "GeoModelKernel/GeoVDetectorFactory.h"
#include <string>
class GeoPhysVol;
......@@ -35,13 +35,13 @@ namespace MuonGM {
virtual const MuonDetectorManager *getDetectorManager() const override;
MuonDetectorManager *getDetectorManager();
inline void setDBAtlasVersion(std::string v);
inline void setDBMuonVersion(std::string v);
inline void setDBkey(std::string v);
inline void setDBnode(std::string v);
inline void setDBAtlasVersion(const std::string&v);
inline void setDBMuonVersion(const std::string&v);
inline void setDBkey(const std::string&v);
inline void setDBnode(const std::string&v);
inline void setAmdcDb(bool value);
inline void setLayout(std::string);
inline void setLayout(const std::string& str);
inline void setCutoutsFlag(int);
inline void setCutoutsBogFlag(int);
inline void setCtbBisFlag(int);
......@@ -68,55 +68,60 @@ namespace MuonGM {
inline void setABLinesAsciiSideC(const std::string &);
private:
std::string m_DBAtlasVersion;
std::string m_DBMuonVersion;
std::string m_DBkey;
std::string m_DBnode;
bool m_isAmdcDb;
std::string m_layout;
int m_includeCutouts;
int m_includeCutoutsBog;
int m_includeCtbBis;
int m_rdb;
int m_controlAlines;
int m_minimalGeoFlag;
int m_controlCscIntAlines;
bool m_dumpAlines;
bool m_dumpCscIntAlines;
bool m_useCscIntAlinesFromGM;
int m_caching;
int m_cacheFillingFlag;
int m_mdtDeformationFlag;
std::string m_DBAtlasVersion{};
std::string m_DBMuonVersion{};
std::string m_DBkey{};
std::string m_DBnode{};
bool m_isAmdcDb{false};
std::string m_layout{};
int m_includeCutouts{0};
int m_includeCutoutsBog{0};
int m_includeCtbBis{0};
int m_rdb{1};
int m_controlAlines{0};
int m_minimalGeoFlag{0};
int m_controlCscIntAlines{0};
bool m_dumpAlines{false};
bool m_dumpCscIntAlines{false};
bool m_useCscIntAlinesFromGM{true};
int m_caching{0};
int m_cacheFillingFlag{0};
int m_mdtDeformationFlag{0};
int m_mdtAsBuiltParaFlag;
bool m_dumpMemoryBreakDown;
int m_enableFineClashFixing;
bool m_hasCSC;
bool m_hasSTgc;
bool m_hasMM;
bool m_dumpMemoryBreakDown{false};
int m_enableFineClashFixing{0};
bool m_hasCSC{true};
bool m_hasSTgc{true};
bool m_hasMM{true};
std::string m_NSWABLinesSideA;
std::string m_NSWABLinesSideC;
std::string m_NSWABLinesSideA{};
std::string m_NSWABLinesSideC{};
std::vector<std::string> m_selectedStations;
std::vector<int> m_selectedStEta;
std::vector<int> m_selectedStPhi;
MuonSystemDescription *m_muon;
MuonDetectorManager *m_manager;
StoreGateSvc *m_pDetStore;
IRDBAccessSvc *m_pRDBAccess;
AltAsciiDBMap m_altAsciiDBMap;
std::unique_ptr<MuonSystemDescription> m_muon;
std::unique_ptr<MuonDetectorManager> m_manager;
StoreGateSvc *m_pDetStore{nullptr};
IRDBAccessSvc *m_pRDBAccess{nullptr};
AltAsciiDBMap m_altAsciiDBMap{};
};
void MuonDetectorFactory001::setDBAtlasVersion(std::string v) { m_DBAtlasVersion = v; }
void MuonDetectorFactory001::setDBMuonVersion(std::string v) { m_DBMuonVersion = v; }
void MuonDetectorFactory001::setDBkey(std::string v) { m_DBkey = v; }
void MuonDetectorFactory001::setDBnode(std::string v) { m_DBnode = v; }
void MuonDetectorFactory001::setDBAtlasVersion(const std::string&v) { m_DBAtlasVersion = v; }
void MuonDetectorFactory001::setDBMuonVersion(const std::string&v) { m_DBMuonVersion = v; }
void MuonDetectorFactory001::setDBkey(const std::string&v) { m_DBkey = v; }
void MuonDetectorFactory001::setDBnode(const std::string&v) { m_DBnode = v; }
void MuonDetectorFactory001::setAmdcDb(bool value) { m_isAmdcDb = value; }
void MuonDetectorFactory001::setLayout(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::setCutoutsBogFlag(int flag) { m_includeCutoutsBog = flag; }
void MuonDetectorFactory001::setCtbBisFlag(int flag) { m_includeCtbBis = flag; }
......@@ -131,9 +136,9 @@ namespace MuonGM {
void MuonDetectorFactory001::setUseCscIntAlinesFromGM(bool useIlinesFromGM) { m_useCscIntAlinesFromGM = useIlinesFromGM; }
void MuonDetectorFactory001::setSelection(std::vector<std::string> vst, std::vector<int> veta, std::vector<int> vphi) {
m_selectedStations = vst;
m_selectedStEta = veta;
m_selectedStPhi = vphi;
m_selectedStations = std::move(vst);
m_selectedStEta = std::move(veta);
m_selectedStPhi = std::move(vphi);
}
void MuonDetectorFactory001::setCachingFlag(int value) { m_caching = value; }
......
......@@ -72,11 +72,9 @@ using namespace GeoXF;
namespace MuonGM {
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_dumpCscIntAlines(false), m_useCscIntAlinesFromGM(true), m_caching(0), m_cacheFillingFlag(0), m_mdtDeformationFlag(0), m_mdtAsBuiltParaFlag(0),
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");
MuonDetectorFactory001::MuonDetectorFactory001(StoreGateSvc *pDetStore):
m_pDetStore{pDetStore} {
m_muon = std::make_unique< MuonSystemDescription>("MuonSystem");
m_muon->barrelInnerRadius = 4.30 * Gaudi::Units::m;
m_muon->innerRadius = 0.07 * Gaudi::Units::m;
m_muon->outerRadius = 13.00 * Gaudi::Units::m;
......@@ -87,21 +85,15 @@ namespace MuonGM {
m_muon->extraZ = 12.9 * 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");
log << MSG::INFO << "MuonDetectorFactory - constructor "
<< " 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; }
MuonDetectorManager *MuonDetectorFactory001::getDetectorManager() { return m_manager; }
const MuonDetectorManager *MuonDetectorFactory001::getDetectorManager() const { return m_manager.get(); }
MuonDetectorManager *MuonDetectorFactory001::getDetectorManager() { return m_manager.get(); }
void MuonDetectorFactory001::create(GeoPhysVol *world) {
MsgStream log(Athena::getMessageSvc(), "MuGM:MuonFactory");
......@@ -127,7 +119,7 @@ namespace MuonGM {
} // if (m_dumpMemoryBreakDown) {
if (!m_manager)
m_manager = new MuonDetectorManager();
m_manager =std::make_unique< MuonDetectorManager>();
// check consistency of flags coming from the tool
m_includeCutouts = 1;
......@@ -241,7 +233,7 @@ namespace MuonGM {
if (log.level() <= MSG::DEBUG)
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);
......@@ -255,16 +247,13 @@ namespace MuonGM {
mysql->setControlAlines(m_controlAlines);
dbr->setGeometryVersion(m_layout);
dbr->setManager(m_manager);
dbr->setManager(m_manager.get());
sc = dbr->ProcessDB(*mysql);
if (sc != StatusCode::SUCCESS) {
log << MSG::ERROR << " FAILURE in DB access; Muon node will not be built" << endmsg;
return;
}
// release memory
delete dbr;
dbr = nullptr;
if (m_dumpMemoryBreakDown) {
umem = GeoPerfUtils::getMem();
ucpu = int(GeoPerfUtils::getCpu() / 100.);
......@@ -462,13 +451,13 @@ namespace MuonGM {
log << MSG::INFO << " Muon Layout " << m_layout << endmsg;
std::vector<std::string> slist;
if (m_selectedStations.size() <= 0)
if (m_selectedStations.empty())
slist.push_back("*");
else
slist = m_selectedStations;
// 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 ntpos_ss = 0;
......@@ -504,7 +493,7 @@ namespace MuonGM {
isAssembly = true;
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);
PositionIterator pit;
......@@ -567,7 +556,7 @@ namespace MuonGM {
isAssembly = true;
// 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, m_manager.get(), zi, fi, is_mirrored, isAssembly);
if (isAssembly)
nAssemblies++;
......@@ -602,7 +591,7 @@ namespace MuonGM {
// alignment issues and readout geometry for station
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
<< " no MuonStation found => no possibility to align" << endmsg;
continue;
......@@ -689,10 +678,7 @@ namespace MuonGM {
cpu = ucpu;
}
// delete the fullphysvol map
delete savemem;
savemem = nullptr;
// delete the station and technology map
delete mysql.get();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment