Beispiel #1
0
def _stream_from_file(file, seq, tuplename, streamNameRoot, clevel):
    """Infer the Athena stream name from the file name.
    Create a new stream if needed.
"""

    # Make sure that THistSvc exists.
    from AthenaCommon.AppMgr import ServiceMgr
    if not hasattr(ServiceMgr, 'THistSvc'):
        from GaudiSvc.GaudiSvcConf import THistSvc
        ServiceMgr += THistSvc()

    # Search existing streams for one writing to this file.
    # If we find one, return it.
    # Also build a list of the names of all existing streams.
    streams = {}
    for s in ServiceMgr.THistSvc.Output:
        stream = s.split()[0]
        streams[stream] = 1
        sfile = None
        ifile = s.find("DATAFILE='")
        if ifile >= 0:
            ifile += 10
            i2 = s.find("'", ifile)
            if i2 >= 0:
                sfile = s[ifile:i2]
        if sfile == file:
            return stream

    # Didn't find the stream.  We'll need to create a new one.
    # This involves making another algorithm, so we need to have
    # the sequence available.
    if not seq:
        raise TypeError("Need to create a new stream for tuple %s, "
                        "but sequence wasn't specified." % tuplename)

    # Find a unique name for the new stream.
    stream = streamNameRoot
    istream = 1
    while streams.has_key(stream):
        stream = streamNameRoot + ` istream `
        istream += 1

    # Create the stream, and add it to the sequence.
    from AnalysisTools.AthAnalysisToolsConf import AANTupleStream
    st = AANTupleStream(stream,
                        ExtraRefNames=['StreamESD', 'StreamRDO', 'StreamAOD'],
                        OutputName=file,
                        WriteInputDataHeader=True,
                        StreamName=stream)
    seq += [st]

    # Register with THistSvc.
    ServiceMgr.THistSvc.Output += [
        "%s DATAFILE='%s' OPT='RECREATE' CL='%i'" % (stream, file, clevel)
    ]
    return stream
Beispiel #2
0
#DATAPATH = '/direct/usatlas+u/vj/vj_tracking/datafile/mc09_7TeV.105004.pythia_ddiff.recon.ESD.e514_s764_s767_r1229_tid126162_00/'
#DATAPATH = '/direct/usatlas+u/vj/vj_tracking/datafile/mc09_7TeV.105003.pythia_sdiff.recon.ESD.e514_s764_s767_r1229_tid126163_00/'
from glob import glob
#INPUT = glob(DATAPATH + 'ESD*.root*')
#print INPUT
#ServiceMgr.EventSelector.InputCollections = INPUT
##########################################
# setup TTree registration Service
# save ROOT histograms and NTuple
from GaudiSvc.GaudiSvcConf import THistSvc

ServiceMgr += THistSvc()
ServiceMgr.THistSvc.Output = ["AANT DATAFILE='vert.root' OPT='RECREATE'"]
from AnalysisTools.AthAnalysisToolsConf import AANTupleStream

topSequence += AANTupleStream()
topSequence.AANTupleStream.ExtraRefNames = ["StreamESD", "Stream1"]
topSequence.AANTupleStream.OutputName = 'vert.root'
topSequence.AANTupleStream.WriteInputDataHeader = True
topSequence.AANTupleStream.OutputLevel = INFO

# Number of Events to process
theApp.EvtMax = -1
#ServiceMgr.EventSelector.SkipEvents = 2
ServiceMgr.MessageSvc.OutputLevel = INFO

## uncomment following lines to dump truth info

#from TruthExamples.TruthExamplesConf import DumpMC
#topSequence += DumpMC()
#DumpMC.McEventKey = "GEN_AOD"
Beispiel #3
0
#=== add to the job
from AthenaCommon.AlgSequence import AlgSequence
job = AlgSequence()
job += tileInfoDump

#=== save ROOT histograms and Tuple for bad cells
if hasattr(tileInfoDump, "PrintBadCells"):
    if tileInfoDump.PrintBadCells:
        from GaudiSvc.GaudiSvcConf import THistSvc
        svcMgr += THistSvc()
        svcMgr.THistSvc.Output = [
            "AANT DATAFILE='tileBadCells.root' OPT='RECREATE'"
        ]
        from AnalysisTools.AthAnalysisToolsConf import AANTupleStream
        job += AANTupleStream()
        AANTupleStream = AANTupleStream()
        AANTupleStream.ExtraRefNames = ["StreamESD", "Stream1"]
        AANTupleStream.OutputName = 'tileBadCells.root'
        AANTupleStream.WriteInputDataHeader = True
        AANTupleStream.OutputLevel = WARNING

#============================================================
#=== MessageSvc setup
#============================================================
MessageSvc = Service("MessageSvc")
MessageSvc.OutputLevel = INFO
MessageSvc.defaultLimit = 9999999

#============================================================
#=== Dummy event loop setup
Beispiel #4
0
MissingETEventSelector.MuonPtCut = 20. * GeV
MissingETEventSelector.minRefFinalMET = 0. * GeV
MissingETEventSelector.minInvMass = 71. * GeV
MissingETEventSelector.maxInvMass = 111. * GeV
MissingETEventSelector.SelectionType = "hasZboson_ee"

##########################################
# setup TTree registration Service
# save ROOT histograms and Tuple
from GaudiSvc.GaudiSvcConf import THistSvc
ServiceMgr += THistSvc()
ServiceMgr.THistSvc.Output = [
    "AANT DATAFILE='METPerformance.root' OPT='RECREATE'"
]
from AnalysisTools.AthAnalysisToolsConf import AANTupleStream
topSequence += AANTupleStream()
AANTupleStream = AANTupleStream()
AANTupleStream.OutputName = 'METPerformance.root'
AANTupleStream.WriteInputDataHeader = True
AANTupleStream.OutputLevel = WARNING

# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
ServiceMgr.MessageSvc.OutputLevel = WARNING

# Number of Events to process
theApp.EvtMax = 1000000

AthenaEventLoopMgr = Service("AthenaEventLoopMgr")
try:
    AthenaEventLoopMgr.EventPrintoutInterval = 100
except Exception:
jobproperties.PerfMonFlags.doMonitoring = False
#from PerfMonComps.JobOptCfg import PerfMonSvc
#svcMgr += PerfMonSvc()
#jobproperties.PerfMonFlags.doDetailedMonitoring = True

#--------------------------------------------------------------
# Event related parameters
#--------------------------------------------------------------
# Number of events to be processed (default is 10)
theApp.EvtMax = 10000
theApp.EvtSel = "EventSelector"

# CBNT
from AnalysisTools.AthAnalysisToolsConf import AANTupleStream

theAANTupleStream = AANTupleStream(OutputName=NtupleName,
                                   ExistDataHeader=False)

include("CBNT_Athena/CBNT_AthenaAware_jobOptions.py")
include("CBNT_Athena/CBNT_EventInfo_jobOptions.py")
include("CBNT_Athena/CBNT_Audit_jobOptions.py")

# CBNT for EM calo cluster
include("CaloRec/CaloCluster_CBNT_jobOptions.py")
# CBNT for CaloTopo cluster
include("CaloRec/CaloTopoCluster_CBNT_jobOptions.py")
# CBNT for EMTopo clustr
include("CaloRec/EMTopoCluster_CBNT_jobOptions.py")

# CBNT for calo cells, with 3 sigma noise cut
from CaloRec.CaloRecConf import CBNTAA_CaloCell
CBNT_LArCell = CBNTAA_CaloCell("CBNT_LArCell")
Beispiel #6
0
MissingETPerformance.doContainerComparatorTool = True
MissingETPerformance.FilterOnTrigger = False
MissingETPerformance.doBasicPlotsTool = False
MissingETPerformance.doResolutionTool = False
MissingETPerformance.doLinearityTool = False
MissingETPerformance.doEtaRingsTool = False
MissingETPerformance.doTrigMissingETTool = False
MissingETPerformance.doTrigVsOfflineMissingETTool = False
MissingETPerformance.doFakeMissingETTool = False
MissingETPerformance.doMuonTool = False

##########################################
# setup TTree registration Service
# save ROOT histograms and Tuple
from GaudiSvc.GaudiSvcConf import THistSvc
ServiceMgr += THistSvc()
ServiceMgr.THistSvc.Output = [
    "AANT DATAFILE='METPerformance.compareRELS.root' OPT='RECREATE'"
]
from AnalysisTools.AthAnalysisToolsConf import AANTupleStream
topSequence += AANTupleStream()
AANTupleStream = AANTupleStream()
AANTupleStream.OutputName = 'METPerformance.compareRELS.root'
AANTupleStream.WriteInputDataHeader = True

AthenaEventLoopMgr = Service("AthenaEventLoopMgr")
try:
    AthenaEventLoopMgr.EventPrintoutInterval = 1
except Exception:
    printfunc('EventPrintoutInterval exception, defaults to 1')
Beispiel #7
0
MyEDMTester.DoDumpSummaryToFile = True
MyEDMTester.DoDumpToFile = False

# Aesthetic track summary for all collections
include("MuonTrackPerformance/MuonTrackStatistics_jobOptions.py")

#from MuonTrackPerformance.MuonTrackPerformanceConf import MuonTrackStatisticsAlg
#MuonTrackStatistics = MuonTrackStatisticsAlg("MuonTrackStatistics")
MuonTrackStatistics.writeToFile = True
MuonTrackStatistics.TrackLocationList = ["MooreTracks"]
if muonCombinedRecFlags.doMuidCombined():
    MuonTrackStatistics.TrackLocationList += ["ConvertedMuIdCBTracks"]
if muonCombinedRecFlags.doMuGirl():
    MuonTrackStatistics.TrackLocationList += ["MuGirlRefittedTracks"]
if muonCombinedRecFlags.doMuTagIMO():
    MuonTrackStatistics.TrackLocationList += ["MuTagIMOTracks"]
MuonTrackStatistics.TrackLocationList += ["ConvertedMBoyTracks"]
if muonCombinedRecFlags.doStaco():
    MuonTrackStatistics.TrackLocationList += ["ConvertedStacoTracks"]
if muonCombinedRecFlags.doMuTag():
    MuonTrackStatistics.TrackLocationList += ["ConvertedMuTagTracks"]
MuonTrackStatistics.TrackLocationList += ["MuonSpectrometerTracks"]

# Suppress too many WARNINGs
from TrkResidualPullCalculator.TrkResidualPullCalculatorConf import Trk__ResidualPullCalculator
Trk__ResidualPullCalculator.OutputLevel = ERROR

# kluge to avoid crash in creating D3PD
from AnalysisTools.AthAnalysisToolsConf import AANTupleStream
AANTupleStream('D3PD').ExistDataHeader = False
Beispiel #8
0
MissingETPerformance.doMuonTool = False
MissingETPerformance.doContainerComparatorTool = False
MissingETPerformance.doZMuMuTool = False
MissingETPerformance.doZeeTool = False
MissingETPerformance.doPileUpTool = False
MissingETPerformance.doMissingETCompositionTool = False

##########################################
# setup TTree registration Service
# save ROOT histograms and Tuple
from GaudiSvc.GaudiSvcConf import THistSvc
ServiceMgr += THistSvc()
aantStr = "AANT DATAFILE='%s' OPT='RECREATE'" % (MetPerfMonFile)
ServiceMgr.THistSvc.Output = [aantStr]
from AnalysisTools.AthAnalysisToolsConf import AANTupleStream
topSequence += AANTupleStream()
AANTupleStream = AANTupleStream()
AANTupleStream.OutputName = MetPerfMonFile
AANTupleStream.WriteInputDataHeader = True
AANTupleStream.OutputLevel = WARNING

# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
ServiceMgr.MessageSvc.OutputLevel = WARNING

# Number of Events to process
theApp.EvtMax = evtmax

AthenaEventLoopMgr = Service("AthenaEventLoopMgr")
try:
    AthenaEventLoopMgr.EventPrintoutInterval = 100
except Exception:
Beispiel #9
0
        from GaudiSvc.GaudiSvcConf import THistSvc
        ServiceMgr += THistSvc()
      THistSvc = ServiceMgr.THistSvc
    else:
      theApp.Dlls += [ "AnalysisTools" ]
      THistSvc     = Service ( "THistSvc" )
    THistSvc.Output = [ "AANT DATAFILE='ntuple.root' TYP='ROOT' OPT='NEW'" ]

    if doBphysNtuple:
      if usedRelease >= 13:
        if not hasattr( topSequence, "AANTStreamBchains" ):
          if usedRelease >= 16:
            from AnalysisTools.AthAnalysisToolsConf import AANTupleStream
          else:
            from AnalysisTools.AnalysisToolsConf import AANTupleStream
          topSequence += AANTupleStream( "AANTStreamBchains" )
        AANTStreamBchains = getattr( topSequence, "AANTStreamBchains" )
      else:
        theApp.TopAlg += [ "AANTupleStream/AANTStreamBchains" ]
        AANTStreamBchains = Algorithm( "AANTStreamBchains" )
      AANTStreamBchains.ExtraRefNames        = [ "StreamESD", "Stream1" ]
      AANTStreamBchains.WriteInputDataHeader = True
      AANTStreamBchains.OutputName           = "ntuple.root"

    if doCBNT:
      if usedRelease >= 13:
        if not hasattr( topSequence, "AANTStreamCBNT" ):
          if usedRelease >= 16:
            from AnalysisTools.AthAnalysisToolsConf import AANTupleStream
          else:
            from AnalysisTools.AnalysisToolsConf import AANTupleStream
Beispiel #10
0
include("AthenaPoolCnvSvc/ReadAthenaPool_jobOptions.py")

# The input file already specified near the top of this file
ServiceMgr.EventSelector.InputCollections = jp.AthenaCommonFlags.FilesInput()

from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()

# list of the algorithms to be executed at run time
from LongLivedParticleDPDMaker.LongLivedParticleDPDMakerConf import RPVLLTestRates
topSequence += RPVLLTestRates()

print(topSequence.RPVLLTestRates)

from GaudiSvc.GaudiSvcConf import THistSvc
ServiceMgr += THistSvc()
ServiceMgr.THistSvc.Output = ["AANT DATAFILE='testRates.root' OPT='RECREATE'"]
from AnalysisTools.AthAnalysisToolsConf import AANTupleStream
topSequence += AANTupleStream()
AANTupleStream = AANTupleStream()
AANTupleStream.ExtraRefNames = ["StreamESD", "Stream1"]
AANTupleStream.OutputName = 'testRates.root'
AANTupleStream.WriteInputDataHeader = True
AANTupleStream.OutputLevel = WARNING

# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
ServiceMgr.MessageSvc.OutputLevel = INFO

# Number of Events to process
theApp.EvtMax = -1
Beispiel #11
0
svcMgr.THistSvc.Output = [
    "AANT DATAFILE='ntuple2.root' TYPE='ROOT' OPT='RECREATE'"
]

NtupleName = "ntuple1.root"
from AnalysisTools.AthAnalysisToolsConf import AANTupleStream
aa = AANTupleStream()
aa.ExtraRefNames = ["StreamESD", "StreamRDO"]
aa.OutputName = NtupleName
aa.ExistDataHeader = False
aa.WriteInputDataHeader = True
topSequence += aa

from CBNT_Athena.CBNT_AthenaAwareCfg import CBNT_AthenaAware
CBNT_Athena = CBNT_AthenaAware()
topSequence += CBNT_Athena
include("CBNT_Athena/CBNT_EventInfo_jobOptions.py")

from CaloIdentifier import SUBCALO
from CaloRec.CaloRecConf import CBNTAA_CaloCell

theApp.Dlls += ["CaloRec"]
#CBNT_Athena.Members  += [ "CBNT_CaloCell/CBNT_RoILArCaloCell" ]
CBNT_RoILArCaloCell = CBNTAA_CaloCell("CBNT_RoILArCaloCell")
CBNT_Athena += CBNT_RoILArCaloCell
CBNT_RoILArCaloCell.CaloNums = [SUBCALO.LAREM, SUBCALO.LARHEC, SUBCALO.LARFCAL]
#CBNT_RoILArCaloCell.NtupleLocID="/FILE1/CALO/168";
CBNT_RoILArCaloCell.CellsName = "HLT_TrigT2CaloEgammaCells"
CBNT_RoILArCaloCell.MaxNCells = 10000
CBNT_RoILArCaloCell.Suffix = "LRoI"
CBNT_RoILArCaloCell.SaveDetInfo = True
    topSequence.AnalysisSkeleton.StatTriggerChains = photons + singletaus + twotaus + combinedtaus

    #topSequence.AnalysisSkeleton.InvestigateChain = 'L2_tau16i_loose_2j23'

## Done with trigger setup

##########################################
# setup TTree registration Service
# save ROOT histograms and Tuple
from GaudiSvc.GaudiSvcConf import THistSvc
ServiceMgr += THistSvc()
ServiceMgr.THistSvc.Output = [
    "AANT DATAFILE='AnalysisSkeleton.aan.root' OPT='RECREATE'"
]
from AnalysisTools.AthAnalysisToolsConf import AANTupleStream
topSequence += AANTupleStream()
AANTupleStream = AANTupleStream()
AANTupleStream.ExtraRefNames = ["StreamESD", "Stream1"]
AANTupleStream.OutputName = 'AnalysisSkeleton.aan.root'
AANTupleStream.WriteInputDataHeader = True
AANTupleStream.OutputLevel = WARNING

###################### For interactive analysis
#include ("PyAnalysisCore/InitPyAnalysisCore.py")

from GaudiSvc.GaudiSvcConf import AuditorSvc
ServiceMgr.AuditorSvc.Auditors += ["ChronoAuditor"]

AthenaPoolCnvSvc = Service("AthenaPoolCnvSvc")
AthenaPoolCnvSvc.UseDetailChronoStat = TRUE
# Author: Karsten Koeneke
# CERN, February 2009

#============================= This algorithm =============================
from D2PDMaker.D2PDMakerConf import CheckD2PD
topSequence += CheckD2PD(
    "MyCheckD2PD",
    OutputLevel=DEBUG,
    #CompositeParticleContainer3 = "MyLooseZBosonOffShellCollection",
    #CompositeParticleContainer2 = "MyLooseZBosonCollection",
    CompositeParticleContainer1="MyZeeLooseZeeBosonCollection")
#==========================================================================

##########################################
# setup TTree registration Service
# save ROOT histograms and Tuple
rootFileName = 'checkD2PD.root'
from GaudiSvc.GaudiSvcConf import THistSvc
ServiceMgr += THistSvc()
ServiceMgr.THistSvc.Output = [
    "AANT DATAFILE='" + rootFileName + "' OPT='RECREATE'"
]
#from AnalysisTools.AnalysisToolsConf import AANTupleStream ## deprecated?
from AnalysisTools.AthAnalysisToolsConf import AANTupleStream
topSequence += AANTupleStream()
AANTupleStream = AANTupleStream()
AANTupleStream.ExtraRefNames = ["StreamDPD", "Stream1"]
AANTupleStream.OutputName = rootFileName
AANTupleStream.WriteInputDataHeader = True
AANTupleStream.OutputLevel = WARNING
Beispiel #14
0
   # Re-run MET "default"
   from MissingETPerformace.METRefGetter import METRefGetter
   METRefGetter()

   aanName="aant.default.root"
   ServiceMgr.THistSvc.Output = [ "AANT DATAFILE='aant.default.root' OPT='RECREATE'" ]

#########################################
# Sum up all different MET RefFinal terms
from MissingETPerformance.METGetterAOD_Neutrinofication import METGetterAOD
METGetterAOD()

################
# Ntuple Service
from AnalysisTools.AthAnalysisToolsConf import AANTupleStream
topSequence.ZeeSequence += AANTupleStream()

AANTupleStream = AANTupleStream()
AANTupleStream.OutputName = aanName
AANTupleStream.WriteInputDataHeader = True
AANTupleStream.OutputLevel = WARNING

##########################
# Default MissingET ntuple
from MissingET.MissingETConf import CBNTAA_MissingET
topSequence.ZeeSequence += CBNTAA_MissingET()

###################################
# Neutrinofication MissingET ntuple
include ( "MissingETPerformance/CBNTAA_MissingET_Neutrinofication_jobOptions.py" )
topSequence.ZeeSequence.CBNTAA_MissingET_Neutrinofication.OutputLevel=WARNING