Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
Root
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
为了安全,强烈建议开启2FA双因子认证:User Settings -> Account -> Enable two-factor authentication!!!
Show more breadcrumbs
cxwx
Root
Commits
9190f6f9
Commit
9190f6f9
authored
5 years ago
by
Mattias Ellert
Committed by
Guilherme Amadio
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Python 3 compatibility
parent
d285d0dd
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tutorials/histfactory/example.py
+1
-1
1 addition, 1 deletion
tutorials/histfactory/example.py
tutorials/pyroot/mrt.py
+10
-10
10 additions, 10 deletions
tutorials/pyroot/mrt.py
with
11 additions
and
11 deletions
tutorials/histfactory/example.py
+
1
−
1
View file @
9190f6f9
...
@@ -12,7 +12,7 @@ def main():
...
@@ -12,7 +12,7 @@ def main():
try
:
try
:
import
ROOT
import
ROOT
except
:
except
:
print
"
It seems that pyROOT isn
'
t properly configured
"
print
(
"
It seems that pyROOT isn
'
t properly configured
"
)
return
return
"""
"""
...
...
This diff is collapsed.
Click to expand it.
tutorials/pyroot/mrt.py
+
10
−
10
View file @
9190f6f9
...
@@ -10,28 +10,28 @@
...
@@ -10,28 +10,28 @@
##
##
## \author Wim Lavrijsen
## \author Wim Lavrijsen
import
sys
,
string
,
os
import
sys
,
os
from
ROOT
import
TFile
,
TNtuple
from
ROOT
import
TFile
,
TNtuple
,
TROOT
ifn
=
os
.
path
.
expandvars
(
"
${ROOTSYS}/tutorials/
pyroot
/
aptuple.txt
"
)
ifn
=
os
.
path
.
join
(
str
(
TROOT
.
GetTutorialDir
()),
'
pyroot
'
,
'
aptuple.txt
'
)
ofn
=
'
aptuple.root
'
ofn
=
'
aptuple.root
'
print
'
opening file
'
,
ifn
,
'
...
'
print
(
'
opening file
%s ...
'
%
ifn
)
infile
=
open
(
ifn
,
'
r
'
)
infile
=
open
(
ifn
,
'
r
'
)
lines
=
infile
.
readlines
()
lines
=
infile
.
readlines
()
title
=
lines
[
0
]
title
=
lines
[
0
]
labels
=
string
.
split
(
lines
[
1
]
)
labels
=
lines
[
1
].
split
(
)
print
'
writing file
'
,
ofn
,
'
...
'
print
(
'
writing file
%s ...
'
%
ofn
)
outfile
=
TFile
(
ofn
,
'
RECREATE
'
,
'
ROOT file with an NTuple
'
)
outfile
=
TFile
(
ofn
,
'
RECREATE
'
,
'
ROOT file with an NTuple
'
)
ntuple
=
TNtuple
(
'
ntuple
'
,
title
,
string
.
join
(
labels
,
'
:
'
)
)
ntuple
=
TNtuple
(
'
ntuple
'
,
title
,
'
:
'
.
join
(
labels
)
)
for
line
in
lines
[
2
:]:
for
line
in
lines
[
2
:]:
words
=
str
in
g
.
split
(
line
)
words
=
l
in
e
.
split
()
row
=
map
(
float
,
words
)
row
=
map
(
float
,
words
)
apply
(
ntuple
.
Fill
,
row
)
ntuple
.
Fill
(
*
row
)
outfile
.
Write
()
outfile
.
Write
()
print
'
done
'
print
(
'
done
'
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment