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
46a9799e
Commit
46a9799e
authored
7 years ago
by
Danilo Piparo
Browse files
Options
Downloads
Patches
Plain Diff
[TDF] Create dataset with TDF
parent
d0f4f5c7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tutorials/dataframe/tdf003_profiles.C
+7
-16
7 additions, 16 deletions
tutorials/dataframe/tdf003_profiles.C
with
7 additions
and
16 deletions
tutorials/dataframe/tdf003_profiles.C
+
7
−
16
View file @
46a9799e
...
...
@@ -12,22 +12,13 @@
// A simple helper function to fill a test tree: this makes the example
// stand-alone.
void
fill_tree
(
const
char
*
filen
ame
,
const
char
*
tre
eName
)
void
fill_tree
(
const
char
*
treeN
ame
,
const
char
*
fil
eName
)
{
TFile
f
(
filename
,
"RECREATE"
);
TTree
t
(
treeName
,
treeName
);
float
px
,
py
,
pz
;
t
.
Branch
(
"px"
,
&
px
);
t
.
Branch
(
"py"
,
&
py
);
t
.
Branch
(
"pz"
,
&
pz
);
for
(
int
i
=
0
;
i
<
25000
;
i
++
)
{
gRandom
->
Rannor
(
px
,
py
);
pz
=
px
*
px
+
py
*
py
;
t
.
Fill
();
}
t
.
Write
();
f
.
Close
();
return
;
ROOT
::
Experimental
::
TDataFrame
d
(
25000
);
d
.
Define
(
"px"
,
[](){
return
gRandom
->
Gaus
();})
.
Define
(
"py"
,
[](){
return
gRandom
->
Gaus
();})
.
Define
(
"pz"
,
[](
double
px
,
double
py
){
return
sqrt
(
px
*
px
+
py
*
py
);},
{
"px"
,
"py"
})
.
Snapshot
(
treeName
,
fileName
);
}
void
tdf003_profiles
()
...
...
@@ -35,7 +26,7 @@ void tdf003_profiles()
// We prepare an input tree to run on
auto
fileName
=
"tdf003_profiles.root"
;
auto
treeName
=
"myTree"
;
fill_tree
(
fil
eName
,
tre
eName
);
fill_tree
(
tre
eName
,
fil
eName
);
// We read the tree from the file and create a TDataFrame.
ROOT
::
Experimental
::
TDataFrame
d
(
treeName
,
fileName
,
{
"px"
,
"py"
,
"pz"
});
...
...
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