ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetUncertainties
testingMacros
python_scripts
StripComponent.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
2
3
import
sys
4
import
re
5
from
ROOT
import
*
6
7
def
GetKeyNames
(self,dir=""):
8
self.cd(dir)
9
return
[key.GetName()
for
key
in
gDirectory.GetListOfKeys()]
10
TFile.GetKeyNames = GetKeyNames
11
12
13
if
len(sys.argv) < 4:
14
print
"Too few arguments. Expected the following:"
15
print
" 1. Input file"
16
print
" 2. Output file"
17
print
" 3. Name of component to strip"
18
exit(1)
19
20
inputFile = TFile.Open(sys.argv[1],
"READ"
)
21
outputFile = TFile.Open(sys.argv[2],
"RECREATE"
)
22
compName = sys.argv[3]
23
24
foundComponent =
False
25
for
histName
in
inputFile.GetKeyNames():
26
hist = inputFile.Get(histName)
27
if
TString(histName).Contains(compName):
28
print
"Removing component:"
,histName
29
continue
30
else
:
31
outputFile.cd()
32
hist.Write(histName)
33
34
outputFile.Close()
35
inputFile.Close()
36
StripComponent.GetKeyNames
GetKeyNames
Definition
StripComponent.py:10
Generated on
for ATLAS Offline Software by
1.17.0