1 |
|
import ROOT |
2 |
– |
from ROOT import TFile |
2 |
|
from printcolor import printc |
4 |
– |
|
3 |
|
|
4 |
|
def copytree(pathIN,pathOUT,prefix,newprefix,file,Aprefix,Acut): |
5 |
|
|
7 |
|
print "Input File : %s/%s%s.root " %(pathIN,prefix,file) |
8 |
|
print "Output File : %s/%s%s%s.root" %(pathOUT,newprefix,Aprefix,file) |
9 |
|
|
10 |
< |
input = TFile.Open("%s/%s%s.root" %(pathIN,prefix,file),'read') |
11 |
< |
output = TFile.Open("%s/%s%s%s.root" %(pathOUT,newprefix,Aprefix,file),'recreate') |
10 |
> |
input = ROOT.TFile.Open("%s/%s%s.root" %(pathIN,prefix,file),'read') |
11 |
> |
output = ROOT.TFile.Open("%s/%s%s%s.root" %(pathOUT,newprefix,Aprefix,file),'recreate') |
12 |
|
|
13 |
|
input.cd() |
14 |
|
obj = ROOT.TObject |
30 |
|
kEntries = outputTree.GetEntries() |
31 |
|
printc('blue','',"\t before cuts\t %s" %nEntries) |
32 |
|
printc('green','',"\t survived\t %s" %kEntries) |
35 |
– |
#print "\t Factor for Scaling is %s" %factor |
33 |
|
outputTree.AutoSave() |
34 |
|
output.ls() |
38 |
– |
#Count.Scale(factor) |
39 |
– |
#CountWithPU.Scale(factor) |
40 |
– |
#CountWithPU2011B.Scale(factor) |
35 |
|
print "Writing output file" |
36 |
|
output.Write() |
37 |
|
print "Closing output file" |