コード例 #1
0
ファイル: samples.py プロジェクト: sparticlesteve/QuickAnaHPC
def split_samples(sh, num_events=150000):
    """
    Split a sample handler's samples into smaller samples of size num_events.
    This function does not split individual files.
    """
    from ROOT import SH
    splitSH = SH.SampleHandler()
    SH.scanNEvents(sh)
    for sample in sh:
        splitSH.add(SH.splitSample(sample, num_events))
    return splitSH
コード例 #2
0
def load_samples(args):
    """
    Build a SampleHandler.
    Not all these options are compatible with each other.
    It might thus be better to split this up somehow.
    """
    from ROOT import SH
    if args.sampleHandler:
        sh = SH.SampleHandler()
        sh.load(args.sampleHandler)
    else:
        sh = scan_samples(args.scanDir, args.samplePattern)
    # Split samples by file if requested
    if args.splitSamples:
        sh = split_samples(sh, 1)
    # Choose samples according to task ID
    if args.task:
        task, numTasks = map(int, args.task.split(':'))
        sh = select_by_task(sh, task, numTasks)
    if args.eventsPerWorker:
        from ROOT import EL
        SH.scanNEvents(sh)
        sh.setMetaDouble(EL.Job.optEventsPerWorker, args.eventsPerWorker)
    return sh
コード例 #3
0
ファイル: samples.py プロジェクト: sparticlesteve/QuickAnaHPC
def _split_samples_worker(sample, num_events):
    """Worker process function for split_samples_mp"""
    from ROOT import SH
    SH.scanNEvents(sample)
    return SH.splitSample(sample, num_events)
コード例 #4
0
ファイル: getFiles.py プロジェクト: brendlin/pennSoftLepton
from ROOT import gROOT
gROOT.ProcessLine(".x $ROOTCOREDIR/scripts/load_packages.C")
from ROOT import SH
print 'SampleHandler imported.', SH, SH.SampleHandler

myhandler = SH.SampleHandler()
コード例 #5
0
gROOT.ProcessLine('.x $ROOTCOREDIR/scripts/load_packages.C')

from ROOT import SH, EL
from ROOT import MyELAlg
from ROOT import xAOD
from ROOT import JetCleaningTool
from ROOT import JERTool, JERSmearingTool

# xAOD event store
event = xAOD.TEvent()

# Submit directory
submitDir = 'submitDir'

# Sampler handler
sh = SH.SampleHandler()

# Scan for files in directory
#SH.scanDir(sh, '/afs/cern.ch/atlas/project/PAT/xAODs/r5591')
l = SH.DiskListLocal('/afs/cern.ch/atlas/project/PAT/xAODs/r5591/mc14_8TeV.117050.PowhegPythia_P2011C_ttbar.recon.AOD.e1727_s1933_s1911_r5591/')
SH.scanSingleDir(sh, 'ttbar', l)
sh.setMetaString('nc_tree', 'CollectionTree')

# The job
job = EL.Job()
job.sampleHandler(sh)

# Our algorithm
GeV = 1000.
alg = MyELAlg()