vector<float>=NULL when using class generate with Make

Hello,

I have a stupid problem. I have a ROOT file with vector [for example :El_E] in it :

root [63] hgD->Print()


*Tree :newTree : newTree *
*Entries : 2500 : Total = 625236004 bytes File Size = 140354178 *

  •    :          : Tree compression factor =   4.46                       *
    

*Br 0 :RunNumber : RunNumber/I *
*Entries : 2500 : Total Size= 10561 bytes File Size = 166 *
*Baskets : 1 : Basket Size= 32000 bytes Compression= 60.72 *



*Br 5 :El_E : *
*Entries : 2500 : Total Size= 20175884 bytes File Size = 7488437 *
*Baskets : 739 : Basket Size= 32000 bytes Compression= 2.69 *

I use MakeClass :
newTree.h :

// Declaration of leaf types
Int_t RunNumber;
Int_t EventNumber;

vector *El_E;

Int_t El_Num;

then in my main code a create a Object : ZeeTreeObject

If I try to access non vector variable it works :
std::cout << "Run Number "<< ZeeTreeObject->RunNumber << std::endl;

If I try to access a vector, it point all the time to the same object [for evey event El_E[0]=41.8848 :

Event Number 1043
Number of Electron 3
ZeeTreeObject = 0x178e0b0
El_E[0] = 41.8848
El_E[1] = 50.5981
El_E[2] = 68.6567
Event Number 1044
Number of Electron 1
ZeeTreeObject = 0x178e0b0
El_E[0] = 41.8848
Event Number 1045
Number of Electron 1
ZeeTreeObject = 0x178e0b0
El_E[0] = 41.8848
Event Number 1046
Number of Electron 2
ZeeTreeObject = 0x178e0b0
El_E[0] = 41.8848
El_E[1] = 50.5981
Event Number 1047

Now If I use the function Show() defined automatically by MakeClass :

ZeeTreeObject->LoadTree(i);
ZeeTreeObject->GetEntry(i);
ZeeTreeObject->Show(i);

I see :

======> EVENT:684
RunNumber = 106050
EventNumber = 684
MET_ExMiss = -5.07273
MET_EyMiss = -5.05433
MET_EtSum = 227.467
El_E = NULL
El_Pt = NULL
El_Eta = NULL
El_Phi = NULL
El_Num = 2
El_Charge = NULL
El_TrkMatch = NULL
El_z0 = NULL
El_d0 = NULL
El_Blayer = NULL
El_Pixel = NULL
El_SCT = NULL
El_TRT = NULL
El_TRTHigh = NULL
El_IsEM = NULL
El_IsLoose = NULL
El_IsMedium = NULL

This is like that for all event ! Why I cannot access vector and only Int_t or Float_t ?

I tried 2 ROOT version :
/afs/cern.ch/sw/lcg/external/root/5.14.00b/slc4_amd64_gcc34/root
/afs/cern.ch/sw/lcg/external/root/5.21.02/slc4_amd64_gcc34/root

Sorry for the stupid problem, any idea ?

Thanks a lot
Cheers
Fabien

I was too fast in my previous post.

If I use command line I see normal vector distribution.

The way to access vector of my ROOT file in my code is the following :
for (Int_t j =0; j< ZeeTreeObject->El_Num;j++){
std::cout <<" El_E["<<j<<"] = "<< (*ZeeTreeObject->El_E)[j]<<std::endl;

The NULL value show by the Show() function seems to be normal since I saw the same thing with a similar code that works

Cheers
Fabien

[quote]The NULL value show by the Show() function seems to be normal since I saw the same thing with a similar code that works [/quote]Yes, this is the expected behavior for the version of ROOT you tried. The behavior of Show was improved in that regard in v5.21/06.

[quote]This is like that for all event ! Why I cannot access vector and only Int_t or Float_t ?[/quote]This is because the code produced by MakeClass, by default, does not support reading objects (including stl containers). To change change you would need to remove the SetMakeClass(1) … but this might (depending on how they are defined) prevent you from reading the Int_t and Float_t. My recommendation is to use MakeProxy instead of MakeClass (MakeProxy support both individual values and object access).

Cheers,
Philippe.