Hello,
I am trying to use MakeProxy indirectly via the TTree::Draw() interface in order to read branches in the following file (80 MB): /afs/cern.ch/user/l/leyton/public/run_1044.root
which has a somewhat complicated structure and uses external classes, e.g. RDCluster.
To make this easier on beginner-level students, I would like to do this in the simplest way possible, with minimal dependence on external libraries. Following the prescription for hsimple described at the bottom of the TTree::MakeProxy() documentation, I can run
reco->Draw("readTree.cxx+");
which automatically creates generatedSel.h and the corresponding shared library. I can then access the variables at the first level of the reco tree using the branch names as if they were data members:
So far so good. My issue comes when I want to read variables at the next level, for example variables belonging to the vector<RDCluster*> stored inside, named “clusters”. What is the appropriate syntax for accessing, e.g. the 0th value of “charge_top” of the 0th RDCluster? I have tried
and also many others, but I always get some error. In this case, the error is "error: no member named ‘charge_top’ in ‘TObject’. I have also tried including the “RDCluster.hh” header file and casting the TObject. Again, I would like to do this as simply as possible.
thank you,
Michael
_ROOT Version: 6.08/06
_Platform: Mac OS 10.11.6 Compiler: Not Provided
Thanks for your reply.
Promising, but I get the following errors:
root [1] _file0->MakeProject("RecoTree", "*", "recreate++");
MakeProject has generated 5 classes in RecoTree
RecoTree/MAKEP file has been generated
In file included from input_line_12:6:
In file included from ./RecoTreeProjectHeaders.h:1:
./EvRaw0.h:28:37: error: expected expression
std::map<int,std::vector<double,*> > wf; //
^
./EvRaw0.h:28:39: error: expected a type
std::map<int,std::vector<double,*> > wf; //
^
Error: rootcint: compilation failure (./RecoTreeProjectDict0ad9590df1_dictUmbrella.h)
In file included from RecoTreeProjectSource.cxx:3:
In file included from ./RecoTreeProjectHeaders.h:1:
./EvRaw0.h:28:37: error: expected expression
std::map<int,std::vector<double,*> > wf; //
^
./EvRaw0.h:28:39: error: expected a type
std::map<int,std::vector<double,*> > wf; //
^
RecoTreeProjectSource.cxx:7:10: fatal error: 'RecoTreeProjectDict.cxx' file not found
#include "RecoTreeProjectDict.cxx"
Hi Michael,
this looks like a bug in MakeProject (the code generated is broken, e.g. std::map<int,std::vector<double,*>). Could you please open a bug report at https://sft.its.cern.ch/jira/projects/ROOT with the simplest possible recipe to reproduce the issue, so we can take a look?
To unblock you in the meanwhile, maybe @pcanal can propose a workaround.
A workaround in the meanwhile would be helpful. I was hoping to remove the affected classes from the MakeProject generation, but it seems this feature is not yet enabled and only the default * is used.
Hi @pcanal,
Thank you. I’m trying to check out one of the versions that you patched, but I do not see any of your tags listed here: https://root.cern.ch/gitweb/?p=root.git
I am looking for 6.22/02, 6.20/08, 6.18/06, etc.
Do I need to wait?
thanks
Yes. The code was just merge into the patch branch. We will need to make tag releases at some point.
You can also download the source and build the tip of the patch branch you need.