Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Keerthi Nakkalil
gain_measurement
Commits
0daf8817
Commit
0daf8817
authored
Jul 21, 2021
by
Keerthi Nakkalil
Browse files
Reading data from a txt file and storing in a tree
parent
6434c3f0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Time walk correction/MyTree.C
0 → 100644
View file @
0daf8817
void
MyTree
(){
std
::
ifstream
Energy_file
(
"Energy_table.dat"
);
double
Ecol1
,
Ecol2
,
Ecol3
,
Ecol4
;
TFile
*
Efile
=
new
TFile
(
"Energy_table.root"
,
"recreate"
);
TTree
*
ETree
=
new
TTree
(
"ETree"
,
"Energy tree"
);
ETree
->
Branch
(
"Ecol1"
,
&
Ecol1
,
"Ecol1/D"
);
ETree
->
Branch
(
"Ecol4"
,
&
Ecol4
,
"Ecol4/D"
);
while
(
1
){
Energy_file
>>
Ecol1
>>
Ecol2
>>
Ecol3
>>
Ecol4
;
if
(
Energy_file
.
eof
())
break
;
ETree
->
Fill
();
}
Efile
->
Write
();
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment