1 |
|
#!/usr/bin/env python |
2 |
|
import ROOT |
3 |
|
import sys, os, math, argparse |
4 |
< |
from auxiliar import getDataset |
4 |
> |
from auxiliar import getDataset, lep3Datasets |
5 |
> |
from fillLep3Tree import fillLep3Tree |
6 |
|
|
7 |
|
parser = argparse.ArgumentParser(prog=os.path.basename(sys.argv[0]),description="analysis") |
8 |
|
parser.add_argument('-d',dest='dataset',action='store',required=True,help='dataset') |
9 |
+ |
parser.add_argument('-o',dest='outputDir',action='store',required=False,help='output directory') |
10 |
+ |
parser.add_argument('-f',dest='firstFile',action='store',required=False,help='first file to process') |
11 |
|
parser.add_argument('-n',dest='maxNumberOfFiles',action='store',required=False,help='max number of files') |
12 |
|
args=parser.parse_args() |
13 |
< |
|
13 |
> |
if not args.outputDir: args.outputDir='./' |
14 |
> |
if not args.firstFile: args.firstFile='0' |
15 |
|
if not args.maxNumberOfFiles: args.maxNumberOfFiles='99999' |
16 |
|
|
17 |
< |
counter = 0 |
18 |
< |
for inputFile in getDataset(args.dataset): |
19 |
< |
print inputFile |
20 |
< |
outputFile = args.dataset+'_'+inputFile[inputFile.rfind('_')+1:-5]+'.root' |
21 |
< |
os.system('./fillTree.py -i '+ inputFile + ' -o '+outputFile) |
22 |
< |
counter+=1 |
23 |
< |
if counter==int(args.maxNumberOfFiles): break |
17 |
> |
if args.dataset in lep3Datasets: |
18 |
> |
counter = 0 |
19 |
> |
for inputFile in getDataset(lep3Datasets[args.dataset][0]): |
20 |
> |
counter+=1 |
21 |
> |
if counter < int(args.firstFile): continue |
22 |
> |
print inputFile |
23 |
> |
outputFile = args.outputDir+args.dataset+'_'+inputFile[inputFile.rfind('_')+1:-5]+'.root' |
24 |
> |
#fillLep3Tree(inputFile, outputFile, lep3Datasets[args.dataset][1]) |
25 |
> |
os.system('./fillTree.py -i '+ inputFile + ' -o '+outputFile ) |
26 |
> |
if counter==int(args.maxNumberOfFiles)+int(args.firstFile): break |
27 |
|
|
21 |
– |
os.system('hadd -f lep3_'+args.dataset+'.root '+args.dataset+'_*') |
22 |
– |
os.system('rm '+args.dataset+'_*') |