Message: segmentation fault from (G4HadronCrossSections::Instance())->GetInelasticCrossSection(...) Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question segmentation fault from (G4HadronCrossSections::Instance())->GetInelasticCrossSection(...) 

Forum: Hadronic Processes
Date: 11 Oct, 2016
From: Jonas <Jonas>

Hello,

I'm getting a segmentation fault from

G4double xsection = (G4HadronCrossSections::Instance())->GetInelasticCrossSection( particle, Z, A );

when I'm using photons (gammas), also when I use e-, mu-, u or d quark, Delta+, D+, eta; however it works when I use protons, neutrons, pi+ or alpha particles, it works. (See code below)

Anybody has any idea why this is?
And, can somebody please try to reproduce the error with the code below?

Best Regards, Jonas

=========================================================================
// XSections.cc
// JR
#include "G4HadronCrossSections.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4ThreeVector.hh"
#include "G4SystemOfUnits.hh"
#include "G4RunManager.hh"

#include "FTFP_BERT.hh" // physics list

int main()
{
G4RunManager* runManager = new G4RunManager;
runManager->SetUserInitialization(new FTFP_BERT);

G4ParticleDefinition* particleDefinition = G4ParticleTable::GetParticleTable()->FindParticle(22); // "gamma"

G4DynamicParticle* particle = new G4DynamicParticle(particleDefinition, G4ThreeVector(0.,0.,1.), 50.*MeV);

particle->DumpInfo();

G4int Z = 26;
G4int A = 56;

G4double xsection = (G4HadronCrossSections::Instance())->GetInelasticCrossSection( particle, Z, A );
G4cout << "x-section: " << xsection/millibarn << " mb" << G4endl;

delete particle;
delete runManager;
return 0;
}

=========================================================================
# CMakeLists.txt
# for XSections
# JR

cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
project(XSections)

find_package(Geant4 REQUIRED)

include(${Geant4_USE_FILE})
include_directories(${PROJECT_SOURCE_DIR}/include)

# (as of yet, no files here)
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)

add_executable(XSections XSections.cc ${sources} ${headers})
target_link_libraries(XSections ${Geant4_LIBRARIES})

install(TARGETS XSections DESTINATION bin)

=========================================================================
console output:

% make -j8  
Scanning dependencies of target XSections
[ 50%] Building CXX object CMakeFiles/XSections.dir/XSections.cc.o
[100%] Linking CXX executable XSections
[100%] Built target XSections
% ./XSections

*************************************************************
 Geant4 version Name: geant4-10-02-patch-02    (17-June-2016)
                      Copyright : Geant4 Collaboration
                      Reference : NIM A 506 (2003), 250-303
                            WWW : http://cern.ch/geant4
*************************************************************

<<< Geant4 Physics List simulation engine: FTFP_BERT 2.0

 Particle type - gamma
   mass:        0[GeV]
   charge:      0[e]
   Direction x: 0, y: 0, z: 1
   Total Momentum = 0.05[GeV]
   Momentum: 0[GeV], y: 0[GeV], z: 0.05[GeV]
   Total Energy   = 0.05[GeV]
   Kinetic Energy = 0.05[GeV]
 MagneticMoment  [MeV/T]: 0
   ProperTime     = 0[ns]
[1]    184725 segmentation fault  ./XSections
%
=========================================================================

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 Ok: Re: segmentation fault from (G4HadronCrossSections::Instance())->GetInelasticCrossSection(...)   (Jonas - 12 Oct, 2016)
(_ Idea: Re: segmentation fault from (G4HadronCrossSections::Instance())->GetInelasticCrossSection(...)   (Vladimir Ivanchenko - 16 Oct, 2016)
 Add Message Add Message
to: "segmentation fault from (G4HadronCrossSections::Instance())->GetInelasticCrossSection(...)"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]