cxwx1
1
_ROOT Version:_6.29.01
Hi all,
I try to use TTree::ReadFile with Bool branch,
how can I write the data file,
I’ve try to use 0, 1. T,F
but it always return true.
#include <TTree.h>
void p1_data()
{
TTree * t1 = new TTree("t1", "t1");
t1->ReadFile("p1.dat");
t1->Scan();
}
p1.dat like this
ff/O
1
1
0
0
return
cx[000]:>
Processing p1_data.cpp...
************************
* Row * ff.ff *
************************
* 0 * 1 *
* 1 * 1 *
* 2 * 1 * // should be 0
* 3 * 1 * // should be 0
************************
cx[001]:> .q
Dear @cxwx1 ,
Thanks for reaching out. Could it be that you would be better served by using RDF::FromCSV in this case?
$: cat test.csv
x
true
false
true
false
false
$: root
root [0] auto df = ROOT::RDF::FromCSV("test.csv");
root [1] df.Display()->Print()
+-----+-------+
| Row | x |
+-----+-------+
| 0 | true |
+-----+-------+
| 1 | false |
+-----+-------+
| 2 | true |
+-----+-------+
| 3 | false |
+-----+-------+
| 4 | false |
+-----+-------+
root [2] df.GetColumnType("x")
(std::string) "bool"
Cheers,
Vincenzo
cxwx1
3
from csv works!
but how can I define a value type if using FromCsV?
for example using float not double
1 Like
system
Closed
4
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.