Vectors in TTree::MakeClass()

Hi,

In ROOT 5.22.00 I use TTree::MakeClass() then it generates an analysis class. The automatically generated variables to store the branch contents are sometimes vectors like:

vector *jetEtCamKt6TruthJets;

(i.e. vector of eT of jets)

However the class does not generate inclusion of necessary header:
#include

nor does it specify the std namespace (as “std::vector”, or “using namespace std”). So one has to make these modifications by hand. I was wondering if there was a reason why these are not done automatically?

Thanks,
Eric

Hi,

Currently MakeClass do not add any include for any of the user classes (However MakeProxy does) [And technically since std::vector is an object it is iffy whether the default MakeClass let you use them properly (i.e. without change SetMakeClass from 1 to 0).

Cheers,
Philippe.

[quote=“pcanal”]Hi,

Currently MakeClass do not add any include for any of the user classes (However MakeProxy does) [And technically since std::vector is an object it is iffy whether the default MakeClass let you use them properly (i.e. without change SetMakeClass from 1 to 0).

Cheers,
Philippe.[/quote]

Hi Philippe,

It seems that it does work properly without changing SetMakeClass from 1 to 1 as you mentioned. I read this description:

http://pcroot.cern.ch/root/roottalk/roottalk03/1854.html

but could not figure exactly what SetMakeClass is supposed to do. Can you explain?

I’m also somewhat unclear on the important differences between TTree::MakeClass(), MakeCode(), MakeProxy, and MakeSelector(), and which is most recommended for analysis use. Any clarification would be appreciated.

Thanks,
Eric

Hi,

SetMakeClass tells the TTree that rather than retrieving the information as object(s), you want to retrieve it individual member by individual members. If you look at the result of MakeClass for some of you object, you will set the decomposition.

MakeCode: C style interface and coding ; the oldest and least recommended alternative.
MakeClass(): C++ style interface with object decomposition, includes the looping of the event and thus preclude the use of Proof ; need to explicitly load the part of the TTree you need.
MakeSelector(): Proof ready C++ style interface with object decomposition, looping over the events in handled via TTree::Process; need to explicitly load the part of the TTree you need
MakeProxy: Proof ready C++ style interface with both object decomposition and object access (when library is loaded), branch loading on demand;

We recommend that you use either MakeSelector (for simple cases) or MakeProxy (for more compex cases.

Cheers,
Philippe.

[quote=“pcanal”]Hi,

SetMakeClass tells the TTree that rather than retrieving the information as object(s), you want to retrieve it individual member by individual members. If you look at the result of MakeClass for some of you object, you will set the decomposition.

MakeCode: C style interface and coding ; the oldest and least recommended alternative.
MakeClass(): C++ style interface with object decomposition, includes the looping of the event and thus preclude the use of Proof ; need to explicitly load the part of the TTree you need.
MakeSelector(): Proof ready C++ style interface with object decomposition, looping over the events in handled via TTree::Process; need to explicitly load the part of the TTree you need
MakeProxy: Proof ready C++ style interface with both object decomposition and object access (when library is loaded), branch loading on demand;

We recommend that you use either MakeSelector (for simple cases) or MakeProxy (for more compex cases.

Cheers,
Philippe.[/quote]

Hi Philippe,

Okay thanks for the explanation.

Eric