eska
January 29, 2024, 11:51am
1
ROOT Version: 6.30.02
Platform: various
Compiler: various
Hello,
I recently wanted to store the TTree::Scan
output in a file and found that there were two approaches of doing so from the terminal (found here RE: Scan a TTree and put the output on a file from Philippe Canal on 2007-03-20 (RootTalk) ):
The TTreePlayer
approach works fine, however the first (and simpler) one returns an error: use of undeclared identifier 'tree'
At first I thought this could be an outdated feature (the site is from 2007), but that method is also described here: Chapter: Trees , so I wonder if something is wrong on my end. Any help with this issue would be appreciated. Thanks a lot in advance.
Try (for example):
root [0] auto file = TFile::Open("hsimple.root")
(TFile *) 0x1484ef9ffc0
root [1] ntuple->SetScanField(0)
root [2] .>scan_output.txt
root [3] ntuple->Scan()
root [4] .>
root [5]
And look at the scan_output.txt
file in the current directory
eska
January 29, 2024, 12:45pm
3
Thanks a lot for your reply!
This works indeed, however it also prints the command into the file. That is not a big issue, but I was wondering, is there is a way around that?
Which command? I don’t see any command in the example I just posted. Here is the content of scan_output.txt
:
************************************************************************
* Row * px.px * py.py * pz.pz * random.ra * i.i *
************************************************************************
* 0 * 0.0194094 * 0.0118254 * 0.0005165 * 0.2826178 * 0 *
* 1 * 0.3271895 * 0.0378782 * 0.1084877 * 0.4849736 * 1 *
[...]
* 24998 * -0.475986 * 2.0145735 * 4.2850694 * 0.5303411 * 24998 *
* 24999 * 1.5432313 * -0.102157 * 2.3919992 * 0.7472974 * 24999 *
************************************************************************
(long long) 25000
eska
January 29, 2024, 1:04pm
5
I see. For me it writes also
e[0mroot [15] tree->Scan(e[De[0me[38;5;83me[1m()
e[0m
before the scan content is written
OK, then I suppose it’s platform specific. I don’t know if we can do something about this…
eska
January 29, 2024, 1:15pm
7
Okay I see, it shouldn’t be too big of an issue. Thanks for clarifying!
1 Like
system
Closed
February 12, 2024, 1:15pm
8
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.