def post_action_for_cpp(): """ Post-configh action to enforce initialization of DoD-algorithms """ from Gaudi.Configuration import log from Configurables import ApplicationMgr app = ApplicationMgr(OutputLevel=3) app.EvtMax = 0 app.EvtSel = 'NONE' from Configurables import LHCb__ParticlePropertySvc as PPSvc from Configurables import DetDataSvc from Configurables import LoKiSvc # ## some reshuffling of order of services is needed # in particular DOD should come after PPSVC, LoKiSvc and ToolSvc # services = app.ExtSvc app.ExtSvc = [ DetDataSvc('DetectorDataSvc'), PPSvc(), LoKiSvc(Welcome=False) ] + services # ## suppress some prints # from Configurables import TimingAuditor timer = TimingAuditor() from Configurables import SequencerTimerTool timer.addTool(SequencerTimerTool, 'TIMER') timer.TIMER.OutputLevel = 5 # suppress printout of various summaries from algorithms. from Gaudi.Configuration import allConfigurables for conf in allConfigurables.itervalues(): for opt in ('StatPrint', 'ErrorsPrint', 'HistoPrint'): if opt in conf.__slots__: setattr(conf, opt, False) # ensure that prints from the main tools/factories are not suppressed import Configurables from Configurables import LoKi__Hybrid__CoreFactory as CoreFactory from Configurables import LoKi__Hybrid__Tool as HybridFactory from Configurables import LoKi__Hybrid__HltFactory as HltFactory for Factory, names in { HltFactory: ("HltFactory", "Hlt1HltFactory", "Hlt2HltFactory"), CoreFactory: ("Hlt1CoreFactory", "Hlt2CoreFactory", "Hlt1Factory"), HybridFactory: ("Hlt1HybridFactory", "Hlt2HybridFactory") }.iteritems(): for name in names: f = Factory(name) f.OutputLevel = 2 f.StatPrint = True
import os from GaudiKernel import SystemOfUnits as units from GaudiKernel import PhysicalConstants as constants from Gaudi.Configuration import * from Configurables import ApplicationMgr main = ApplicationMgr() main.EvtSel = 'NONE' main.EvtMax = 10 main.TopAlg = [] main.ExtSvc = [] # PODIO algorithm from Configurables import FCCDataSvc podioevent = FCCDataSvc("EventDataSvc") main.ExtSvc += [podioevent] ### Generation ################################################# from Configurables import GaussSmearVertex smeartool = GaussSmearVertex() smeartool.xVertexSigma = 0.5 * units.mm smeartool.yVertexSigma = 0.5 * units.mm smeartool.zVertexSigma = 40.0 * units.mm smeartool.tVertexSigma = 180.0 * units.picosecond from Configurables import ConstPtParticleGun pgun_tool = ConstPtParticleGun() pgun_tool.PdgCodes = [13] pgun_tool.PhiMin = 0.0
from Gaudi.Configuration import * from GaudiKernel import SystemOfUnits as units from Configurables import ApplicationMgr app = ApplicationMgr() app.EvtMax = 3 app.EvtSel = "NONE" from Configurables import k4DataSvc podioevent = k4DataSvc("EventDataSvc") app.ExtSvc += [podioevent] from Configurables import ConstPtParticleGun guntool1 = ConstPtParticleGun(PdgCodes=[-211], PtMin=50 * units.GeV, PtMax=50 * units.GeV) from Configurables import GenAlg gun = GenAlg() gun.SignalProvider = guntool1 gun.hepmc.Path = "hepmc" ApplicationMgr().TopAlg += [gun] from Configurables import HepMCToEDMConverter hepmc_converter = HepMCToEDMConverter() hepmc_converter.hepmc.Path = "hepmc" hepmc_converter.GenParticles.Path = "GenParticles" ApplicationMgr().TopAlg += [hepmc_converter] from Configurables import k4SimDelphesAlg delphesalg = k4SimDelphesAlg()
def post_action_for_cpp(): """ Post-configh action to enforce initialization of DoD-algorithms """ from Gaudi.Configuration import log log.info( '# VB: Post-action to enforce the initialization of DoD-algorithms') from Configurables import DataOnDemandSvc dod = DataOnDemandSvc() dod.PreInitialize = True ## this is the most important line here ## dod.AllowPreInitializeFailure = True ## dod.Dump = True removed = [] for key in dod.AlgMap: if 0 <= key.find('Raw/UT'): removed.append(key) log.warning('# VB: REMOVE UT decoding from DataOnDemand!') dct = dod.AlgMap for k in removed: del dct[k] dod.AlgMap = dct from Configurables import ApplicationMgr app = ApplicationMgr(OutputLevel=5) app.EvtMax = 0 app.EvtSel = 'NONE' from Configurables import LHCb__ParticlePropertySvc as PPSvc from Configurables import DetDataSvc from Configurables import LoKiSvc # ## some reshuffling of order of services is needed # in particular DOD should come after PPSVC, LoKiSvc and ToolSvc # services = app.ExtSvc app.ExtSvc = [ DetDataSvc('DetectorDataSvc'), PPSvc(), LoKiSvc(Welcome=False) ] + services + [dod] # ## suppress some prints # from Configurables import TimingAuditor timer = TimingAuditor() from Configurables import SequencerTimerTool timer.addTool(SequencerTimerTool, 'TIMER') timer.TIMER.OutputLevel = 5 # suppress printout of various summaries from algorithms. from Gaudi.Configuration import allConfigurables for conf in allConfigurables.itervalues(): for opt in ('StatPrint', 'ErrorsPrint', 'HistoPrint'): if opt in conf.__slots__: setattr(conf, opt, False) # ensure that prints from the main tools/factories are not suppressed import Configurables for factory in ('Tool', 'CoreFactory', 'TrackFunctorFactory', 'HltFactory', 'Hlt1HltFactory', 'Hlt2HltFactory'): factory = 'LoKi__Hybrid__%s' % factory try: factory = getattr(Configurables, factory) factory(OutputLevel=2, StatPrint=True) except AttributeError: # ignore unknown factories pass
def configOnline(app, alg, name): from Configurables import ApplicationMgr, UpdateAndReset appMgr = ApplicationMgr() ## Configure saving of histograms ur = UpdateAndReset() ur.saveHistograms = 1 appMgr.TopAlg.insert(0, ur) from Configurables import LoKiSvc LoKiSvc().Welcome = False import OnlineEnv app.DDDBtag = OnlineEnv.DDDBTag app.CondDBtag = OnlineEnv.CondDBTag from Configurables import CondDB conddb = CondDB() conddb.IgnoreHeartBeat = True conddb.UseDBSnapshot = True conddb.EnableRunChangeHandler = True conddb.EnableRunStampCheck = False conddb.Tags['ONLINE'] = 'fake' import ConditionsMap conddb.RunChangeHandlerConditions = ConditionsMap.RunChangeHandlerConditions from Gaudi.Configuration import EventLoopMgr EventLoopMgr().Warnings = False from Configurables import MonitorSvc MonitorSvc().disableDimPropServer = 1 MonitorSvc().disableDimCmdServer = 1 MonitorSvc().ExpandCounterServices = 0; MonitorSvc().ExpandNameInfix = "<part>_x_<program>/"; MonitorSvc().PartitionName = OnlineEnv.PartitionName; MonitorSvc().ProgramName = name + "_00"; # setup the histograms and the monitoring service appMgr.ExtSvc.append( 'MonitorSvc' ) from Configurables import RootHistCnv__PersSvc RootHistCnv__PersSvc().OutputEnabled = False from Gaudi.Configuration import allConfigurables # set up the event selector if 'EventSelector' in allConfigurables : del allConfigurables['EventSelector'] input = 'Events' mepMgr = OnlineEnv.mepManager(OnlineEnv.PartitionID,OnlineEnv.PartitionName,[input],True) mepMgr.ConnectWhen = "start"; appMgr.Runable = OnlineEnv.evtRunable(mepMgr) appMgr.SvcOptMapping.append('LHCb::OnlineEvtSelector/EventSelector') appMgr.SvcOptMapping.append('LHCb::FmcMessageSvc/MessageSvc') appMgr.ExtSvc.append(mepMgr) eventSelector = OnlineEnv.mbmSelector(input = input, type = 'ONE', decode = False, event_type = 2) appMgr.ExtSvc.append(eventSelector) appMgr.ExtSvc.append(mepMgr) appMgr.OutputLevel = 3 OnlineEnv.evtDataSvc() eventSelector.REQ1 = 'EvType=2;TriggerMask=0x0,0x4,0x0,0x0;VetoMask=0,0,0,0x300;MaskType=ANY;UserType=USER;Frequency=PERC;Perc=100.0' appMgr.EvtSel = eventSelector from Configurables import AuditorSvc AuditorSvc().Auditors = [] configMsgSvc( appMgr ) OnlineEnv.end_config(False)
import os from Gaudi.Configuration import * from Configurables import ApplicationMgr app = ApplicationMgr() app.TopAlg = [] app.EvtSel = 'NONE' app.EvtMax = 1 app.ExtSvc = [] app.OutputLevel = INFO # DD4hep geometry service from Configurables import GeoSvc ## parse the given xml file path_to_detectors = os.environ.get("FCCDETECTORS", "") geoservice = GeoSvc("GeoSvc") geoservice.detectors = [ os.path.join(path_to_detectors, 'Detector/DetFCCeeCLD/compact/FCCee_o2_v02/FCCee_o2_v02.xml'), ] ApplicationMgr().ExtSvc += [geoservice] from Configurables import SimG4Svc geantservice = SimG4Svc("SimG4Svc") ApplicationMgr().ExtSvc += [geantservice] from Configurables import GeoToGdmlDumpSvc geodumpservice = GeoToGdmlDumpSvc() geodumpservice.gdml = "DetFCCeeCLD.gdml" ApplicationMgr().ExtSvc += [geodumpservice]