Exemplo n.º 1
0
# Test and Train event cuts
#TrainCut = '%s & EventForTraining==1' % TCut
#EvalCut  = '%s & EventForTraining==0' % TCut
TrainCut= TCut +' & evt%2==0'
EvalCut = TCut +' & evt%2!=0'


cuts = [TrainCut,EvalCut]  

print '\n ------> with Train Cuts: ', TrainCut
print '                Test Cuts : ', EvalCut

samples = []
samples = info.get_samples(signals+backgrounds)
tc = TreeCache(cuts,samples,path,config)

output = ROOT.TFile.Open(fnameOutput, "RECREATE")

print '\n\t>>> READING EVENTS <<<\n'

signal_samples = info.get_samples(signals)
background_samples = info.get_samples(backgrounds)

#TRAIN trees
Tbackgrounds = []
TbScales = []
Tsignals = []
TsScales = []
#EVAL trees
Ebackgrounds = []
Exemplo n.º 2
0
        newtree.Fill()

    print "Exit loop"
    newtree.AutoSave()
    print "Save"
    output.Close()
    print "Close"
    targetStorage = (
        pathOUT.replace("gsidcap://t3se01.psi.ch:22128/", "srm://t3se01.psi.ch:8443/srm/managerv2?SFN=")
        + "/"
        + job.prefix
        + job.identifier
        + ".root"
    )
    if TreeCache.get_slc_version() == "111SLC5":  # NOT WORKING !!! ALWAYS USE SRM
        command = "lcg-del -b -D srmv2 -l %s" % (targetStorage)
        print (command)
        subprocess.call([command], shell=True)
        command = "lcg-cp -b -D srmv2 file:///%s %s" % (
            tmpDir + "/" + job.prefix + job.identifier + ".root",
            targetStorage,
        )
        print (command)
        subprocess.call([command], shell=True)
    else:
        command = "srmrm %s" % (targetStorage)
        print (command)
        subprocess.call([command], shell=True)
        command = "srmcp -2 -globus_tcp_port_range 20000,25000 file:///%s %s" % (
            tmpDir + "/" + job.prefix + job.identifier + ".root",
Exemplo n.º 3
0
print 'after the selections, backgrounds are', backgrounds
print 'after the selections, signals are', signals
samples = []
samples = info.get_samples(signals + backgrounds)

print "XXXXXXXXXXXXXXXX"
print 'filelist is', filelist

#tc = TreeCache(cuts,samples,path,config, [])
#to be compatible with mergecaching
tc = TreeCache(
    cuts,
    samples,
    path,
    config,
    filelist=filelist,
    mergeplot=opts.mergeplot,
    sample_to_merge=sample_to_cache_,
    mergeCachingPart=mergeCachingPart,
    plotMergeCached=opts.mergecachingplot,
    remove_sys=remove_sys_
)  # created cached tree i.e. create new skimmed trees using the list of cuts

#for mergesubcaching step, need to continue even if some root files are missing to perform the caching in parallel
if sample_to_cache_ or mergeCachingPart:
    tc = TreeCache(cuts,
                   samples,
                   path,
                   config,
                   filelist=filelist,
                   mergeplot=opts.mergeplot,
                   sample_to_merge=None,
Exemplo n.º 4
0
MVA_Vars['Nominal'] = MVA_Vars['Nominal'].split(' ')

#Infofile
info = ParseInfo(samplesinfo, path)

#Workdir
workdir = ROOT.gDirectory.GetPath()

TrainCut = '%s & EventForTraining==1' % TCut
EvalCut = '%s & EventForTraining==0' % TCut
cuts = [TrainCut, EvalCut]

samples = []
samples = info.get_samples(signals + backgrounds)

tc = TreeCache(cuts, samples, path, config)

output = ROOT.TFile.Open(fnameOutput, "RECREATE")

print '\n\t>>> READING EVENTS <<<\n'

signal_samples = info.get_samples(signals)
background_samples = info.get_samples(backgrounds)

#TRAIN trees
Tbackgrounds = []
TbScales = []
Tsignals = []
TsScales = []
#EVAL trees
Ebackgrounds = []