constructComparisonTree.C

When I try to use examples : constructComparisonTree.C

root -l test_gamma_test1.root

root [1] .L constructComparisonTree.C++

root [2] auto file = new TFile(“output.root”, “RECREATE”)

(TFile *) @0x7ffd22a0e380

root [3] t.constructComparisonTree(test_gamma_test1.root, “supix”)

I faild:

auto tree = constructComparisonTree(clusters, “supix”)

^
FunctionDecl 0x1c6fedd8 <input_line_42:1:1, ROOT_prompt_7:3:1> input_line_42:1:6 __cling_Un1Qu321 ‘void (void *)’
|-ParmVarDecl 0x1c6fed20 <col:23, col:29> col:29 vpClingValue ‘void *’
|-CompoundStmt 0x1c6ff0e0 <col:43, ROOT_prompt_7:3:1>
| -DeclStmt 0x1c6ff0c8 <line:1:1, line:2:1> | -VarDecl 0x1c6feeb8 <line:1:1, col:54> col:6 tree ‘auto’ cinit
| -CallExpr 0x1c6ff098 <col:13, col:54> '<dependent type>' | |-UnresolvedLookupExpr 0x1c6fef20 <col:13> '<overloaded function type>' lvalue (ADL) = 'constructComparisonTree' 0x1bfb8610 | |-DeclRefExpr 0x1c6ff038 <col:37> '<dependent type>' lvalue Var 0x1c6fef70 'clusters' '<dependent type>' | -StringLiteral 0x1c6ff078 col:47 ‘const char [6]’ lvalue “supix”
`-AnnotateAttr 0x1c6fefd8 <> R"ATTRDUMP(__ResolveAtRuntime)ATTRDUMP"
<<>>
root [8] .q

I don’t know what went wrong.

Hi @Newyean

do you maybe have an example file (test_gamma_test1.root) for me so I can try to reproduce it?

Simon

test_supix1_gamma_test1.root (8.8 MB)
This is my rootfile, thanks for your help~!

Oh! I think I know where I went wrong.

auto file = new TFile(“output.root”, “RECREATE”)

i should input the file.

Very thanks for your help~!

Hi @Newyean

yes, that;s probably the issue - for me it works nicely:

root -l test_supix1_gamma_test1.root                                                                                                                                      ✔   39s 

root [0]
Attaching file test_supix1_gamma_test1.root as _file0...
(TFile *) 0x55e92bcd1710
root [1] .L ~/software/allpix-squared/lib/libAllpixObjects.so 
root [2] .L ~/software/allpix-squared/tools/root_analysis_macros/constructComparisonTree.C++
/root_analysis_macros/constructComparisonTree_C.so
root [3] auto file = new TFile("output.root", "RECREATE")
(TFile *) @0x7ffd99edb928
root [4] auto tree = constructComparisonTree(_file0, "supix")
(std::shared_ptr<TTree> &) std::shared_ptr -> 0x55e92c35ae80
root [5] tree->Write()

Best,
Simon

Pretty thanks for your help~