ATLAS Offline Software
Tracking
TrkDetDescr
TrkDetDescrExample
root
python
TTreeHelper.py
Go to the documentation of this file.
1
"""
2
TreePlotter.py
3
4
Created by Andreas Salzburger on 2009-04-16.
5
6
"""
7
from
__future__
import
print_function
8
9
import
sys
10
import
os
11
from
ROOT
import
TFile
12
13
class
TTreeSelector
(
object
):
14
"""TreePlotter helper class in python"""
15
def
__init__
(self, *args):
16
super(TTreeSelector, self).
__init__
()
17
# open the file
18
try
:
19
self.
file
= TFile.Open(args[0])
20
except
IndexError :
21
print
(
'[!] You need to specify a file name in the argument list'
)
22
# get the hashlist and entries
23
self.
hashlist
= self.
file
.GetListOfKeys()
24
self.
entries
= self.
hashlist
.
GetEntries
()
25
print
(
'[>] File ['
,args[0],
'] sucessfully loaded'
)
26
27
def
loadTrees
(self, arg):
28
"""load Trees method: loads trees that match one of the arguments in name"""
29
treedict = {}
30
for
itree
in
range
(0,self.
entries
):
31
treename = self.
hashlist
.At(itree).GetName()
32
if
treename.find(arg) >= 0 :
33
tree = self.
file
.
Get
(treename)
34
treedict[treename] = tree
35
print
(
'[>] '
,len(treedict),
'Trees loaded matching the selection:'
, arg)
36
return
treedict
TTreeHelper.TTreeSelector.hashlist
hashlist
Definition:
TTreeHelper.py:23
GetEntries
TGraphErrors * GetEntries(TH2F *histo)
Definition:
TRTCalib_makeplots.cxx:4019
TTreeHelper.TTreeSelector.loadTrees
def loadTrees(self, arg)
Definition:
TTreeHelper.py:27
Get
T * Get(TFile &f, const std::string &n, const std::string &dir="", const chainmap_t *chainmap=0, std::vector< std::string > *saved=0)
get a histogram given a path, and an optional initial directory if histogram is not found,...
Definition:
comparitor.cxx:179
plotBeamSpotVxVal.range
range
Definition:
plotBeamSpotVxVal.py:195
TTreeHelper.TTreeSelector.file
file
Definition:
TTreeHelper.py:19
TTreeHelper.TTreeSelector
Definition:
TTreeHelper.py:13
TTreeHelper.TTreeSelector.entries
entries
Definition:
TTreeHelper.py:24
pickleTool.object
object
Definition:
pickleTool.py:30
TTreeHelper.TTreeSelector.__init__
def __init__(self, *args)
Definition:
TTreeHelper.py:15
Generated on Tue Dec 24 2024 21:22:20 for ATLAS Offline Software by
1.8.18