Problem 887

Summary: Unhandled win32 exception with TestEm7 example
Product: Geant4 Reporter: david.shipley
Component: processes/hadronic/utilAssignee: Gunter.Folger
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 8.1   
Hardware: PC   
OS: All   
URL: http://geant4-hn.slac.stanford.edu:5090/HyperNews/public/get/docsexamples/271.html

Description david.shipley 2006-08-30 11:09:13 CEST
I am having problems running extended example TestEm7 using macro file
proton.mac and with the hadronic physics models enabled (binary etc) under
Windows XP/cygwin/Visual Studio 2005 (see my posts on the user forum - URL
below). Trace information to the exception is given in one of the later
postings.

I have also had similar problems with the HadronTherapy advanced example. In
both cases, there appears to be no problem running these configurations under
Linux (which seems to indicate that it may be a platform issue).

Please advise.
Comment 1 dennis.herbert.wright 2006-09-20 20:11:59 CEST
I have no experience running under Windows, so I will try to find another
hadronics expert who does.
Comment 2 Gabriele Cosmo 2006-10-23 10:05:59 CEST
Catching in sync with the investigations ...

The problem was reproduced by compiling the Geant4 kernel libraries and TestEm7 with G4DEBUG=1
as suggested. Then TestEm7 is executed with the macro file proton.mac with only 2 changes (1000
events & binary hadronic physics enabled).

Here is the call stack produced by VS2005 at the point at which the program results in an unhandled
win32 exception (during the first event).

        msvcr80.dll!_crt_debugger_hook(int _Reserved=)  Line 65 C
        msvcr80.dll!_invoke_watson(const wchar_t * pszExpression=0x00000000, const wchar_t *
pszFunction=0x00000000, const wchar_t * pszFile=0x00000000, unsigned int nLine=0, unsigned int
pReserved=0)  Line 181 + 0x7 bytes  C++
        msvcr80.dll!_invalid_parameter_noinfo()  Line 99 + 0xc bytes    C++
        TestEm7.exe!std::vector<CLHEP::Hep3Vector,std::allocator<CLHEP::Hep3Vector> >::operator[]
(unsigned int _Pos=0)  Line 762        C++
        TestEm7.exe!G4Fancy3DNucleus::ChoosePositions()  Line 313 + 0x13 bytes  C++
        TestEm7.exe!G4Fancy3DNucleus::Init(double theA=16.000000000000000, double
theZ=8.0000000000000000)  Line 95     C++
        TestEm7.exe!G4BinaryCascade::ApplyYourself(const G4HadProjectile & aTrack={...}, G4Nucleus &
aNucleus={...})  Line 158  C++
        TestEm7.exe!G4HadronicInteractionWrapper::ApplyInteraction(G4HadProjectile & thePro={...},
G4Nucleus & targetNucleus={...}, G4HadronicInteraction * theInteraction=0x01682f38)  Line 37 C++
        TestEm7.exe!G4HadronicProcess::GeneralPostStepDoIt(const G4Track & aTrack={...}, const G4Step
& __formal={...})  Line 418 + 0x2b bytes  C++
        TestEm7.exe!G4HadronInelasticProcess::PostStepDoIt(const G4Track & aTrack={...}, const G4Step
& aStep={...})  Line 81   C++
        TestEm7.exe!G4SteppingManager::InvokePSDIP(unsigned int np=3)  Line 503 + 0x21 bytes    C++
        TestEm7.exe!G4SteppingManager::InvokePostStepDoItProcs()  Line 485      C++
        TestEm7.exe!G4SteppingManager::Stepping()  Line 208     C++
Comment 3 Gabriele Cosmo 2006-10-23 10:05:59 CEST
Catching in sync with the investigations ...

The problem was reproduced by compiling the Geant4 kernel libraries and TestEm7 with G4DEBUG=1
as suggested. Then TestEm7 is executed with the macro file proton.mac with only 2 changes (1000
events & binary hadronic physics enabled).

Here is the call stack produced by VS2005 at the point at which the program results in an unhandled
win32 exception (during the first event).

        msvcr80.dll!_crt_debugger_hook(int _Reserved=)  Line 65 C
        msvcr80.dll!_invoke_watson(const wchar_t * pszExpression=0x00000000, const wchar_t *
pszFunction=0x00000000, const wchar_t * pszFile=0x00000000, unsigned int nLine=0, unsigned int
pReserved=0)  Line 181 + 0x7 bytes  C++
        msvcr80.dll!_invalid_parameter_noinfo()  Line 99 + 0xc bytes    C++
        TestEm7.exe!std::vector<CLHEP::Hep3Vector,std::allocator<CLHEP::Hep3Vector> >::operator[]
(unsigned int _Pos=0)  Line 762        C++
        TestEm7.exe!G4Fancy3DNucleus::ChoosePositions()  Line 313 + 0x13 bytes  C++
        TestEm7.exe!G4Fancy3DNucleus::Init(double theA=16.000000000000000, double
theZ=8.0000000000000000)  Line 95     C++
        TestEm7.exe!G4BinaryCascade::ApplyYourself(const G4HadProjectile & aTrack={...}, G4Nucleus &
aNucleus={...})  Line 158  C++
        TestEm7.exe!G4HadronicInteractionWrapper::ApplyInteraction(G4HadProjectile & thePro={...},
G4Nucleus & targetNucleus={...}, G4HadronicInteraction * theInteraction=0x01682f38)  Line 37 C++
        TestEm7.exe!G4HadronicProcess::GeneralPostStepDoIt(const G4Track & aTrack={...}, const G4Step
& __formal={...})  Line 418 + 0x2b bytes  C++
        TestEm7.exe!G4HadronInelasticProcess::PostStepDoIt(const G4Track & aTrack={...}, const G4Step
& aStep={...})  Line 81   C++
        TestEm7.exe!G4SteppingManager::InvokePSDIP(unsigned int np=3)  Line 503 + 0x21 bytes    C++
        TestEm7.exe!G4SteppingManager::InvokePostStepDoItProcs()  Line 485      C++
        TestEm7.exe!G4SteppingManager::Stepping()  Line 208     C++
Comment 4 Gabriele Cosmo 2006-10-23 10:06:59 CEST
Catching in sync with the investigations ...

The problem was reproduced by compiling the Geant4 kernel libraries and TestEm7 with G4DEBUG=1
as suggested. Then TestEm7 is executed with the macro file proton.mac with only 2 changes (1000
events & binary hadronic physics enabled).

Here is the call stack produced by VS2005 at the point at which the program results in an unhandled
win32 exception (during the first event).

        msvcr80.dll!_crt_debugger_hook(int _Reserved=)  Line 65 C
        msvcr80.dll!_invoke_watson(const wchar_t * pszExpression=0x00000000, const wchar_t *
pszFunction=0x00000000, const wchar_t * pszFile=0x00000000, unsigned int nLine=0, unsigned int
pReserved=0)  Line 181 + 0x7 bytes  C++
        msvcr80.dll!_invalid_parameter_noinfo()  Line 99 + 0xc bytes    C++
        TestEm7.exe!std::vector<CLHEP::Hep3Vector,std::allocator<CLHEP::Hep3Vector> >::operator[]
(unsigned int _Pos=0)  Line 762        C++
        TestEm7.exe!G4Fancy3DNucleus::ChoosePositions()  Line 313 + 0x13 bytes  C++
        TestEm7.exe!G4Fancy3DNucleus::Init(double theA=16.000000000000000, double
theZ=8.0000000000000000)  Line 95     C++
        TestEm7.exe!G4BinaryCascade::ApplyYourself(const G4HadProjectile & aTrack={...}, G4Nucleus &
aNucleus={...})  Line 158  C++
        TestEm7.exe!G4HadronicInteractionWrapper::ApplyInteraction(G4HadProjectile & thePro={...},
G4Nucleus & targetNucleus={...}, G4HadronicInteraction * theInteraction=0x01682f38)  Line 37 C++
        TestEm7.exe!G4HadronicProcess::GeneralPostStepDoIt(const G4Track & aTrack={...}, const G4Step
& __formal={...})  Line 418 + 0x2b bytes  C++
        TestEm7.exe!G4HadronInelasticProcess::PostStepDoIt(const G4Track & aTrack={...}, const G4Step
& aStep={...})  Line 81   C++
        TestEm7.exe!G4SteppingManager::InvokePSDIP(unsigned int np=3)  Line 503 + 0x21 bytes    C++
        TestEm7.exe!G4SteppingManager::InvokePostStepDoItProcs()  Line 485      C++
        TestEm7.exe!G4SteppingManager::Stepping()  Line 208     C++
Comment 5 Gabriele Cosmo 2006-10-23 10:09:59 CEST
A fix was introduced in the module processes/hadronics/models/utils (tag hadr-mod-util-V08-01-01)
reviewing the way std vectors are treated. The fix requires verification for this problem.
Comment 6 Gabriele Cosmo 2006-10-26 08:39:59 CEST
The user re-built and re-run TestEm7 using the patch in "hadr-mod-util-V08-01-01"
Ran TestEm7 within cygwin (VC++8.0), with proton.mac (using the binary hadronic
physics list, 2000 events). The program still fails producing an unhandled win32
exception. The call back (trace) for this issue is given below (and is
different to before).

Other quick tests:

1) no hadronic physics used -> works OK (as before)
2) binary-ion had physics -> works OK for 10000 ev (as before)
3) elastic had physics -> fails after < 2000 ev (trace also below)

Call back trace (with 'binary' had physics list):

	msvcr80.dll!_crt_debugger_hook(int _Reserved=)  Line 65	C
 	msvcr80.dll!_invoke_watson(const wchar_t *
pszExpression=0x00000000, const wchar_t * pszFunction=0x00000000, const
wchar_t * pszFile=0x00000000, unsigned int nLine=0, unsigned int
pReserved=0)  Line 181 + 0x7 bytes	C++
 	msvcr80.dll!_invalid_parameter_noinfo()  Line 99 + 0xc bytes C++
 	TestEm7.exe!std::list<G4Fragment *,std::allocator<G4Fragment *>
::_Const_iterator<1>::operator--()  Line 271	C++
 	TestEm7.exe!std::list<G4Fragment *,std::allocator<G4Fragment *>
::_Iterator<1>::operator--()  Line 412	C++
 	TestEm7.exe!std::list<G4Fragment *,std::allocator<G4Fragment *>
::_Iterator<1>::operator--(int __formal=0)  Line 419	C++
 	TestEm7.exe!G4ExcitationHandler::BreakItUp(const G4Fragment &
theInitialState={...})  Line 225 + 0x14 bytes	C++
 	TestEm7.exe!G4PreCompoundModel::PerformEquilibriumEmission(const
G4Fragment & aFragment={...}, std::vector<G4ReactionProduct
*,std::allocator<G4ReactionProduct *> > * Result=[1](0x01b51d28
{theParticleDefinition=0x015c8480 positionInNucleus={...}
formationTime=0.00000000000000000 ...}))  Line 283 + 0x13 bytes C++
 	TestEm7.exe!G4PreCompoundModel::DeExcite(const G4Fragment &
theInitialState={...})  Line 269	C++
 	TestEm7.exe!G4BinaryCascade::Propagate(G4KineticTrackVector *
secondaries=0x0177afb8, G4V3DNucleus * nucleus=0x01730ca8)  Line 524 +
0x25 bytes	C++
 	TestEm7.exe!G4BinaryCascade::ApplyYourself(const G4HadProjectile
& aTrack={...}, G4Nucleus & aNucleus={...})  Line 212 + 0x24 bytes C++
Comment 7 Gunter.Folger 2011-03-18 15:23:37 CET
Fixes in 9.4; several examples failed on windows, and most are now fixed.