Problem w/ TChain::Process using compiled TSelector

Dear Rooters,
There are 3 possible ways of using TChain::Process with a selector.
I tried all the variants of the TChain::Process running.
Two works fine, while the TChain::Process(“testSelector.C+”) option cause
a break with the tracelist presented below.
Any hints?
I use binary distribution of ROOT v4.00.08, gcc 3.2 and
Linux 2.4.20-20.9 #1 Mon Aug 18 11:45:58 EDT 2003 i686 i686 i386 GNU/Linux
Regards, Valery.

[Event2] > root


  •                                     *
    
  •    W E L C O M E  to  R O O T       *
    
  •                                     *
    
  • Version 4.00/08 9 July 2004 *
  •                                     *
    
  • You are welcome to visit our Web site *
  •      [root.cern.ch](http://root.cern.ch)            *
    
  •                                     *
    

FreeType Engine v2.1.3 used to render TrueType fonts.
Compiled for linux with thread support.

CINT/ROOT C/C++ Interpreter version 5.15.138, May 23 2004
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] gSystem->Load(“Track_cxx.so”);
root [1] gSystem->Load(“Event_cxx.so”);
root [2] TChain ch(“mctreecoll”);
root [3] ch.Add(“treetestmc1.root”);
root [4] ch.Add(“treetestmc2.root”);
root [5] ch.Process(“testSelector.C+”);
Info in TUnixSystem::ACLiC: creating shared library /home/dorofeev/private/bec/user/mc/run17/etpim/Event2/./testSelector_C.so
In file included from /home/dorofeev/private/bec/user/mc/run17/etpim/Event2/filem7LkGs.h:29,
from /home/dorofeev/private/bec/user/mc/run17/etpim/Event2/filem7LkGs.cxx:13:
/home/dorofeev/private/bec/user/mc/run17/etpim/Event2/testSelector.C: In member
function virtual void testSelector::Begin(TTree*)': /home/dorofeev/private/bec/user/mc/run17/etpim/Event2/testSelector.C:35: warning: unused parameterTTree*tree’

*** Break *** segmentation violation
Generating stack trace…
0x41905b2b in TTreePlayer::Process(TSelector*, char const*, int, int) + 0x259 from /work/dorofeev/root/v4.00.08/rh90_gcc322/root/lib/libTreePlayer.so
0x41905883 in TTreePlayer::Process(char const*, char const*, int, int) + 0xa1 from /work/dorofeev/root/v4.00.08/rh90_gcc322/root/lib/libTreePlayer.so
0x40dd74fc in TTree::Process(char const*, char const*, int, int) + 0x4c from /work/dorofeev/root/v4.00.08/rh90_gcc322/root/lib/libTree.so
0x40dbe960 in TChain::Process(char const*, char const*, int, int) + 0x44 from /work/dorofeev/root/v4.00.08/rh90_gcc322/root/lib/libTree.so
0x40e076e5 in from /work/dorofeev/root/v4.00.08/rh90_gcc322/root/lib/libTree.so
0x406ae94a in G__call_cppfunc + 0x263 from /work/dorofeev/root/v4.00.08/rh90_gcc322/root/lib/libCint.so
0x4069e292 in G__interpret_func + 0x6ee from /work/dorofeev/root/v4.00.08/rh90_gcc322/root/lib/libCint.so
0x40685eee in G__getfunction + 0x134a from /work/dorofeev/root/v4.00.08/rh90_gcc322/root/lib/libCint.so
0x40709c08 in G__getstructmem + 0x82a from /work/dorofeev/root/v4.00.08/rh90_gcc322/root/lib/libCint.so
0x40703d21 in G__getvariable + 0x4db from /work/dorofeev/root/v4.00.08/rh90_gcc322/root/lib/libCint.so
0x4067d4e2 in G__getitem + 0x5c1 from /work/dorofeev/root/v4.00.08/rh90_gcc322/root/lib/libCint.so
0x4067c0fa in G__getexpr + 0x783e from /work/dorofeev/root/v4.00.08/rh90_gcc322/root/lib/libCint.so
0x406c3710 in G__exec_function + 0x1d5 from /work/dorofeev/root/v4.00.08/rh90_gcc322/root/lib/libCint.so
0x406ca35d in G__exec_statement + 0x23eb from /work/dorofeev/root/v4.00.08/rh90_gcc322/root/lib/libCint.so
0x40665493 in G__exec_tempfile_core + 0x2ce from /work/dorofeev/root/v4.00.08/rh90_gcc322/root/lib/libCint.so
0x40665670 in G__exec_tempfile_fp + 0x22 from /work/dorofeev/root/v4.00.08/rh90_gcc322/root/lib/libCint.so
0x406d24f8 in G__process_cmd + 0x4575 from /work/dorofeev/root/v4.00.08/rh90_gcc322/root/lib/libCint.so
0x4019220d in TCint::ProcessLine(char const*, TInterpreter::EErrorCode*) + 0xa9 from /work/dorofeev/root/v4.00.08/rh90_gcc322/root/lib/libCore.so
0x40104060 in TApplication::ProcessLine(char const*, bool, int*) + 0x596 from /work/dorofeev/root/v4.00.08/rh90_gcc322/root/lib/libCore.so
0x4100df8d in TRint::HandleTermInput() + 0x1dd from /work/dorofeev/root/v4.00.08/rh90_gcc322/root/lib/libRint.so
0x4100cede in TTermInputHandler::Notify() + 0x24 from /work/dorofeev/root/v4.00.08/rh90_gcc322/root/lib/libRint.so
0x4100e8bc in TTermInputHandler::ReadNotify() + 0x12 from /work/dorofeev/root/v4.00.08/rh90_gcc322/root/lib/libRint.so
0x401fb8b5 in TUnixSystem::CheckDescriptors() + 0x143 from /work/dorofeev/root/v4.00.08/rh90_gcc322/root/lib/libCore.so
0x401fae8f in TUnixSystem::DispatchOneEvent(bool) + 0x161 from /work/dorofeev/root/v4.00.08/rh90_gcc322/root/lib/libCore.so
0x4015fb94 in TSystem::InnerLoop() + 0x18 from /work/dorofeev/root/v4.00.08/rh90_gcc322/root/lib/libCore.so
0x4015fb39 in TSystem::Run() + 0x6f from /work/dorofeev/root/v4.00.08/rh90_gcc322/root/lib/libCore.so
0x40104ad4 in TApplication::Run(bool) + 0x32 from /work/dorofeev/root/v4.00.08/rh90_gcc322/root/lib/libCore.so
0x4100da89 in TRint::Run(bool) + 0x327 from /work/dorofeev/root/v4.00.08/rh90_gcc322/root/lib/libRint.so
0x0804886d in main + 0x71 from /work/dorofeev/root/v4.00.08/rh90_gcc322/root/bin/root.exe
0x42015704 in __libc_start_main + 0xe4 from /lib/tls/libc.so.6
0x0804876d in _Unwind_Resume + 0x31 from /work/dorofeev/root/v4.00.08/rh90_gcc322/root/bin/root.exe
Root >
root [6] .q

Hi,

The first step would be to get a better stack trace (to make sure the problem does not come from your code). Run root.exe in the debugger.

Cheers,
Philippe.

Hi Philippe,
It sounds strange, for as i’ve mentioned i’ve tested 3 methods.
When i use a TChain::Process(“testSelector.C”) everything is ok.
Everyhting is fine, when i load by .L testSelector.C++, then create an inherited from
the TSelector object and run the TChain::Process(TSelector *obj).
My personal inclusion is just a printout from a code, created by MakeSelector.
Regards, Valery.

Hi,

To be more helpfull, I would still need to get a full stack trace of the crash.

Cheers,
Philippe.

Hi,

It looks that i have foun the reason.

I store in a TTree a splitted object of, say, MyClass.
Thus in a MySelector, inherited from the TSelector, generated by
a MakeSelector there is a declaration of the MyClass pointer along with declarations of
the MyClass members.
In the MySelector::Process i checked the value of this poibter to be non-zero.
It is equal to 0 in the case of interpreted run ( Process(“MYSelcetor.C”)), and
is non-zero for the compiled case (Process(“MySelcetor.C+”)).
It’s better to generate code with presetting this pointer to NULL in the MySelector c-tor.

Thank you for the inspiring help.
Regards, Valery.