Problems modifying a TSelector (basic)

Hello. I’m very new to ROOT, and in attempting to follow documentation and apply it to the analysis of some data I’m running into errors I can’t understand or seem to correct.

I’ve set up ROOT from ATLASLocalRootBase, i.e. by

	export ATLAS_LOCAL_ROOT_BASE=/cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase
	alias setupATLAS='source ${ATLAS_LOCAL_ROOT_BASE}/user/atlasLocalSetup.sh'
	setupATLAS
	lsetup root

Following the articles
[ul]
root.cern.ch/developing-tselector
root.cern.ch/accessing-ttree-tselector
[/ul]
I’m generating a TSelector from a given TTree as follows -

	root [0] TFile *f = new TFile("filename.root")
	root [1] TTree *t = (TTree *) f->Get("treename")
	root [2] t->MakeSelector("selectorname")
	root [3] t->Process("selectorname.C")

At first this works correctly. However if I run the last command again (as I did initially after making changes to selectorname.C), I get

	*** Break *** segmentation violation

followed by a very long stack trace. If I run it a third time I get instead

	In file included from input_line_179:1:
	In file included from /path/selectorname.C:26:
	/path/selectorname.h:314:20: error: redefinition of 'Init'
	void selectorname::Init(TTree *tree)
	
	/path/selectorname.h:314:20: previous definition is here
	void selectorname::Init(TTree *tree)

and the same for Notify, Begin, SlaveBegin, Process, SlaveTerminate and Terminate, followed by another segmentation violation with a much shorter stack trace.

I imagine there is something fundamentally wrong with what I’m doing (and that really I should return to the documentation and work through it more fully), but with limited experience of ROOT (and C++, and Linux…) I’m at a loss as to where to go from here.

Many thanks in advance for your assistance.
Tim

Dear Tim,

I could reproduce some weird behaviour, although not exactly yours.
To help investigation, could you:

  1. Specify which is version your ROOT version (also platform)?
  2. Repeat the exercise adding a +, i.e.
t->Process("selectorname.C+")

G Ganis

The version of ROOT is 6.02/12, I am ssh’ing from Windows (my computer) to Linux (a computer in the department, not sure which Linux distribution, etc.).

	Info in <TUnixSystem::ACLiC>: creating shared library /path/./selectorname_C. so
	
	Total number of events is 160507
	(Long64_t) 0

and on repetition,

	Info in <ACLiC>: unmodified script has already been compiled and loaded
	
	Total number of events is 160507
	(Long64_t) 0

which makes a little more sense. Thank you for your reply!

Tim

Dear Tim,

Apparently this is a (known) problem with macro (re)loading in ROOT 6.
Using the + is the suggested workaround.
I have opened a JIRA ticket in the case you want to follow the evolution (sft.its.cern.ch/jira/browse/ROOT-7936).

G Ganis

Ah - that’s comforting, in a sense. Thank you, will keep an eye on it - and otherwise rest assured I’m not doing something horrendously wrong…