32 Helper to create the CutFlowSvc, extract the needed information from
33 the input file, and also schedule all the needed stuff.
36 from AthenaCommon.Logging
import logging
37 msg = logging.getLogger(
"CreateCutFlowSvc" )
40 from AthenaCommon.AppMgr
import ServiceMgr
as svcMgr
44 msg.debug(
"CreateCutFlowSvc: Have inputStreamName = %s", inputStreamName)
47 msg.debug(
"CreateCutFlowSvc: Have skimmingCycle = %s", skimmingCycle)
50 import AthenaCommon.CfgMgr
as CfgMgr
51 if not hasattr(svcMgr,
"CutFlowSvc"):
52 cutFlowSvc = CfgMgr.CutFlowSvc()
55 cutFlowSvc = svcMgr.CutFlowSvc
56 cutFlowSvc.Configured =
True
57 cutFlowSvc.InputStream = inputStreamName
58 cutFlowSvc.SkimmingCycle = skimmingCycle
61 if not hasattr(svcMgr,
'MetaDataSvc'):
62 from AthenaServices.AthenaServicesConf
import MetaDataSvc
66 from EventBookkeeperTools.EventBookkeeperToolsConf
import BookkeeperTool
69 output_name =
"CutBookkeepers"
71 InputCollName = output_name,
72 OutputCollName= output_name)
73 svcMgr.ToolSvc += cutflowtool
76 svcMgr.MetaDataSvc.MetaDataTools += [cutflowtool]
81 seq = CfgMgr.AthSequencer(
"AthAlgSeq")
85 if not hasattr(seq,
"AllExecutedEvents"):
86 if not seq.isLocked():
89 if hasattr( seq,
"xAODMaker::EventInfoCnvAlg" ):
92 if alg.getName() ==
"xAODMaker::EventInfoCnvAlg":
break
95 msg.debug(
"Adding AllExecutedEventsCounterAlg with name AllExecutedEvents to sequence with name %s at position %i", seq.getName(), index)
96 seq.insert( index, CfgMgr.AllExecutedEventsCounterAlg(
"AllExecutedEvents") )
99 msg.info(
"Could NOT add AllExecutedEventsCounterAlg with name AllExecutedEvents to locked sequence with name %s", seq.getName())
104 if addMetaDataToAllOutputFiles:
105 msg.debug(
"Adding CutBookkeepers the the output meta data of all output streams")
106 from OutputStreamAthenaPool.MultipleStreamManager
import MSMgr
109 MSMgr.AddMetaDataItemToAllStreams(
"xAOD::CutBookkeeperContainer#"+output_name+
"*" )
110 MSMgr.AddMetaDataItemToAllStreams(
"xAOD::CutBookkeeperAuxContainer#"+output_name+
"*Aux.*" )
111 MSMgr.AddMetaDataItemToAllStreams(
"xAOD::CutBookkeeperContainer#Incomplete"+output_name+
"*" )
112 MSMgr.AddMetaDataItemToAllStreams(
"xAOD::CutBookkeeperAuxContainer#Incomplete"+output_name+
"*Aux.*" )