1 from __future__
import print_function
7 print(
"Error. Expected at least 3 arguments\n\nUsage: python GetRecoTauVFromDQM_MC_cff.py InputFile OutputFile EventType")
15 InputFileName =
"%s" % Input
16 OutputFileName =
"%s" % Output
21 outFile = ROOT.TFile(OutputFileName,
"recreate")
24 fullFile = ROOT.TFile(InputFileName)
27 source = ROOT.gDirectory.ls()
30 source = ROOT.gDirectory.ls()
31 next=ROOT.TIter(fullFile.GetListOfKeys())
38 cl = ROOT.gROOT.GetClass(key.GetClassName())
39 if(cl.InheritsFrom(
"TDirectory")):
41 dirFound0=dir.GetName()
42 next2=ROOT.TIter(dir.GetListOfKeys())
44 cl2 = ROOT.gROOT.GetClass(key.GetClassName())
45 if(cl2.InheritsFrom(
"TDirectory")):
47 dirFound1 = dir2.GetName()
48 next3=ROOT.TIter(dir2.GetListOfKeys())
50 cl3 = ROOT.gROOT.GetClass(key.GetClassName())
51 if(cl3.InheritsFrom(
"TDirectory")):
53 if 'RecoTauV' in dir3.GetName():
54 dirFound2 = dir3.GetName()
55 next4=ROOT.TIter(dir3.GetListOfKeys())
57 cl4 = ROOT.gROOT.GetClass(key.GetClassName())
58 if(cl4.InheritsFrom(
"TDirectory")):
60 dirFound3 = dir4.GetName()
62 InputDir = dirFound0+
"/"+dirFound1+
"/"+dirFound2+
"/"+dirFound3
63 ROOT.gDirectory.cd(InputDir)
67 next5=ROOT.TIter(ROOT.gDirectory.GetListOfKeys())
69 cl5 = ROOT.gROOT.GetClass(key.GetClassName())
70 if(cl5.InheritsFrom(
"TDirectory")):
71 dirFound4=key.ReadObj()
72 dirFound4_name=dirFound4.GetName()
73 if EventType
in dirFound4_name:
74 SubDirs.append(dirFound4_name)
79 ROOT.gDirectory.mkdir(sub)
81 ROOT.gDirectory.cd(InputDir+
"/"+sub)
82 HList = ROOT.TIter(ROOT.gDirectory.GetListOfKeys())
84 kk = ROOT.gROOT.GetClass(k.GetClassName())
85 if(kk.InheritsFrom(
"TH1F")):
87 ROOT.gDirectory.cd(sub)
S & print(S &os, JobReport::InputFile const &f)