Writing a class into a tree inside Geant4

Hi,

I’m trying to add a class to a tree inside a Geant4 program (writing doubles into the tree works already) and get problems with the Dictionary.
The class consists of some double and also G4Strings for which I have to include “globals.hh” (from G4INSTALL). When I try to create the Dictionary I’m using the command
rootcint Dictionary.cc -c -I$(G4INSTALL) include/Settings.hh RootLinkDef.h
where G4INSTALL points to the directory with the geant4 includes.
rootcint then reports that it can’t find “globals.hh” and quits because it doesn’t know G4Strings.
Is there any option to rootcint so that it tells me where it searchs for globals.hh or am I doing something wrong?
Thanks,

Vinzenz

Hi,

rootcint support the -I. Since you already added -I$(G4INSTALL), I suspect that globals.hh is actually is a subdirectory of the g4 install directory (maybe you meant -I$(G4INSTALL)/include ?)

Cheers,
Philippe.

Good to know that the -I option should work. Actually globals.hh is not in G4INSTALL, but a subdirectory, but at least for g++ that still works since all subdirectories are searched as well.
So is this different for rootcint? Do I have to list every single subdirectory I’ll need?

[quote]but at least for g++ that still works since all subdirectories are searched as well. [/quote]As far as I know, this is incorrect, g++ does not look in subdirective unless explicitly asked. In term of support for -I the behavior of CINT and g++ should be the same.

So my suspicions is that you code is using
#include "somesubidrectory/globals.hh"
but that you entered only
#include "globals.hh"
when using rootcint.

Cheers,
Philippe

If I try to enter “subdirectory/globals.hh” rootcint complains that is doesn’t find the header files included by globals.hh which would mean that I have use -I for each subdirectory with header-files (which are a lot). Anyway the compilation of the Geant4 program without adding a class to a tree works fine even if I only use -I$(G4INSTALL) for g++ (and globals.hh is inluded and found by g++).

Hi,
no, there must be something else that’s wrong. If it works for GCC it works for rootcint, too. So we need more info to understand what’s wrong, and how to fix it. Please send all of this:

  • where do you ‘enter “subdirectory/globals.hh”’
  • your Linkdef.h
  • one of your headers that includes a geant header
  • the output of ‘ls -I$(G4INSTALL)’
  • the exact position (as in full path) of globals.hh, and the value of $(G4INSTALL)
  • the exact line with all flags that you use to compile your file with g++ (no “mysubdir” - we need the exact line)
  • the exact line with all flags that you use to call rootcint
  • $PWD of where you call g++, $PWD of where you call rootcint.

Yes, it’s a lot, but this way we can be sure that we can reproduce what you’re doing.

Cheers, Axel.

Okay, I’ve rechecked the “normal” Makefile (without own class in tree) and it includes a special geant4 makefile which has every single subdirectory listed. So I’ll try first to do it the same way with rootcint and see if it works now.