ATLAS Offline Software
Functions | Variables
mergePhysValFiles Namespace Reference

Functions

def mergeFolder (path)
 

Variables

 start = time.clock()
 
 parser = argparse.ArgumentParser(description='Merge specific folder(s) in root files.')
 
 help
 
 default
 
 nargs
 
 args = parser.parse_args()
 
 folder = os.path.abspath(args.input)
 
 mergeDirs = args.dir
 
 origDir = os.getcwd()
 
 out = args.output
 
 pattern = args.pattern
 
 output_file = os.path.abspath(args.output)
 
 files = glob.glob(folder + "/" + pattern)
 
 f = ROOT.TFile(output_file, "recreate")
 
 f2 = ROOT.TFile(files[1])
 
list errors = []
 
 newfolder = f.mkdir(mergeDir,mergeDir)
 
 end = time.clock()
 
list categories
 
string restCategory = 'other'
 
list categories_with_subcategories_type_1 = ['SV', 'tracks']
 
list sub_categories_type_1
 
list categories_with_subcategories_type_2 = ['tagger_IP3D', 'tagger_RNNIP', 'tagger_DIPS', 'tagger_SV1', 'tagger_DL1dv01', 'tagger_DL1r', 'tagger_GN2v01','tagger_GN2Xv01']
 
list sub_categories_type_2
 
list categories_with_subcategories_type_3 = ['old_taggers']
 
list sub_categories_type_3
 
list categories_with_subcategories_type_4 = ['jet']
 
list sub_categories_type_4 = [ 'jet']
 
list jetcontainers
 
dictionary tagfolders = {}
 

Function Documentation

◆ mergeFolder()

def mergePhysValFiles.mergeFolder (   path)

Definition at line 45 of file DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py.

45 def mergeFolder(path) :
46  print("Merging folder " + path)
47  d = f2.Get(path)
48  if not d:
49  error = "ERROR: Cannot find directory " + path + ". Omitting."
50  print(error)
51  errors.append(error)
52  return
53  dirlist = d.GetListOfKeys()
54  for subdir in dirlist:
55  obj = subdir.ReadObj()
56  if obj.IsA().InheritsFrom(ROOT.TH1.Class()):
57  print("Now merging "+obj.GetName())
58  h1 = obj
59  hpath = d.GetPath()
60  hname = hpath[hpath.find(":")+2:]+"/"+obj.GetName()
61  print("Path: "+hname)
62  for tup in files:
63  if tup==files[1]: continue
64  nextfile = ROOT.TFile(tup)
65  h2 = nextfile.Get(hname)
66  if not h2:
67  error = "ERROR: Cannot find " + hname + " in file " + tup + ". Omitting."
68  print(error)
69  errors.append(error)
70  continue
71  h1.Add(h2)
72  subfolder = f.Get(hpath[hpath.find(":")+2:])
73  subfolder.cd()
74  h1.Write()
75  if obj.IsA().InheritsFrom(ROOT.TDirectory.Class()):
76  print("Found subdirectory "+obj.GetName())
77  hpath = obj.GetPath()
78  subfolder = f.mkdir(hpath[hpath.find(":")+2:],obj.GetTitle())
79  subfolder.cd()
80  mergeFolder(hpath[hpath.find(":")+2:])
81 

Variable Documentation

◆ args

mergePhysValFiles.args = parser.parse_args()

◆ categories

list mergePhysValFiles.categories
Initial value:
1 = ['jet',
2  'tracks',
3  'SV',
4  'tagger_IP3D',
5  'tagger_RNNIP',
6  'tagger_DIPS',
7  'tagger_SV1',
8  'tagger_DL1dv01',
9  'tagger_DL1r',
10  'tagger_GN2v01',
11  'tagger_GN2Xv01',
12  'old_taggers',
13  #'tagger_IP2D',
14  ]

Definition at line 18 of file PhysicsAnalysis/JetTagging/JetTagValidation/JetTagDQA/scripts/mergePhysValFiles.py.

◆ categories_with_subcategories_type_1

list mergePhysValFiles.categories_with_subcategories_type_1 = ['SV', 'tracks']

◆ categories_with_subcategories_type_2

list mergePhysValFiles.categories_with_subcategories_type_2 = ['tagger_IP3D', 'tagger_RNNIP', 'tagger_DIPS', 'tagger_SV1', 'tagger_DL1dv01', 'tagger_DL1r', 'tagger_GN2v01','tagger_GN2Xv01']

◆ categories_with_subcategories_type_3

list mergePhysValFiles.categories_with_subcategories_type_3 = ['old_taggers']

◆ categories_with_subcategories_type_4

list mergePhysValFiles.categories_with_subcategories_type_4 = ['jet']

◆ default

mergePhysValFiles.default

◆ end

mergePhysValFiles.end = time.clock()

◆ errors

list mergePhysValFiles.errors = []

◆ f

mergePhysValFiles.f = ROOT.TFile(output_file, "recreate")

◆ f2

mergePhysValFiles.f2 = ROOT.TFile(files[1])

◆ files

mergePhysValFiles.files = glob.glob(folder + "/" + pattern)

◆ folder

mergePhysValFiles.folder = os.path.abspath(args.input)

◆ help

mergePhysValFiles.help

◆ jetcontainers

list mergePhysValFiles.jetcontainers
Initial value:
1 = ['AntiKt4EMTopoJets',
2  'AntiKt4EMPFlowJets',
3  'AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets',
4  'AntiKtVR30Rmax4Rmin02PV0TrackJets',
5  ]

Definition at line 63 of file PhysicsAnalysis/JetTagging/JetTagValidation/JetTagDQA/scripts/mergePhysValFiles.py.

◆ mergeDirs

mergePhysValFiles.mergeDirs = args.dir

◆ nargs

mergePhysValFiles.nargs

◆ newfolder

mergePhysValFiles.newfolder = f.mkdir(mergeDir,mergeDir)

◆ origDir

mergePhysValFiles.origDir = os.getcwd()

◆ out

mergePhysValFiles.out = args.output

◆ output_file

mergePhysValFiles.output_file = os.path.abspath(args.output)

◆ parser

mergePhysValFiles.parser = argparse.ArgumentParser(description='Merge specific folder(s) in root files.')

◆ pattern

mergePhysValFiles.pattern = args.pattern

◆ restCategory

string mergePhysValFiles.restCategory = 'other'

◆ start

mergePhysValFiles.start = time.clock()

◆ sub_categories_type_1

list mergePhysValFiles.sub_categories_type_1
Initial value:
1 = [ '_incl',
2  '_b',
3  '_c',
4  '_l',
5  '_muon',
6  ]

Definition at line 39 of file PhysicsAnalysis/JetTagging/JetTagValidation/JetTagDQA/scripts/mergePhysValFiles.py.

◆ sub_categories_type_2

list mergePhysValFiles.sub_categories_type_2
Initial value:
1 = [ '_pt_ttbar',
2  '_pt_Zprime',
3  '_Lxy'
4  ]

Definition at line 48 of file PhysicsAnalysis/JetTagging/JetTagValidation/JetTagDQA/scripts/mergePhysValFiles.py.

◆ sub_categories_type_3

list mergePhysValFiles.sub_categories_type_3
Initial value:
1 = [ '_IP2D',
2  ]

Definition at line 55 of file PhysicsAnalysis/JetTagging/JetTagValidation/JetTagDQA/scripts/mergePhysValFiles.py.

◆ sub_categories_type_4

list mergePhysValFiles.sub_categories_type_4 = [ 'jet']

◆ tagfolders

dictionary mergePhysValFiles.tagfolders = {}
mergePhysValFiles.mergeFolder
def mergeFolder(path)
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:45
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25