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 6 of file copySelective.py.

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

Variable Documentation

◆ dirfilt

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

Definition at line 30 of file copySelective.py.

◆ infile

copySelective.infile = ROOT.TFile(source)

Definition at line 44 of file copySelective.py.

◆ outfile

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

Definition at line 49 of file copySelective.py.

◆ source

copySelective.source = 'test.root'

Definition at line 32 of file copySelective.py.

◆ target

copySelective.target = 'copy.root'

Definition at line 37 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:6