MakeProxy to read external classes in TTree

I am trying to use MakeProxy indirectly via the TTree::Draw() interface in order to read branches in the following file (80 MB): /afs/
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


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:

Double_t readTree() {
  Double_t bmean = baseline_mean->at(0);
  return bmean;

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

Double_t myCharge = (clusters[0]).charge_top->at(0);

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,

_ROOT Version: 6.08/06
_Platform: Mac OS 10.11.6
Compiler: Not Provided

Before trying to access your tree, try:
gFile->MakeProject("MyFile", "*", "recreate++");

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"

Well, @pcanal will have some fun again.

Just checked: I get the same error message on lxplus (CentOS 7.8) and ROOT version 6.20/04.

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 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.


Hi Enrico,

Thank you. I submitted bug report ROOT-10796:

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.


1 Like

@pcanal Any news on this? Hoping the topic will not close.

Hi @pcanal, any chance you could take a look at this? thank you

To workaround the problem you can call MakeProject then correct the broken file (EvRaw0.h) and re-run the library building (. MAKEP)


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:
I am looking for 6.22/02, 6.20/08, 6.18/06, etc.
Do I need to wait?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

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.