Skip to content
Snippets Groups Projects
Verified Commit 5dfe8d09 authored by Tadej Novak's avatar Tadej Novak
Browse files

Autoconfigure and load PLR from the geometry database

parent f1699ec6
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,!47698Autoconfigure and load PLR from the geometry database
......@@ -74,7 +74,9 @@ def _initializeGeometryParameters(geoTag):
params = { 'Common' : CommonGeoDB.InitializeGeometryParameters(dbGeomCursor),
'Pixel' : PixelGeoDB.InitializeGeometryParameters(dbGeomCursor),
'LAr' : LArGeoDB.InitializeGeometryParameters(dbGeomCursor),
'Muon' : MuonGeoDB.InitializeGeometryParameters(dbGeomCursor) }
'Muon' : MuonGeoDB.InitializeGeometryParameters(dbGeomCursor),
'Luminosity' : CommonGeoDB.InitializeLuminosityDetectorParameters(dbGeomCursor),
}
return params
......@@ -104,6 +106,10 @@ def getDefaultDetectors(geoTag):
if DetDescrInfo(geoTag)['Common']['Run'] == 'RUN4':
detectors.add('ITkPixel')
detectors.add('ITkStrip')
if DetDescrInfo(geoTag)['Luminosity']['BCMPrime']:
pass # keep disabled for now
if DetDescrInfo(geoTag)['Luminosity']['PLR']:
detectors.add('PLR')
else:
detectors.add('Pixel')
detectors.add('SCT')
......
......@@ -19,3 +19,24 @@ def InitializeGeometryParameters(dbGeomCursor):
params["GeoType"] = dbCommon[key][dbParam.index("GEOTYPE")]
return params
def InitializeLuminosityDetectorParameters(dbGeomCursor):
"""Read luminosity detectors from the DB
dbGeomCursor: AtlasGeoDBInterface instance
"""
dbId, dbCommon, dbParam = dbGeomCursor.GetCurrentLeafContent("LuminositySwitches")
params = {"BCMPrime" : False,
"PLR" : False}
if len(dbId):
key = dbId[0]
if "BCMPRIME" in dbParam :
params["BCMPrime"] = dbCommon[key][dbParam.index("BCMPRIME")] == 1
if "PLR" in dbParam :
params["PLR"] = dbCommon[key][dbParam.index("PLR")] == 1
return params
......@@ -49,7 +49,17 @@ void PLRDetectorFactory::create(GeoPhysVol *world)
std::string gmxInput;
if (m_options.gmxFilename().empty()) {
ATH_MSG_INFO("gmxFilename not set; getting .gmx from Geometry database Blob not supported");
ATH_MSG_INFO("gmxFilename not set; getting .gmx from Geometry database Blob");
flags = 0x1; // Lowest bit ==> string; next bit implies gzip'd but we decided not to gzip
gmxInput = getBlob();
std::string dtdFile = '"' + PathResolver::find_file("geomodel.dtd", "DATAPATH") + '"';
ATH_MSG_INFO( "dtdFile = " << dtdFile );
size_t index = gmxInput.find("\"geomodel.dtd\"");
if (index != std::string::npos) {
gmxInput.replace(index, 14, dtdFile);
} else {
throw std::runtime_error("PLRDetectorFactory::create: Did not find string geomodel.dtd in the gmx input string.");
}
} else {
flags = 0;
gmxInput = PathResolver::find_file(m_options.gmxFilename(), "DATAPATH");
......@@ -83,11 +93,34 @@ void PLRDetectorFactory::create(GeoPhysVol *world)
m_detectorManager->initNeighbours();
}
std::string PLRDetectorFactory::getBlob()
{
DecodeVersionKey versionKey(geoDbTagSvc(), "InnerDetector");
const std::string& versionTag = versionKey.tag();
const std::string& versionNode = versionKey.node();
ATH_MSG_INFO("getBlob: versionTag = " << versionTag);
ATH_MSG_INFO("getBlob: versionNode = " << versionNode);
IRDBAccessSvc *accessSvc = getAthenaComps()->rdbAccessSvc();
IRDBRecordset_ptr recordSetPLR = accessSvc->getRecordsetPtr("PLRXDD", versionTag, versionNode);
if (!recordSetPLR || recordSetPLR->size() == 0) {
ATH_MSG_FATAL("getBlob: Unable to obtain PLR recordSet");
throw std::runtime_error("getBlob: Unable to obtain PLR recordSet");
}
const IRDBRecord *recordPLR = (*recordSetPLR)[0];
std::string string = recordPLR->getString("XMLCLOB");
return string;
}
PixelDetectorManager * PLRDetectorFactory::getDetectorManager() const
{
return m_detectorManager;
}
void PLRDetectorFactory::doNumerology()
{
InDetDD::SiNumerology n;
......
......@@ -36,6 +36,8 @@ public:
private:
// Print out how many of each layer/eta/phi etc. have been set up.
void doNumerology();
// Get the xml from the database instead of a file. Returns gzipped xml as a string.
std::string getBlob();
// Copy and assignments operations illegal and so are made private
PLRDetectorFactory(PLRDetectorFactory &right);
......
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