コード例 #1
0
        if process['Scale']:
            exec "plotscalefactor = str(float("+process['Scale']+"))"
        else:
            plotscalefactor = 1
        exec "plotter.add" + process['Type'] + "(\'" + process['SamplePath'] + "\', \' scale = " + plotscalefactor + "\')"
    except:
        exec "plotter.add" + process['Type'] + "(\'" + process['SamplePath'] + "\')"
    naddedprocess += 1

# check that there was process imported
if naddedprocess == 0:
    print 'added process are not more than 0'
    usage()

if options.verbose:
    tool.printObj(samples, 'rH')

# gather cut names
#examplepath = tool.get_example_path(processes[0]['SamplePath'])
print options.examplepath
cutlist = samples.getListOfFolders(options.examplepath + '/.histograms/?')

cuts = []
for cut in cutlist:
    cuts.append(cut.GetName())
cutlist = cuts

# gather var names
xvars = []
for var in samples.getListOfHistogramNames(): xvars.append(str(var).split('/')[1])
varlist = list(set(xvars))
コード例 #2
0
try:
    from ROOT import *
except:
    print 'No ROOT module found, please setup ROOT before proceeding'
gROOT.SetBatch(True)
gSystem.Load('$TQPATH/lib/libQFramework.so')
import tool

tqsf = TQSampleFolder.loadSampleFolder(options.samplespath)

cutfolderentryfolder = tqsf.getFolder(options.entrypath)
if not cutfolderentryfolder:
    print "ERROR - provided entry point does not exist!"
    print "        provided =", options.entrypath
    sys.exit(-1)

cutfolder = tool.get_folder_with_name(cutfolderentryfolder, options.cutname)
if not cutfolder:
    print "ERROR - requested folder name has not been found!"
    print "        requested =", options.cutname
    sys.exit(-1)

cutexpr = TString("")
wgtexpr = TString("")

tool.printObj(cutfolder, "r1")
cutfolder.getTagString(".cutExpression", cutexpr)
cutfolder.getTagString(".weightExpression", wgtexpr)

print cutexpr, "          ", wgtexpr
コード例 #3
0
#if not options.outdir: usage()

# import ROOT
try:
    from ROOT import *
except:
    print 'No ROOT module found, please setup ROOT before proceeding'

#gROOT.SetBatch(True)
#gSystem.Load('$TQPATH/lib/libQFramework.so')
from QFramework import *
#TQLibrary.gQFramework.setApplicationName(alias);

samples = TQSampleFolder.newSampleFolder('samples')

import tool

tqsamplefolders = []

for samplepath in args:
    tqsamplefolders.append(TQSampleFolder.loadSampleFolder("%s" % samplepath))

print tqsamplefolders

tool.printObj(tqsamplefolders[0], 'rd')
tool.printObj(tqsamplefolders[1], 'rd')

tqsamplefolders[0].merge(tqsamplefolders[1])

tool.printObj(tqsamplefolders[0], 'rd')
コード例 #4
0
ファイル: viewSample.py プロジェクト: sgnoohc/login
#                  help='print verbose output')

# parse options
(options, args) = parser.parse_args()

# check if a sample is provided
if not options.sample: usage()
if not options.printoption: options.printoption = 'rdt'
#if not options.metadata: usage()
#if not options.lumi: options.lumi = '20980.2'
#if not options.outdir: usage()

# import ROOT
try: from ROOT import *
except: print 'No ROOT module found, please setup ROOT before proceeding'

gROOT.SetBatch(True)
from QFramework import *
#gSystem.Load('$TQPATH/lib/libQFramework.so')

import tool

samples = TQSampleFolder.loadSampleFolder('%s'%(options.sample))
if options.rootpath:
    tool.printObj(samples, options.rootpath + ':' + options.printoption)
else:
    tool.printObj(samples, options.printoption)


#eof
コード例 #5
0
    # if not found error
    if not sampleFound:
        print 'ERROR - the sample you provided was not found from the metadata'
        print '   you provided --sample=', samplekey
        print '   you provided --metadata=', options.metadata
        sys.exit(-1)

    # add sample to samples
    samples.addSampleFolder(sample)

    # dump cut info
    cuts.dumpToFolder(samples.getFolder('/info/cuts+'))

    # verbose
    if options.verbose:
        tool.printObj(cuts)

    # visit the sample!
    samples.visitSampleFolders(visitor, samplekey)

    # verbose
    if options.verbose:
        #tool.printObj(cuts)
        tool.printObj(samples, 'rd')

    # write sample
    if not os.path.exists(options.outdir):
        os.makedirs(options.outdir)
    outfn = os.path.join(options.outdir, samplekey + '.root')
    print ''
    print 'writing analysis file \'%s\'' % outfn