From f1f0e0ddd44ef479d8f3364f3ef911e9a221b958 Mon Sep 17 00:00:00 2001 From: Gloria Corti <gloria.corti@cern.ch> Date: Mon, 18 Mar 2024 16:56:40 +0100 Subject: [PATCH 1/4] add removeing use of DDDB when using DD4hep --- Det/DDDB/python/DDDB/Configuration.py | 73 ++++++++++++++++++++++++++- 1 file changed, 72 insertions(+), 1 deletion(-) diff --git a/Det/DDDB/python/DDDB/Configuration.py b/Det/DDDB/python/DDDB/Configuration.py index 11fbe899..ad2dc1e4 100755 --- a/Det/DDDB/python/DDDB/Configuration.py +++ b/Det/DDDB/python/DDDB/Configuration.py @@ -87,10 +87,12 @@ class DDDBConf(ConfigurableUser): False, "EnableRunStampCheck": False, + "GeometryFormat": + "DD4Hep", "GeometryLocation": "", "GeometryVersion": - "trunk", + "run3/trunk", "GeometryMain": "LHCb.xml", "ConditionsLocation": @@ -117,6 +119,8 @@ class DDDBConf(ConfigurableUser): """ Disable check on latest update of ONLINE CondDB """, 'EnableRunStampCheck': """ Enable the check for run stamp (valid data for the run) """, + 'GeometryFormat': + """ Format of the geometry, i.e. DD4Hep or DetDesc, when empty it means not DD4Hep """, 'GeometryLocation': """ Top directory for the DD4hep geometry files """, 'GeometryVersion': @@ -135,6 +139,73 @@ class DDDBConf(ConfigurableUser): """ Converts the high-level information passed as properties into low-level configuration. """ + ########################################################################## + # DD4hep Detector Configuration + ########################################################################## + ########################################################################## + UseDD4Hep = (self.getProp("GeometryFormat").upper() == "DD4HEP") + if UseDD4Hep: + from Configurables import LHCb__Det__LbDD4hep__DD4hepSvc as DD4hepSvc + dd4hepSvc = DD4hepSvc() + + if self.getProp( + "GeometryLocation" + ) and not dd4hepSvc.isPropertySet("GeometryLocation"): + dd4hepSvc.GeometryLocation = self.getProp("GeometryLocation") + + if self.getProp("GeometryVersion") and not dd4hepSvc.isPropertySet( + "GeometryVersion"): + dd4hepSvc.GeometryVersion = self.getProp("GeometryVersion") + + if self.getProp("GeometryMain" + ) and not dd4hepSvc.isPropertySet("GeometryMain"): + dd4hepSvc.GeometryMain = self.getProp("GeometryMain") + + if self.getProp( + "ConditionsVersion" + ) and not dd4hepSvc.isPropertySet("ConditionsVersion"): + dd4hepSvc.ConditionsVersion = self.getProp("ConditionsVersion") + + if self.getProp( + "ConditionsLocation" + ) and not dd4hepSvc.isPropertySet("ConditionsLocation"): + dd4hepSvc.ConditionsLocation = self.getProp( + "ConditionsLocation") + else: + if not hasattr(dd4hepSvc, "ConditionsLocation"): + lhcb_cond_db = GIT_CONDDBS.get("lhcb-conditions-database", + None) + if not lhcb_cond_db: + log.warning( + "Could not find git repository: lhcb-conditions-database" + ) + else: + url = "git:" + lhcb_cond_db + if (not lhcb_cond_db.endswith(".git")): + url = "file:" + lhcb_cond_db + "/" + log.info("Using git repository: " + url) + dd4hepSvc.ConditionsLocation = url + + if self.getProp("DD4HepDetectorList"): + if not hasattr(dd4hepSvc, "DetectorList"): + dd4hepSvc.DetectorList = self.getProp("DD4HepDetectorList") + + log.info(dd4hepSvc) + + # make sure we do not use HeartBeat and RunStampCheck in DD4hep mode + self._properties["IgnoreHeartBeat"].setDefault(True) + self._properties["EnableRunStampCheck"].setDefault(False) + + # FIXME: We need to find a way to configure LHCb__ParticlePropertySvc for Run3 + from Configurables import LHCb__ParticlePropertySvc + pps = LHCb__ParticlePropertySvc() + if not pps.isPropertySet("ParticlePropertiesFile"): + from PartProp import DEFAULT_PARTICLE_PROPERTY_FILE + pps.ParticlePropertiesFile = str( + DEFAULT_PARTICLE_PROPERTY_FILE) + + return # everything else in this function is about using the old CondDB + ########################################################################## # Detector Transient Store Configuration ########################################################################## -- GitLab From 20668fb5fcb2916d61d402ae7e159ba63ebcc54b Mon Sep 17 00:00:00 2001 From: Gloria Corti <gloria.corti@cern.ch> Date: Mon, 18 Mar 2024 17:11:23 +0100 Subject: [PATCH 2/4] fix formatting --- Det/DDDB/python/DDDB/Configuration.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Det/DDDB/python/DDDB/Configuration.py b/Det/DDDB/python/DDDB/Configuration.py index ad2dc1e4..c189f1f7 100755 --- a/Det/DDDB/python/DDDB/Configuration.py +++ b/Det/DDDB/python/DDDB/Configuration.py @@ -88,7 +88,7 @@ class DDDBConf(ConfigurableUser): "EnableRunStampCheck": False, "GeometryFormat": - "DD4Hep", + "DD4Hep", "GeometryLocation": "", "GeometryVersion": @@ -143,7 +143,7 @@ class DDDBConf(ConfigurableUser): # DD4hep Detector Configuration ########################################################################## ########################################################################## - UseDD4Hep = (self.getProp("GeometryFormat").upper() == "DD4HEP") + UseDD4Hep = (self.getProp("GeometryFormat").upper() == "DD4HEP") if UseDD4Hep: from Configurables import LHCb__Det__LbDD4hep__DD4hepSvc as DD4hepSvc dd4hepSvc = DD4hepSvc() @@ -178,7 +178,7 @@ class DDDBConf(ConfigurableUser): if not lhcb_cond_db: log.warning( "Could not find git repository: lhcb-conditions-database" - ) + ) else: url = "git:" + lhcb_cond_db if (not lhcb_cond_db.endswith(".git")): @@ -202,7 +202,7 @@ class DDDBConf(ConfigurableUser): if not pps.isPropertySet("ParticlePropertiesFile"): from PartProp import DEFAULT_PARTICLE_PROPERTY_FILE pps.ParticlePropertiesFile = str( - DEFAULT_PARTICLE_PROPERTY_FILE) + DEFAULT_PARTICLE_PROPERTY_FILE) return # everything else in this function is about using the old CondDB -- GitLab From 5c8a494cf417c085bf0cd8420f91cc9d081d8589 Mon Sep 17 00:00:00 2001 From: Gloria Corti <gloria.corti@cern.ch> Date: Wed, 20 Mar 2024 16:13:49 +0100 Subject: [PATCH 3/4] Apply 1 suggestion(s) to 1 file(s) --- Det/DDDB/python/DDDB/Configuration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Det/DDDB/python/DDDB/Configuration.py b/Det/DDDB/python/DDDB/Configuration.py index c189f1f7..466093ac 100755 --- a/Det/DDDB/python/DDDB/Configuration.py +++ b/Det/DDDB/python/DDDB/Configuration.py @@ -88,7 +88,7 @@ class DDDBConf(ConfigurableUser): "EnableRunStampCheck": False, "GeometryFormat": - "DD4Hep", + "", "GeometryLocation": "", "GeometryVersion": -- GitLab From 4a434fdaf364cd7474b38cc2f3fdbe5b07c01ced Mon Sep 17 00:00:00 2001 From: Gloria Corti <gloria.corti@cern.ch> Date: Wed, 10 Apr 2024 18:27:21 +0200 Subject: [PATCH 4/4] rename the property geoformat to backend --- Det/DDDB/python/DDDB/Configuration.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Det/DDDB/python/DDDB/Configuration.py b/Det/DDDB/python/DDDB/Configuration.py index 466093ac..2d8140c2 100755 --- a/Det/DDDB/python/DDDB/Configuration.py +++ b/Det/DDDB/python/DDDB/Configuration.py @@ -87,7 +87,7 @@ class DDDBConf(ConfigurableUser): False, "EnableRunStampCheck": False, - "GeometryFormat": + "GeometryBackend": "", "GeometryLocation": "", @@ -119,7 +119,7 @@ class DDDBConf(ConfigurableUser): """ Disable check on latest update of ONLINE CondDB """, 'EnableRunStampCheck': """ Enable the check for run stamp (valid data for the run) """, - 'GeometryFormat': + 'GeometryBackend': """ Format of the geometry, i.e. DD4Hep or DetDesc, when empty it means not DD4Hep """, 'GeometryLocation': """ Top directory for the DD4hep geometry files """, @@ -143,8 +143,7 @@ class DDDBConf(ConfigurableUser): # DD4hep Detector Configuration ########################################################################## ########################################################################## - UseDD4Hep = (self.getProp("GeometryFormat").upper() == "DD4HEP") - if UseDD4Hep: + if (self.getProp("GeometryBackend").upper() == "DD4HEP"): from Configurables import LHCb__Det__LbDD4hep__DD4hepSvc as DD4hepSvc dd4hepSvc = DD4hepSvc() -- GitLab