Example #1
0
    'HSG5WH_LooseStacoMuonLinkCollection')
leptonFilter += muSelector.getMuonSelector(
    'HSG5WH_ThirdChainMuonSelector', 'Muons',
    'HSG5WH_LooseThirdChainMuonLinkCollection')

sequencer += leptonFilter

HSG5D3PD_Stream.RequireAlgs.append("HSG5WH_SingleLeptonFilter")

# MET selector
from D2PDMaker.D2PDMakerConf import D2PDMissingEtSelector
sequencer += D2PDMissingEtSelector("HSG5WH_MissingEtFilter",
                                   inputCollection='MET_RefFinal',
                                   outputCollection='HSG5WH_NeutrinoRefFinal',
                                   minNumberPassed=1,
                                   missingEtMin=15.0 * Units.GeV)
HSG5D3PD_Stream.RequireAlgs.append("HSG5WH_MissingEtFilter")

if False:
    # (for private production ony) insert in beginning of PreD3PDSequencer
    mainSequencer = AlgSequence(D3PDMakerFlags.PreD3PDAlgSeqName(),
                                StopOverride=False)

    if not hasattr(topSequence, D3PDMakerFlags.PreD3PDAlgSeqName()):
        topSequence += mainSequencer

    mainSequencer.insert(0, sequencer)

else:
    topSequence += sequencer
Example #2
0
        def __init__(self, JetAlgName, TruthJetCont="AntiKt4TruthJets", AllRecoJetCont="AntiKt4LCTopoJets"):

            from AthenaCommon.AlgSequence import AlgSequence
            topSequence = AlgSequence()
            
            # Build the list of decay modes that shall be separated (needed to get the case fragment right for weight files)
            # === IMPORTANT NOTE ===
            #NOTE: This order has to match the order in which the DiscTools add their likeliness to the likeliness vector in PanTau::TauJetBuilderAlg::execute.
            #NOTE: Convention for order: Start with Low prong and low neutrals, move up in neutrals, then move to next higher prong. Add fakes at the end.
            # 
            # However, this code should not need to be changed very often. Only if the number of modes change. In that case, one would have to revisit the code anyway...
            # Hence: Hands off, unless you know what you're getting yourself into :)
            from PanTauAnalysis.PanTauJetBuilderAlg_Flags import PanTauJetBuilderAlgFlags as PJB_Flags
            ListOfDecayModes = [PJB_Flags.MVA_ModeName1p0n(),
                                PJB_Flags.MVA_ModeName1p1n(),
                                PJB_Flags.MVA_ModeName1pXn(),
                                PJB_Flags.MVA_ModeName3p0n(),
                                PJB_Flags.MVA_ModeName3pXn()]
            
            # Add the discrimination tools
            from AthenaCommon.AppMgr import ToolSvc
            
            ### ====== Tool for 1p0n
            ItsName = "PanTauDiscrTool_" + JetAlgName + "_" + PJB_Flags.MVA_ModeName1p0n()
            DiscTool_1p0n = getDiscriminantTool(ItsName, JetAlgName, PJB_Flags.MVA_ModeName1p0n(), ListOfDecayModes, PJB_Flags.MVA_UsedFeatures1p0n())
            DiscTool_1p0n.OutputLevel = INFO
            ToolSvc += DiscTool_1p0n
            printfunc (DiscTool_1p0n)
            
            ### ====== Tool for 1p1n
            ItsName = "PanTauDiscrTool_" + JetAlgName + "_" + PJB_Flags.MVA_ModeName1p1n()
            DiscTool_1p1n = getDiscriminantTool(ItsName, JetAlgName, PJB_Flags.MVA_ModeName1p1n(), ListOfDecayModes, PJB_Flags.MVA_UsedFeatures1p1n())
            DiscTool_1p1n.OutputLevel = INFO
            ToolSvc += DiscTool_1p1n
            printfunc (DiscTool_1p1n)
            
            ### ====== Tool for 1pXn
            ItsName = "PanTauDiscrTool_" + JetAlgName + "_" + PJB_Flags.MVA_ModeName1pXn()
            DiscTool_1pXn = getDiscriminantTool(ItsName, JetAlgName, PJB_Flags.MVA_ModeName1pXn(), ListOfDecayModes, PJB_Flags.MVA_UsedFeatures1pXn())
            DiscTool_1pXn.OutputLevel = INFO
            ToolSvc += DiscTool_1pXn
            printfunc (DiscTool_1pXn)
            
            ### ====== Tool for 3p0n
            ItsName = "PanTauDiscrTool_" + JetAlgName + "_" + PJB_Flags.MVA_ModeName3p0n()
            DiscTool_3p0n = getDiscriminantTool(ItsName, JetAlgName, PJB_Flags.MVA_ModeName3p0n(), ListOfDecayModes, PJB_Flags.MVA_UsedFeatures3p0n())
            DiscTool_3p0n.OutputLevel = INFO
            ToolSvc += DiscTool_3p0n
            printfunc (DiscTool_3p0n)
            
            ### ====== Tool for 3pXn
            ItsName = "PanTauDiscrTool_" + JetAlgName + "_" + PJB_Flags.MVA_ModeName3pXn()
            DiscTool_3pXn = getDiscriminantTool(ItsName, JetAlgName, PJB_Flags.MVA_ModeName3pXn(), ListOfDecayModes, PJB_Flags.MVA_UsedFeatures3pXn())
            DiscTool_3pXn.OutputLevel = INFO
            ToolSvc += DiscTool_3pXn
            printfunc (DiscTool_3pXn)
            
            
            
            from PanTauAnalysis.PanTauValidationFlags import panTauValidationFlags
            
            from PanTauAnalysis.PanTauSeedBuilderAlg_Flags import PanTauSeedBuilderAlgFlags as PSB_Flags
            PanTauGoodSeeds = PSB_Flags.ContainerName_PanTauGoodOutputSeeds() + JetAlgName
            PanTauBadSeeds  = PSB_Flags.ContainerName_PanTauBadOutputSeeds() + JetAlgName
            
            from PanTauAnalysis.PanTauValidationFlags import panTauValidationFlags
            
            from PanTauAlgs.PanTauAlgsConf import PanTau__TauJetBuilderAlg
            jetBuilderAlg = PanTau__TauJetBuilderAlg(   "TauJetBuild"+JetAlgName,
                                                        #container names...
                                                        ContainerName_PanTauSeedCollection = PanTauGoodSeeds,
                                                        ContainerName_PanTauRejectedSeedCollection = PanTauBadSeeds,
                                                        #the decay mode separation tools...
                                                        MVA_ListOfDecayModeNames = ListOfDecayModes,
                                                        MVA_DiscTool_1p0n = DiscTool_1p0n,
                                                        MVA_DiscTool_1p1n = DiscTool_1p1n,
                                                        MVA_DiscTool_1pXn = DiscTool_1pXn,
                                                        MVA_DiscTool_3p0n = DiscTool_3p0n,
                                                        MVA_DiscTool_3pXn = DiscTool_3pXn,
                                                        FeatureNames                        = panTauValidationFlags.AllFeatureNames(),
                                                        FeatureDefaultValues                = panTauValidationFlags.AllFeatureDefaultValues(),
                                                        FeatureDefaultValueSmearingSigma    = panTauValidationFlags.AllFeatureDefaultValueSmearingSigma(),
                                                        FeatureTypes                        = panTauValidationFlags.AllFeatureTypes(),
                                                        SmearDefaultValuesOfFeatures        = panTauValidationFlags.DoFeatureDefaultSmearing()
                                                         )
            jetBuilderAlg.OutputLevel = INFO
            topSequence += jetBuilderAlg
            printfunc (jetBuilderAlg)
Example #3
0
  conddb.addFolder("PIXEL_OFL","/PIXEL/PixCalib")

### configure the special pixel map service

from PixelConditionsServices.PixelConditionsServicesConf import PixelCalibSvc
PixelCalibSvc = PixelCalibSvc()

ServiceMgr.EventSelector.RunNumber = 282222
#ServiceMgr.EventSelector.RunNumber = 222222
#ServiceMgr.EventSelector.RunNumber = 200805

### define the job

from AthenaCommon.AlgSequence import AlgSequence

job = AlgSequence()

from PixelConditionsServices.PixelConditionsServicesConf import PixelCalibServiceTest

job +=PixelCalibServiceTest(OutputTextFile =myOutput, MakeDummy = TRUE ) 

ServiceMgr += PixelCalibSvc


theApp.EvtMax                   = 1


### set up auditors

from AthenaCommon.AppMgr import ServiceMgr
Example #4
0
include("FastSiDigitization/PixelDigiTool_jobOptions.py")
DetFlags.pixel_setOff()
DetFlags.detdescr.pixel_setOn()

include("Digitization/ForceUseOfPileUpTools.py")
include(
    "SimulationJobOptions/preInclude.PileUpBunchTrains2011Config8_DigitConfig.py"
)

include("Digitization/Digitization.py")

from SiClusterizationTool.SiClusterizationToolConf import InDet__ClusterMakerTool
InDetClusterMakerTool = InDet__ClusterMakerTool(name="InDetClusterMakerTool")

ToolSvc += InDetClusterMakerTool

from PixelConditionsTools.PixelConditionsToolsConf import PixelRecoDbTool
ToolSvc += PixelRecoDbTool(name="PixelRecoDbTool")
ToolSvc.PixelRecoDbTool.InputSource = 1

from AthenaCommon.AppMgr import ServiceMgr
ServiceMgr.MessageSvc.enableSuppression = False

from AthenaCommon.AlgSequence import AlgSequence
AlgSequence("Streams").StreamRDO.ItemList += [
    "InDet::PixelClusterContainer#PixelClusters"
]

MessageSvc.OutputLevel = INFO  #INFO
Example #5
0
    def configure(self):

        log = logging.getLogger("HLTTriggerResultGetter.py")
        from RecExConfig.ObjKeyStore import objKeyStore

        # set EDMDecodingVersion
        EDMDecodingVersion()

        # Set AODFULL for data unless it was set explicitly already
        if TriggerFlags.AODEDMSet.isDefault() and globalflags.DataSource()=='data':
            TriggerFlags.AODEDMSet = 'AODFULL'
            
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        log.info("BS unpacking (TF.readBS): %d" % TriggerFlags.readBS() )
        if TriggerFlags.readBS():
            bs = ByteStreamUnpackGetter()

        xAODContainers = {}
#        if not recAlgs.doTrigger():      #only convert when running on old data
        if TriggerFlags.EDMDecodingVersion()==1:
            xaodcnvrt = xAODConversionGetter()
            xAODContainers = xaodcnvrt.xaodlist

        if recAlgs.doTrigger() or TriggerFlags.doTriggerConfigOnly():
            tdt = TrigDecisionGetter()

        # TrigJetRec additions
        if rec.doWriteESD():
            objKeyStore.addStreamESD("JetKeyDescriptor","JetKeyMap")
            objKeyStore.addStreamESD("JetMomentMap","TrigJetRecMomentMap")

        if rec.doWriteAOD():
            objKeyStore.addStreamAOD("JetKeyDescriptor","JetKeyMap")
            objKeyStore.addStreamAOD("JetMomentMap","TrigJetRecMomentMap")
                    
        # ID truth
        if not rec.readESD() and (not rec.readAOD()) and TriggerFlags.doID() \
                and rec.doTruth():
            try:
                from TrigInDetTruthAlgs.TrigInDetTruthAlgsConfig import \
                    TrigIDTruthMaker
                topSequence += TrigIDTruthMaker()
            except Exception:
                log.warning( "Couldn't set up the trigger ID truth maker" )
                pass

        if rec.doESD() or rec.doAOD():
            from TrigEDMConfig.TriggerEDM import getTrigIDTruthList
            objKeyStore.addManyTypesStreamESD(getTrigIDTruthList(TriggerFlags.ESDEDMSet()))
            objKeyStore.addManyTypesStreamAOD(getTrigIDTruthList(TriggerFlags.AODEDMSet()))

        if (rec.doESD() or rec.doAOD()) and TriggerFlags.writeL1TopoValData():
            objKeyStore.addManyTypesStreamESD(['xAOD::TrigCompositeContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValData',
                                               'xAOD::TrigCompositeAuxContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValDataAux.'])
            objKeyStore.addManyTypesStreamAOD(['xAOD::TrigCompositeContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValData',
                                               'xAOD::TrigCompositeAuxContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValDataAux.'])
            log.debug("HLT_xAOD__TrigCompositeContainer_L1TopoValData(Aux.) for L1Topo validation added to the data.")

        if rec.doAOD() or rec.doWriteAOD():
            # schedule the RoiDescriptorStore conversion
            # log.warning( "HLTTriggerResultGetter - setting up RoiWriter" )
            topSequence += RoiWriter()
            # write out the RoiDescriptorStores
            from TrigEDMConfig.TriggerEDM import TriggerRoiList
            objKeyStore.addManyTypesStreamAOD( TriggerRoiList )

        #Are we adding operational info objects in ESD?
        added=self._AddOPIToESD()
        if added:
            log.debug("Operational Info object HLT_EXPRESS_OPI_HLT with extra information about express stream prescaling added to the data.")
        


        # ESD objects definitions
        _TriggerESDList = {}

        from TrigEDMConfig.TriggerEDM import getTriggerEDMList 
        # we have to store xAOD containers in the root file, NOT AOD,
        # if the xAOD container list is not empty
        if(xAODContainers):
            _TriggerESDList.update( xAODContainers )
        else:
            _TriggerESDList.update( getTriggerEDMList(TriggerFlags.ESDEDMSet(),  TriggerFlags.EDMDecodingVersion()) ) 
        
        log.info("ESD content set according to the ESDEDMSet flag: %s and EDM version %d" % (TriggerFlags.ESDEDMSet() ,TriggerFlags.EDMDecodingVersion()) )

        # AOD objects choice
        _TriggerAODList = {}
        
        #from TrigEDMConfig.TriggerEDM import getAODList    
        _TriggerAODList.update( getTriggerEDMList(TriggerFlags.AODEDMSet(),  TriggerFlags.EDMDecodingVersion()) ) 

        log.info("AOD content set according to the AODEDMSet flag: %s and EDM version %d" % (TriggerFlags.AODEDMSet(),TriggerFlags.EDMDecodingVersion()) )

        log.debug("ESD EDM list: %s", _TriggerESDList)
        log.debug("AOD EDM list: %s", _TriggerAODList)
        
        # Highlight what is in AOD list but not in ESD list, as this can cause
        # the "different number of entries in branch" problem, when it is in the
        # AOD list but the empty container per event is not created
        # Just compares keys of dicts, which are the class names, not their string keys in StoreGate
        not_in = [ element for element in  _TriggerAODList if element not in _TriggerESDList ]
        if (len(not_in)>0):
            log.warning("In AOD list but not in ESD list: ")
            log.warning(not_in)
        else:
            log.info("AOD list is subset of ESD list - good.")


        def _addSlimming(stream, thinningSvc, edm):
            from AthenaCommon.AlgSequence import AlgSequence 
            topSequence = AlgSequence()
            from TrigNavTools.TrigNavToolsConf import HLT__StreamTrigNavSlimming, HLT__TrigNavigationSlimming
            from TrigNavTools.TrigNavToolsConfig import navigationSlimming

            edmlist = list(y.split('-')[0] for x in edm.values() for y in x) #flatten names
          
            # from HLT result drop unrecorded features
            # slimmerHLT = HLT__StreamTrigNavSlimming('HLTNavSlimmer_%s'%stream)
            slimmerHLT = HLT__TrigNavigationSlimming('TrigNavigationSlimmer_%s'%stream)
            tHLT = navigationSlimming({'name':'HLTNav_%s'%stream, 'mode':'cleanup', 
                                                          'ThinningSvc':thinningSvc, 'result':'HLTResult_HLT',
                                                          'features':edmlist})
            #tHLT.SlimmingTool.OutputLevel=DEBUG
            tHLT.ActInPlace=True
            slimmerHLT.ThinningTool = tHLT
            print slimmerHLT.ThinningTool
            topSequence += slimmerHLT
            log.info("Configured slimming of HLT")
            del edmlist


        from AthenaCommon.AppMgr import ServiceMgr as svcMgr
        from AthenaServices.Configurables import ThinningSvc, createThinningSvc
        
        _doSlimming = True
        if _doSlimming and rec.readRDO() and rec.doWriteAOD():
            if not hasattr(svcMgr, 'ThinningSvc'): # if the default is there it is configured for AODs
                svcMgr += ThinningSvc(name='ThinningSvc', Streams=['StreamAOD'])             
            _addSlimming('StreamAOD', svcMgr.ThinningSvc, _TriggerESDList ) #Use ESD item list also for AOD!
            log.info("configured navigation slimming for AOD output")
            
        if _doSlimming and rec.readRDO() and rec.doWriteESD(): #rec.doWriteESD() and not rec.readESD(): 
            if not  hasattr(svcMgr, 'ESDThinningSvc'):
                svcMgr += ThinningSvc(name='ESDThinningSvc', Streams=['StreamESD']) # the default is configured for AODs
            _addSlimming('StreamESD', svcMgr.ESDThinningSvc, _TriggerESDList )                
            log.info("configured navigation slimming for ESD output")              
            



        objKeyStore.addManyTypesStreamESD( _TriggerESDList )                        
        objKeyStore.addManyTypesStreamAOD( _TriggerAODList )        
            
        return True
Example #6
0
print 'SINGLE PARTICLE GENERATOR'

## Run ParticleGun
import AthenaCommon.AtlasUnixGeneratorJob

from AthenaCommon.AlgSequence import AlgSequence
topSeq = AlgSequence()

import ParticleGun as PG
from G4AtlasApps.SimFlags import simFlags
pg = PG.ParticleGun(randomSvcName=simFlags.RandomSvc.get_Value(), randomStream="SINGLE")
pg.sampler.pid = 13
pg.sampler.mom = PG.EEtaMPhiSampler(energy=10000, eta=[-1,1])
topSeq += pg

try:
    from GeneratorModules.GeneratorModulesConf import CopyEventWeight
    topSeq += CopyEventWeight(TruthCollKey="GEN_EVENT")
except:
    include("G4AtlasApps/fragment.SimCopyWeights.py")
include.block("PhysicsD3PDMaker/ElectronSelector.py")

from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags

from D2PDMaker.D2PDMakerConf import D2PDElectronSelector
from D2PDMaker.D2PDMakerConf import D2PDParticleCombiner

## Import the module that allows to use named units, e.g. GeV
import AthenaCommon.SystemOfUnits as Units

## Get pre sequence
from AthenaCommon.AlgSequence import AlgSequence
preseq = AlgSequence(D3PDMakerFlags.PreD3PDAlgSeqName())

## Define event selector
from D2PDMaker.D2PDMakerConf import D2PDElectronSelector
preseq += D2PDElectronSelector(
    "WPrimeElectronSelector",
    OutputLevel=INFO,
    inputCollection='ElectronAODCollection',
    minNumberPassed=1,
    ptMin=20.0 * Units.GeV,
)
Example #8
0
if hasattr(runArgs, "preInclude"):
    for fragment in runArgs.preInclude:
        include(fragment)

#========================================================
# Central topOptions (this is one is a string not a list)
#========================================================
if hasattr(runArgs, "topOptions"): include(runArgs.topOptions)
else: include("RecExCommon/RecExCommon_topOptions.py")

# Intervene and strip SkimmingTools from algs if pass through mode requested
# recusion is necessary to ensure all kernels from all subsequences are
# caught
if passThroughMode:
    sequenceList = []
    mainSeq = AlgSequence()
    getSubSequences(mainSeq, sequenceList)
    for seq in sequenceList:
        for item in seq:
            if isinstance(item, DerivationFramework__DerivationKernel):
                item.SkimmingTools = []
    msg.info(
        'Pass through mode was requested. Skimming tools have been removed from all kernels.'
    )

## Post-include
if hasattr(runArgs, "postInclude"):
    for fragment in runArgs.postInclude:
        include(fragment)

## Post-exec
Example #9
0
include("EventAthenaPool/EventAthenaPool_joboptions.py")

from AthenaCommon.AppMgr import ServiceMgr as svcMgr
from AthenaCommon.AppMgr import theApp

# Input AOD file
ServiceMgr.EventSelector.InputCollections = [
    "/afs/cern.ch/user/r/radbal/scratch0/data/TopMix/user.RichardHawkings.0108175.topmix_Muon.AOD.v4._00057.pool.root"
]

# Number of Events to process
if not "EvtMax" in dir(): EvtMax = 5
theApp.EvtMax = EvtMax

# the Top Algorithm Sequence
topSequence = AlgSequence()

# Add the service and configure
from LumiBlockComps.LumiBlockCompsConf import LumiCalcSvc
LumiCalcSvc = LumiCalcSvc()
LumiCalcSvc.Triggers = ["EF_mu20"]
LumiCalcSvc.UseMC = True
# explicit list of LumiBlockCollections names
LumiCalcSvc.LBCollNames = ["LumiBlocks", "IncompleteLumiBlocks"]
LumiCalcSvc.Verbose = False
# NOTE: UseInputStore must be *False* by default BUT just for this example we set it to True
LumiCalcSvc.UseInputStore = True
svcMgr += LumiCalcSvc

# Add LumiCalcPyAthena Alg
from LumiBlockComps.LumiCalcPyAthena import LumiCalcPyAthena
Example #10
0
def AddConfiguredMuonTPAlg(name_suffix  = "MuonProbe",
                            MatchContainer = "Muons",
                            doIso = True,
                            doTrig = True,
                            doTrigEtaSlices    = True, 
                            doIsolEtaSlices    = False, 
                            doIsolPlots      = False,
                            doTriggerPlots      = True,
                            writeNtuple    = False,
                            doClosure      = False,
                            doDRSys    = False,
                            doDPhiTPSys    = False,
                            doProbeCharSys = False,
                            doVeryLooseProbes = False,
                            doLooseProbes   = False,
                            doMediumProbes  = False,
                            doTightProbes   = False,
                            doHighPtProbes   = False,
                            doTruthProbes   = False,
                            DoProbeMatchPlots=True,
                            ProduceEfficiencies=False,
                            doL1 = False,
                            doL2 = False, doEF = False,
                            doHLT = False
                ):
    
    from AthenaCommon.AlgSequence import AlgSequence
    from AthenaCommon.AppMgr import ToolSvc
    job = AlgSequence()

    MuonContainerToUse = "Muons"
    if hasattr(job, "MuonQualityUpdater"):
        MuonContainerToUse = "UpdatedMuons"

    ProbeContainer = MuonContainerToUse
    theAlg = CommonMuonTPConfig.AddTagProbeAlg(name="ZmumuMuProbeAlg_%s"%name_suffix, ProbeCont=ProbeContainer, MatchCont=MatchContainer)
    theAlg.TopLevelFolderName = "ZmumuTPMuon"

    SelectionTools = []
    
    if doLooseProbes:
        SelecToolsOC_LooseProbes = CommonMuonTPConfig.AddZmumuTPSelectionTool(name="ZmumuTPSelectionTool_OC_LooseProbes_%s"%name_suffix,EffiFlag="%s_OC_LooseProbes"%name_suffix, ProbeType="Loose")
        SelecToolsOC_LooseProbes.UseLooseProbes = True
        SelectionTools.append(SelecToolsOC_LooseProbes)
        
        SelecToolsSC_LooseProbes = CommonMuonTPConfig.AddZmumuTPSelectionTool(name="ZmumuTPSelectionTool_SC_LooseProbes_%s"%name_suffix,EffiFlag="%s_SC_LooseProbes"%name_suffix, ProbeType="Loose", SameSign=True)
        SelecToolsSC_LooseProbes.UseLooseProbes = True
        SelectionTools.append(SelecToolsSC_LooseProbes)

        
        if doDPhiTPSys:
            SelecToolsOC_LooseProbesDPhiCut = CommonMuonTPConfig.AddZmumuTPSelectionTool(name="ZmumuTPSelectionTool_OC_LooseProbesDPhiCut_%s"%name_suffix,EffiFlag="%s_OC_LooseProbesDPhiCut"%name_suffix, ProbeType="Loose")
            SelecToolsOC_LooseProbesDPhiCut.DeltaPhiCut  = 3.04
            SelecToolsOC_LooseProbesDPhiCut.IsNominal = False
            SelectionTools.append(SelecToolsOC_LooseProbesDPhiCut)
            
            SelecToolsSC_LooseProbesDPhiCut = CommonMuonTPConfig.AddZmumuTPSelectionTool(name="ZmumuTPSelectionTool_SC_LooseProbesDPhiCut_%s"%name_suffix,EffiFlag="%s_SC_LooseProbesDPhiCut"%name_suffix, ProbeType="Loose", SameSign=True)
            SelecToolsSC_LooseProbesDPhiCut.DeltaPhiCut  = 3.04
            SelecToolsSC_LooseProbesDPhiCut.IsNominal = False
            SelectionTools.append(SelecToolsSC_LooseProbesDPhiCut)

        if doProbeCharSys:
            SelecToolsOC_LooseProbesPos = CommonMuonTPConfig.AddZmumuTPSelectionTool(name="ZmumuTPSelectionTool_OC_LooseProbesPos_%s"%name_suffix,EffiFlag="%s_OC_LooseProbesPos"%name_suffix, ProbeType="Loose")
            SelecToolsOC_LooseProbesPos.doProbeChargeSys = True
            SelecToolsOC_LooseProbesPos.ProbeCharge = "positive"
            SelecToolsOC_LooseProbesPos.IsNominal = False
            SelectionTools.append(SelecToolsOC_LooseProbesPos)

            SelecToolsOC_LooseProbesNeg = CommonMuonTPConfig.AddZmumuTPSelectionTool(name="ZmumuTPSelectionTool_OC_LooseProbesNeg_%s"%name_suffix,EffiFlag="%s_OC_LooseProbesNeg"%name_suffix, ProbeType="Loose")
            SelecToolsOC_LooseProbesNeg.doProbeChargeSys = True
            SelecToolsOC_LooseProbesNeg.IsNominal = False
            SelecToolsOC_LooseProbesNeg.ProbeCharge = "negative"
            SelectionTools.append(SelecToolsOC_LooseProbesNeg)
            
            
            SelecToolsSC_LooseProbesPos = CommonMuonTPConfig.AddZmumuTPSelectionTool(name="ZmumuTPSelectionTool_SC_LooseProbesPos_%s"%name_suffix,EffiFlag="%s_SC_LooseProbesPos"%name_suffix, ProbeType="Loose", SameSign=True)
            SelecToolsSC_LooseProbesPos.doProbeChargeSys = True
            SelecToolsSC_LooseProbesPos.ProbeCharge = "positive"
            SelecToolsSC_LooseProbesPos.IsNominal = False
            SelectionTools.append(SelecToolsSC_LooseProbesPos)

            SelecToolsSC_LooseProbesNeg = CommonMuonTPConfig.AddZmumuTPSelectionTool(name="ZmumuTPSelectionTool_SC_LooseProbesNeg_%s"%name_suffix,EffiFlag="%s_SC_LooseProbesNeg"%name_suffix, ProbeType="Loose", SameSign=True)
            SelecToolsSC_LooseProbesNeg.doProbeChargeSys = True
            SelecToolsSC_LooseProbesNeg.IsNominal = False
            SelecToolsSC_LooseProbesNeg.ProbeCharge = "negative"
            SelectionTools.append(SelecToolsSC_LooseProbesNeg)

    
    if doMediumProbes:
        SelecToolsOC_MediumProbes = CommonMuonTPConfig.AddZmumuTPSelectionTool(name="ZmumuTPSelectionTool_OC_MediumProbes_%s"%name_suffix,EffiFlag="%s_OC_MediumProbes"%name_suffix, ProbeType="Medium")
        SelecToolsOC_MediumProbes.UseMediumProbes = True
        SelectionTools.append(SelecToolsOC_MediumProbes)
        
        SelecToolsSC_MediumProbes = CommonMuonTPConfig.AddZmumuTPSelectionTool(name="ZmumuTPSelectionTool_SC_MediumProbes_%s"%name_suffix,EffiFlag="%s_SC_MediumProbes"%name_suffix, ProbeType="Medium", SameSign=True)
        SelecToolsSC_MediumProbes.UseMediumProbes = True
        SelectionTools.append(SelecToolsSC_MediumProbes)

        
        if doDPhiTPSys:
            SelecToolsOC_MediumProbesDPhiCut = CommonMuonTPConfig.AddZmumuTPSelectionTool(name="ZmumuTPSelectionTool_OC_MediumProbesDPhiCut_%s"%name_suffix,EffiFlag="%s_OC_MediumProbesDPhiCut"%name_suffix, ProbeType="Medium")
            SelecToolsOC_MediumProbesDPhiCut.DeltaPhiCut  = 3.04
            SelecToolsOC_MediumProbesDPhiCut.IsNominal = False
            SelectionTools.append(SelecToolsOC_MediumProbesDPhiCut)
            
            SelecToolsSC_MediumProbesDPhiCut = CommonMuonTPConfig.AddZmumuTPSelectionTool(name="ZmumuTPSelectionTool_SC_MediumProbesDPhiCut_%s"%name_suffix,EffiFlag="%s_SC_MediumProbesDPhiCut"%name_suffix, ProbeType="Medium", SameSign=True)
            SelecToolsSC_MediumProbesDPhiCut.DeltaPhiCut  = 3.04
            SelecToolsSC_MediumProbesDPhiCut.IsNominal = False
            SelectionTools.append(SelecToolsSC_MediumProbesDPhiCut)

        if doProbeCharSys:
            SelecToolsOC_MediumProbesPos = CommonMuonTPConfig.AddZmumuTPSelectionTool(name="ZmumuTPSelectionTool_OC_MediumProbesPos_%s"%name_suffix,EffiFlag="%s_OC_MediumProbesPos"%name_suffix, ProbeType="Medium")
            SelecToolsOC_MediumProbesPos.doProbeChargeSys = True
            SelecToolsOC_MediumProbesPos.ProbeCharge = "positive"
            SelecToolsOC_MediumProbesPos.IsNominal = False
            SelectionTools.append(SelecToolsOC_MediumProbesPos)

            SelecToolsOC_MediumProbesNeg = CommonMuonTPConfig.AddZmumuTPSelectionTool(name="ZmumuTPSelectionTool_OC_MediumProbesNeg_%s"%name_suffix,EffiFlag="%s_OC_MediumProbesNeg"%name_suffix, ProbeType="Medium")
            SelecToolsOC_MediumProbesNeg.doProbeChargeSys = True
            SelecToolsOC_MediumProbesNeg.IsNominal = False
            SelecToolsOC_MediumProbesNeg.ProbeCharge = "negative"
            SelectionTools.append(SelecToolsOC_MediumProbesNeg)
            
            
            SelecToolsSC_MediumProbesPos = CommonMuonTPConfig.AddZmumuTPSelectionTool(name="ZmumuTPSelectionTool_SC_MediumProbesPos_%s"%name_suffix,EffiFlag="%s_SC_MediumProbesPos"%name_suffix, ProbeType="Medium", SameSign=True)
            SelecToolsSC_MediumProbesPos.doProbeChargeSys = True
            SelecToolsSC_MediumProbesPos.ProbeCharge = "positive"
            SelecToolsSC_MediumProbesPos.IsNominal = False
            SelectionTools.append(SelecToolsSC_MediumProbesPos)

            SelecToolsSC_MediumProbesNeg = CommonMuonTPConfig.AddZmumuTPSelectionTool(name="ZmumuTPSelectionTool_SC_MediumProbesNeg_%s"%name_suffix,EffiFlag="%s_SC_MediumProbesNeg"%name_suffix, ProbeType="Medium", SameSign=True)
            SelecToolsSC_MediumProbesNeg.doProbeChargeSys = True
            SelecToolsSC_MediumProbesNeg.IsNominal = False
            SelecToolsSC_MediumProbesNeg.ProbeCharge = "negative"
            SelectionTools.append(SelecToolsSC_MediumProbesNeg)

    if doTightProbes:
        SelecToolsOC_TightProbes = CommonMuonTPConfig.AddZmumuTPSelectionTool(name="ZmumuTPSelectionTool_OC_TightProbes_%s"%name_suffix,EffiFlag="%s_OC_TightProbes"%name_suffix, ProbeType="Tight")
        SelecToolsOC_TightProbes.UseTightProbes = True
        SelectionTools.append(SelecToolsOC_TightProbes)
        
        SelecToolsSC_TightProbes = CommonMuonTPConfig.AddZmumuTPSelectionTool(name="ZmumuTPSelectionTool_SC_TightProbes_%s"%name_suffix,EffiFlag="%s_SC_TightProbes"%name_suffix, ProbeType="Tight", SameSign=True)
        SelecToolsSC_TightProbes.UseTightProbes = True
        SelectionTools.append(SelecToolsSC_TightProbes)

        
        if doDPhiTPSys:
            SelecToolsOC_TightProbesDPhiCut = CommonMuonTPConfig.AddZmumuTPSelectionTool(name="ZmumuTPSelectionTool_OC_TightProbesDPhiCut_%s"%name_suffix,EffiFlag="%s_OC_TightProbesDPhiCut"%name_suffix, ProbeType="Tight")
            SelecToolsOC_TightProbesDPhiCut.DeltaPhiCut  = 3.04
            SelecToolsOC_TightProbesDPhiCut.IsNominal = False
            SelectionTools.append(SelecToolsOC_TightProbesDPhiCut)
            
            SelecToolsSC_TightProbesDPhiCut = CommonMuonTPConfig.AddZmumuTPSelectionTool(name="ZmumuTPSelectionTool_SC_TightProbesDPhiCut_%s"%name_suffix,EffiFlag="%s_SC_TightProbesDPhiCut"%name_suffix, ProbeType="Tight", SameSign=True)
            SelecToolsSC_TightProbesDPhiCut.DeltaPhiCut  = 3.04
            SelecToolsSC_TightProbesDPhiCut.IsNominal = False
            SelectionTools.append(SelecToolsSC_TightProbesDPhiCut)

        if doProbeCharSys:
            SelecToolsOC_TightProbesPos = CommonMuonTPConfig.AddZmumuTPSelectionTool(name="ZmumuTPSelectionTool_OC_TightProbesPos_%s"%name_suffix,EffiFlag="%s_OC_TightProbesPos"%name_suffix, ProbeType="Tight")
            SelecToolsOC_TightProbesPos.doProbeChargeSys = True
            SelecToolsOC_TightProbesPos.ProbeCharge = "positive"
            SelecToolsOC_TightProbesPos.IsNominal = False
            SelectionTools.append(SelecToolsOC_TightProbesPos)

            SelecToolsOC_TightProbesNeg = CommonMuonTPConfig.AddZmumuTPSelectionTool(name="ZmumuTPSelectionTool_OC_TightProbesNeg_%s"%name_suffix,EffiFlag="%s_OC_TightProbesNeg"%name_suffix, ProbeType="Tight")
            SelecToolsOC_TightProbesNeg.doProbeChargeSys = True
            SelecToolsOC_TightProbesNeg.IsNominal = False
            SelecToolsOC_TightProbesNeg.ProbeCharge = "negative"
            SelectionTools.append(SelecToolsOC_TightProbesNeg)
            
            
            SelecToolsSC_TightProbesPos = CommonMuonTPConfig.AddZmumuTPSelectionTool(name="ZmumuTPSelectionTool_SC_TightProbesPos_%s"%name_suffix,EffiFlag="%s_SC_TightProbesPos"%name_suffix, ProbeType="Tight", SameSign=True)
            SelecToolsSC_TightProbesPos.doProbeChargeSys = True
            SelecToolsSC_TightProbesPos.ProbeCharge = "positive"
            SelecToolsSC_TightProbesPos.IsNominal = False
            SelectionTools.append(SelecToolsSC_TightProbesPos)

            SelecToolsSC_TightProbesNeg = CommonMuonTPConfig.AddZmumuTPSelectionTool(name="ZmumuTPSelectionTool_SC_TightProbesNeg_%s"%name_suffix,EffiFlag="%s_SC_TightProbesNeg"%name_suffix, ProbeType="Tight", SameSign=True)
            SelecToolsSC_TightProbesNeg.doProbeChargeSys = True
            SelecToolsSC_TightProbesNeg.IsNominal = False
            SelecToolsSC_TightProbesNeg.ProbeCharge = "negative"
            SelectionTools.append(SelecToolsSC_TightProbesNeg)


    if doHighPtProbes:
        SelecToolsOC_HighPtProbes = CommonMuonTPConfig.AddZmumuTPSelectionTool(name="ZmumuTPSelectionTool_OC_HighPtProbes_%s"%name_suffix,EffiFlag="%s_OC_HighPtProbes"%name_suffix, ProbeType="HighPt")
        SelecToolsOC_HighPtProbes.UseHighPtProbes = True
        SelectionTools.append(SelecToolsOC_HighPtProbes)
        
        SelecToolsSC_HighPtProbes = CommonMuonTPConfig.AddZmumuTPSelectionTool(name="ZmumuTPSelectionTool_SC_HighPtProbes_%s"%name_suffix,EffiFlag="%s_SC_HighPtProbes"%name_suffix, ProbeType="HighPt", SameSign=True)
        SelecToolsSC_HighPtProbes.UseHighPtProbes = True
        SelectionTools.append(SelecToolsSC_HighPtProbes)

        
        if doDPhiTPSys:
            SelecToolsOC_HighPtProbesDPhiCut = CommonMuonTPConfig.AddZmumuTPSelectionTool(name="ZmumuTPSelectionTool_OC_HighPtProbesDPhiCut_%s"%name_suffix,EffiFlag="%s_OC_HighPtProbesDPhiCut"%name_suffix, ProbeType="HighPt")
            SelecToolsOC_HighPtProbesDPhiCut.DeltaPhiCut  = 3.04
            SelecToolsOC_HighPtProbesDPhiCut.IsNominal = False
            SelectionTools.append(SelecToolsOC_HighPtProbesDPhiCut)
            
            SelecToolsSC_HighPtProbesDPhiCut = CommonMuonTPConfig.AddZmumuTPSelectionTool(name="ZmumuTPSelectionTool_SC_HighPtProbesDPhiCut_%s"%name_suffix,EffiFlag="%s_SC_HighPtProbesDPhiCut"%name_suffix, ProbeType="HighPt", SameSign=True)
            SelecToolsSC_HighPtProbesDPhiCut.DeltaPhiCut  = 3.04
            SelecToolsSC_HighPtProbesDPhiCut.IsNominal = False
            SelectionTools.append(SelecToolsSC_HighPtProbesDPhiCut)

        if doProbeCharSys:
            SelecToolsOC_HighPtProbesPos = CommonMuonTPConfig.AddZmumuTPSelectionTool(name="ZmumuTPSelectionTool_OC_HighPtProbesPos_%s"%name_suffix,EffiFlag="%s_OC_HighPtProbesPos"%name_suffix, ProbeType="HighPt")
            SelecToolsOC_HighPtProbesPos.doProbeChargeSys = True
            SelecToolsOC_HighPtProbesPos.ProbeCharge = "positive"
            SelecToolsOC_HighPtProbesPos.IsNominal = False
            SelectionTools.append(SelecToolsOC_HighPtProbesPos)

            SelecToolsOC_HighPtProbesNeg = CommonMuonTPConfig.AddZmumuTPSelectionTool(name="ZmumuTPSelectionTool_OC_HighPtProbesNeg_%s"%name_suffix,EffiFlag="%s_OC_HighPtProbesNeg"%name_suffix, ProbeType="HighPt")
            SelecToolsOC_HighPtProbesNeg.doProbeChargeSys = True
            SelecToolsOC_HighPtProbesNeg.IsNominal = False
            SelecToolsOC_HighPtProbesNeg.ProbeCharge = "negative"
            SelectionTools.append(SelecToolsOC_HighPtProbesNeg)
            
            
            SelecToolsSC_HighPtProbesPos = CommonMuonTPConfig.AddZmumuTPSelectionTool(name="ZmumuTPSelectionTool_SC_HighPtProbesPos_%s"%name_suffix,EffiFlag="%s_SC_HighPtProbesPos"%name_suffix, ProbeType="HighPt", SameSign=True)
            SelecToolsSC_HighPtProbesPos.doProbeChargeSys = True
            SelecToolsSC_HighPtProbesPos.ProbeCharge = "positive"
            SelecToolsSC_HighPtProbesPos.IsNominal = False
            SelectionTools.append(SelecToolsSC_HighPtProbesPos)

            SelecToolsSC_HighPtProbesNeg = CommonMuonTPConfig.AddZmumuTPSelectionTool(name="ZmumuTPSelectionTool_SC_HighPtProbesNeg_%s"%name_suffix,EffiFlag="%s_SC_HighPtProbesNeg"%name_suffix, ProbeType="HighPt", SameSign=True)
            SelecToolsSC_HighPtProbesNeg.doProbeChargeSys = True
            SelecToolsSC_HighPtProbesNeg.IsNominal = False
            SelecToolsSC_HighPtProbesNeg.ProbeCharge = "negative"
            SelectionTools.append(SelecToolsSC_HighPtProbesNeg)
            
            
    from AthenaCommon.GlobalFlags import globalflags
    if doTruthProbes and not globalflags.DataSource()=='data':
        SelecToolsOC_TruthProbes = CommonMuonTPConfig.AddZmumuTPSelectionTool(name="ZmumuTPSelectionTool_OC_TruthProbes_%s"%name_suffix,EffiFlag="%s_TruthProbes"%name_suffix, ProbeType="TruthMatchedMuons")
        SelectionTools.append(SelecToolsOC_TruthProbes)
        
        
    for thetool in SelectionTools:
        thetool.ProbeTrackIsoCut = -1
        thetool.ProbeTrackAntiIsoCut = -1
        thetool.ProbeCaloIsoCut = -1
        thetool.ProbeCaloAntiIsoCut = -1
        # also accept high eta muons
        thetool.ProbeEtaCut = 4.5   
        
    PlotTools = []
    
    # first the trigger plots 
    if doTrig and doTriggerPlots:
        PlotTools += ZmumuTPTrigAnalysis.AddTrigPlots(name_suffix=name_suffix,
                                        doEtaSlices=doTrigEtaSlices,
                                        doClosure=doClosure,
                                        DoProbeMatchPlots=DoProbeMatchPlots,
                                        ProduceEfficiencies=ProduceEfficiencies)
    # then the isolation plots
    if doIso and doIsolPlots:
        PlotTools += ZmumuTPIsolAnalysis.AddIsolPlots(name_suffix=name_suffix,
                                        doEtaSlices=doIsolEtaSlices,
                                        doClosure=doClosure,
                                        DoProbeMatchPlots=DoProbeMatchPlots,
                                        ProduceEfficiencies=ProduceEfficiencies)
        
    
    MatchingTools = []
    if doTrig:
        MatchingTools += ZmumuTPTrigAnalysis.AddTrigMatchTools(name_suffix=name_suffix,doL1 = doL1, doL2=doL2, doEF=doEF,doHLT=doHLT,doDRSys=doDRSys)
    if doIso:
        MatchingTools += ZmumuTPIsolAnalysis.AddIsolMatchTools(name_suffix=name_suffix)
    
    
    ntuples = []
    if writeNtuple:
        ntuples.append(CommonMuonTPConfig.AddTreeTool(name="ZmumuTPMuonTreeTool_%s"%name_suffix, EffiFlag="Trees",WriteSFInfo=doClosure))
    
    for ntuple in ntuples:
        if doIso:
            ntuple.AddExtendedIsolation = True
        
    # create the TP tool itself
    TheTPTool = CommonMuonTPConfig.AddMuonTPTool(name = "MuonProbeTPTool_%s"%name_suffix,EffiFlag=name_suffix)
    TheTPTool.MuonTPSelectionTools  = SelectionTools
    TheTPTool.PlottingTools         = PlotTools
    TheTPTool.MuonTPEfficiencyTools = MatchingTools
    TheTPTool.TreeTools             = ntuples
    theAlg.MuonTPTools += [TheTPTool]
Example #11
0
    def configure(self):
        mlog = logging.getLogger('METRefGetter::configure:')
        mlog.info('entering')

        # now configure the algorithm
        try:
            from MissingET.MissingETConf import METRefinedAlgorithm
            theMETRefAlg = METRefinedAlgorithm("METRefAlg")

            from RecExConfig.RecFlags import rec
            if rec.readAOD():
                theMETRefAlg.UseCells = False
            else:
                theMETRefAlg.UseCells = True
        except:
            mlog.error("could not import MissingET.METRefAlg")
            print traceback.format_exc()
            return False
#------------------------------------------------------------------------------------------------
# configure the tools: METRefinedEleTool => calibrator Tool for ATLFASTII

        try:
            from MissingET.MissingETConf import METRefinedEleTool
            theMETRefinedEleTool = METRefinedEleTool("METRefEle")
            theMETRefinedEleTool.OutputLevel = DEBUG
            # refEleTool = theMETRefinedEleTool.getHandle()
            if rec.readAOD():
                theMETRefinedEleTool.EleInputCollectionKey = "ElectronAODCollection"
            else:
                theMETRefinedEleTool.EleInputCollectionKey = "ElectronCollection"
            theMETRefinedEleTool.isEM = 0
            theMETRefinedEleTool.ElectronEtCut = 10.0 * GeV
            theMETRefinedEleTool.CalibType = "EmScale"  # H1 or EmScale or KFact or RefCalib
            # if doFastCaloSim set calibrator tool for ATLFAST2
            from CaloRec.CaloCellFlags import jobproperties
            if jobproperties.CaloCellFlags.doFastCaloSim:
                doAtlfastII = True
            else:
                doAtlfastII = False

            cellcalibtool = getStandardCalibTool(doAtlfastII)
            calibtool_name = cellcalibtool.name()
            theMETRefinedEleTool.CalibToolName = 'H1WeightToolCSC12Generic/' + calibtool_name

            theMETRefinedEleTool.BackNavigationTo = "Cell"  # to "Cell"
            theMETRefinedEleTool.MissingETOutKey = "MET_RefEle"
            print "******************* key = " + theMETRefinedEleTool.MissingETOutKey
            #-----------------
            from MissingET.MissingETConf import METClusterResolverTool
            theMETEleResolver = METClusterResolverTool("EleResolve")
            theMETEleResolver.ReferenceClusterContainer = "CaloCalTopoCluster"
            theMETRefinedEleTool.ClusterResolverTool = theMETEleResolver.getFullName(
            )

            #------------------------------------------------------------------------------------
            theMETRefinedGammaTool = METRefinedEleTool("METRefGamma")
            if rec.readAOD():
                theMETRefinedGammaTool.EleInputCollectionKey = "PhotonAODCollection"
            else:
                theMETRefinedGammaTool.EleInputCollectionKey = "PhotonCollection"
            theMETRefinedGammaTool.isEM = 0
            theMETRefinedGammaTool.ElectronEtCut = 10.0 * GeV
            theMETRefinedGammaTool.CalibType = "EmScale"  # H1 or EmScale or KFact or RefCalib
            from CaloRec.CaloCellFlags import jobproperties
            if jobproperties.CaloCellFlags.doFastCaloSim:
                doAtlfastII = True
            else:
                doAtlfastII = False
            cellcalibtool = getStandardCalibTool(doAtlfastII)
            calibtool_name = cellcalibtool.name()
            theMETRefinedGammaTool.CalibToolName = 'H1WeightToolCSC12Generic/' + calibtool_name

            theMETRefinedGammaTool.BackNavigationTo = "Cell"  # to "Cell"
            theMETRefinedGammaTool.MissingETOutKey = "MET_RefGamma"
            #-----------------
            theMETGammaResolver = METClusterResolverTool("GammaResolve")
            theMETGammaResolver.ReferenceClusterContainer = "CaloCalTopoCluster"
            theMETRefinedGammaTool.ClusterResolverTool = theMETGammaResolver.getFullName(
            )

        except:
            mlog.error("could not get handle to METRefinedEleTool Quit")
            print traceback.format_exc()
            return False

# add cellcalibtool
        theMETRefinedEleTool += cellcalibtool
        theMETRefinedEleTool += theMETEleResolver
        theMETRefinedGammaTool += cellcalibtool
        theMETRefinedGammaTool += theMETGammaResolver

        # add the METRefinedEleTool to list of tools
        theMETRefAlg.AlgTools += [theMETRefinedEleTool.getFullName()]
        theMETRefAlg.AlgTools += [theMETRefinedGammaTool.getFullName()]

        # add tools to alg
        theMETRefAlg += theMETRefinedEleTool
        theMETRefAlg += theMETRefinedGammaTool
        #theMETRefAlg.OutputLevel = DEBUG

        #------------------------------------------------------------------------------------------------
        # configure tools: METRefinedTauTool => calibrator Tool for ATLFASTII
        if not rec.readAOD():
            try:
                from MissingET.MissingETConf import METRefinedTauTool
                theMETRefinedTauTool = METRefinedTauTool("METRefTau")

                theMETRefinedTauTool.TauInputCollectionKey = "TauRecContainer"  # or Tau1P3PContainer
                theMETRefinedTauTool.isTau = "Old"  # Tight, Medium, Loose
                theMETRefinedTauTool.CalibType = "H1"  # H1 or LocHad
                # if doFastCaloSim set calibrator tool for ATLFAST2
                from CaloRec.CaloCellFlags import jobproperties
                if jobproperties.CaloCellFlags.doFastCaloSim:
                    doAtlfastII = True
                else:
                    doAtlfastII = False

                cellcalibtool = getStandardCalibTool(doAtlfastII)
                calibtool_name = cellcalibtool.name()
                theMETRefinedTauTool.CalibToolName = 'H1WeightToolCSC12Generic/' + calibtool_name

                theMETRefinedTauTool.BackNavigationTo = "Topo"
                theMETRefinedTauTool.Cell2ClusterMapKey = "CaloCell2TopoCluster"
                theMETRefinedTauTool.MissingETOutKey = "MET_RefTau"

            except:
                mlog.error("could not get handle to METRefinedTauTool Quit")
                print traceback.format_exc()
                return False

# add cellcalibtool
            theMETRefinedTauTool += cellcalibtool

            # add  METRefinedTauTool to list of tools
            theMETRefAlg.AlgTools += [theMETRefinedTauTool.getFullName()]

            # add tools to alg
            theMETRefAlg += theMETRefinedTauTool

        #------------------------------------------------------------------------------------------------
        # configure tools: METRefinedJetTool => calibrator Tool for ATLFASTII
        try:
            from MissingET.MissingETConf import METRefinedJetTool
            theMETRefinedJetTool = METRefinedJetTool("METRefJet")
            if rec.readAOD():
                theMETRefinedJetTool.JetInputCollectionKey = "Cone4LCTopoJets"  # or "Cone4CalTowerJets","Cone4H1TopoJets"
                theMETRefinedJetTool.JetPtCut = 5.0 * GeV  # cut on jet pt
                theMETRefinedJetTool.CalibType = "LocHad"  # H1 or LocHad
                theMETRefinedJetTool.MissingETOutKey = "MET_RefJet"
            else:
                theMETRefinedJetTool.JetInputCollectionKey = "Cone4H1TopoJets"  # or "Cone4CalTowerJets","Cone4H1TopoJets"
                theMETRefinedJetTool.JetPtCut = 5.0 * GeV  # cut on jet pt
                theMETRefinedJetTool.CalibType = "H1"  # H1 or LocHad
                theMETRefinedJetTool.BackNavigationTo = "Topo"  # to "Topo" or to "Cell"
                theMETRefinedJetTool.MissingETOutKey = "MET_RefJet"

# if doFastCaloSim set calibrator tool for ATLFAST2
            from CaloRec.CaloCellFlags import jobproperties
            if jobproperties.CaloCellFlags.doFastCaloSim:
                doAtlfastII = True
            else:
                doAtlfastII = False
            cellcalibtool = getStandardCalibTool(doAtlfastII)
            calibtool_name = cellcalibtool.name()
            theMETRefinedJetTool.CalibToolName = 'H1WeightToolCSC12Generic/' + calibtool_name

        except:
            mlog.error("could not get handle to METRefinedJetTool Quit")
            print traceback.format_exc()
            return False

        # add cellcalibtool
        theMETRefinedJetTool += cellcalibtool

        # add METRefinedJetTool to list of tools
        theMETRefAlg.AlgTools += [theMETRefinedJetTool.getFullName()]

        # add tools to alg
        theMETRefAlg += theMETRefinedJetTool
        #------------------------------------------------------------------------------------------------
        # configure tools: METRefinedClusterTool => calibrator Tool for ATLFASTII
        try:
            from MissingET.MissingETConf import METRefinedClusterTool
            #
            # set it to True for MiniJet Calibration
            doMiniJets = False

            theMETRefinedClusterTool = METRefinedClusterTool("METRefCluster")
            if rec.readAOD():
                theMETRefinedClusterTool.ClusterInputCollectionKey = "CaloCalTopoCluster"
                theMETRefinedClusterTool.CalibType = "LocHad"
                theMETRefinedClusterTool.MissingETOutKey = "MET_CellOut"
            else:
                theMETRefinedClusterTool.ClusterInputCollectionKey = "CaloTopoCluster"
                theMETRefinedClusterTool.CalibType = "H1"  # H1 or LocHad
                theMETRefinedClusterTool.MissingETOutKey = "MET_CellOut"
                # if doFastCaloSim set calibrator tool for ATLFAST2
                from CaloRec.CaloCellFlags import jobproperties
                if jobproperties.CaloCellFlags.doFastCaloSim:
                    doAtlfastII = True
                else:
                    doAtlfastII = False
                cellcalibtool = getStandardCalibTool(doAtlfastII)
                calibtool_name = cellcalibtool.name()
                theMETRefinedClusterTool.CalibToolName = 'H1WeightToolCSC12Generic/' + calibtool_name
            if doMiniJets:
                theMETRefinedClusterTool.ClusterInputCollectionKey = "CaloTopoCluster"
                theMETRefinedClusterTool.CalibType = "MiniJet"
                theMETRefinedClusterTool.MissingETOutKey = "MET_CellOut"

                miniJetFinder = getMiniJetTool()
                miniJetCalibrator = getPionWeightTool()
                theMETRefinedClusterTool += miniJetFinder
                theMETRefinedClusterTool += miniJetCalibrator

        except:
            mlog.error("could not get handle to METRefinedClusterTool Quit")
            print traceback.format_exc()
            return False

        # add cellcalibtool
        theMETRefinedClusterTool += cellcalibtool

        # add METRefinedClusterTool to list of tools
        theMETRefAlg.AlgTools += [theMETRefinedClusterTool.getFullName()]

        # add tools to alg
        theMETRefAlg += theMETRefinedClusterTool

        #------------------------------------------------------------------------------------------------
        # add algorithm to topSequence (this should always come at the end)

        mlog.info(" now adding to topSequence")
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()

        topSequence.ZeeSequence += theMETRefAlg

        return True
Example #12
0
##########################################
# Comments
# Requested for IBL Digitization studies
##########################################

from AthenaCommon.AlgSequence import AlgSequence
job = AlgSequence()

###########################################################
## Add Pixel and SCT SiHitCollections to outputStream, if required
outStreams = AlgSequence("Streams")
if hasattr(outStreams, 'StreamRDO'):
    outStream = outStreams.StreamRDO
elif hasattr(outStreams, 'Stream1'):
    # Legacy only
    # this option will be removed after 15.6.X
    outStream = outStreams.Stream1
if 'outStream' in dir():
    outStream.ItemList += ["SiHitCollection#PixelHits"]
    outStream.ItemList += ["SiHitCollection#SCT_Hits"]

###########################################################
## Disable some Pixel stuff
from PixelGeoModel.PixelGeoModelConf import PixelDetectorTool
pixelTool = PixelDetectorTool()
pixelTool.Alignable = False

from Digitization.DigitizationFlags import digitizationFlags
if not digitizationFlags.doXingByXingPileUp():
    ## Check PixelDigitization is defined in the AlgSequence
    if hasattr(job, 'PixelDigitization'):
Example #13
0
    def __init__(self,
                 extension="",
                 InputCollections=None,
                 NewTrackingCuts=None,
                 BarrelSegments=None,
                 TrackCollectionKeys=[],
                 TrackCollectionTruthKeys=[],
                 PRDtoTrackMap=''):

        from InDetRecExample.InDetJobProperties import InDetFlags
        from InDetRecExample.InDetKeys import InDetKeys
        from AthenaCommon.DetFlags import DetFlags

        import InDetRecExample.TrackingCommon as TrackingCommon
        #
        # get ToolSvc and topSequence
        #
        from AthenaCommon.AppMgr import ToolSvc
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()

        # --- Always use PRD association tool (even if only 1 collection) to remove TRT
        #     segments with significant overlaping hits
        usePrdAssociationTool = True
        #usePrdAssociationTool = True if len(InputCollections) > 0 else False

        #
        # --- get list of already associated hits (always do this, even if no other tracking ran before)
        #
        prd_to_track_map = PRDtoTrackMap
        if usePrdAssociationTool and extension != "_TRT":
            prefix = 'InDetTRTonly_'
            InDetTRTonly_PRD_Association = TrackingCommon.getInDetTrackPRD_Association(
                namePrefix=prefix,
                nameSuffix=extension,
                TracksName=list(InputCollections))

            prd_to_track_map = prefix + 'PRDtoTrackMap' + extension
            topSequence += InDetTRTonly_PRD_Association
            if (InDetFlags.doPrintConfigurables()):
                printfunc(InDetTRTonly_PRD_Association)

        #
        # Cut values and output key for the TRT segments standalone TRT track finder
        #
        if extension == "_TRT":
            # TRT track segments
            pTmin = NewTrackingCuts.minPT()
            self.__TRTStandaloneTracks = InDetKeys.TRTTracks()
        else:
            # TRT standalone
            # pTmin                      = NewTrackingCuts.minSecondaryPt()
            pTmin = NewTrackingCuts.minTRTonlyPt(
            )  # new cut parameter to make it flexible...
            self.__TRTStandaloneTracks = InDetKeys.TRTTracks_NewT()

        #
        # --- set up special Scoring Tool for standalone TRT tracks
        #
        from InDetTrackScoringTools.InDetTrackScoringToolsConf import InDet__InDetTrtTrackScoringTool
        InDetTRT_StandaloneScoringTool = InDet__InDetTrtTrackScoringTool(
            name='InDetTRT_StandaloneScoringTool' + extension,
            SummaryTool=TrackingCommon.getInDetTrackSummaryTool(),
            DriftCircleCutTool=InDetTRTDriftCircleCut,
            useAmbigFcn=True,
            useSigmaChi2=False,
            PtMin=pTmin,
            minTRTonTrk=NewTrackingCuts.minTRTonly(),
            maxEta=2.1,
            UseParameterization=NewTrackingCuts.useTRTonlyParamCuts(),
            OldTransitionLogic=NewTrackingCuts.useTRTonlyOldLogic(),
            minTRTPrecisionFraction=NewTrackingCuts.minSecondaryTRTPrecFrac())
        # InDetTRT_StandaloneScoringTool.OutputLevel = VERBOSE
        ToolSvc += InDetTRT_StandaloneScoringTool
        if (InDetFlags.doPrintConfigurables()):
            printfunc(InDetTRT_StandaloneScoringTool)

        #
        # set up TRT_SegmentToTrackTool
        #
        from AthenaCommon import CfgGetter
        from TRT_SegmentToTrackTool.TRT_SegmentToTrackToolConf import InDet__TRT_SegmentToTrackTool
        asso_tool = TrackingCommon.getInDetPRDtoTrackMapToolGangedPixels(
        ) if usePrdAssociationTool else None
        InDetTRT_SegmentToTrackTool = InDet__TRT_SegmentToTrackTool(
            name='InDetTRT_SegmentToTrackTool' + extension,
            RefitterTool=CfgGetter.getPublicTool('InDetTrackFitterTRT'),
            AssociationTool=asso_tool,
            TrackSummaryTool=TrackingCommon.getInDetTrackSummaryTool(),
            ScoringTool=InDetTRT_StandaloneScoringTool,
            Extrapolator=TrackingCommon.getInDetExtrapolator(),
            FinalRefit=True,
            MaxSharedHitsFraction=NewTrackingCuts.maxTRTonlyShared(),
            SuppressHoleSearch=True)

        ToolSvc += InDetTRT_SegmentToTrackTool
        if (InDetFlags.doPrintConfigurables()):
            printfunc(InDetTRT_SegmentToTrackTool)

        if not InDetFlags.doCosmics():
            #
            # --- TRT standalone tracks algorithm
            #

            from TRT_StandaloneTrackFinder.TRT_StandaloneTrackFinderConf import InDet__TRT_StandaloneTrackFinder
            InDetTRT_StandaloneTrackFinder = InDet__TRT_StandaloneTrackFinder(
                name='InDetTRT_StandaloneTrackFinder' + extension,
                MinNumDriftCircles=NewTrackingCuts.minTRTonly(),
                MinPt=NewTrackingCuts.minTRTonlyPt(),
                InputSegmentsLocation=BarrelSegments,
                MaterialEffects=0,
                PRDtoTrackMap=prd_to_track_map,
                OldTransitionLogic=NewTrackingCuts.useTRTonlyOldLogic(),
                OutputTracksLocation=self.__TRTStandaloneTracks,
                TRT_SegToTrackTool=InDetTRT_SegmentToTrackTool)
            #InDetTRT_StandaloneTrackFinder.OutputLevel = VERBOSE
            topSequence += InDetTRT_StandaloneTrackFinder
            if InDetFlags.doPrintConfigurables():
                printfunc(InDetTRT_StandaloneTrackFinder)

            # --- Delete TRT segments for the subdetector pattern only (back-tracking has already run by this point)
            from InDetRecExample.ConfiguredInDetSGDeletion import InDetSGDeletionAlg
            InDetSGDeletionAlg(container="Trk::SegmentCollection#",
                               key=BarrelSegments)

        else:
            #
            # --- cosmics segment to track conversion for Barrel
            #
            from AthenaCommon import CfgGetter
            from TRT_SegmentsToTrack.TRT_SegmentsToTrackConf import InDet__TRT_SegmentsToTrack
            InDetTrkSegmenttoTrk = InDet__TRT_SegmentsToTrack(
                name="InDetTRT_SegmentsToTrack_Barrel" + extension,
                InputSegmentsCollection=BarrelSegments,
                OutputTrackCollection=self.__TRTStandaloneTracks,
                TrackFitter=CfgGetter.getPublicTool('InDetTrackFitter'),
                SummaryTool=TrackingCommon.getInDetTrackSummaryToolTRTTracks(),
                AssociationTool=TrackingCommon.
                getInDetPRDtoTrackMapToolGangedPixels()
                if prd_to_track_map != '' else None,
                InputAssociationMapName=prd_to_track_map,
                MinNHit=NewTrackingCuts.minTRTonly(),
                OutlierRemoval=True,
                MaterialEffects=False)
            #InDetTrkSegmenttoTrk.OutputLevel = VERBOSE
            topSequence += InDetTrkSegmenttoTrk
            if InDetFlags.doPrintConfigurables():
                printfunc(InDetTrkSegmenttoTrk)

        #
        #
        # ------------ Track truth.
        #
        if (extension == "_TRT" or not InDetFlags.doSGDeletion()):
            if InDetFlags.doTruth():
                #
                # set up the truth info for this container
                #
                include("InDetRecExample/ConfiguredInDetTrackTruth.py")
                InDetTracksTruth = ConfiguredInDetTrackTruth(
                    self.__TRTStandaloneTracks,
                    self.__TRTStandaloneTracks + "DetailedTruth",
                    self.__TRTStandaloneTracks + "TruthCollection")
                #
                # add final output for statistics
                #
                TrackCollectionKeys += [InDetTracksTruth.Tracks()]
                TrackCollectionTruthKeys += [InDetTracksTruth.TracksTruth()]
            else:
                TrackCollectionKeys += [self.__TRTStandaloneTracks]
Example #14
0
ServiceMgr.MessageSvc.Format = "% F%50W%S%7W%R%T %0W%M"

OutputNameString = 'CheckSmearing'

if not hasattr(ServiceMgr, 'THistSvc'):
    from GaudiSvc.GaudiSvcConf import THistSvc
    ServiceMgr += THistSvc()

from AthenaCommon.AlgSequence import AlgSequence
from AthenaCommon.SystemOfUnits import *
import math

# load the tracking geometry service
from TrkDetDescrSvc.AtlasTrackingGeometrySvc import AtlasTrackingGeometrySvc

topSequence = AlgSequence()

topSequence.PixelSmearedDigitization.SiSmearedDigitizationTool.CheckSmear = True
topSequence.PixelSmearedDigitization.SiSmearedDigitizationTool.OutputLevel = OutputLevel
#topSequence.PixelSmearedDigitization.SiSmearedDigitizationTool.pitch_X=10.0*micrometer
#topSequence.PixelSmearedDigitization.SiSmearedDigitizationTool.pitch_X=0.0*micrometer
#topSequence.PixelSmearedDigitization.SiSmearedDigitizationTool.pitch_Y=55.0*micrometer
#topSequence.PixelSmearedDigitization.SiSmearedDigitizationTool.pitch_Y=0.0*micrometer
topSequence.PixelSmearedDigitization.SiSmearedDigitizationTool.TrackingGeometrySvc = AtlasTrackingGeometrySvc
topSequence.PixelSmearedDigitization.SiSmearedDigitizationTool.UseCustomGeometry = True
topSequence.PixelSmearedDigitization.SiSmearedDigitizationTool.DetectorElementMapName = "Pixel_IdHashDetElementMap"
topSequence.PixelSmearedDigitization.SiSmearedDigitizationTool.MergeClusters = False
topSequence.PixelSmearedDigitization.SiSmearedDigitizationTool.PlanarClusterContainerName = "Pixel_PlanarClusters"
topSequence.PixelSmearedDigitization.SiSmearedDigitizationTool.PRD_TruthPlanarContainerName = "PRD_MultiTruthPlanarPixel"
#topSequence.PixelSmearedDigitization.SiSmearedDigitizationTool.Nsigma = 1.0
Example #15
0
from InDetRecExample.InDetKeys import InDetKeys
InDetKeys.lockAllExceptAlias()
InDetKeys.print_JobProperties()

OutputLevel = INFO
doEdmMonitor = False
doJiveXML = False
doVP1 = False
doAuditors = False
doWriteESD = False
doWriteAOD = False

include("InDetRecExample/InDetRec_all.py")

from AthenaCommon.AlgSequence import AlgSequence
algSeq = AlgSequence()

from TrkVertexSeedFinderUtils.TrkVertexSeedFinderUtilsConf import Trk__LocalMax1DClusterFinder, Trk__VertexImageMaker

InDetMedImgClusterFinder = Trk__LocalMax1DClusterFinder(
    name="InDetMedImgClusterFinder",
    weightThreshold=0.02,
    mergeParameter=0.5,
    clusterWindowXY=3.0)
ToolSvc += InDetMedImgClusterFinder
InDetMedImgMaker = Trk__VertexImageMaker(name="InDetMedImgMaker",
                                         xbins=32,
                                         ybins=32,
                                         zbins=2048,
                                         xrange=2.0,
                                         yrange=2.0,
Example #16
0
from AthenaCommon.AlgSequence import AlgSequence

alg = AlgSequence()

#--------------------------------------------------------------
# FTK algorithm inclusions
#--------------------------------------------------------------
from AthenaCommon.AppMgr import ToolSvc
from PyJobTransforms.trfUtils import findFile
from TrigFTKSim.TrigFTKSimConf import *
from TrigFTKBankGen.TrigFTKBankGenConf import *

print "Add FTK_SGHitInput tool"
FTKSGHit = FTK_SGHitInput()
FTKSGHit.ReadTruthTracks = True
FTKSGHit.OutputLevel = INFO  # DEBUG
FTKSGHit.DoOutFileRawHits = True
ToolSvc += FTKSGHit

FTKBankGen = FTKBankGenAlgo("FTKBankGenAlgo", OutputLevel=DEBUG)
FTKBankGen.pmap_path = findFile(
    os.environ['DATAPATH'], "ftk_configuration/map_files/raw_ITkExample.pmap")
FTKBankGen.rmap_path = findFile(
    os.environ['DATAPATH'], "ftk_configuration/map_files/raw_ITkExample.tmap")
FTKBankGen.IBLMode = 0
FTKBankGen.ITkMode = True

FTKBankGen.const_test_mode = False
FTKBankGen.Clustering = False
FTKBankGen.SaveClusterContent = False
FTKBankGen.DiagClustering = True
Example #17
0
from AthenaCommon.AlgSequence import AlgSequence

job = AlgSequence("Streams")

if hasattr(job, 'StreamHITS'):
    job.StreamHITS.ItemList += ["LArHitContainer#*"]
    job.StreamHITS.ItemList += ["TileHitVector#TileHitVec_Fast"]

else:
    raise AttributeError("StreamHITS not found!")



    def __init__(self, InputTrackCollections=[], TRT_Segments_EC=None):

        from InDetRecExample.InDetJobProperties import InDetFlags
        from AthenaCommon.DetFlags import DetFlags
        from InDetRecExample.InDetKeys import InDetKeys
        #
        # get ToolSvc and topSequence
        #
        from AthenaCommon.AppMgr import ToolSvc
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()

        if InDetFlags.doPRDFormation() and DetFlags.makeRIO.TRT_on():

            #
            # --- calculation of the event phase from all 3 input collections
            #

            useNewEP = True
            if globalflags.DataSource == 'data':
                if InDetFlags.doCosmics():
                    globalOffset = 8
                else:
                    globalOffset = 0
            else:
                globalOffset = -3.125
            cutWindowCenter = -8.5
            numberIterations = 5
            cutWindowSize = 7

            #
            # --- load tool
            #
            from InDetCosmicsEventPhase.InDetCosmicsEventPhaseConf import InDet__InDetCosmicsEventPhaseTool
            InDetCosmicsEventPhaseTool = InDet__InDetCosmicsEventPhaseTool(
                name="InDetCosmicsEventPhaseTool",
                UseTRTCalibration=True,
                UseNewEP=useNewEP,
                GlobalOffset=globalOffset)

            ToolSvc += InDetCosmicsEventPhaseTool
            if (InDetFlags.doPrintConfigurables()):
                print InDetCosmicsEventPhaseTool

            from InDetCosmicsEventPhase.InDetCosmicsEventPhaseConf import InDet__InDetFixedWindowTrackTimeTool
            InDetFixedWindowTrackTimeTool = InDet__InDetFixedWindowTrackTimeTool(
                name="InDetFixedWindowTrackTimeTool",
                UseTRTCalibration=True,
                UseNewEP=useNewEP,
                GlobalOffset=globalOffset,
                WindowCenter=cutWindowCenter,
                WindowSize=cutWindowSize)

            ToolSvc += InDetFixedWindowTrackTimeTool
            if (InDetFlags.doPrintConfigurables()):
                print InDetFixedWindowTrackTimeTool

            from InDetCosmicsEventPhase.InDetCosmicsEventPhaseConf import InDet__InDetSlidingWindowTrackTimeTool
            InDetSlidingWindowTrackTimeTool = InDet__InDetSlidingWindowTrackTimeTool(
                name="InDetSlidingWindowTrackTimeTool",
                UseTRTCalibration=True,
                UseNewEP=useNewEP,
                GlobalOffset=globalOffset,
                NumberIterations=numberIterations,
                WindowSize=cutWindowSize)

            ToolSvc += InDetSlidingWindowTrackTimeTool
            if (InDetFlags.doPrintConfigurables()):
                print InDetSlidingWindowTrackTimeTool

            #
            # --- load algorithm
            #
            from InDetCosmicsEventPhase.InDetCosmicsEventPhaseConf import InDet__InDetCosmicsEventPhase
            InDetCosmicsEventPhase = InDet__InDetCosmicsEventPhase(
                name="InDetCosmicsEventPhase",
                InputTracksNames=InputTrackCollections,
                #  InputSegmentsName = TRT_Segments_EC,
                TrackSummaryTool=InDetTrackSummaryTool,
                #EventPhaseTool    = InDetCosmicsEventPhaseTool)
                #EventPhaseTool    = InDetFixedWindowTrackTimeTool)
                EventPhaseTool=InDetSlidingWindowTrackTimeTool)
            if InDetFlags.doCosmics():
                InDetCosmicsEventPhase.EventPhaseTool = InDetCosmicsEventPhaseTool
            topSequence += InDetCosmicsEventPhase
            if (InDetFlags.doPrintConfigurables()):
                print InDetCosmicsEventPhase
# Common import(s):
from D3PDMakerConfig import D3PDProdFlags
from AthenaCommon.JobProperties import jobproperties
prodFlags = jobproperties.D3PDProdFlags
from PrimaryDPDMaker.PrimaryDPDHelpers import buildFileName

from D3PDMakerConfig.CommonD3PDMakerFlags import *
CommonD3PDMakerFlagsSetDefaults()

# this flag here does not work, if you want to switch off TruthWriteHadrons, do truthParticleConfig here.
# the situation here is complicated...
from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags, _string_prop
D3PDMakerFlags.TruthWriteHadrons.set_Value_and_Lock(False)

from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()
# do truthParticleConfig here will drop all the truth hadrons
#from TruthD3PDAnalysis.truthParticleConfig import truthParticleConfig
#truthParticleConfig (seq = topSequence, prefix = 'mc_')

from RecExConfig.RecFlags import rec
if rec.doTruth():
    from TauD3PDMaker.TauD3PDMakerConf import TruthTausToSG
    topSequence += TruthTausToSG('truthtaus')
    topSequence.truthtaus.truth_container = 'SpclMC'
    if rec.readESD:
        topSequence.truthtaus.truth_container = 'INav4MomTruthEvent'

from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags
D3PDMakerFlags.TruthWriteHadrons = True
Example #20
0
def addJetRecoToAlgSequence(job =None, useTruth =None, eventShapeTools =None,
                            separateJetAlgs= None, debug =None):

  myname = "JetAlgorithm: "

  # We need this to modify the global variable.
  global jetalg

  # Import message level flags.
  from GaudiKernel.Constants import DEBUG

  # Import the jet reconstruction control flags.
  from JetRecFlags import jetFlags

  # Import the standard jet tool manager.
  from JetRecStandardToolManager import jtm

  # Set sequence and flags as needed.
  if job == None:
    from AthenaCommon.AlgSequence import AlgSequence
    job = AlgSequence()
  if useTruth == None:
    useTruth = jetFlags.useTruth()
  if eventShapeTools == None:
    eventShapeTools = jetFlags.eventShapeTools()
    if eventShapeTools == None:
      eventShapeTools = []
  if separateJetAlgs == None:
    separateJetAlgs = jetFlags.separateJetAlgs()


  from RecExConfig.ObjKeyStore import cfgKeyStore
  # Event shape tools.
  evstools = []
  evsDict = {
    "emtopo"   : ("EMTopoEventShape",   jtm.emget),
    "lctopo"   : ("LCTopoEventShape",   jtm.lcget),
    "empflow"  : ("EMPFlowEventShape",  jtm.empflowget),
    "emcpflow" : ("EMCPFlowEventShape", jtm.emcpflowget),
    "lcpflow"  : ("LCPFlowEventShape",  jtm.lcpflowget),
  }

  if jetFlags.useTracks():
    evsDict["emtopo"] = ("EMTopoEventShape",   jtm.emoriginget)
    evsDict["lctopo"] = ("LCTopoEventShape",   jtm.lcoriginget)
  jetlog.info( myname + "Event shape tools: " + str(eventShapeTools) )

  for evskey in eventShapeTools:
    from EventShapeTools.EventDensityConfig import configEventDensityTool
    if evskey in evsDict:
      (toolname, getter) = evsDict[evskey]
      if toolname in jtm.tools:
        jetlog.info( myname + "Skipping duplicate event shape: " + toolname )
      else:
        jetlog.info( myname + "Adding event shape " + evskey )
        if not cfgKeyStore.isInInputFile("xAOD::EventShape",toolname):
          jtm += configEventDensityTool(toolname, getter, 0.4)
          evstools += [jtm.tools[toolname]]
    else:
      jetlog.info( myname + "Invalid event shape key: " + evskey )
      raise Exception

  # Add the tool runner. It runs the jetrec tools.
  rtools = []
  # Add the truth tools.
  if useTruth:    
    from JetRec.JetFlavorAlgs import scheduleCopyTruthParticles
    rtools += scheduleCopyTruthParticles()
    
    # build truth jet input :
    rtools += [ jtm.truthpartcopy, jtm.truthpartcopywz ]

  ## if jetFlags.useCells():
  ##   rtools += [jtm.missingcells] commented out : incompatible with trigger : ATR-9696
  if jetFlags.useTracks:
    rtools += [jtm.tracksel,
               jtm.tvassoc,
               jtm.trackselloose_trackjets,
               ]
   
  # Add the algorithm. It runs the jetrec tools.
  from JetRec.JetRecConf import JetAlgorithm
  ctools = []
  if jetFlags.useTracks:
    if not cfgKeyStore.isInInputFile("xAOD::CaloClusterContainer","LCOriginTopoClusters"):
      ctools += [jtm.JetConstitSeq_LCOrigin]
    if not cfgKeyStore.isInInputFile("xAOD::CaloClusterContainer","EMOriginTopoClusters"):
      ctools += [jtm.JetConstitSeq_EMOrigin]
  from JetRec.JetRecConf import JetToolRunner
  runners = []
  if len(ctools)>0:
    jtm += JetToolRunner("jetconstit",
                         EventShapeTools=[],
                         Tools=ctools,
                         Timer=jetFlags.timeJetToolRunner()
                         )
    jtm.jetconstit
    runners = [jtm.jetconstit]

  if jetFlags.separateJetAlgs():

    jtm += JetToolRunner("jetrun",
                         EventShapeTools=evstools,
                         Tools=rtools,
                         Timer=jetFlags.timeJetToolRunner()
                         )
    runners += [jetrun]

    job += JetAlgorithm("jetalg")
    jetalg = job.jetalg
    jetalg.Tools = runners

    for t in jtm.jetrecs:
      jalg = JetAlgorithm("jetalg"+t.name())
      jalg.Tools = [t]
      job+= jalg

  else:
    from JetRec.JetRecConf import JetToolRunner
    jtm += JetToolRunner("jetrun",
                         EventShapeTools=evstools,
                         Tools=rtools+jtm.jetrecs,
                         Timer=jetFlags.timeJetToolRunner()
                         )
    runners += [jtm.jetrun]

    job += JetAlgorithm("jetalg")
    jetalg = job.jetalg
    jetalg.Tools = runners
    if jetFlags.debug > 0:
      jtm.setOutputLevel(jtm.jetrun, DEBUG)
      jetalg.OutputLevel = DEBUG
    if jetFlags.debug > 1:
      for tool in jtm.jetrecs:
        jtm.setOutputLevel(tool, DEBUG)
    if jetFlags.debug > 2:
      for tool in jtm.finders:
        jtm.setOutputLevel(tool, DEBUG)
    if jetFlags.debug > 3:
      jtm.setOutputLevel(jtm.jetBuilderWithArea, DEBUG)
      jtm.setOutputLevel(jtm.jetBuilderWithoutArea, DEBUG)
# ----------------------------------------------------------------------
# JO file for RTT
# ----------------------------------------------------------------------

from AthenaCommon.AppMgr import ServiceMgr
ServiceMgr.MessageSvc.OutputLevel = INFO

from EvgenProdTools.EvgenProdToolsConf import *
from PyJobTransformsCore.runargs import *
runArgs = RunArguments()

outputFileName = "RTT_Pythia6_Zee.root"
print "Output file name: ", outputFileName

from AthenaCommon.AlgSequence import AlgSequence
topAlg = AlgSequence("TopAlg")

from EvgenJobTransforms.EvgenConfig import *

# ----------------------------------------------------------------------
from AthenaServices.AthenaServicesConf import AtRndmGenSvc
ServiceMgr += AtRndmGenSvc()

# Add HepMCAnalysis algorithms
from HepMCAnalysis_i.HepMCAnalysis_iConfig import HepMCAnalysis_i

myHepMCAnalysis = HepMCAnalysis_i("HepMCAnalysis_i", file=outputFileName)
myHepMCAnalysis.EtmissAnalysis = True
myHepMCAnalysis.ZAnalysis = True
myHepMCAnalysis.JetAnalysis = True
Example #22
0
def setup_eflowCaloObjectCreator(Configured, nameModifier, mlog):

    if nameModifier != "EM" and nameModifier != "LC":
        mlog.error(
            "Invalid calorimeter scale was specified : should be LC or EM, but was "
            + nameModifier)
        return False

    try:
        from eflowRec.eflowRecConf import eflowPreparation
        eflowPreparationAlgorithm = eflowPreparation("eflow" + nameModifier +
                                                     "CaloObjectBuilder")
    except:
        mlog.error("could not import eflowRec.eflowPreparation")
        print traceback.format_exc()
        return False

    Configured._eflowPreparationHandle = eflowPreparationAlgorithm

    try:
        from eflowRec.eflowRecConf import eflowTrackCaloExtensionTool
        TrackCaloExtensionTool = eflowTrackCaloExtensionTool()
    except:
        mlog.error("could not import eflowRec.eflowTrackCaloExtensionTool")
        print traceback.format_exc()
        return False

    eflowPreparationAlgorithm.TrackExtrapolatorTool = TrackCaloExtensionTool

    # sets output key of C++ algorithm equal to the python side
    eflowPreparationAlgorithm.EflowCaloObjectsOutputName = Configured.outputKey(
    )

    from eflowRec.eflowRecFlags import jobproperties

    if "EM" == nameModifier:
        eflowPreparationAlgorithm.ClustersName = "CaloTopoCluster"
        eflowPreparationAlgorithm.CalClustersName = "CaloCalTopoClusters"
    elif "LC" == nameModifier:
        eflowPreparationAlgorithm.ClustersName = "CaloCalTopoClusters"
        eflowPreparationAlgorithm.CalClustersName = ""

    if True == jobproperties.eflowRecFlags.useLeptons:
        eflowPreparationAlgorithm.useLeptons = True
        if True == jobproperties.eflowRecFlags.storeLeptonCells:
            eflowPreparationAlgorithm.storeLeptonCells = True
            if "LC" == nameModifier:
                eflowPreparationAlgorithm.eflowLeptonCellsName = "eflowRec_leptonCellContainer_LC"
    else:
        eflowPreparationAlgorithm.useLeptons = False

    if "LC" == nameModifier:
        eflowPreparationAlgorithm.EflowCaloObjectsOutputName = "eflowCaloObjects_LC"
        eflowPreparationAlgorithm.eflowElectronsName = "eflowRec_selectedElectrons_LC"

    try:
        from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool
        TrackSelectionTool = InDet__InDetTrackSelectionTool()
    except:
        mlog.error(
            "could not import InDetTrackSelectionTool.InDet__InDetTrackSelectionTool"
        )
        print traceback.format_exc()
        return False

    try:
        from AthenaCommon.AppMgr import ToolSvc
    except:
        mlog.error("could not import ToolSvc")
        print traceback.format_exc()
        return False

    ToolSvc += TrackSelectionTool

    TrackSelectionTool.CutLevel = "TightPrimary"
    TrackSelectionTool.minPt = 500.0

    eflowPreparationAlgorithm.TrackSelectionTool = TrackSelectionTool

    from RecExConfig.ObjKeyStore import objKeyStore
    objKeyStore.addTransient(Configured.outputType(), Configured.outputKey())

    from AthenaCommon.AlgSequence import AlgSequence
    topSequence = AlgSequence()
    topSequence += eflowPreparationAlgorithm

    return True
Example #23
0
    def configure(self):

        log = logging.getLogger("ByteStreamUnpackGetter.py")
        from AthenaCommon.AlgSequence import AlgSequence 
        topSequence = AlgSequence()
        
        #if TriggerFlags.readBS():
        log.info( "TriggerFlags.dataTakingConditions: %s" % TriggerFlags.dataTakingConditions() )
        # in MC this is always FullTrigger
        hasHLT = TriggerFlags.dataTakingConditions()=='HltOnly' or TriggerFlags.dataTakingConditions()=='FullTrigger'
        
        if hasHLT:
            from AthenaCommon.AppMgr import ServiceMgr
            # Decide based on the run number whether to assume a merged, or a
            # split HLT:
            if not TriggerFlags.doMergedHLTResult():
                ServiceMgr.ByteStreamAddressProviderSvc.TypeNames += [
                    "HLT::HLTResult/HLTResult_L2",
                    "HLT::HLTResult/HLTResult_EF" ]
            else:
                ServiceMgr.ByteStreamAddressProviderSvc.TypeNames += [
                    "HLT::HLTResult/HLTResult_HLT" ]
                pass
            pass

        # BS unpacking
        from TrigBSExtraction.TrigBSExtractionConf import TrigBSExtraction
        extr = TrigBSExtraction()
        
        if hasHLT:
            from TrigNavigation.TrigNavigationConfig import HLTNavigationOffline
            extr.Navigation = HLTNavigationOffline()

            from TrigEDMConfig.TriggerEDM import getEDMLibraries
            extr.Navigation.Dlls = getEDMLibraries()            

            from TrigEDMConfig.TriggerEDM import getPreregistrationList
            extr.Navigation.ClassesToPreregister = getPreregistrationList(TriggerFlags.EDMDecodingVersion())
            
            if TriggerFlags.doMergedHLTResult():
                extr.L2ResultKey=""
                extr.EFResultKey=""
            else:
                extr.HLTResultKey=""

            #
            # Configure DataScouting
            #
            from RecExConfig.InputFilePeeker import inputFileSummary
            if inputFileSummary['bs_metadata']['Stream'].startswith('calibration_DataScouting_') or TriggerFlags.doAlwaysUnpackDSResult():
                for stag in inputFileSummary['stream_tags']:
                    if (stag['stream_type'] == 'calibration') and (stag['stream_name'].startswith('DataScouting_')):
                        ds_tag = stag['stream_name'][0:15]
                        ServiceMgr.ByteStreamAddressProviderSvc.TypeNames += [ "HLT::HLTResult/"+ds_tag ]
                        extr.DSResultKeys += [ ds_tag ]

        else:            
            #if data doesn't have HLT info set HLTResult keys as empty strings to avoid warnings
            # but the extr alg must run
            extr.L2ResultKey=""
            extr.EFResultKey=""
            extr.HLTResultKey=""
            extr.DSResultKeys=[]

        topSequence += extr
        
        from TrigSerializeTP.TrigSerializeTPConf import TrigSerTPTool
        TrigSerToolTP = TrigSerTPTool('TrigSerTPTool')

        from AthenaCommon.AppMgr import ToolSvc
        ToolSvc += TrigSerToolTP
        from TrigEDMConfig.TriggerEDM import getTPList
        TrigSerToolTP.TPMap = getTPList((TriggerFlags.EDMDecodingVersion()))
        
        from TrigSerializeCnvSvc.TrigSerializeCnvSvcConf import TrigSerializeConvHelper
        TrigSerializeConvHelper = TrigSerializeConvHelper(doTP = True)
        ToolSvc += TrigSerializeConvHelper

        #
        # Configure L1Topo validation data algorithm
        #
        if hasHLT and TriggerFlags.doMergedHLTResult() and TriggerFlags.writeL1TopoValData() :
            # make sure that CTP_RDO is known (see also ATR-14683)
            ServiceMgr.ByteStreamAddressProviderSvc.TypeNames += [
                "CTP_RDO/CTP_RDO"
                ]
            from L1TopoValDataCnv.L1TopoValDataCnvConf import xAODMaker__L1TopoValDataCnvAlg
            L1TopoValDataCvnAlg = xAODMaker__L1TopoValDataCnvAlg()
            topSequence += L1TopoValDataCvnAlg

        return True
Example #24
0
svcMgr += MetaDataSvc("MetaDataSvc")
svcMgr.MetaDataSvc.MetaDataTools += [ToolSvc.LumiBlockMetaDataTool]

# Configure the goodrunslist selector tool
from GoodRunsLists.GoodRunsListsConf import *
ToolSvc += GoodRunsListSelectorTool()
GoodRunsListSelectorTool.OutputLevel = INFO
GoodRunsListSelectorTool.GoodRunsListVec = [
    'data11_7TeV.periodAllYear_DetStatus-v36-pro10_CoolRunQuery-00-04-08_Susy.xml'
]
GoodRunsListSelectorTool.PassThrough = False

## This Athena job consists of algorithms that loop over events;
## here, the (default) top sequence is used:
from AthenaCommon.AlgSequence import AlgSequence, AthSequencer
job = AlgSequence()
seq = AthSequencer("AthFilterSeq")

from GoodRunsListsUser.GoodRunsListsUserConf import *
seq += GRLTriggerSelectorAlg('GRLTriggerAlg1')
## In the next line, pick up correct name from inside xml file!
seq.GRLTriggerAlg1.GoodRunsListArray = ['Susy']
seq.GRLTriggerAlg1.TriggerSelection = 'EF_mu18'
#seq.GRLTriggerAlg1.TriggerSelection = 'EF_mu18_L1J10'

# Full job is a list of algorithms
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()

localDataFile = "ilumicalc_histograms_EF_2g20_loose_178044-184169.root"
localMCFile = "mu_mc10b.root"
Example #25
0
# Set up the file reading:
#FNAME = "/afs/cern.ch/atlas/project/PAT/data/xAOD/19.0.X_rel_4/mc12_8TeV.105200.McAtNloJimmy_CT10_ttbar_LeptonFilter.AOD.19.0.X_rel_4.pool.root"
FNAME = "/amnt/remote/pkts08.raid2/users/felix/Athena/METRefTauVal/Samples/valid2.147818.Pythia8_AU2CTEQ6L1_Ztautau.digit.AOD.e2657_s1933_s1964_r5539_tid01483611_00/AOD.01483611._000001.pool.root.1"
FNAME = "/ZIH.fast/users/duschi/xAOD/mc14_8TeV.147808.PowhegPythia8_AU2CT10_Ztautau.recon.AOD.e2372_s1933_s1911_r5591/AOD.01495170._006878.pool.root.1"

import AthenaPoolCnvSvc.ReadAthenaPool
from AthenaCommon.AppMgr import ServiceMgr
ServiceMgr.EventSelector.InputCollections = [FNAME]

# Access the algorithm sequence:
from AthenaCommon.AlgSequence import AlgSequence
theJob = AlgSequence()

# Add the test algorithm:
from TauAnalysisTools.TauAnalysisToolsConf import TauAnalysisTools__TauAnalysisToolsExampleAthena
alg = TauAnalysisTools__TauAnalysisToolsExampleAthena()
alg.TauSelectionTool.PtMin = 20
alg.TauSelectionTool.SelectionCuts = 1
alg.OutputLevel = DEBUG
theJob += alg

# Do some additional tweaking:
from AthenaCommon.AppMgr import theApp
theApp.EvtMax = 10
ServiceMgr.MessageSvc.OutputLevel = INFO
ServiceMgr.MessageSvc.defaultLimit = 1000000
Example #26
0

##############################
### PRE-DEFINED JOBOPTIONS ###
##############################
include( "EventAthenaPool/EventAthenaPool_joboptions.py" )

#############
### TOOLS ###
#############
# ALGORITHM SEQUENCE
AthenaEventLoopMgr = Service( "AthenaEventLoopMgr" )
AthenaEventLoopMgr.EventPrintoutInterval = 200

from AthenaCommon.AlgSequence import AlgSequence
topSequencer = AlgSequence()

from AthenaCommon.AlgSequence import AthSequencer
Sequencer = AthSequencer("TileD3PDMaker")
Sequencer.StopOverride = False
topSequencer += Sequencer

# ATLAS EXTRAPOLATOR #
from TrkExTools.AtlasExtrapolator import AtlasExtrapolator
ToolSvc += AtlasExtrapolator()

# VERTEXING TOOL
from TrackToVertex.TrackToVertexConf import Reco__TrackToVertex
TrackToVertexTool = Reco__TrackToVertex(name="TrackToVertexTool")
ToolSvc+=TrackToVertexTool
#--------------------------------------------------------------
include( "AthenaPoolCnvSvc/WriteAthenaPool_jobOptions.py" )
from AthenaCommon.Configurable import Configurable
from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream

# configuring the Athena application for a 'generator' job
import AthenaCommon.AtlasUnixGeneratorJob

# make sure we are loading the ParticleProperty service
from PartPropSvc.PartPropSvcConf import PartPropSvc
svcMgr += PartPropSvc()
#--------------------------------------------------------------
# Private Application Configuration options
#--------------------------------------------------------------
from AthenaCommon.AlgSequence import AlgSequence
topAlg = AlgSequence()

from Hijing_i.Hijing_iConf import Hijing
topAlg += Hijing()
from TruthExamples.TruthExamplesConf import DumpMC
topAlg += DumpMC()

theApp.ExtSvc += ["AtRndmGenSvc"]
# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
svcMgr.MessageSvc.OutputLevel  = 4
svcMgr.MessageSvc.defaultLimit = 100000
#--------------------------------------------------------------
# Event related parameters
#--------------------------------------------------------------
# Number of events to be processed (default is 10)
theApp.EvtMax = 5
Example #28
0
def moveEDAlg(seq):
    from AthenaCommon.AlgSequence import AlgSequence
    topSequence = AlgSequence()
    edalg = topSequence.EventEtDensityTester  # get the old density calculation alg
    topSequence.remove(edalg)  # remove it from topsequence
    seq += edalg  # readd it to DerivationFrameworkJob)))
Example #29
0
## try to load a catalogue of AthFiles from a cache (to speed-up tests)
try:
    import PyUtils.AthFile as af
    af.server.load_cache('recexcommon-afserver-cache.ascii.gz')
except Exception:
    logRecExCommon_topOptions.warning("Could not load or disable athfile cache")


from AthenaCommon.AlgSequence import AlgSequence
from AthenaCommon.AppMgr import ToolSvc,theApp,ServiceMgr
from AthenaCommon.AthenaCommonFlags  import athenaCommonFlags
from AthenaCommon.GlobalFlags  import globalflags
from RecExConfig.RecFlags import rec
from AthenaCommon.Resilience import treatException,protectedInclude

topSequence = AlgSequence()

if rec.Production():
    AthenaCommon.Configurable.log.setLevel( WARNING ) 

include ( "RecExCond/RecExCommon_flags.py" )
   
logRecExCommon_topOptions.info("Abort on unchecked status code enabled !")


###################
# Common Services #
###################

# ConditionsTag
from IOVDbSvc.CondDB import conddb
def getStream(type, name):
    # globals in this module
    global svcMgr
    global _streamMap

    # type check
    type = type.upper()
    if not type in ['EVENTSTORAGE', 'TRANSIENT']:
        raise RuntimeError, "unsupported StreamType:%s" % type

    # return existing stream
    if _streamMap.has_key((type, name)):
        return _streamMap[(type, name)]

    # EventStorage
    if type == 'EVENTSTORAGE':
        # OutputSvc
        if not hasattr(svcMgr, "ByteStreamEventStorageOutputSvc"):
            from ByteStreamCnvSvc.ByteStreamCnvSvcConf import ByteStreamEventStorageOutputSvc
            svcMgr += ByteStreamEventStorageOutputSvc()

        # Properties
        ByteStreamCnvSvc = svcMgr.ByteStreamCnvSvc
        ByteStreamCnvSvc.ByteStreamOutputSvcList += [
            "ByteStreamEventStorageOutputSvc"
        ]

        # OutputStream
        from AthenaServices.AthenaServicesConf import AthenaOutputStream
        StreamBS = AthenaOutputStream(
            name,
            EvtConversionSvc="ByteStreamCnvSvc",
            OutputFile="ByteStreamEventStorageOutputSvc",
            ForceRead=True)
        theApp.addOutputStream(StreamBS)
        theApp.OutStreamType = "AthenaOutputStream"

        # Define the output as follows:
        ByteStreamEventStorageOutputSvc = svcMgr.ByteStreamEventStorageOutputSvc

        ByteStreamEventStorageOutputSvc.MaxFileMB = 15000
        # maximum number of event (beyond which it creates a new file)
        ByteStreamEventStorageOutputSvc.MaxFileNE = 15000000
        ByteStreamEventStorageOutputSvc.OutputDirectory = "./"
        ByteStreamEventStorageOutputSvc.AppName = "Athena"
        # release variable depends the way the env is configured
        #svcMgr.ByteStreamEventStorageOutputSvc.FileTag = release
        svcMgr.ByteStreamEventStorageOutputSvc.RunNumber = 0
        # does not work
        if hasattr(svcMgr.EventSelector, 'RunNumber'):
            svcMgr.ByteStreamEventStorageOutputSvc.RunNumber = svcMgr.EventSelector.RunNumber

        # decode BSRDOOutput property and overwrite some OutputStream properties if things are there defined
        from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
        props = athenaCommonFlags.BSRDOOutput().split(",")
        if len(props) > 1:
            for p in props:
                if "AppName" in p:
                    svcMgr.ByteStreamEventStorageOutputSvc.AppName = p.split(
                        "=")[1]
                if "OutputDirectory" in p:
                    svcMgr.ByteStreamEventStorageOutputSvc.OutputDirectory = p.split(
                        "=")[1]
                if "FileTag" in p:
                    svcMgr.ByteStreamEventStorageOutputSvc.FileTag = p.split(
                        "=")[1]
                if "Run" in p:
                    svcMgr.ByteStreamEventStorageOutputSvc.RunNumber = int(
                        p.split("=")[1])
        else:
            svcMgr.ByteStreamEventStorageOutputSvc.SimpleFileName = athenaCommonFlags.BSRDOOutput(
            )
        # append
        _streamMap[(type, name)] = StreamBS
        return StreamBS

    elif type == 'TRANSIENT':
        # OutputSvc
        if not hasattr(svcMgr, "ROBDataProviderSvc"):
            from ByteStreamCnvSvcBase.ByteStreamCnvSvcBaseConf import ROBDataProviderSvc
            svcMgr += ROBDataProviderSvc()
        if not hasattr(svcMgr, "ByteStreamRDP_OutputSvc"):
            from ByteStreamCnvSvc.ByteStreamCnvSvcConf import ByteStreamRDP_OutputSvc
            svcMgr += ByteStreamRDP_OutputSvc()

        # Properties
        ByteStreamCnvSvc = svcMgr.ByteStreamCnvSvc
        ByteStreamCnvSvc.ByteStreamOutputSvcList += ["ByteStreamRDP_OutputSvc"]

        # This output stream is created as a regular OutputStream
        from AthenaServices.AthenaServicesConf import AthenaOutputStream
        StreamBS = AthenaOutputStream(name,
                                      EvtConversionSvc="ByteStreamCnvSvc",
                                      OutputFile="ByteStreamRDP_OutputSvc",
                                      ForceRead=True)
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        topSequence += StreamBS

        # ByteStreamCnvSvc is an input CnvSvc now.
        EventPersistencySvc = svcMgr.EventPersistencySvc
        EventPersistencySvc.CnvServices += ["ByteStreamCnvSvc"]

        # append
        _streamMap[(type, name)] = StreamBS
        return StreamBS

    else:
        raise RuntimeError, "unsupported StreamType:%s" % type