Commit e0d95042 authored by Olli Lupton's avatar Olli Lupton
Browse files

Provide options for fast-from-MDF configuration as well as slow-from-DIGI.

parent bad2f141
###############################################################################
# (c) Copyright 2019 CERN for the benefit of the LHCb Collaboration #
# #
# This software is distributed under the terms of the GNU General Public #
# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". #
# #
# In applying this licence, CERN does not waive the privileges and immunities #
# granted to it by virtue of its status as an Intergovernmental Organization #
# or submit itself to any jurisdiction. #
###############################################################################
from PyConf.environment import EverythingHandler, setupInputFromTestFileDB
from PyConf.Algorithms import FTRawBankDecoder
from RecoConf.hlt1_tracking import (require_gec, make_raw_data,
make_RawData_IOSvc)
from Hlt1Conf.lines.track_mva import (one_track_mva_line, two_track_mva_line)
tes = 'EvtStoreSvc'
env = EverythingHandler(
threadPoolSize=1, nEventSlots=1, evtMax=100000, debug=True, TESName=tes)
ftdec_v = 4
inputFiles = setupInputFromTestFileDB(
'MiniBrunel_2018_MinBias_FTv4_MDF',
inputFiles=['/run/swtest/00067189.mdf'] * 50,
TESName=tes,
fileType='MDF',
withEventSelector=False)
make_input_data = lambda: make_RawData_IOSvc(inputFiles)
with FTRawBankDecoder.bind(DecodingVersion=ftdec_v), \
require_gec.bind(FTDecodingVersion=ftdec_v), \
make_raw_data.bind(make_raw=make_input_data):
builders = {
'Hlt1TrackMVALine': one_track_mva_line,
'Hlt1TwoTrackMVALine': two_track_mva_line,
}
for name, builder in builders.items():
env.registerLine(name, builder())
env.configure()
# env.plotDataFlow()
......@@ -13,6 +13,7 @@ from PyConf.components import (
make_algorithm,
Algorithm,
force_location,
setup_component,
)
from Configurables import (
......@@ -43,6 +44,7 @@ from PyConf.Algorithms import (
SciFiTrackForwardingStoreHit,
VeloKalman,
createODIN,
LHCb__MDF__IOAlg,
)
from GaudiKernel.SystemOfUnits import mm, MeV
......@@ -74,10 +76,21 @@ EmptyFilter = make_algorithm(
VoidFilter, input_transform=__emptyfilter_input_transform)
def make_raw_data():
def make_RawData():
return RawData().RawEvent
def make_RawData_IOSvc(inputFiles):
setup_component('LHCb__MDF__IOSvcMM', Input=inputFiles)
return LHCb__MDF__IOAlg(
IOSvc="LHCb::MDF::IOSvcMM/LHCb__MDF__IOSvcMM").RawEventLocation
@configurable
def make_raw_data(make_raw=make_RawData):
return make_raw()
@configurable
def make_odin(make_raw_data=make_raw_data):
return createODIN(RawEvent=make_raw_data()).ODIN
......
......@@ -75,12 +75,19 @@ def _output_writer(writer_cls, filename, **kwargs):
return writer_cls(**kwargs)
def setupInput(inputFiles, dataType, DDDBTag, CONDDBTag, Simulation,
inputFileType):
def setupInput(inputFiles,
dataType,
DDDBTag,
CONDDBTag,
Simulation,
inputFileType,
outputFileType=None,
withEventSelector=True,
TESName='HiveWhiteBoard'):
# FIXME(AP) we need to modify the ApplicationMgr and query the
# HiveWhiteBoard held by the EverythingHandler; the former modifies global
# state which is not ideal
whiteboard = setup_component('HiveWhiteBoard', instanceName='EventDataSvc')
whiteboard = setup_component(TESName, instanceName='EventDataSvc')
if inputFileType != 'MDF' and whiteboard.EventSlots > 1:
raise ConfigurationError(
"only MDF files can run in multithreaded mode, please change number of eventslots to 1"
......@@ -88,8 +95,15 @@ def setupInput(inputFiles, dataType, DDDBTag, CONDDBTag, Simulation,
setup_component(
'ApplicationMgr',
packageName='Gaudi.Configuration',
EvtSel="EventSelector")
input_iohelper = IOHelper(inputFileType, None)
EvtSel="EventSelector" if withEventSelector else "NONE")
setup_component('DDDBConf', Simulation=Simulation, DataType=dataType)
setup_component(
'CondDB', Upgrade=True, Tags={
'DDDB': DDDBTag,
'SIMCOND': CONDDBTag
})
if not withEventSelector: return inputFiles
input_iohelper = IOHelper(inputFileType, outputFileType)
input_iohelper.setupServices()
evtSel = input_iohelper.inputFiles(inputFiles, clear=True)
inputs = []
......@@ -97,16 +111,16 @@ def setupInput(inputFiles, dataType, DDDBTag, CONDDBTag, Simulation,
inputs.append(inp + " IgnoreChecksum='YES'")
evtSel.Input = inputs
evtSel.PrintFreq = 10000
setup_component('DDDBConf', Simulation=Simulation, DataType=dataType)
setup_component(
'CondDB', Upgrade=True, Tags={
'DDDB': DDDBTag,
'SIMCOND': CONDDBTag
})
setup_component('IODataManager', DisablePFNWarning=True)
return inputs
def setupInputFromTestFileDB(testFileDBkey, inputFiles=None, fileType=None):
def setupInputFromTestFileDB(testFileDBkey,
inputFiles=None,
fileType=None,
outputFileType=None,
withEventSelector=True,
TESName='HiveWhiteBoard'):
"""Run from files defined by a TestFileDB key.
Parameters
......@@ -128,10 +142,11 @@ def setupInputFromTestFileDB(testFileDBkey, inputFiles=None, fileType=None):
DDDBTag = qualifiers['DDDB']
if not inputFiles:
inputFiles = test_file_db[testFileDBkey].filenames
setupInput(inputFiles, dataType, DDDBTag, CondDBTag, Simulation, fileType)
return setupInput(inputFiles, dataType, DDDBTag, CondDBTag, Simulation,
fileType, outputFileType, withEventSelector, TESName)
def setupOutput(filename, filetype):
def setupOutput(filename, filetype, TESName='HiveWhiteBoard'):
"""Configure the application to write out a file.
Only the raw event, under `/Event/DAQ/RawEvent`, is persisted.
......@@ -216,7 +231,8 @@ class EverythingHandler(object):
nEventSlots=0,
evtMax=-1,
debug=True,
HistoFile=None):
HistoFile=None,
TESName='HiveWhiteBoard'):
self._nodes = []
self._algs = []
self._tools = [] # public tools
......@@ -225,7 +241,7 @@ class EverythingHandler(object):
if nEventSlots == 0:
nEventSlots = int(threadPoolSize * 1.2) # sensible default
self._whiteboard = setup_component(
'HiveWhiteBoard',
TESName,
instanceName='EventDataSvc',
EventSlots=nEventSlots,
ForceLeaves=True)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment