MakeClass (or similar) with own TObject class

Hi,

sorry about the fact that this might have been discussed previously, but browsing the forum I still couldn’t find a solution …

I have a class defined in a shared library (I do .L PixelDCSclasses.h++) along with a ROOT file containing a tree with some integer, some vector of integer and a vector of the object class defined in the shared library …

now I want to get something similar to the result of TTree::MakeClass, but it seems to struggle a) with the vectors (which I might have solved) and b) with the object class …

Any suggestion is most welcome!!!

Files (PixelDCSclasses.h for the shared library, demo.root as examplary ROOT file) can be found under /afs/cern.ch/user/m/mehlhase/public

Thanks very much in advance …
Cheers
Sascha

Hi,

The skeleton created by MakeClass is intentionally deconstructing any of the object in the TTree. Namely rather than giving your access to the object themselves it give you access to the individual members (as long as they were split). This allows for easy analysis when you do not have the original shared library. Conversely it prevents your from using the object even if you do have the library. The best means to use your objects is to move to use MakeProxy instead of MakeClass.

You can also adapt/fix the skeleton produced by MakeClass by
[ul]Remove the line fChain->SetMakeClass(1);
Replace all the individual members in the skeleton by the objects
Update the SetBranchAddress accordingly[/ul]

Cheers,
Philippe

Hi,

[quote=“pcanal”]You can also adapt/fix the skeleton produced by MakeClass by
[ul]Remove the line fChain->SetMakeClass(1);
Replace all the individual members in the skeleton by the objects
Update the SetBranchAddress accordingly[/ul]
[/quote]

that’s exactly what I tried, since I also want to have compiled code in the end, but didn’t succeed so far … I added/changed


#include “PixelDCSclasses.h”

std::vector< PP0ClassStore >* PP0s;

TBranch *b_PP0s; //!

//fChain->SetMakeClass(1);

fChain->SetBranchAddress(“PP0s”, &PP0s, &b_PP0s);

I also tried a couple of slight variations and the other way of using the members of the the object instead of the object itself … but all fail (even after succesful compilation) at runtime …

Cheers
Sascha

Hi,

This should work if the branch PPOs is a top level branch and contains a std::vector and you initialized PPOs to zero.

Also you must be loading a shared library containing the dictionary for PPOClassStore and for std::vector.

Cheers,
Philippe.