// ******************************************************************** // * License and Disclaimer * // * * // * The Geant4 software is copyright of the Copyright Holders of * // * the Geant4 Collaboration. It is provided under the terms and * // * conditions of the Geant4 Software License, included in the file * // * LICENSE and available at http://cern.ch/geant4/license . These * // * include a list of copyright holders. * // * * // * Neither the authors of this software system, nor their employing * // * institutes,nor the agencies providing financial support for this * // * work make any representation or warranty, express or implied, * // * regarding this software system or assume any liability for its * // * use. Please see the license in the file LICENSE and URL above * // * for the full disclaimer and the limitation of liability. * // * * // * This code implementation is the result of the scientific and * // * technical work of the GEANT4 collaboration. * // * By using, copying, modifying or distributing the software (or * // * any work based on the software) you agree to acknowledge its * // * use in resulting scientific publications, and indicate your * // * acceptance of all terms of the Geant4 Software license. * // ******************************************************************** // // // $Id: PhysicsList.cc,v 1.37 2010-11-19 20:12:32 vnivanch Exp $ // GEANT4 tag $Name: not supported by cvs2svn $ // ///////////////////////////////////////////////////////////////////////// // // PhysicsList // // Created: 31.04.2006 V.Ivanchenko // // Modified: // 04.06.2006 Adoptation of hadr01 (V.Ivanchenko) // 26.04.2007 Physics according to 8.3 Physics List (V.Ivanchenko) // //////////////////////////////////////////////////////////////////////// // // Include-files for Physics List #include "globals.hh" #include "PhysicsList.hh" #include "PhysicsListMessenger.hh" #include "G4DecayPhysics.hh" #include "G4EmStandardPhysics.hh" #include "G4EmStandardPhysics_option1.hh" #include "G4EmStandardPhysics_option2.hh" #include "G4EmStandardPhysics_option3.hh" #include "G4EmLivermorePhysics.hh" #include "G4EmPenelopePhysics.hh" #include "G4HadronElasticPhysics.hh" #include "G4HadronElasticPhysicsXS.hh" #include "G4HadronElasticPhysicsHP.hh" #include "G4ChargeExchangePhysics.hh" #include "G4NeutronTrackingCut.hh" #include "G4NeutronCrossSectionXS.hh" #include "G4StoppingPhysics.hh" #include "G4IonBinaryCascadePhysics.hh" #include "G4IonBinaryCascadePhysics.hh" #include "G4IonPhysics.hh" #include "G4EmExtraPhysics.hh" #include "G4EmProcessOptions.hh" #include "G4VPhysicsConstructor.hh" //#include "G4HadronPhysicsFTFP_BERT.hh" //#include "G4HadronPhysicsFTF_BIC.hh" //#include "G4HadronInelasticQBBC.hh" //#include "G4HadronPhysicsQGSP_BERT.hh" //#include "G4HadronPhysicsQGSP_BERT_HP.hh" //#include "G4HadronPhysicsQGSP_BIC.hh" //#include "G4HadronPhysicsQGSP_BIC_HP.hh" //#include "G4HadronPhysicsQGSP_FTFP_BERT.hh" //#include "G4HadronPhysicsQGS_BIC.hh" #include "G4IonPhysics.hh" #include "G4LossTableManager.hh" #include "G4ProcessManager.hh" #include "G4ParticleTypes.hh" #include "G4VUserPhysicsList.hh" #include "G4ParticleTable.hh" #include "G4Gamma.hh" #include "G4Electron.hh" #include "G4Positron.hh" #include "G4Proton.hh" #include "G4Neutron.hh" // Class Constructor PhysicsList::PhysicsList() : G4VModularPhysicsList() { G4LossTableManager::Instance(); defaultCutValue = 0.001*mm; cutForGamma = defaultCutValue; cutForElectron = defaultCutValue; cutForPositron = defaultCutValue; cutForProton = defaultCutValue; cutForNeutron = defaultCutValue; verboseLevel = 1; pMessenger = new PhysicsListMessenger(this); // Particles particleList = new G4DecayPhysics("decays"); // EM physics emPhysicsList = new G4EmStandardPhysics(); } // Destructor PhysicsList::~PhysicsList() { delete pMessenger; delete particleList; delete emPhysicsList; for(size_t i=0; iConstructParticle(); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... void PhysicsList::ConstructProcess() { AddTransportation(); emPhysicsList->ConstructProcess(); particleList->ConstructProcess(); for(size_t i=0; iConstructProcess(); } AddStepMax(); } void PhysicsList::AddPhysicsList(const G4String& name) { if (verboseLevel>0) { G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; } if (name == "emstandard_opt2") { delete emPhysicsList; emPhysicsList = new G4EmStandardPhysics_option2(); } else if (name == "emstandard_opt3") { delete emPhysicsList; emPhysicsList = new G4EmStandardPhysics_option3(); } else if (name == "emstandard_opt1") { delete emPhysicsList; emPhysicsList = new G4EmStandardPhysics_option1(); } else if (name == "emstandard_opt0") { delete emPhysicsList; emPhysicsList = new G4EmStandardPhysics(); } else if (name == "FTFP_BERT_EMV") { AddPhysicsList("emstandard_opt1"); AddPhysicsList("FTFP_BERT"); } else if (name == "FTFP_BERT_EMX") { AddPhysicsList("emstandard_opt2"); AddPhysicsList("FTFP_BERT"); } // else if (name == "FTFP_BERT") { // // SetBuilderList1(); // hadronPhys.push_back( new G4HadronPhysicsFTFP_BERT()); // // } else if (name == "FTF_BIC") { // // SetBuilderList0(); // hadronPhys.push_back( new G4HadronPhysicsFTF_BIC()); // hadronPhys.push_back( new G4NeutronCrossSectionXS(verboseLevel)); // // } else if (name == "QBBC") { // // AddPhysicsList("emstandard_opt2"); // SetBuilderList3(); // hadronPhys.push_back( new G4HadronInelasticQBBC()); // // // } else if (name == "QGSP_BERT") { // // SetBuilderList1(); // hadronPhys.push_back( new G4HadronPhysicsQGSP_BERT()); // // } else if (name == "QGSP_FTFP_BERT") { // // SetBuilderList1(); // hadronPhys.push_back( new G4HadronPhysicsQGSP_FTFP_BERT()); // // } else if (name == "QGSP_BERT_EMV") { // // AddPhysicsList("emstandard_opt1"); // AddPhysicsList("QGSP_BERT"); // // } else if (name == "QGSP_BERT_EMX") { // // AddPhysicsList("emstandard_opt2"); // AddPhysicsList("QGSP_BERT"); // // } else if (name == "QGSP_BERT_HP") { // // SetBuilderList1(true); // hadronPhys.push_back( new G4HadronPhysicsQGSP_BERT_HP()); // // } else if (name == "QGSP_BIC") { // // SetBuilderList0(); // hadronPhys.push_back( new G4HadronPhysicsQGSP_BIC()); // // } else if (name == "QGSP_BIC_EMY") { // // AddPhysicsList("emstandard_opt3"); // SetBuilderList0(); // hadronPhys.push_back( new G4HadronPhysicsQGSP_BIC()); // // } else if (name == "QGS_BIC") { // // SetBuilderList0(); // hadronPhys.push_back( new G4HadronPhysicsQGS_BIC()); // hadronPhys.push_back( new G4NeutronCrossSectionXS(verboseLevel)); // // } else if (name == "QGSP_BIC_HP") { // // SetBuilderList0(true); // hadronPhys.push_back( new G4HadronPhysicsQGSP_BIC_HP()); // // } else { // // G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" // << " is not defined" // << G4endl; // } } // Set Builder Lists // List0 void PhysicsList::SetBuilderList0(G4bool flagHP) { hadronPhys.push_back( new G4EmExtraPhysics(verboseLevel)); if(flagHP) { hadronPhys.push_back( new G4HadronElasticPhysicsHP(verboseLevel) ); } else { hadronPhys.push_back( new G4HadronElasticPhysics(verboseLevel) ); } hadronPhys.push_back( new G4StoppingPhysics(verboseLevel)); hadronPhys.push_back( new G4IonBinaryCascadePhysics(verboseLevel)); hadronPhys.push_back( new G4NeutronTrackingCut(verboseLevel)); } // List1 void PhysicsList::SetBuilderList1(G4bool flagHP) { hadronPhys.push_back( new G4EmExtraPhysics(verboseLevel)); if(flagHP) { hadronPhys.push_back( new G4HadronElasticPhysicsHP(verboseLevel) ); } else { hadronPhys.push_back( new G4HadronElasticPhysics(verboseLevel) ); } hadronPhys.push_back( new G4IonPhysics(verboseLevel)); hadronPhys.push_back( new G4NeutronTrackingCut(verboseLevel)); } // List2 void PhysicsList::SetBuilderList2(G4bool addStopping) { hadronPhys.push_back( new G4EmExtraPhysics(verboseLevel)); hadronPhys.push_back( new G4HadronElasticPhysics(verboseLevel)); if(addStopping) { hadronPhys.push_back( new G4StoppingPhysics(verboseLevel)); } hadronPhys.push_back( new G4IonPhysics(verboseLevel)); } // List3 void PhysicsList::SetBuilderList3() { hadronPhys.push_back( new G4EmExtraPhysics(verboseLevel)); RegisterPhysics( new G4HadronElasticPhysicsXS(verboseLevel) ); hadronPhys.push_back( new G4IonBinaryCascadePhysics(verboseLevel)); hadronPhys.push_back( new G4NeutronTrackingCut(verboseLevel)); } // List4 void PhysicsList::SetBuilderList4() { hadronPhys.push_back( new G4EmExtraPhysics(verboseLevel)); hadronPhys.push_back( new G4HadronElasticPhysics(verboseLevel)); hadronPhys.push_back( new G4StoppingPhysics(verboseLevel)); hadronPhys.push_back( new G4IonPhysics(verboseLevel)); hadronPhys.push_back( new G4NeutronTrackingCut(verboseLevel)); } // Set Cuts // Call the values: cutForGamma, cutForElectron ... // They can be modified prior to call SetCuts() // using SetCutForGamme(G4double cut), SetForElectron(G4double cut ...) void PhysicsList::SetCuts() { if (verboseLevel >0){ G4cout << "PhysicsList::SetCuts:"; G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl; } // set cut values for gamma at first and for e- second and next for e+, // because some processes for e+/e- need cut values for gamma SetCutValue(cutForGamma, "gamma"); SetCutValue(cutForElectron, "e-"); SetCutValue(cutForPositron, "e+"); SetCutValue(cutForProton, "proton"); SetCutValue(cutForNeutron, "neutron"); if (verboseLevel>0) DumpCutValuesTable(); } // Modify the Private Attribute Values // For Gamma void PhysicsList::SetCutForGamma(G4double cut) { cutForGamma = cut; SetParticleCuts(cutForGamma, G4Gamma::Gamma()); } // For Electron void PhysicsList::SetCutForElectron(G4double cut) { cutForElectron = cut; SetParticleCuts(cutForElectron, G4Electron::Electron()); } // For Positron void PhysicsList::SetCutForPositron(G4double cut) { cutForPositron = cut; SetParticleCuts(cutForPositron, G4Positron::Positron()); } // For Proton void PhysicsList::SetCutForProton(G4double cut) { cutForProton = cut; SetParticleCuts(cutForProton, G4Proton::Proton()); } // For Neutron void PhysicsList::SetCutForNeutron(G4double cut) { cutForNeutron = cut; SetParticleCuts(cutForNeutron, G4Neutron::Neutron()); } #include "G4StepLimiter.hh" #include "G4UserSpecialCuts.hh" void PhysicsList::AddStepMax() { // Step limitation seen as a process //G4StepLimiter* stepLimiter = new G4StepLimiter(); G4UserSpecialCuts* userCuts = new G4UserSpecialCuts(); auto aParticleIterator=GetParticleIterator(); //theParticleIterator->reset(); aParticleIterator->reset(); //while ((*theParticleIterator)()){ while ((*aParticleIterator)()){ //G4ParticleDefinition* particle = theParticleIterator->value(); G4ParticleDefinition* particle = aParticleIterator->value(); G4ProcessManager* pmanager = particle->GetProcessManager(); pmanager ->AddDiscreteProcess(userCuts); // userCUTS (outside "IF") 10.000 events in 1 min 10 sec - SAME as inside "if" if ( particle->GetPDGCharge() == 0.0 ) { //pmanager ->AddDiscreteProcess(stepLimiter); pmanager ->AddDiscreteProcess(userCuts); // using this "IF"........ // with STEP LIMITER::: 10.000 events in 2 min 30 sec // userCUTS::::::: 10.000 events in 1 min 10 sec } } } // Print // void PhysicsList::List() { G4cout << "### PhysicsLists available: FTFP_BERT FTFP_BERT_EMV FTFP_BERT_EMX FTF_BIC " << G4endl; G4cout << " LHEP LHEP_EMV QBBC QGS_BIC QGSP " << G4endl; G4cout << " QGSC_BERT QGSP_BERT QGSP_BERT_EMV QGSP_BIC_EMY" << G4endl; G4cout << " QGSP_BERT_EMX QGSP_BERT_HP QGSP_BIC QGSP_BIC_HP"<< G4endl; }