Problem with MakeClass

Hello,

I am a first time user of Root, using at cern ROOT 3.10/02 (cms lcg installation). I was given a small root file with a tree (called tracks) to use, and have tried to get a Class with

tracks->MakeClass(“TestOne”)

The first problem is that in the generated TestOne.h file, several instances of TBranch have the same name, lthough obviously in the TTree, the branches have different names:

line 321: TBranch *b_Chi2; //!
line 332: TBranch *b_Chi2; //!
line 367: TBranch *b_Chi2; //!
line 402: TBranch *b_Chi2; //!

These refer to the following branches, as cen be seen later in that file:
b_Chi2 = fChain->GetBranch(“kfIpHitChi2_”);
b_Chi2 = fChain->GetBranch(“kfTipHitChi2_”);
b_Chi2 = fChain->GetBranch(“gsfIpHitChi2_”);
b_Chi2 = fChain->GetBranch(“gsfTipHitChi2_”);

The obvious problem is that when I try to compile that code (with .L TestOne.C+), I get the error:

/localscratch/s/speer/rootex/TestOne.h:332: declaration of TBranch*TestOne::b_Chi2' /localscratch/s/speer/rootex/TestOne.h:321: conflicts with previous declarationTBranchTestOne::b_Chi2’
/localscratch/s/speer/rootex/TestOne.h:367: declaration of
TBranch*TestOne::b_Chi2' /localscratch/s/speer/rootex/TestOne.h:321: conflicts with previous declarationTBranch
TestOne::b_Chi2’
/localscratch/s/speer/rootex/TestOne.h:402: declaration of TBranch*TestOne::b_Chi2' /localscratch/s/speer/rootex/TestOne.h:321: conflicts with previous declarationTBranch*TestOne::b_Chi2’
/localscratch/s/speer/rootex/TestOne.h:332: duplicate member TestOne::b_Chi2' /localscratch/s/speer/rootex/TestOne.h:367: duplicate memberTestOne::b_Chi2’
/localscratch/s/speer/rootex/TestOne.h:402: duplicate member `TestOne::b_Chi2’

and the compilation fails.

Has this problem been seen before, and what can I do about it?
An example root file, with the TestOne.C and .h can be found in /afs/cern.ch/user/s/speer/public/root

I then try to change manually the names of the TBranches to be unique:
TBranch *b_kfIpHitChi2_; //!
TBranch *b_kfTipHitChi2_; //!
TBranch *b_gsfIpHitChi2_; //!
TBranch *b_gsfTipHitChi2_; //!
with the corresponding changes to the fChain->GetBranch part:
b_kfIpHitChi2_ = fChain->GetBranch(“kfIpHitChi2_”);
(etc…)
This class is now called TestTwo

When compiling this class, I get a fatal error:

Fatal: sizeof(::TestTwo) == sizeof(ROOT::Shadow::TestTwo) violated at line 438 of `/localscratch/s/speer/rootex/fileCvV3AG.cxx’

and root crashes (with a coredump).
The complete log of that compilation and dump is below.

TestTwo, with the file generated during the compilation (fileCvV3AG.h, etc) are also in /afs/cern.ch/user/s/speer/public/root

Would you know what the problem here is ? (although this may belong to the CINT forum :wink:

Thanks for your help,

Thomas.

Info in TUnixSystem::ACLiC: creating shared library /localscratch/s/speer/rootex/./TestTwo_C.so
In file included from /localscratch/s/speer/rootex/TestTwo.C:2,
from /localscratch/s/speer/rootex/fileCvV3AG.h:29,
from /localscratch/s/speer/rootex/fileCvV3AG.cxx:13:
/localscratch/s/speer/rootex/TestTwo.h: In member function Int_t TestTwo::Cut(int)': /localscratch/s/speer/rootex/TestTwo.h:678: warning: unused parameterInt_t
entry’
Fatal: sizeof(::TestTwo) == sizeof(ROOT::Shadow::TestTwo) violated at line 438 of `/localscratch/s/speer/rootex/fileCvV3AG.cxx’
aborting
Generating stack trace…
0x4167026f in from /localscratch/s/speer/rootex/./TestTwo_C.so
0x4167030a in from /localscratch/s/speer/rootex/./TestTwo_C.so
0x416703a5 in from /localscratch/s/speer/rootex/./TestTwo_C.so
0x4165fce2 in from /localscratch/s/speer/rootex/./TestTwo_C.so
0x4000b782 in _dl_init + 0x10e from /lib/ld-linux.so.2
0x42112472 in from /afs/cern.ch/cms/external/lcg/external/root/3.10.02/rh73_gcc32/root//bin/root.exe
0x4000b4b3 in _dl_catch_error + 0x93 from /lib/ld-linux.so.2
0x421128e1 in _dl_open + 0x71 from /afs/cern.ch/cms/external/lcg/external/root/3.10.02/rh73_gcc32/root//bin/root.exe
0x40e86af5 in from /lib/libdl.so.2
0x4000b4b3 in _dl_catch_error + 0x93 from /lib/ld-linux.so.2
0x40e8628f in from /lib/libdl.so.2
0x40e86aa4 in dlopen + 0x40 from /lib/libdl.so.2
0x406666ae in G__dlopen + 0x2c from /afs/cern.ch/cms/external/lcg/external/root/3.10.02/rh73_gcc32/root//lib/libCint.so
0x4066707d in G__shl_load + 0x7f from /afs/cern.ch/cms/external/lcg/external/root/3.10.02/rh73_gcc32/root//lib/libCint.so
0x40624f5b in G__loadfile + 0x14c5 from /afs/cern.ch/cms/external/lcg/external/root/3.10.02/rh73_gcc32/root//lib/libCint.so
0x40164ab1 in TCint::Load(char const*, bool) + 0x5b from /afs/cern.ch/cms/external/lcg/external/root/3.10.02/rh73_gcc32/root//lib/libCore.so
0x401359d5 in TSystem::Load(char const*, char const*, bool) + 0x69 from /afs/cern.ch/cms/external/lcg/external/root/3.10.02/rh73_gcc32/root//lib/libCore.so
0x401cd3d5 in TUnixSystem::Load(char const*, char const*, bool) + 0x35 from /afs/cern.ch/cms/external/lcg/external/root/3.10.02/rh73_gcc32/root//lib/libCore.so
0x4013a0b7 in TSystem::CompileMacro(char const*, char const*, char const*, char const*) + 0x3b5b from /afs/cern.ch/cms/external/lcg/external/root/3.10.
02/rh73_gcc32/root//lib/libCore.so
0x4016416b in ScriptCompiler + 0x43 from /afs/cern.ch/cms/external/lcg/external/root/3.10.02/rh73_gcc32/root//lib/libCore.so
0x40623ce6 in G__loadfile + 0x250 from /afs/cern.ch/cms/external/lcg/external/root/3.10.02/rh73_gcc32/root//lib/libCint.so
0x4064b947 in G__reloadfile + 0x255 from /afs/cern.ch/cms/external/lcg/external/root/3.10.02/rh73_gcc32/root//lib/libCint.so
0x4064f750 in G__process_cmd + 0x26f6 from /afs/cern.ch/cms/external/lcg/external/root/3.10.02/rh73_gcc32/root//lib/libCint.so
0x40164c1e in TCint::ProcessLine(char const*, TInterpreter::EErrorCode*) + 0xaa from /afs/cern.ch/cms/external/lcg/external/root/3.10.02/rh73_gcc32/root//lib/libCore.so
0x400e368f in TApplication::ProcessLine(char const*, bool, int*) + 0x45b from /afs/cern.ch/cms/external/lcg/external/root/3.10.02/rh73_gcc32/root//lib/libCore.so
0x40e521cf in TRint::HandleTermInput() + 0x1e1 from /afs/cern.ch/cms/external/lcg/external/root/3.10.02/rh73_gcc32/root//lib/libRint.so
0x40e50ed5 in TTermInputHandler::Notify() + 0x27 from /afs/cern.ch/cms/external/lcg/external/root/3.10.02/rh73_gcc32/root//lib/libRint.so
0x40e52a9a in TTermInputHandler::ReadNotify() + 0x14 from /afs/cern.ch/cms/external/lcg/external/root/3.10.02/rh73_gcc32/root//lib/libRint.so
0x401caef1 in TUnixSystem::CheckDescriptors() + 0xf7 from /afs/cern.ch/cms/external/lcg/external/root/3.10.02/rh73_gcc32/root//lib/libCore.so
0x401ca5d7 in TUnixSystem::DispatchOneEvent(bool) + 0xf7 from /afs/cern.ch/cms/external/lcg/external/root/3.10.02/rh73_gcc32/root//lib/libCore.so
0x40133f9f in TSystem::InnerLoop() + 0x25 from /afs/cern.ch/cms/external/lcg/external/root/3.10.02/rh73_gcc32/root//lib/libCore.so
0x40133f2d in TSystem::Run() + 0x7b from /afs/cern.ch/cms/external/lcg/external/root/3.10.02/rh73_gcc32/root//lib/libCore.so
0x400e41dc in TApplication::Run(bool) + 0x30 from /afs/cern.ch/cms/external/lcg/external/root/3.10.02/rh73_gcc32/root//lib/libCore.so
0x40e51c8f in TRint::Run(bool) + 0x311 from /afs/cern.ch/cms/external/lcg/external/root/3.10.02/rh73_gcc32/root//lib/libRint.so
0x08048890 in main + 0x90 from /afs/cern.ch/cms/external/lcg/external/root/3.10.02/rh73_gcc32/root//bin/root.exe
0x42017589 in __libc_start_main + 0x95 from /afs/cern.ch/cms/external/lcg/external/root/3.10.02/rh73_gcc32/root//bin/root.exe
0x08048711 in _Unwind_Resume + 0x35 from afs/cern.ch/cms/external/lcg/external/root/3.10.02/rh73_gcc32/root//bin/root.exe

Hi Thomas,
I can reproduce this problem. I do not understand what is special with the Chi2 variables. I will investigate.
I see that the compilation error that you report after having fixed the variable names is connected with the declaration [0] for the arrays
where it should be 1 even if the effective number of entries is null.

Rene