ATLAS Offline Software
Functions | Variables
copySelective Namespace Reference

Functions

def copyHist (indir, outdir, dirfilt)
 

Variables

string dirfilt = 'run_.*|GLOBAL|lb_.*|lowStat_LB.*|DQTGlobalWZFinder'
 
string source = 'test.root'
 
string target = 'copy.root'
 
 infile = ROOT.TFile(source)
 
 outfile = ROOT.TFile.Open(target, "RECREATE")
 

Function Documentation

◆ copyHist()

def copySelective.copyHist (   indir,
  outdir,
  dirfilt 
)

Definition at line 5 of file copySelective.py.

5 def copyHist(indir, outdir, dirfilt):
6  print("Decending into directory", indir.GetName())
7  for key in indir.GetListOfKeys():
8  obj = indir.Get(key.GetName())
9 
10  isdir = obj.InheritsFrom("TDirectory")
11  ishist = obj.InheritsFrom("TH1")
12 
13  match = True
14  if isdir: match = re.match(dirfilt, obj.GetName()) != None
15 
16  #print(key.GetName(), match, isdir, ishist)
17  if not match: continue
18 
19  outdir.cd()
20  if isdir:
21  newoutdir = outdir.mkdir(obj.GetName())
22  newindir = obj
23  copyHist(newindir, newoutdir, dirfilt)
24 
25  if ishist:
26  obj.Write()
27 
28 

Variable Documentation

◆ dirfilt

string copySelective.dirfilt = 'run_.*|GLOBAL|lb_.*|lowStat_LB.*|DQTGlobalWZFinder'

Definition at line 29 of file copySelective.py.

◆ infile

copySelective.infile = ROOT.TFile(source)

Definition at line 43 of file copySelective.py.

◆ outfile

copySelective.outfile = ROOT.TFile.Open(target, "RECREATE")

Definition at line 48 of file copySelective.py.

◆ source

copySelective.source = 'test.root'

Definition at line 31 of file copySelective.py.

◆ target

copySelective.target = 'copy.root'

Definition at line 36 of file copySelective.py.

print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
copySelective.copyHist
def copyHist(indir, outdir, dirfilt)
Definition: copySelective.py:5