diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index d59e17e3029256e3abc8f7cf1963794c1721117b..7f315bd91fc55a25601668b4baaeabc4682f348b 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -58,6 +58,7 @@ dd4hep_enable_tests ( if ( DD4HEP_USE_XERCESC ) dd4hep_print("|++> XercesC PRESENT. Building DDDB examples.") dd4hep_enable_tests (DDDB) + dd4hep_enable_tests (DDCodex) else() dd4hep_print("|++> XercesC is not present. NOT building DDDB examples.") endif() diff --git a/examples/DDCodex/README.txt b/examples/DDCodex/README.txt index 617ba4d5f3f95c1022835ffe83ea00bc932be531..0678ef0b3a73f4212148ae37fe97cb8aa13c340a 100644 --- a/examples/DDCodex/README.txt +++ b/examples/DDCodex/README.txt @@ -5,7 +5,40 @@ CODEX starting kit Small geometry driver for CODEX-b sketch. -To execute: +First save a snapshot of the upgrade geometry in DD4hep +------------------------------------------------------- +You will need a proper checkout of the git repository of Ben provided for testing the +upgrade with DD4hep. + +Comamnds: +$> `which python` `which gaudirun.py` GeoExtract.py +root [0] gDD4hepUI->saveROOT("Upgrade.root") +root [1] .q + +Output: +DetElement-Info INFO ++ -> +++++++++++++ Printout summary: +DetElement-Info INFO ++ -> Number of conditions: 0 [ dto. empty:0] +DetElement-Info INFO ++ -> Total Number of parameters: 0 [ 0.000 Parameters/Condition] +DD4hepUI Use the ROOT interpreter variable gDD4hepUI to interact with the detector description. + ------------------------------------------------------------ + | Welcome to ROOT 6.10/06 http://root.cern.ch | + | (c) 1995-2017, The ROOT Team | + | Built for linuxx8664gcc | + | From tag v6-10-06, 19 September 2017 | + | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q' | + ------------------------------------------------------------ + +DD4hepRint INFO ++ Created ROOT interpreter instance for DD4hepUI. +root [0] gDD4hepUI->saveROOT("VPGeo.root") +Geometry2ROOT INFO +++ Dump geometry to root file:VPGeo.root +DD4hepRootPersistency +++ No valid Volume manager. No nominals saved. +DD4hepRootPersistency +++ Wrote 992746 Bytes of geometry data 'Geometry' to 'VPGeo.root' [ 0.772 seconds]. +DD4hepRootPersistency +++ Successfully saved geometry data to file. +(long) 1 +root [1] .q + + +Then to execute: ---------------------------------------------------------------------------- $> geoPluginRun -ui -inter ... diff --git a/examples/DDCodex/python/GeoExtract.py b/examples/DDCodex/python/GeoExtract.py new file mode 100644 index 0000000000000000000000000000000000000000..76a586beade25034ad37d4dfbb1fad48fd4cf2a4 --- /dev/null +++ b/examples/DDCodex/python/GeoExtract.py @@ -0,0 +1,89 @@ +############################################################################### +# File for running Brunel with default options (2008 real data,.mdf in,.dst out) +############################################################################### +# Syntax is: +# gaudirun.py Brunel-Default.py <someDataFiles>.py +############################################################################### +from Gaudi.Configuration import * +from Configurables import LHCbConfigurableUser, LHCbApp, CondDB, ToolSvc, EventSelector +from Configurables import LoadDD4hepDet, LbDD4hepExample +import GaudiKernel.ProcessJobOptions + +# import DD4hep +# DD4hep.setPrintLevel(DD4hep.OutputLevel.DEBUG) + + +class MyTest(LHCbConfigurableUser): + # Steering options + __slots__ = { + "DDDBtag" : "" + ,"CondDBtag" : "" + ,"UseDBSnapshot" : False + ,"PartitionName" : "LHCb" + ,"DBSnapshotDirectory" : "/group/online/hlt/conditions" + } + + _propertyDocDct = { + 'DDDBtag' : """ Tag for DDDB """ + ,'CondDBtag' : """ Tag for CondDB """ + ,"UseDBSnapshot" : """Use a snapshot for velo position and rich pressure""" + ,"PartitionName" : """Name of the partition when running (needed to find DB: '', 'FEST', or 'LHCb'""" + ,"DBSnapshotDirectory" : """Local Directory where the snapshot is""" + } + + ## Apply the configuration + def __apply_configuration__(self): + actor = LoadDD4hepDet() + actor.OutputLevel = DEBUG + #actor.SetupPlugins = ['DDCondDetElementMapping','DDDB_AssignConditions','DDDB_DetectorConditionKeysDump'] + actor.SetupPlugins = ['DDDB_DetectorDump','DD4hep_InteractiveUI','DD4hep_Rint'] + actor.DumpDetElements = 0 + actor.DumpDetVolumes = 0 + actor.DumpConditions = "" + #actor.DumpConditions = "DDDB_DetElementConditionDump" + #actor.DumpAlignments = "DDDB_AlignmentDump" + #actor.DumpAlignments = "DDDB_DerivedCondTest" + actor.ScanConditions = 0 + pxml = None + try: + pxml = os.path.join(os.path.dirname(os.path.realpath(__file__)), "Parameters.xml") + except: + pxml = os.path.join(os.getcwd(), "Parameters.xml") + actor.Parameters = "file://" + pxml + actor.VisAttrs = os.path.join(os.getcwd(), "Visattrs.xml") + #actor.Config = [os.path.join(os.getcwd(), "apps/DD4hep/examples/DDDB/data/VPOnly.xml")] + + example_alg = LbDD4hepExample() + ApplicationMgr().TopAlg = [actor, example_alg] + +# Just instantiate the configurable... +theApp = MyTest() +ToolSvc.LogLevel=DEBUG +cdb = CondDB() +tag = { "DDDB": '' + , "LHCBCOND": 'default' + #, "SIMCOND" : 'upgrade/dd4hep' + , "SIMCOND" : '' + , "ONLINE" : 'fake' + } +cdb.Tags = tag +cdb.setProp('IgnoreHeartBeat', True) +cdb.setProp('EnableRunChangeHandler', True) +#cdb.LogFile = "/tmp/cdb.log" +cdb.Upgrade = True +theApp.setOtherProps( cdb, [ 'UseDBSnapshot', + 'DBSnapshotDirectory', + 'PartitionName' ]) + +#-- Use latest database tags for real data +#LHCbApp().DDDBtag = "" +#LHCbApp().CondDBtag = "default" +LHCbApp().EvtMax = 5 +LHCbApp().DataType = "Upgrade" +LHCbApp().Simulation = True +EventSelector().PrintFreq = 1 + +from GaudiConf import IOHelper +IOHelper('ROOT').inputFiles([ + 'PFN:Gauss/Boole.xdigi', +])