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
66cf46bc
Commit
66cf46bc
authored
Jul 21, 2021
by
Keerthi Nakkalil
Browse files
Functions incorporated to store data from a txt file to a tree and read the tree
parent
0daf8817
Changes
1
Hide whitespace changes
Inline
Side-by-side
Time walk correction/MyTree.C
View file @
66cf46bc
void
MyTree
(){
void
ReadEnergy
(){
std
::
ifstream
Energy_file
(
"Energy_table.dat"
);
double
Ecol1
,
Ecol2
,
Ecol3
,
Ecol4
;
...
...
@@ -21,3 +21,26 @@ void MyTree(){
Efile
->
Write
();
}
void
ReadTPdata
(){
TFile
*
readEfile
=
new
TFile
(
"Energy_table.root"
,
"read"
);
TTree
*
tree
=
(
TTree
*
)
readEfile
->
Get
(
"ETree"
);
double
energy
,
voltage
;
tree
->
SetBranchAddress
(
"Ecol1"
,
&
energy
);
tree
->
SetBranchAddress
(
"Ecol4"
,
&
voltage
);
for
(
int
i
=
0
;
i
<
tree
->
GetEntries
();
i
++
){
tree
->
GetEntry
(
i
);
cout
<<
energy
<<
" "
<<
voltage
<<
std
::
endl
;
}
}
void
MyTree
(){
ReadEnergy
();
ReadTPdata
();
}
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