ROOT 32 v 64 bit problems


I am an undergraduate researcher and am currently trying to compile and execute a monte carlo simulation (using GEANT4) on a 64 bit linux computer. I am told that it works seamlessly with 32 bit macs and linux with the proper installations of ROOT, CLHEP, and GEANT4. However, I have hit a snag trying to execute with the 64 bit versions. There appears to be a memory leak and the program always crashes with a segmentation violation in between these two lines:

EventTree = new TTree("Events","Statistics for each event"); EventTree->Branch("particle_data","EventData",&data,32000,1);

My question is whether the 64 v 32 bit issue might be the root of the problem, and how I may get past it. Should programs geared towards a 32 bit installation be able to run on 64 bit architecture? Also, if this may be the case, how would I go about installing the 32 bit version of ROOT? I have just recently loaded the source code and have tried:

which I think should run a 32 bit instillation if I am not mistaken. However, after trying ‘make’ I recieved an error:

e\" -DOBJSUFFIX=\".o\" -o build/rmkdepend/cppsetup.o -c build/rmkdepend/cppsetup.c In file included from /usr/include/features.h:352, from /usr/include/stdio.h:28, from build/rmkdepend/def.h:35, from build/rmkdepend/cppsetup.c:30: /usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory Running build/unix/ Making include/compiledata.h bin/rmkdepend -R -fcint/cint/src/g__cfunc.d -Y -w 1000 -- -pipe -m32 -Wall -W -fPIC -Iinclude -DG__REGEXP -DG__UNIX -DG__SHAREDLIB -DG__OSFDLL -DG__ROOT -DG__REDIRECTIO -DG__STD_EXCEPTION -DG__HAVE_CONFIG -DG__NOMAKEINFO -DG__CINTBODY -Icint/cint/inc -Icint/cint/src -Icint/cint/src/dict -pthread -I. -- cint/cint/src/g__cfunc.c make: bin/rmkdepend: Command not found make: *** [cint/cint/src/g__cfunc.o] Error 127

Is this because I forced it to compile for the wrong version of linux? I could try make -k but, but this might leave me with an incomplete version of root.

I know this is a very vague problem but I’d appreciate any help that I can get!



the 64 bit version should of course work. You might be working around a real problem with your code that’s only visible in 64bit. So I would stick with 64bit and try to understand why you see the crash. With the information you provided (what is data? how do you iterate? where is your tree - i.e. we need your code) I cannot really help you track it down…

To get 32bit built on 64bit you need additional headers. If you use SLC5 (but how should I know…) you should install

yum -y install glibc-devel

(which you could have found out searching this forum, too :wink:

So please provide OS, which ROOT version you use and your code so we can properly help you.

Cheers, Axel.

Thanks Axel,

I have tried the command that you gave me, but the problem is that my account doesn’t have the necessary permissions to install this way. It comes up with the errors:

Loaded plugins: fastestmirror, kernel-module Traceback (most recent call last): File "/usr/bin/yum", line 29, in ? yummain.user_main(sys.argv[1:], exit_code=True) File "/usr/share/yum-cli/", line 309, in user_main errcode = main(args) File "/usr/share/yum-cli/", line 157, in main base.getOptionsConfig(args) File "/usr/share/yum-cli/", line 201, in getOptionsConfig (opts, self.cmds) = self.optparser.setupYumConfig(args=args) File "/usr/share/yum-cli/", line 1172, in setupYumConfig cachedir = yum.misc.getCacheDir() File "/usr/lib/python2.4/site-packages/yum/", line 544, in getCacheDir cachedir = tempfile.mkdtemp(prefix=prefix, dir=tmpdir) File "/usr/lib64/python2.4/", line 328, in mkdtemp _os.mkdir(file, 0700) OSError: [Errno 13] Permission denied: '/var/tmp/yum-anemtzow-gkQn6S'

The current system that I am working on is: Linux version 2.6.18-194.3.1.el5 ( (gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)) #1 SMP Fri May 7 01:43:09 EDT 2010.

Also, the problematic code is simply one part of a quite large program. For the sake of saving space here is the file which is causing the problem:

[code]//#include “PUProcessesList.hh”
#include “PUAnalysis.hh”
//#include “EventDataDict.h”
#include “G4ProcessManager.hh”
#include “G4ProcessVector.hh”
#include “G4ParticleDefinition.hh”
#include “G4ParticleWithCuts.hh”
#include “G4ParticleTypes.hh”
#include “G4ParticleTable.hh”
#include “G4ios.hh”
#include “Randomize.hh”
#include “globals.hh”
#include “G4HCofThisEvent.hh”
#include “PUHit.hh”
#include “CLHEP/Random/Random.h”
#include “CLHEP/Random/RandGauss.h”
#include “TString.h”
#include “G4UImanager.hh”
#include “ConfigOptions.hh”
#include “G4VPhysicalVolume.hh”
#include “G4PhysicalVolumeStore.hh”
#include “PUPlacement.hh”
#include “TH1F.h”
#include “TFile.h”
#include “TTree.h”
#include “G4Track.hh”
#include “G4Event.hh”
#include “G4Navigator.hh”
PUAnalysis* PUAnalysis::instance = 0;

PUAnalysis::PUAnalysis(G4String filename) : ok(true), ROOTFileName(filename)
ConfigOptions *config = ConfigOptions::GetInstance();
if(ROOTFileName == “”){
ROOTFileName = config->GetValue(“output_filename”);

if(ROOTFileName.length() < 5 ||
ROOTFileName.substr(ROOTFileName.length()-5) != “.root”){



std::string::size_type loc = ROOTFileName.find(’/’,0);
if(loc == std::string::npos){
std::string output_dir = config->GetValue(“output_directory”);
nav = new G4Navigator;
event_threshold = 1keV;
registration_threshold = 1
if(config->GetValue(“event_threshold”) != “”)
event_threshold = atof(config->GetValue(“event_threshold”).c_str())*keV;
if(config->GetValue(“registration_threshold”) != “”)
registration_threshold =


if(OutFile->IsOpen()) Finish();
// if(ok) delete EventTree;
delete OutFile;
delete data;
delete nav;

PUAnalysis* PUAnalysis::GetInstance(G4String filename)
if (instance == 0) instance = new PUAnalysis(filename);
return instance;

void PUAnalysis::Init()
data = new EventData;
OutFile = new TFile(ROOTFileName.c_str(),“RECREATE”);
G4cout<<"Error: Unable to open output file "<<ROOTFileName<<G4endl;
G4cout<<"Saving output to file "<<ROOTFileName<<G4endl;
EventTree = new TTree(“Events”,“Statistics for each event”);

void PUAnalysis::Finish()
if(OutFile->IsOpen() && ok){
G4cout<<“Saving output to file “<<ROOTFileName<<G4endl;

void PUAnalysis::WriteConfigOptions()
ConfigOptions *config = ConfigOptions::GetInstance();
if(config->GetValue(“save_config”) == “true”){
G4cout<<“Saving config options to root file…”<<G4endl;
TTree ConfigTree = new TTree(“ConfigOptions”,“Configuration Options”);
str_str_map ops_map = config->GetOptionsMap();
std::map<std::string, std::string>::iterator ops=ops_map.begin();
while(ops != ops_map.end()){
ConfigTree->Branch((ops -> first).c_str(),
)(ops -> second).c_str(),
(ops -> first + “/C”).c_str() );

void PUAnalysis::RegisterParticle(const G4Track * ptrack)
G4int id = ptrack->GetTrackID();
G4int parid = ptrack->GetParentID();
G4ParticleDefinition *particle = ptrack->GetDefinition();
G4String pname = particle->GetParticleName();
G4String ptype = particle->GetParticleType();
const G4VProcess * proc = ptrack->GetCreatorProcess();
G4String procname = “primary”;
if(proc) procname = proc->GetProcessName();
G4ThreeVector pos = ptrack->GetPosition();
G4VPhysicalVolume *vol = nav->LocateGlobalPointAndSetup(pos);
G4String volname = “unreadable”;
if(vol) volname = vol->GetName();
G4double KE = ptrack->GetKineticEnergy()/keV;
G4double time = ptrack->GetGlobalTime()/s;
if(KE > registration_threshold/keV
|| pname == “neutron”
|| particle->GetPDGLifeTime() > 0) {

void PUAnalysis::EndEvent(const G4Event *evt)
G4ThreeVector active_centroid(0,0,0);
G4HCofThisEvent *HCE = evt->GetHCofThisEvent();
G4cout<<“HCofThisEvent is null pointer!!”<<G4endl;
EventData::detector_list det=EventData::active;
for(G4int i=0;iGetNumberOfCollections();i++){
HitsCollection hc = (HitsCollection)HCE->GetHC(i);
if(hc->GetName() == “activeDet”)
det = EventData::active;
else if(hc->GetName() == “vetoDet”)
det = EventData::veto;
else if(hc->GetName() == “inactiveDet”)
det = EventData::inactive;
else if(hc->GetName() == “externalDet”)
det = EventData::external;
G4cout<<“Warning! Unknown hits collection passed to analysis!”<<G4endl;
for(G4int hitid=0; hitid < hc->entries(); hitid++){
PUHit *hit = (*hc)[hitid];
G4int id=hit->GetID();
G4int parid = hit->GetParentID();
G4double edep=hit->GetEdep()/keV;
G4String volname = “unreadable”;
G4VPhysicalVolume *vol = hit->GetVolume();
if(vol) volname = vol->GetName();
if(det == EventData::active){
active_centroid += hit->GetPosition() * hit->GetEdep()/keV;

double total_active_edep = std::accumulate(data->edep_active.begin(),
double total_veto_edep = std::accumulate(data->edep_veto.begin(),

if(total_active_edep > event_threshold/keV){
data->total_active_edep = total_active_edep;
active_centroid /= total_active_edep;
G4PhysicalVolumeStore* volstore = G4PhysicalVolumeStore::GetInstance();
PUPlacement* active_vol = (PUPlacement*)(volstore->GetVolume(“p_active”));
active_centroid -= active_vol->GetGlobalCenter();

data->total_veto_edep = total_veto_edep;

data->active_centroid_x = active_centroid.getX();
data->active_centroid_y = active_centroid.getY();
data->active_centroid_z = active_centroid.getZ();


else if(total_veto_edep > event_threshold/keV){
data->total_veto_edep = total_veto_edep;
data->total_active_edep = total_active_edep;


I found by placing cout statements that the error occurs in the Init() section in the middle. It completes the EventTree = new TTree(…) but never finishes Event Tree->Branch(…). I am not the author of the code so I am no expert on the structure of the program, but can assure you that this is working fine on other 32 bit computers. I am currently using ROOT version 5_27 but have also found the same error when I had root 5_26 (both are available on the system in a shared library and are compiled for 64 bit). I am assuming that it is in face a problem with the code that only appears in in 64 bit, however, if it runs on 32 I would like to try a 32 bit install on the computer to confirm this. If you need any other information such as a gdb debug please ask! Also, I am not sure if this is important, but I am accessing this program from another computer. I am using ssh -y and have been able to run some GEANT4 examples without a problem.

Thanks for the help so far, I really appreciate it.



Can you post the definition of EventData? Can you call

gROOT->ProcessLine(".class EventData")

in front of the new TTree() in PUAnalysis::Init() and post the output?

Cheers, Axel.

hey it turns out the GNUmakefile just needed to be restructured a bit. Now it compiles and runs fine! Thanks for the help though!