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
8
import
sys
9
import
os
10
from
ROOT
import
TFile
11
12
class
TTreeSelector
(
object
):
13
"""TreePlotter helper class in python"""
14
def
__init__
(self, *args):
15
super(TTreeSelector, self).
__init__
()
16
# open the file
17
try
:
18
self.
file
= TFile.Open(args[0])
19
except
IndexError :
20
print
(
'[!] You need to specify a file name in the argument list'
)
21
# get the hashlist and entries
22
self.
hashlist
= self.
file
.GetListOfKeys()
23
self.
entries
= self.
hashlist
.
GetEntries
()
24
print
(
'[>] File ['
,args[0],
'] sucessfully loaded'
)
25
26
def
loadTrees
(self, arg):
27
"""load Trees method: loads trees that match one of the arguments in name"""
28
treedict = {}
29
for
itree
in
range
(0,self.
entries
):
30
treename = self.
hashlist
.At(itree).GetName()
31
if
treename.find(arg) >= 0 :
32
tree = self.
file
.
Get
(treename)
33
treedict[treename] = tree
34
print
(
'[>] '
,len(treedict),
'Trees loaded matching the selection:'
, arg)
35
return
treedict
TTreeHelper.TTreeSelector.hashlist
hashlist
Definition:
TTreeHelper.py:22
GetEntries
TGraphErrors * GetEntries(TH2F *histo)
Definition:
TRTCalib_makeplots.cxx:4019
TTreeHelper.TTreeSelector.loadTrees
def loadTrees(self, arg)
Definition:
TTreeHelper.py:26
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:181
plotBeamSpotVxVal.range
range
Definition:
plotBeamSpotVxVal.py:194
TTreeHelper.TTreeSelector.file
file
Definition:
TTreeHelper.py:18
TTreeHelper.TTreeSelector
Definition:
TTreeHelper.py:12
TTreeHelper.TTreeSelector.entries
entries
Definition:
TTreeHelper.py:23
pickleTool.object
object
Definition:
pickleTool.py:29
TTreeHelper.TTreeSelector.__init__
def __init__(self, *args)
Definition:
TTreeHelper.py:14
Generated on Wed Sep 3 2025 21:23:06 for ATLAS Offline Software by
1.8.18