Skip to content

Commit

Permalink
compilation geant4.10.10 and old versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Arbor committed Jan 15, 2014
1 parent 5c066d9 commit e8fa2fa
Show file tree
Hide file tree
Showing 14 changed files with 383 additions and 299 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ ENDIF()
STRING(REGEX REPLACE "(.*)[.](.*)[.](.*)" "\\1" G4VERSION_MAJOR ${Geant4_VERSION})
STRING(REGEX REPLACE "(.*)[.](.*)[.](.*)" "\\2" G4VERSION_MINOR ${Geant4_VERSION})
STRING(REGEX REPLACE "(.*)[.](.*)[.](.*)" "\\3" G4VERSION_PATCH ${Geant4_VERSION})
#MESSAGE(${Geant4_VERSION})
#MESSAGE(${G4VERSION_MAJOR})
#MESSAGE(${G4VERSION_MINOR})
#MESSAGE(${G4VERSION_PATCH})

IF(${G4VERSION_MINOR} EQUAL 6)
IF((${G4VERSION_MAJOR} EQUAL 9 AND ${G4VERSION_MINOR} GREATER 6) OR ${G4VERSION_MAJOR} GREATER 9)
OPTION(Geant496_COMPATIBILITY "Compatibility with Geant4.9.6 version" ON)
ELSE()
OPTION(Geant496_COMPATIBILITY "Compatibility with Geant4.9.6 version" OFF)
ENDIF()


#=========================================================
# Option for Root use
OPTION(GATE_USE_ROOT "Gate use ROOT (Recommanded)" ON)
Expand Down
2 changes: 1 addition & 1 deletion Gate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ int main( int argc, char* argv[] )
welcome();

std::ostringstream s;
s << G4VERSION_MAJOR;// << "." << G4VERSION_MINOR << "." << G4VERSION_PATCH; //no match for geant4.10.00
s << G4VERSION_MAJOR << "." << G4VERSION_MINOR << "." << G4VERSION_PATCH;
GateMessage( "Core", 0, "You are using Geant4 version " << s.str() << G4endl );

// Launching Gate if macro file
Expand Down
9 changes: 8 additions & 1 deletion GateConfiguration.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,15 @@
#cmakedefine GATE_USE_GPU @GATE_USE_GPU@
#cmakedefine CUDA_FOUND @CUDA_FOUND@

// WARNING : Replace all G4VERSION_3 and other with a correct test
#ifndef G4VERSION_MINOR
#define G4VERSION_MINOR 0
#endif

#ifndef G4VERSION_PATCH
#define G4VERSION_PATCH 0
#endif

// WARNING : Replace all G4VERSION_3 and other with a correct test
#if (G4VERSION_MAJOR > 9) || ((G4VERSION_MAJOR==9) && (G4VERSION_MINOR >=3))
#define G4VERSION9_3 1
#endif
Expand Down
18 changes: 15 additions & 3 deletions source/digits_hits/src/GateMaterialMuHandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,19 @@ void GateMaterialMuHandler::SimulateMaterialTable()
{
G4String processName = (*processListForGamma)[i]->GetProcessName();
if(processName == "PhotoElectric" || processName == "phot") {
modelPE = (dynamic_cast<G4VEmProcess *>((*processListForGamma)[i]))->EmModel(1); //change Model to EmModel for geant4.10 compilation
#if (G4VERSION_MAJOR > 9) || ((G4VERSION_MAJOR ==9 && G4VERSION_MINOR > 5))
modelPE = (dynamic_cast<G4VEmProcess *>((*processListForGamma)[i]))->EmModel(1);
#else
modelPE = (dynamic_cast<G4VEmProcess *>((*processListForGamma)[i]))->Model(1);
#endif
}
else if(processName == "Compton" || processName == "compt") {
G4VEmProcess *processCS = dynamic_cast<G4VEmProcess *>((*processListForGamma)[i]);
modelCS = processCS->EmModel(1); //change Model to EmModel for geant4.10 compilation
#if (G4VERSION_MAJOR > 9) || ((G4VERSION_MAJOR ==9 && G4VERSION_MINOR > 5))
modelCS = processCS->EmModel(1);
#else
modelCS = processCS->Model(1);
#endif

// Get the G4VParticleChange of compton scattering by running a fictive step (no simple 'get' function available)
G4Track myTrack(new G4DynamicParticle(gamma,G4ThreeVector(1.,0.,0.),0.01),0.,G4ThreeVector(0.,0.,0.));
Expand All @@ -290,7 +298,11 @@ void GateMaterialMuHandler::SimulateMaterialTable()
particleChangeCS = dynamic_cast<G4ParticleChangeForGamma *>(processCS->PostStepDoIt((const G4Track)(myTrack), myStep));
}
else if(processName == "RayleighScattering" || processName == "Rayl") {
modelRS = (dynamic_cast<G4VEmProcess *>((*processListForGamma)[i]))->EmModel(1); //change Model to EmModel for geant4.10 compilation
#if (G4VERSION_MAJOR > 9) || ((G4VERSION_MAJOR ==9 && G4VERSION_MINOR > 5))
modelRS = (dynamic_cast<G4VEmProcess *>((*processListForGamma)[i]))->EmModel(1);
#else
modelRS = (dynamic_cast<G4VEmProcess *>((*processListForGamma)[i]))->Model(1);
#endif
}
}

Expand Down
36 changes: 23 additions & 13 deletions source/physics/include/GateHadronicModelHeaders.hh
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,27 @@ See GATE/LICENSE.txt for further details


// Elastic
//#include "G4LElastic.hh" (replace by G4HadronElastic.hh)
#if (G4VERSION_MAJOR == 9)
#include "G4LElastic.hh"
#endif
#include "G4ElasticHadrNucleusHE.hh"
#include "G4LEpp.hh"
#include "G4LEnp.hh"
#include "G4HadronElastic.hh"

// Nucleus-nucleus
#include "G4BinaryLightIonReaction.hh"
//#include "G4LEDeuteronInelastic.hh"
//#include "G4LETritonInelastic.hh"
//#include "G4LEAlphaInelastic.hh"
#if (G4VERSION_MAJOR == 9)
#include "G4LEDeuteronInelastic.hh"
#include "G4LETritonInelastic.hh"
#include "G4LEAlphaInelastic.hh"
#endif
#include "G4WilsonAbrasionModel.hh"
#include "G4EMDissociation.hh"
#include "G4QMDReaction.hh"

// Low energy parameterized
/*
#if (G4VERSION_MAJOR == 9)
#include "G4LEProtonInelastic.hh"
#include "G4LEPionPlusInelastic.hh"
#include "G4LEPionMinusInelastic.hh"
Expand All @@ -49,7 +53,7 @@ See GATE/LICENSE.txt for further details
#include "G4LEAntiXiMinusInelastic.hh"
#include "G4LEAntiXiZeroInelastic.hh"
#include "G4LEAntiOmegaMinusInelastic.hh"
*/
#endif

// Leading Particle Bias
// Seb Modifs - 05/11/2010 - Geant4 9.4 validations
Expand All @@ -64,17 +68,23 @@ See GATE/LICENSE.txt for further details
#include "G4BinaryCascade.hh"
#include "GateBinaryCascade.hh"
// Gamma- and Lepto-Nuclear
//#include "G4ElectroNuclearReaction.hh"
//#include "G4GammaNuclearReaction.hh"
#if (G4VERSION_MAJOR == 9)
#include "G4ElectroNuclearReaction.hh"
#include "G4GammaNuclearReaction.hh"
#endif

// Neutron (for high precision models, user must first download high precision neutron data files from Geant4 web page)
#include "G4NeutronRadCapture.hh" //#include "G4LCapture.hh"
#if (G4VERSION_MAJOR == 9)
#include "G4LCapture.hh"
#include "G4NeutronHPorLCapture.hh"
#include "G4NeutronHPorLElastic.hh"
#include "G4NeutronHPorLEInelastic.hh"
#include "G4NeutronHPorLFission.hh"
#endif
#include "G4NeutronRadCapture.hh"
#include "G4LFission.hh"
#include "G4NeutronHPCapture.hh"
//#include "G4NeutronHPorLCapture.hh"

#include "G4NeutronHPElastic.hh"
#include "G4NeutronHPInelastic.hh"
#include "G4NeutronHPFission.hh"
//#include "G4NeutronHPorLElastic.hh"
//#include "G4NeutronHPorLEInelastic.hh"
//#include "G4NeutronHPorLFission.hh"
9 changes: 6 additions & 3 deletions source/physics/include/GateeMultipleScatteringPB.hh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ See GATE/LICENSE.txt for further details
#include "GateVProcess.hh"

#include "G4eMultipleScattering.hh"
#include "G4UrbanMscModel.hh" //replace model93 and model95 in geant4.10
//#include "G4UrbanMscModel93.hh"
//#include "G4UrbanMscModel95.hh"
#if (G4VERSION_MAJOR == 9)
#include "G4UrbanMscModel93.hh"
#include "G4UrbanMscModel95.hh"
#else
#include "G4UrbanMscModel.hh"
#endif

MAKE_PROCESS_AUTO_CREATOR_WITH_MODEL(GateeMultipleScatteringPB)

Expand Down
2 changes: 1 addition & 1 deletion source/physics/src/GateBinaryCascade.cc
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ G4HadFinalState * GateBinaryCascade::ApplyYourself(const G4HadProjectile & aTrac
#ifdef Geant496_COMPATIBILITY
the3DNucleus->Init(aNucleus.GetA_asInt(), aNucleus.GetZ_asInt());
#else
the3DNucleus->Init(aNucleus.GetN_asInt(), aNucleus.GetZ_asInt()); //change GetN() by GetN_asInt() for geant4.10 compilation (idem Z)
the3DNucleus->Init(aNucleus.GetN_asInt(), aNucleus.GetZ_asInt());
#endif

thePropagator->Init(the3DNucleus);
Expand Down
18 changes: 15 additions & 3 deletions source/physics/src/GateComptonPB.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,29 @@ void GateComptonPB::AddUserModel(GateListOfHadronicModels * model){
else if(model->GetModelName() == "LivermoreModel")
{
G4LivermoreComptonModel* theLivermoreComptonModel = new G4LivermoreComptonModel();
dynamic_cast<G4VEmProcess*>(pProcess)->SetEmModel(theLivermoreComptonModel); //change SetModel to SetEmModel for geant4.10 compilation
#if (G4VERSION_MAJOR > 9) || ((G4VERSION_MAJOR ==9 && G4VERSION_MINOR > 5))
dynamic_cast<G4VEmProcess*>(pProcess)->SetEmModel(theLivermoreComptonModel);
#else
dynamic_cast<G4VEmProcess*>(pProcess)->SetModel(theLivermoreComptonModel);
#endif
}
else if(model->GetModelName() == "LivermorePolarizedModel")
{
G4LivermorePolarizedComptonModel* theLivermoreComptonModel = new G4LivermorePolarizedComptonModel();
dynamic_cast<G4VEmProcess*>(pProcess)->SetEmModel(theLivermoreComptonModel); //change SetModel to SetEmModel for geant4.10 compilation
#if (G4VERSION_MAJOR > 9) || ((G4VERSION_MAJOR ==9 && G4VERSION_MINOR > 5))
dynamic_cast<G4VEmProcess*>(pProcess)->SetEmModel(theLivermoreComptonModel);
#else
dynamic_cast<G4VEmProcess*>(pProcess)->SetModel(theLivermoreComptonModel);
#endif
}
else if(model->GetModelName() == "PenelopeModel")
{
G4PenelopeComptonModel* theComptonModel = new G4PenelopeComptonModel();
dynamic_cast<G4VEmProcess*>(pProcess)->SetEmModel(theComptonModel); //change SetModel to SetEmModel for geant4.10 compilation
#if (G4VERSION_MAJOR > 9) || ((G4VERSION_MAJOR ==9 && G4VERSION_MINOR > 5))
dynamic_cast<G4VEmProcess*>(pProcess)->SetEmModel(theComptonModel);
#else
dynamic_cast<G4VEmProcess*>(pProcess)->SetModel(theComptonModel);
#endif
}


Expand Down
18 changes: 15 additions & 3 deletions source/physics/src/GateGammaConversionPB.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,29 @@ void GateGammaConversionPB::AddUserModel(GateListOfHadronicModels *model){
else if(model->GetModelName() == "LivermoreModel")
{
G4LivermoreGammaConversionModel* theLivermoreGammaConversionModel = new G4LivermoreGammaConversionModel();
dynamic_cast<G4VEmProcess*>(pProcess)->SetEmModel(theLivermoreGammaConversionModel); //change SetModel to SetEmModel for geant4.10
#if (G4VERSION_MAJOR > 9) || ((G4VERSION_MAJOR ==9 && G4VERSION_MINOR > 5))
dynamic_cast<G4VEmProcess*>(pProcess)->SetEmModel(theLivermoreGammaConversionModel);
#else
dynamic_cast<G4VEmProcess*>(pProcess)->SetModel(theLivermoreGammaConversionModel);
#endif
}
else if(model->GetModelName() == "LivermorePolarizedModel")
{
G4LivermorePolarizedGammaConversionModel* theLivermoreGammaConversionModel = new G4LivermorePolarizedGammaConversionModel();
dynamic_cast<G4VEmProcess*>(pProcess)->SetEmModel(theLivermoreGammaConversionModel); //change SetModel to SetEmModel for geant4.10
#if (G4VERSION_MAJOR > 9) || ((G4VERSION_MAJOR ==9 && G4VERSION_MINOR > 5))
dynamic_cast<G4VEmProcess*>(pProcess)->SetEmModel(theLivermoreGammaConversionModel);
#else
dynamic_cast<G4VEmProcess*>(pProcess)->SetModel(theLivermoreGammaConversionModel);
#endif
}
else if(model->GetModelName() == "PenelopeModel")
{
G4PenelopeGammaConversionModel* theGammaConversionModel = new G4PenelopeGammaConversionModel();
dynamic_cast<G4VEmProcess*>(pProcess)->SetEmModel(theGammaConversionModel); //change SetModel to SetEmModel for geant4.10
#if (G4VERSION_MAJOR > 9) || ((G4VERSION_MAJOR ==9 && G4VERSION_MINOR > 5))
dynamic_cast<G4VEmProcess*>(pProcess)->SetEmModel(theGammaConversionModel);
#else
dynamic_cast<G4VEmProcess*>(pProcess)->SetModel(theGammaConversionModel);
#endif
}
}
//-----------------------------------------------------------------------------
Expand Down
18 changes: 15 additions & 3 deletions source/physics/src/GatePhotoElectricPB.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ void GatePhotoElectricPB::AddUserModel(GateListOfHadronicModels *model){
// if( lowEGamma>0 ) theLivermorePhotoElectricModel->SetCutForLowEnSecPhotons(lowEGamma);
// if( lowEElec>0 ) theLivermorePhotoElectricModel->SetCutForLowEnSecElectrons(lowEElec);

dynamic_cast<G4VEmProcess*>(pProcess)->SetEmModel(theLivermorePhotoElectricModel); //change SetModel to SetEmModel in geant4.10
#if (G4VERSION_MAJOR > 9) || ((G4VERSION_MAJOR ==9 && G4VERSION_MINOR > 5))
dynamic_cast<G4VEmProcess*>(pProcess)->SetEmModel(theLivermorePhotoElectricModel);
#else
dynamic_cast<G4VEmProcess*>(pProcess)->SetModel(theLivermorePhotoElectricModel);
#endif
}
else if(model->GetModelName() == "LivermorePolarizedModel")
{
Expand All @@ -111,7 +115,11 @@ void GatePhotoElectricPB::AddUserModel(GateListOfHadronicModels *model){
// if( lowEGamma>0 ) theLivermorePhotoElectricModel->SetCutForLowEnSecPhotons(lowEGamma);
// if( lowEElec>0 ) theLivermorePhotoElectricModel->SetCutForLowEnSecElectrons(lowEElec);

dynamic_cast<G4VEmProcess*>(pProcess)->SetEmModel(theLivermorePhotoElectricModel); //change SetModel to SetEmModel in geant4.10
#if (G4VERSION_MAJOR > 9) || ((G4VERSION_MAJOR ==9 && G4VERSION_MINOR > 5))
dynamic_cast<G4VEmProcess*>(pProcess)->SetEmModel(theLivermorePhotoElectricModel);
#else
dynamic_cast<G4VEmProcess*>(pProcess)->SetModel(theLivermorePhotoElectricModel);
#endif
}
else if(model->GetModelName() == "PenelopeModel")
{
Expand All @@ -127,7 +135,11 @@ void GatePhotoElectricPB::AddUserModel(GateListOfHadronicModels *model){
//if( lowEGamma>0 ) thePhotoElectricModel->SetCutForLowEnSecPhotons(lowEGamma);
//if( lowEElec>0 ) thePhotoElectricModel->SetCutForLowEnSecElectrons(lowEElec);

dynamic_cast<G4VEmProcess*>(pProcess)->SetEmModel(thePhotoElectricModel); //change SetModel to SetEmModel in geant4.10
#if (G4VERSION_MAJOR > 9) || ((G4VERSION_MAJOR ==9 && G4VERSION_MINOR > 5))
dynamic_cast<G4VEmProcess*>(pProcess)->SetEmModel(thePhotoElectricModel);
#else
dynamic_cast<G4VEmProcess*>(pProcess)->SetModel(thePhotoElectricModel);
#endif
}
}
//-----------------------------------------------------------------------------
Expand Down
6 changes: 5 additions & 1 deletion source/physics/src/GatePositronAnnihilationStdPB.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ void GatePositronAnnihilationStdPB::AddUserModel(GateListOfHadronicModels *model
else if(model->GetModelName() == "PenelopeModel")
{
G4PenelopeAnnihilationModel* theAnnihilationModel = new G4PenelopeAnnihilationModel();
dynamic_cast<G4VEmProcess*>(pProcess)->SetEmModel(theAnnihilationModel); //change SetModel to SetEmModel in geant4.10
#if (G4VERSION_MAJOR > 9) || ((G4VERSION_MAJOR ==9 && G4VERSION_MINOR > 5))
dynamic_cast<G4VEmProcess*>(pProcess)->SetEmModel(theAnnihilationModel);
#else
dynamic_cast<G4VEmProcess*>(pProcess)->SetModel(theAnnihilationModel);
#endif
}
}
//-----------------------------------------------------------------------------
Expand Down
18 changes: 15 additions & 3 deletions source/physics/src/GateRayleighPB.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,29 @@ void GateRayleighPB::AddUserModel(GateListOfHadronicModels *model){
if(model->GetModelName() == "LivermoreModel")
{
G4LivermoreRayleighModel* theLivermoreRayleighModel = new G4LivermoreRayleighModel();
dynamic_cast<G4VEmProcess*>(pProcess)->SetEmModel(theLivermoreRayleighModel); //change SetModel to SetEmModel in geant4.10
#if (G4VERSION_MAJOR > 9) || ((G4VERSION_MAJOR ==9 && G4VERSION_MINOR > 5))
dynamic_cast<G4VEmProcess*>(pProcess)->SetEmModel(theLivermoreRayleighModel);
#else
dynamic_cast<G4VEmProcess*>(pProcess)->SetModel(theLivermoreRayleighModel);
#endif
}
else if(model->GetModelName() == "LivermorePolarizedModel")
{
G4LivermorePolarizedRayleighModel* theLivermoreRayleighModel = new G4LivermorePolarizedRayleighModel();
dynamic_cast<G4VEmProcess*>(pProcess)->SetEmModel(theLivermoreRayleighModel); //change SetModel to SetEmModel in geant4.10
#if (G4VERSION_MAJOR > 9) || ((G4VERSION_MAJOR ==9 && G4VERSION_MINOR > 5))
dynamic_cast<G4VEmProcess*>(pProcess)->SetEmModel(theLivermoreRayleighModel);
#else
dynamic_cast<G4VEmProcess*>(pProcess)->SetModel(theLivermoreRayleighModel);
#endif
}
else if(model->GetModelName() == "PenelopeModel")
{
G4PenelopeRayleighModel* theRayleighModel = new G4PenelopeRayleighModel();
dynamic_cast<G4VEmProcess*>(pProcess)->SetEmModel(theRayleighModel); //change SetModel to SetEmModel in geant4.10
#if (G4VERSION_MAJOR > 9) || ((G4VERSION_MAJOR ==9 && G4VERSION_MINOR > 5))
dynamic_cast<G4VEmProcess*>(pProcess)->SetEmModel(theRayleighModel);
#else
dynamic_cast<G4VEmProcess*>(pProcess)->SetModel(theRayleighModel);
#endif
}


Expand Down
Loading

0 comments on commit e8fa2fa

Please sign in to comment.