Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /geant4/examples/advanced/exp_microdosimetry/src/PhysicsList.cc was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // Authors: Susanna Guatelli and Francesco Romano
0027 // susanna@uow.edu.au, francesco.romano@ct.infn.it
0028 //
0029 // Code based on the hadrontherapy advanced example
0030 
0031 #include "PhysicsList.hh"
0032 #include "PhysicsListMessenger.hh"
0033 #include "G4PhysListFactory.hh"
0034 #include "G4VPhysicsConstructor.hh"
0035 
0036 // Physic lists (contained inside the Geant4 distribution)
0037 #include "G4EmStandardPhysics_option3.hh"
0038 #include "G4EmLivermorePhysics.hh"
0039 #include "G4EmPenelopePhysics.hh"
0040 #include "G4DecayPhysics.hh"
0041 #include "G4HadronElasticPhysics.hh"
0042 #include "G4HadronDElasticPhysics.hh"
0043 #include "G4HadronElasticPhysicsHP.hh"
0044 #include "G4IonBinaryCascadePhysics.hh"
0045 #include "G4Decay.hh"
0046 #include "G4StepLimiter.hh"
0047 #include "G4LossTableManager.hh"
0048 #include "G4UnitsTable.hh"
0049 #include "G4SystemOfUnits.hh"
0050 #include "G4ProcessManager.hh"
0051 
0052 #include "G4IonFluctuations.hh"
0053 #include "G4IonParametrisedLossModel.hh"
0054 #include "G4HadronPhysicsQGSP_BIC_HP.hh"
0055 #include "G4RadioactiveDecayPhysics.hh"
0056 
0057 /////////////////////////////////////////////////////////////////////////////
0058 PhysicsList::PhysicsList() : G4VModularPhysicsList()
0059 {
0060   G4LossTableManager::Instance();
0061   defaultCutValue = 0.01*micrometer;
0062   cutForGamma     = defaultCutValue;
0063   cutForElectron  = defaultCutValue;
0064   cutForPositron  = defaultCutValue;
0065 
0066   G4double lowLimit = 250. * eV;
0067   G4double highLimit = 100. * GeV;
0068   G4ProductionCutsTable::GetProductionCutsTable()->SetEnergyRange(lowLimit, highLimit);
0069 
0070   // set cut values for gamma at first and for e- second and next for e+,
0071   // because some processes for e+/e- need cut values for gamma
0072   SetCutValue(cutForGamma, "gamma");
0073   SetCutValue(cutForElectron, "e-");
0074   SetCutValue(cutForPositron, "e+"); 
0075   
0076   DumpCutValuesTable();
0077   
0078   helIsRegisted  = false;
0079   bicIsRegisted  = false;
0080   biciIsRegisted = false;
0081   locIonIonInelasticIsRegistered = false;
0082   radioactiveDecayIsRegisted = false;
0083 
0084   pMessenger = new PhysicsListMessenger(this);
0085 
0086   SetVerboseLevel(1);
0087 
0088   // EM physics
0089   emPhysicsList = new G4EmStandardPhysics_option3(1);
0090   emName = G4String("emstandard_opt3");
0091 
0092   // Decay physics and all particles
0093   decPhysicsList = new G4DecayPhysics();
0094 }
0095 
0096 /////////////////////////////////////////////////////////////////////////////
0097 PhysicsList::~PhysicsList()
0098 {
0099   delete pMessenger;
0100   delete emPhysicsList;
0101   delete decPhysicsList;
0102   for(size_t i=0; i<hadronPhys.size(); i++) {delete hadronPhys[i];}
0103 }
0104 
0105 /////////////////////////////////////////////////////////////////////////////
0106 void PhysicsList::AddPackage(const G4String& name)
0107 {
0108   G4PhysListFactory factory;
0109   G4VModularPhysicsList* phys =factory.GetReferencePhysList(name);
0110   G4int i=0;
0111   const G4VPhysicsConstructor* elem= phys->GetPhysics(i);
0112   G4VPhysicsConstructor* tmp = const_cast<G4VPhysicsConstructor*> (elem);
0113   while (elem !=0)
0114     {
0115       RegisterPhysics(tmp);
0116       elem= phys->GetPhysics(++i) ;
0117       tmp = const_cast<G4VPhysicsConstructor*> (elem);
0118     }
0119 }
0120 
0121 /////////////////////////////////////////////////////////////////////////////
0122 void PhysicsList::ConstructParticle()
0123 {
0124   decPhysicsList->ConstructParticle();
0125 }
0126 
0127 /////////////////////////////////////////////////////////////////////////////
0128 void PhysicsList::ConstructProcess()
0129 {
0130   // transportation
0131   //
0132   AddTransportation();
0133 
0134   // electromagnetic physics list
0135   //
0136   emPhysicsList->ConstructProcess();
0137   em_config.AddModels();
0138 
0139   // decay physics list
0140   //
0141   decPhysicsList->ConstructProcess();
0142 
0143   // hadronic physics lists
0144   for(size_t i=0; i<hadronPhys.size(); i++) {
0145     hadronPhys[i]->ConstructProcess();
0146   }
0147 
0148 
0149   // step limitation (as a full process)
0150   //
0151  // AddStepMax();
0152 }
0153 
0154 /////////////////////////////////////////////////////////////////////////////
0155 void PhysicsList::AddPhysicsList(const G4String& name)
0156 {
0157 
0158   if (verboseLevel>1) {
0159     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
0160   }
0161   if (name == emName) return;
0162 
0163   /////////////////////////////////////////////////////////////////////////////
0164   //   ELECTROMAGNETIC MODELS
0165   /////////////////////////////////////////////////////////////////////////////
0166 
0167   if (name == "standard_opt3") {
0168     emName = name;
0169     delete emPhysicsList;
0170     emPhysicsList = new G4EmStandardPhysics_option3();
0171     G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmStandardPhysics_option3" << G4endl;
0172 
0173   } else if (name == "LowE_Livermore") {
0174     emName = name;
0175     delete emPhysicsList;
0176     emPhysicsList = new G4EmLivermorePhysics();
0177     G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmLivermorePhysics" << G4endl;
0178 
0179   } else if (name == "LowE_Penelope") {
0180     emName = name;
0181     delete emPhysicsList;
0182     emPhysicsList = new G4EmPenelopePhysics();
0183     G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmLivermorePhysics" << G4endl;
0184 
0185     /////////////////////////////////////////////////////////////////////////////
0186     //   HADRONIC MODELS
0187     /////////////////////////////////////////////////////////////////////////////
0188   } else if (name == "elastic" && !helIsRegisted) {
0189     G4cout << "THE FOLLOWING HADRONIC ELASTIC PHYSICS LIST HAS BEEN ACTIVATED: G4HadronElasticPhysics()" << G4endl;
0190     hadronPhys.push_back( new G4HadronElasticPhysics());
0191     helIsRegisted = true;
0192 
0193   } else if (name == "DElastic" && !helIsRegisted) {
0194     hadronPhys.push_back( new G4HadronDElasticPhysics());
0195     helIsRegisted = true;
0196 
0197   } else if (name == "HPElastic" && !helIsRegisted) {
0198     hadronPhys.push_back( new G4HadronElasticPhysicsHP());
0199     helIsRegisted = true;
0200 
0201   } else if (name == "binary" && !bicIsRegisted) {
0202     hadronPhys.push_back(new G4HadronPhysicsQGSP_BIC_HP());
0203     bicIsRegisted = true;
0204     G4cout << "THE FOLLOWING HADRONIC INELASTIC PHYSICS LIST HAS BEEN ACTIVATED: HadronPhysicsQGSP_BIC_HP()" << G4endl;
0205 
0206   } else if (name == "binary_ion" && !biciIsRegisted) {
0207     hadronPhys.push_back(new G4IonBinaryCascadePhysics());
0208     biciIsRegisted = true;
0209     G4cout << "THE FOLLOWING HADRONIC INELASTIC PHYSICS LIST HAS BEEN ACTIVATED: G4IonBinaryCascadePhysics()" << G4endl;
0210   } else if (name == "radioactive_decay" && !radioactiveDecayIsRegisted ) {
0211     hadronPhys.push_back(new G4RadioactiveDecayPhysics());
0212     radioactiveDecayIsRegisted = true;
0213     G4cout << "THE FOLLOWING HADRONIC INELASTIC PHYSICS LIST HAS BEEN ACTIVATED: G4RadioactiveDecayPhysics()" << G4endl;
0214   } else {
0215 
0216     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
0217            << " is not defined"
0218            << G4endl;
0219   }
0220 }
0221 
0222 
0223 void PhysicsList::AddStepMax()
0224 {
0225   // Step limitation seen as a process
0226 
0227   auto particleIterator=GetParticleIterator();
0228   particleIterator->reset();
0229 
0230   while ((*particleIterator)())
0231 {
0232     G4ParticleDefinition* particle = particleIterator->value();
0233     G4ProcessManager* pmanager = particle->GetProcessManager();
0234         pmanager -> AddProcess(new G4StepLimiter(),  -1,-1,3);
0235   }
0236 
0237 }
0238 
0239 void PhysicsList::SetCutForGamma(G4double cut)
0240 {
0241   cutForGamma = cut;
0242   SetParticleCuts(cutForGamma, G4Gamma::Gamma());
0243 }
0244 
0245 void PhysicsList::SetCutForElectron(G4double cut)
0246 {
0247   cutForElectron = cut;
0248   SetParticleCuts(cutForElectron, G4Electron::Electron());
0249 }
0250 
0251 void PhysicsList::SetCutForPositron(G4double cut)
0252 {
0253   cutForPositron = cut;
0254   SetParticleCuts(cutForPositron, G4Positron::Positron());
0255 }
0256