Esempio n. 1
0
def CutFlowMetadataConfig(d3pdalg):

    from AthenaCommon.AppMgr import ServiceMgr
    from EventBookkeeperTools.EventBookkeeperToolsConf import CutFlowSvc

    # Add the cut flow service if it's not in the job yet:
    if not hasattr(ServiceMgr, "CutFlowSvc"):
        ServiceMgr += CutFlowSvc()

    # Create a separate D3PDSvc:
    _d3pdSvcName = "CutFlowD3PDSvc"
    if not hasattr(ServiceMgr, _d3pdSvcName):
        from D3PDMakerRoot.D3PDMakerRootConf import D3PD__RootD3PDSvc
        ServiceMgr += D3PD__RootD3PDSvc(_d3pdSvcName)
    _d3pdSvc = getattr(ServiceMgr, _d3pdSvcName)
    _d3pdSvc.MasterTree = ""
    _d3pdSvc.IndexMajor = ""

    # Now create the metadata tool with the correct configuration:
    import EventCommonD3PDMaker
    return EventCommonD3PDMaker.CutFlowMetadataTool("CutFlowMetadataTool",
                                                    MetaKey='CutFlow',
                                                    D3PDSvc=_d3pdSvc,
                                                    MetaDir=d3pdalg.TuplePath +
                                                    "Meta")
Esempio n. 2
0
def addTrigCostData(mode = "COST", fileName = "trig_cost.root", costConfigL2 = False, costConfigEF = False, costConfigHLT = True):

    # Set up a logger:
    from AthenaCommon.Logging import logging
    addTrigCostData_msg = logging.getLogger( 'addTrigCostData' )

    # Construct the stream and file names for the Trigger D3PD:
    streamName = "StreamNTUP_TRIG" + mode
    addTrigCostData_msg.info( "Configuring Trigger Cost D3PD from bytestream with streamName '%s' and fileName '%s'" % ( streamName, fileName ) )

    # Create the D3PD stream(s):
    # We dont actually use the default stream! 
    from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
    d3pdalg = MSMgr.NewRootStream( streamName, fileName, "dummy" )
      
    # As we are running from bytestream, need to disable data headers.
    from AthenaCommon.AlgSequence import AlgSequence
    theJob = AlgSequence()
    fullStreamName = "StreamNTUP_TRIG" + mode + "AANTStream"
    if hasattr(theJob, fullStreamName):
        streamRef = getattr( theJob, fullStreamName )
        streamRef.ExistDataHeader = False
        streamRef.WriteInputDataHeader = False

    # The tool needs a special D3PDSvc in which the indexing is turned off for the TTree-s:
    _costD3PDSvcName = "TrigCostD3PDSvc_" + mode
    from AthenaCommon.AppMgr import ServiceMgr
    if not hasattr( ServiceMgr, _costD3PDSvcName ):
        from D3PDMakerRoot.D3PDMakerRootConf import D3PD__RootD3PDSvc
        ServiceMgr += D3PD__RootD3PDSvc( _costD3PDSvcName )
    else:
        addTrigCostData_msg.info( "The private D3PDSvc for the cost monitoring TTree already exists" )
    _costD3PDSvc = getattr( ServiceMgr, _costD3PDSvcName )
    _costD3PDSvc.MasterTree = ""
    _costD3PDSvc.IndexMajor = ""

    # Add the tool:
    _costD3PDToolName = "TrigCostD3PDMakerTool_" + mode
    _tuplePath = "/StreamNTUP_TRIG" + mode + "/trig_cost"
    if not _costD3PDToolName in [ t.name() for t in d3pdalg.MetadataTools ]:
        import TrigCostD3PDMaker
        _trigCostTool = TrigCostD3PDMaker.TrigCostD3PDMakerTool( _costD3PDToolName, D3PDSvc = _costD3PDSvc, dir = _tuplePath )
        _trigCostTool.mode = mode
        if (costConfigL2 == True):
            _trigCostTool.keyEvent = "HLT_TrigMonEventCollection_OPI_L2_monitoring_event"
            _trigCostTool.prefix = "TrigCostL2_"
        elif (costConfigEF == True):
            _trigCostTool.keyEvent = "HLT_TrigMonEventCollection_OPI_EF_monitoring_event"
            _trigCostTool.prefix = "TrigCostEF_"
        elif (costConfigHLT == True):
            _trigCostTool.keyEvent = "HLT_TrigMonEventCollection_OPI_HLT_monitoring_event"
            _trigCostTool.prefix = "TrigCostHLT_"
        d3pdalg.MetadataTools += [ _trigCostTool ]

    if (mode != "EBWEIGHT"):
      from TrigCostD3PDMaker.TrigCostConfMetadata import addTrigCostConfMetadata
      addTrigCostConfMetadata( d3pdalg, costConfigL2, costConfigEF, costConfigHLT, _tuplePath )
Esempio n. 3
0
def addAlfaDcsMetadata( d3pdalg = None ):

	"""Helper function that adds the necessary tool(s) and service(s) to the
	   job to save the trigger configuration metadata to the output D3PD
	   file.

		Arguments:
		  d3pdalg: The D3PD::MakerAlg that is creating the D3PD. If not specified,
				   the configuration is saved in a file called TrigConfig.root
	"""

	# Create a logger for the function:
	if "logger" in dir(): orig_logger = logger
	from AthenaCommon.Logging import logging
	logger = logging.getLogger( "addAlfaDcsMetadata" )

	# Let the user know what we're doing:
	logger.info( "Adding ALFA DCS metadata to the D3PD" )

	# The tool needs a special D3PDSvc in which the indexing is turned off
	# for the TTree-s:
	_d3pdSvcName = "AlfaDcsD3PDSvc"
	from AthenaCommon.AppMgr import ServiceMgr
	if not hasattr( ServiceMgr, _d3pdSvcName ):
		from D3PDMakerRoot.D3PDMakerRootConf import D3PD__RootD3PDSvc
		ServiceMgr += D3PD__RootD3PDSvc( _d3pdSvcName )
		ServiceMgr.AlfaDcsD3PDSvc.MasterTree = ""
		ServiceMgr.AlfaDcsD3PDSvc.IndexMajor = ""
	else:
		logger.info( "The private D3PDSvc for the metadata TTree already exists" )
	_d3pdSvc = getattr( ServiceMgr, _d3pdSvcName )

	# If no D3PD::MakerAlg has been provided, create a dummy one:
	if d3pdalg == None:
		logger.warning( "No D3PD MakerAlg given to function!" )
		logger.warning( "The DCS data will be saved into file: " + "\"AlfaDCS.root\"" )
		from AthenaCommon.AlgSequence import AlgSequence
		theJob = AlgSequence()
		import D3PDMakerCoreComps
		d3pdalg = D3PDMakerCoreComps.MakerAlg( "AlfaDCSAlg", theJob, file = "AlfaDCS.root", D3PDSvc = _d3pdSvc )

	# Add the metadata tool:
	_d3pdToolName = "AlfaMetaDataTool"
	if not _d3pdToolName in [ t.name() for t in d3pdalg.MetadataTools ]:
		import ForwardDetectorsD3PDMaker
		d3pdalg.MetadataTools += [
			ForwardDetectorsD3PDMaker.AlfaMetaDataTool( _d3pdToolName, D3PDSvc = _d3pdSvc, MetaDataDir=d3pdalg.TuplePath+"Meta")
			]
	else:
		logger.info( "AlfaMetaDataTool was already added to the D3PD::MakerAlg" )

	# Restore the original logger if necessary:
	if "orig_logger" in dir(): logger = orig_logger

	return
streamName = prodFlags.WriteSMDYEED3PD.StreamName
fileName = buildFileName(prodFlags.WriteSMDYEED3PD)
SMDYEED3PDStream_msg.info( "Configuring SMDYEED3PD with streamName '%s' and fileName '%s'" % \
                            ( streamName, fileName ) )

#### add specific containers
include("PhysicsD3PDMaker/LowPtElectronPairSelector.py")
include("PhysicsD3PDMaker/PhotonSelector.py")
include("PhysicsD3PDMaker/MuonSelector.py")
include("PhysicsD3PDMaker/JetSelector.py")
include("PhysicsD3PDMaker/TauSelector.py")

# Configure branches
from AthenaCommon.AppMgr import ServiceMgr
from D3PDMakerRoot.D3PDMakerRootConf import D3PD__RootD3PDSvc
ServiceMgr += D3PD__RootD3PDSvc("SMDYEE_D3PDSvc")
ServiceMgr.SMDYEE_D3PDSvc.VetoedNames = [
    "L1_.*", "L2_.*", "EF_m.*", "EF_2m.*", "EF_j.*", "EF_2j.*", "EF_tau.*"
]
ServiceMgr.SMDYEE_D3PDSvc.VetoedNames += ["trig_EF_trigmu.*"]
ServiceMgr.SMDYEE_D3PDSvc.VetoedNames += ["MET.*", ".*etx.*", ".*ety.*"]

# Create the D3PD streams:
from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
SMDYEED3PDStream = MSMgr.NewRootStream(streamName, fileName, "physics")
SMDYEED3PDStream.D3PDSvc = ServiceMgr.SMDYEE_D3PDSvc

# Now add all the content to this stream:
from PhysicsD3PDMaker.SMWZLightD3PD import SMWZLightD3PD
SMWZLightD3PD(SMDYEED3PDStream, stdElectronContainer='LowPtElectrons')
def addTrigConfMetadata(d3pdalg=None,
                        useTrigConfEventSummaries=False,
                        doCostL2=False,
                        doCostEF=False,
                        doCostHLT=False,
                        saveKeys=True,
                        tuplePath=""):
    """Helper function that adds the necessary tool(s) and service(s) to the
       job to save the trigger configuration metadata to the output D3PD
       file.

        Arguments:
          d3pdalg: The D3PD::MakerAlg that is creating the D3PD. If not specified,
                   the configuration is saved in a file called TrigConfig.root
          useTrigConfEventSummaries:	Set true when running in AtlasP1HLT or trigger BS
                   to gather detailed configuration from TrigConfEvent
                   summary objects (TrigCost running). 
    """

    # Create a logger for the function:
    if "logger" in dir(): orig_logger = logger
    from AthenaCommon.Logging import logging
    logger = logging.getLogger("addTrigConfMetadata")

    # Let the user know what we're doing:
    logger.info("Adding trigger configuration metadata to the D3PD")

    # The tool needs a special D3PDSvc in which the indexing is turned off
    # for the TTree-s:
    _d3pdSvcName = "TrigConfD3PDSvc"
    from AthenaCommon.AppMgr import ServiceMgr
    if not hasattr(ServiceMgr, _d3pdSvcName):
        from D3PDMakerRoot.D3PDMakerRootConf import D3PD__RootD3PDSvc
        ServiceMgr += D3PD__RootD3PDSvc(_d3pdSvcName)
        ServiceMgr.TrigConfD3PDSvc.MasterTree = ""
        ServiceMgr.TrigConfD3PDSvc.IndexMajor = ""
    else:
        logger.info(
            "The private D3PDSvc for the metadata TTree already exists")
    _d3pdSvc = getattr(ServiceMgr, _d3pdSvcName)

    # If no D3PD::MakerAlg has been provided, create a dummy one:
    if d3pdalg == None:
        logger.warning("No D3PD MakerAlg given to function!")
        logger.warning("The trigger configuration will be saved into file: " +
                       "\"TrigConfig.root\"")
        from AthenaCommon.AlgSequence import AlgSequence
        theJob = AlgSequence()
        import D3PDMakerCoreComps
        d3pdalg = D3PDMakerCoreComps.MakerAlg("trigConf",
                                              theJob,
                                              file="TrigConfig.root",
                                              D3PDSvc=_d3pdSvc)

    # Add the metadata tool:
    _d3pdToolName = "TrigConfMetadataTool"
    if not _d3pdToolName in [t.name() for t in d3pdalg.MetadataTools]:
        import TriggerD3PDMaker
        if (tuplePath == ""):
            tuplePath = d3pdalg.TuplePath
        _trigConfTool = TriggerD3PDMaker.TrigConfMetadataTool(
            _d3pdToolName, D3PDSvc=_d3pdSvc, ConfigDir=tuplePath + "Meta")
        _trigConfTool.UseTrigConfEventSummaries = useTrigConfEventSummaries
        if useTrigConfEventSummaries:
            # Figure out if old or new style HLT if using CostMon to get correct storegate key
            # Old key fomat was HLT_OPI_HLT_monitoring_config
            if (doCostL2 == True or doCostEF == True or doCostHLT == True):
                logger.info(
                    "TrigConfMetadataTool will use passed arguments [L2=" +
                    str(doCostL2) + ",EF=" + str(doCostEF) + ",HLT=" +
                    str(doCostHLT) + "]")
                if (doCostL2 == True or doCostEF == True):
                    _trigConfTool.keyConfig = "HLT_TrigMonConfigCollection_OPI_EF_monitoring_config"
                elif (doCostHLT == True):
                    _trigConfTool.keyConfig = "HLT_TrigMonConfigCollection_OPI_HLT_monitoring_config"
            else:
                logger.info(
                    "TrigConfMetadataTool will use TriggerFlags flags for config"
                )
                from TriggerJobOpts.TriggerFlags import TriggerFlags
                if TriggerFlags.doHLT() and not (TriggerFlags.doEF()
                                                 or TriggerFlags.doLVL2()):
                    _trigConfTool.keyConfig = "HLT_TrigMonConfigCollection_OPI_HLT_monitoring_config"
                elif TriggerFlags.doEF() or TriggerFlags.doLVL2():
                    _trigConfTool.keyConfig = "HLT_TrigMonConfigCollection_OPI_EF_monitoring_config"
            logger.info("TrigConfMetadataTool will use the StoreGate key " +
                        _trigConfTool.keyConfig)
            d3pdalg.MetadataTools += [_trigConfTool]
    else:
        logger.info(
            "TrigConfMetadataTool was already added to the D3PD::MakerAlg")

    # Add the DB key filler object:
    if saveKeys == True:
        _dbKeysFillerName = "TrigDBKeysFiller"
        if not hasattr(d3pdalg, _dbKeysFillerName):
            from TriggerD3PDMaker.TrigDBKeysD3PDObject import TrigDBKeysD3PDObject
            d3pdalg += TrigDBKeysD3PDObject(0)
        else:
            logger.info(
                "TrigDBKeysD3PDObject already added to the D3PD::MakerAlg")

    # Restore the original logger if necessary:
    if "orig_logger" in dir(): logger = orig_logger

    return
Esempio n. 6
0
    def __init__(self,
                 name,
                 seq=topSequence,
                 file=None,
                 stream=None,
                 tuplename=None,
                 TuplePath=None,
                 preD3PDAlgSeqName=D3PDMakerFlags.PreD3PDAlgSeqName(),
                 streamNameRoot=None,
                 clevel=D3PDMakerFlags.CompressionLevel(),
                 **kwargs):
        """MakerAlg constructor.  See the class documentation for a full description.
"""

        if streamNameRoot == None:
            streamNameRoot = 'D3PD'

        # Work around initialization order issue.
        if seq:
            seq.__iadd__(D3PDMakerCoreComps.DummyInitAlg(name + 'DummyInit'),
                         index=0)

        # If the tuple path wasn't supplied, build it from the other args.
        if TuplePath == None:
            # tuple name defaults to the algorithm name.
            if tuplename == None:
                tuplename = name

            if stream == None:
                # If no stream was given, infer it from the file.
                # This creates the stream if needed.
                if file == None:
                    raise TypeError("Neither stream nor file specified "
                                    "for tuple %s" % tuplename)
                stream = _stream_from_file(file, seq, tuplename,
                                           streamNameRoot, clevel)
            TuplePath = '/%s/%s' % (stream, tuplename)

        # Create the algorithm Configurable.
        D3PDMakerCoreCompsConf.D3PD__MakerAlg.__init__(self,
                                                       name,
                                                       TuplePath=TuplePath,
                                                       **kwargs)

        # Ensure configuration parameters are set.
        if (D3PDMakerFlags.AutoFlush() != -1
                and self.D3PDSvc.getFullName() == 'D3PD::RootD3PDSvc'):
            from D3PDMakerRoot.D3PDMakerRootConf import D3PD__RootD3PDSvc
            rootsvc = D3PD__RootD3PDSvc()
            rootsvc.AutoFlush = D3PDMakerFlags.AutoFlush()
            from AthenaCommon.AppMgr import ServiceMgr
            ServiceMgr += rootsvc

        # Add to the supplied sequence.
        if seq:
            # But first, add a sequence for algorithms that should run
            # before D3PD making, if it's not already there.
            preseq = AlgSequence(preD3PDAlgSeqName)
            if not hasattr(seq, preD3PDAlgSeqName):
                seq += [preseq]

            # We don't want to do filtering in the presequence.
            preseq.StopOverride = True

            # Now set up another sequence for filtering.
            # Unlike the presequence, there should be a unique one of these
            # per algorithm.  We also need to break out an additional
            # sequence to which users can add, and to wrap the whole
            # thing in a sequence to prevent a failed filter
            # decision from stopping other algorithms.
            # Like this:
            #
            #   ALG_FilterAlgorithmsWrap (StopOverride = True)
            #     ALG_FilterAlgorithmsHolder
            #       ALG_FilterAlgorithms
            #       ALG
            #     Dummy alg, to reset filter flag

            suffix = D3PDMakerFlags.FilterAlgSeqSuffix()
            wrap = AlgSequence(name + suffix + 'Wrap', StopOverride=True)
            holder = AlgSequence(name + suffix + 'Holder')
            self.filterSeq = AlgSequence(name + suffix)
            holder += self.filterSeq
            holder += self
            wrap += holder
            wrap += PyAthena.Alg(name + 'Dummy')

            seq += wrap

        # Create a unique collection getter registry tool for this tree.
        from AthenaCommon.AppMgr import ToolSvc
        self._registry = \
           D3PDMakerCoreComps.CollectionGetterRegistryTool (self.name() +
                                                   '_CollectionGetterRegistry')
        ToolSvc += self._registry
        return
Esempio n. 7
0
streamName = prodFlags.WriteSMZMUMUD3PD.StreamName
fileName = buildFileName(prodFlags.WriteSMZMUMUD3PD)
SMZMUMUD3PDStream_msg.info( "Configuring SMZMUMUD3PD with streamName '%s' and fileName '%s'" % \
                            ( streamName, fileName ) )

#### add specific containers
include("PhysicsD3PDMaker/ElectronSelector.py")
include("PhysicsD3PDMaker/PhotonSelector.py")
include("PhysicsD3PDMaker/LowPtMuonPairSelector.py")
include("PhysicsD3PDMaker/JetSelector.py")
include("PhysicsD3PDMaker/TauSelector.py")

# Configure branches
from AthenaCommon.AppMgr import ServiceMgr
from D3PDMakerRoot.D3PDMakerRootConf import D3PD__RootD3PDSvc
ServiceMgr += D3PD__RootD3PDSvc("SMZMUMU_D3PDSvc")
ServiceMgr.SMZMUMU_D3PDSvc.VetoedNames = [
    "L1_.*", "L2_.*", "EF_e.*", "EF_2e.*", "EF_g.*", "EF_j.*", "EF_2j.*",
    "EF_tau.*"
]
ServiceMgr.SMZMUMU_D3PDSvc.VetoedNames += ["trig_EF_el.*"]
ServiceMgr.SMZMUMU_D3PDSvc.VetoedNames += [".*etx.*", ".*ety.*"]

# Create the D3PD streams:
from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
SMZMUMUD3PDStream = MSMgr.NewRootStream(streamName, fileName, "physics")
SMZMUMUD3PDStream.D3PDSvc = ServiceMgr.SMZMUMU_D3PDSvc

# Now add all the content to this stream:
from PhysicsD3PDMaker.SMWZLightD3PD import SMWZLightD3PD
from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags
#from PhysicsD3PDMaker.SMWZD3PD import SMWZD3PD
#SMWZD3PD( SMTRILEPD3PDStream )

#h ok
### add specific containers
# Will need to redefine these ourselves...
include("PhysicsD3PDMaker/SMTRILEP_ElectronSelector.py")
include("PhysicsD3PDMaker/SMTRILEP_PhotonSelector.py")
include("PhysicsD3PDMaker/SMTRILEP_MuonSelector.py")
include("PhysicsD3PDMaker/SMTRILEP_JetSelector.py")
#include ("PhysicsD3PDMaker/TauSelector.py")

# Configure branches
from AthenaCommon.AppMgr import ServiceMgr
from D3PDMakerRoot.D3PDMakerRootConf import D3PD__RootD3PDSvc
ServiceMgr += D3PD__RootD3PDSvc("SMTRILEP_D3PDSvc")
#ServiceMgr.SMTRILEP_D3PDSvc.VetoedNames  = [ "EF_j.*","EF_2j.*","EF_tau.*" ]
ServiceMgr.SMTRILEP_D3PDSvc.VetoedNames = [
    "^L1_.*",
    "^L2_.*",
    "EF_j.*",
    "EF_2j.*",
    "EF_tau.*",
    "EF_xe.*",
    "EF_eb.*",
]
ServiceMgr.SMTRILEP_D3PDSvc.VetoedNames += [
    ".*etx.*", ".*ety.*", "IPEstimate.*"
]

include("PhysicsD3PDMaker/SMTRILEP_VetoBranches.py")
Esempio n. 9
0
def addBunchStructureMetadata(d3pdalg=None, source=""):

    # Create a logger for the function:
    if "logger" in dir(): orig_logger = logger
    from AthenaCommon.Logging import logging
    logger = logging.getLogger("addBunchStructureMetadata")

    # Let the user know what we're doing:
    logger.info("Adding bunch configuration metadata to the D3PD")

    # The tool needs a special D3PDSvc in which the indexing is turned off
    # for the TTree-s:
    _d3pdSvcName = "BCD3PDSvc"
    from AthenaCommon.AppMgr import ServiceMgr
    if not hasattr(ServiceMgr, _d3pdSvcName):
        from D3PDMakerRoot.D3PDMakerRootConf import D3PD__RootD3PDSvc
        ServiceMgr += D3PD__RootD3PDSvc(_d3pdSvcName)
        _d3pdSvc = getattr(ServiceMgr, _d3pdSvcName)
        _d3pdSvc.MasterTree = ""
        _d3pdSvc.IndexMajor = ""
    else:
        logger.info(
            "The private D3PDSvc for the metadata TTree already exists")
    _d3pdSvc = getattr(ServiceMgr, _d3pdSvcName)

    # If no D3PD::MakerAlg has been provided, create a dummy one:
    if d3pdalg == None:
        logger.warning("No D3PD MakerAlg given to function!")
        logger.warning("The bunch configuration will be saved into file: " +
                       "\"BunchConfig.root\"")
        from AthenaCommon.AlgSequence import AlgSequence
        theJob = AlgSequence()
        import D3PDMakerCoreComps
        d3pdalg = D3PDMakerCoreComps.MakerAlg("bunchConf",
                                              theJob,
                                              file="BunchConfig.root",
                                              D3PDSvc=_d3pdSvc)

    # Add the metadata tool:
    _d3pdToolName = "BunchStructureMetadataTool"
    if not _d3pdToolName in [t.name() for t in d3pdalg.MetadataTools]:
        import TriggerD3PDMaker
        from TrigBunchCrossingTool.BunchCrossingConfProvider import BunchCrossingConfProvider
        d3pdalg.MetadataTools += [
            TriggerD3PDMaker.BunchStructureMetadataTool( _d3pdToolName,
                                                         D3PDSvc = _d3pdSvc,
                                                         ConfigDir = d3pdalg.TuplePath + \
                                                                     "Meta",
                                                         BCConfProvider = \
                                                         BunchCrossingConfProvider( source ) )
            ]
    else:
        logger.info(
            "BunchStructureMetadataTool was already added to the D3PD::MakerAlg"
        )

    # Add the DB key filler object:
    _configIdFillerName = "BunchConfigIDFiller"
    if not hasattr(d3pdalg, _configIdFillerName):
        from TriggerD3PDMaker.BunchConfigIDD3PDObject import BunchConfigIDD3PDObject
        d3pdalg += BunchConfigIDD3PDObject(source)(0)
    else:
        logger.info(
            "BunchConfigIDD3PDObject already added to the D3PD::MakerAlg")

    # Restore the original logger if necessary:
    if "orig_logger" in dir(): logger = orig_logger

    return
Esempio n. 10
0
fileName = buildFileName(prodFlags.WriteSMWMUNUD3PD)
SMWMUNUD3PDStream_msg.info( "Configuring SMWMUNUD3PD with streamName '%s' and fileName '%s'" % \
                            ( streamName, fileName ) )

# add specific containers
include("PhysicsD3PDMaker/ElectronSelector.py")
include("PhysicsD3PDMaker/PhotonSelector.py")
include("PhysicsD3PDMaker/MuonSelector.py")
include("PhysicsD3PDMaker/JetSelector.py")
include("PhysicsD3PDMaker/TauSelector.py")

# Configure branches
from AthenaCommon.AppMgr import ServiceMgr
from D3PDMakerRoot.D3PDMakerRootConf import D3PD__RootD3PDSvc

ServiceMgr += D3PD__RootD3PDSvc("SMWMUNU_D3PDSvc")
ServiceMgr.SMWMUNU_D3PDSvc.VetoedNames = [
    "L1_.*", "L2_.*", "EF_e.*", "EF_2e.*", "EF_g.*", "EF_j.*", "EF_2j.*",
    "EF_tau.*"
]
ServiceMgr.SMWMUNU_D3PDSvc.VetoedNames += ["trig_EF_el.*"]
ServiceMgr.SMWMUNU_D3PDSvc.VetoedNames += [".*etx.*", ".*ety.*"]

# Create the D3PD streams:
from OutputStreamAthenaPool.MultipleStreamManager import MSMgr

SMWMUNUD3PDStream = MSMgr.NewRootStream(streamName, fileName, "physics")
SMWMUNUD3PDStream.D3PDSvc = ServiceMgr.SMWMUNU_D3PDSvc

# Now add all the content to this stream:
from PhysicsD3PDMaker.SMWZLightD3PD import SMWZLightD3PD

def _TruthTauDecayAssocHook(c, prefix, *args, **kw):
    assoc = getattr(c, c.name() + '_child_TruthTauDecayAssociation', None)
    if assoc:
        indexer = getattr(assoc, assoc.name() + 'Index')
        indexer.Target = prefix
    return


tauTruth.defineHook(_TruthTauDecayAssocHook)

phTruth = simpleTruthParticleD3PDObject('SimplePhotonContainer',
                                        'ph_',
                                        skipDressing=True)
alg += elTruth(0, 'ElTruthParticle', sgkey='SimpleElectronContainer')
alg += muTruth(0, 'MuTruthParticle', sgkey='SimpleMuonContainer')
alg += tauTruth(0, 'TauTruthParticle', sgkey='SimpleTauContainer')
alg += phTruth(0, 'PhotonTruthParticle', sgkey='SimplePhotonContainer')

# To explicitly list variables to keep or exclude in final D3PD
from AthenaCommon.AppMgr import ServiceMgr
from D3PDMakerRoot.D3PDMakerRootConf import D3PD__RootD3PDSvc
ServiceMgr += D3PD__RootD3PDSvc("MyD3PDVetoSvc")
ServiceMgr.MyD3PDVetoSvc.VetoedNames = [
    'timestamp', 'timestamp_ns', 'lbn', 'bcid', 'detmask0', 'detmask1',
    'actualIntPerXing', 'averageIntPerXing', 'el_pdgId', 'mu_pdgId',
    'tau_pdgId', 'ph_pdgId', 'ph_charge'
]  # These are just stupid
alg.D3PDSvc = ServiceMgr.MyD3PDVetoSvc
streamName = prodFlags.WriteSMLIGHTD3PD.StreamName
fileName = buildFileName(prodFlags.WriteSMLIGHTD3PD)
SMLIGHTD3PDStream_msg.info( "Configuring SMLIGHTD3PD with streamName '%s' and fileName '%s'" % \
                            ( streamName, fileName ) )

#### add specific containers
include("PhysicsD3PDMaker/ElectronSelector.py")
include("PhysicsD3PDMaker/PhotonSelector.py")
include("PhysicsD3PDMaker/MuonSelector.py")
include("PhysicsD3PDMaker/JetSelector.py")
include("PhysicsD3PDMaker/TauSelector.py")

# Configure branches
from AthenaCommon.AppMgr import ServiceMgr
from D3PDMakerRoot.D3PDMakerRootConf import D3PD__RootD3PDSvc
ServiceMgr += D3PD__RootD3PDSvc("SMLIGHT_D3PDSvc")
ServiceMgr.SMLIGHT_D3PDSvc.VetoedNames = [
    "L1_.*", "L2_.*", "EF_j.*", "EF_2j.*", "EF_tau.*"
]
ServiceMgr.SMLIGHT_D3PDSvc.VetoedNames += [".*etx.*", ".*ety.*"]

# Create the D3PD streams:
from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
SMLIGHTD3PDStream = MSMgr.NewRootStream(streamName, fileName, "physics")
SMLIGHTD3PDStream.D3PDSvc = ServiceMgr.SMLIGHT_D3PDSvc

# Now add all the content to this stream:
from PhysicsD3PDMaker.SMWZLightD3PD import SMWZLightD3PD
from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags
SMWZLightD3PD(SMLIGHTD3PDStream,
              stdElectronContainer='HighPtElectrons',
CommonD3PDStream_msg.info( "Configuring CommonD3PD with streamName '%s' and fileName '%s'" % \
                            ( streamName, fileName ) )

from RecExConfig.RecAlgsFlags import recAlgs
recAlgs.doMissingET.set_Value_and_Lock(True)

# Create the D3PD streams:
from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
CommonD3PDStream = MSMgr.NewRootStream(streamName, fileName, "physics")
CommonTriggerD3PDStream = MSMgr.NewRootStream(
    streamName + ":" + streamName + "TrigDec", fileName, "physicsTrigDec")

# Configure branches
from AthenaCommon.AppMgr import ServiceMgr
from D3PDMakerRoot.D3PDMakerRootConf import D3PD__RootD3PDSvc
ServiceMgr += D3PD__RootD3PDSvc("COMMON_D3PDSvc")
include("D3PDMakerConfig/CommonD3PD_VetoBranches.py")
ServiceMgr.COMMON_D3PDSvc.VetoedNames += CommonD3PD_VetoBranches
CommonD3PDStream.D3PDSvc = ServiceMgr.COMMON_D3PDSvc

# Now add all the content to this stream:
from D3PDMakerConfig.commonD3PD import commonD3PD
commonD3PD_args = globals().get('commonD3PD_args', {})
commonD3PD(CommonD3PDStream, CommonTriggerD3PDStream, **commonD3PD_args)

from D3PDMakerConfig.CommonJSD3PD import CommonJSD3PD
for xx in groomedJetKeys:
    print "cccccc xx = ", xx
    if xx[0] != None and xx[1] != None:
        CommonJSD3PD(xx, CommonD3PDStream)