Skip to content
Snippets Groups Projects
Commit 8af5af2c authored by Eduardo Rodrigues's avatar Eduardo Rodrigues
Browse files

Merge branch 'apearce-validate-turbo-configuration' into 'master'

Validate DaVinci configuration for Turbo data

See merge request !116

(cherry picked from commit b715c5a0)

59a7a745 Validate DaVinci configuration for Turbo data.
a86fdeb8 Fix typo.
parent 890c44f5
No related branches found
No related tags found
1 merge request!123Cherry-pick MR !116 to 2018-patches branch
"""Invalid configuration for running over Turbo data."""
from Configurables import DaVinci
dv = DaVinci()
dv.DataType = '2016'
dv.InputType = 'MDST'
dv.Turbo = True
# The absence of this setting should cause DaVinci to throw an exception
# dv.RootInTES = '/Event/Turbo'
"""Valid configuration for running over Turbo data.
We don't set InputType to MDST explicitly, but this should be done by the
DaVinci configuration.
"""
from Configurables import DaVinci
dv = DaVinci()
dv.DataType = '2016'
# This value should be set automatically as Turbo = True (although it's better
# to set it explicitly anyway)
# dv.InputType = 'MDST'
dv.Turbo = True
dv.RootInTES = '/Event/Turbo'
"""Valid configuration for running over Turbo data."""
from Configurables import DaVinci
dv = DaVinci()
dv.DataType = '2016'
dv.InputType = 'MDST'
dv.Turbo = True
dv.RootInTES = '/Event/Turbo'
<?xml version="1.0" ?>
<!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'>
<extension class="GaudiTest.GaudiExeTest" kind="test">
<argument name="program">
<text>gaudirun.py</text>
</argument>
<argument name="args"><set>
<text>../options/DV_Turbo_Error.py</text>
</set></argument>
<argument name="validator"><text>
expected = &quot;DaVinci.Configuration.DaVinciConfigurationError: You must set DaVinci().RootInTES when DaVinci().Turbo is `True`&quot;
if stderr.find(expected) == -1:
causes.append('missing string in stderr')
result['GaudiTest.expected_string'] = result.Quote(expected)
</text></argument>
<argument name="exit_code">
<integer>1</integer>
</argument>
</extension>
<?xml version="1.0" ?>
<!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'>
<extension class="GaudiTest.GaudiExeTest" kind="test">
<argument name="program">
<text>gaudirun.py</text>
</argument>
<argument name="args"><set>
<text>../options/DV_Turbo_Implicit.py</text>
</set></argument>
<argument name="validator">
<text>
findReferenceBlock("""
# |-InputType = 'MDST' (default: 'DST')
""")
</text>
</argument>
<argument name="exit_code">
<integer>0</integer>
</argument>
</extension>
<?xml version="1.0" ?>
<!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'>
<extension class="GaudiTest.GaudiExeTest" kind="test">
<argument name="program">
<text>gaudirun.py</text>
</argument>
<argument name="args"><set>
<text>../options/DV_Turbo_OK.py</text>
</set></argument>
<argument name="exit_code">
<integer>0</integer>
</argument>
</extension>
......@@ -18,6 +18,12 @@ import GaudiKernel.ProcessJobOptions
from AnalysisPython.Logger import getLogger
log = getLogger ( 'DaVinci' )
class DaVinciConfigurationError(Exception):
"""Exception type raised when DaVinci is not configured consistently."""
pass
class DaVinci(LHCbConfigurableUser) :
__slots__ = {
......@@ -400,6 +406,12 @@ class DaVinci(LHCbConfigurableUser) :
DstConf().setProp("SimType","Full")
if self.getProp("Turbo"):
log.debug("Forcing `InputType` to `'MDST'` as `Turbo` is `True`")
self.setProp("InputType", "MDST")
if not self.getProp("RootInTES"):
raise DaVinciConfigurationError((
"You must set DaVinci().RootInTES when DaVinci().Turbo is `True`"
))
if self.getProp("DataType") == "2016":
# Enable the decoding of the persisted reconstruction objects
TurboConf().RunPackedDataDecoder = True
......
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