| 1 | //
|
|---|
| 2 | // ********************************************************************
|
|---|
| 3 | // * License and Disclaimer *
|
|---|
| 4 | // * *
|
|---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of *
|
|---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and *
|
|---|
| 7 | // * conditions of the Geant4 Software License, included in the file *
|
|---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These *
|
|---|
| 9 | // * include a list of copyright holders. *
|
|---|
| 10 | // * *
|
|---|
| 11 | // * Neither the authors of this software system, nor their employing *
|
|---|
| 12 | // * institutes,nor the agencies providing financial support for this *
|
|---|
| 13 | // * work make any representation or warranty, express or implied, *
|
|---|
| 14 | // * regarding this software system or assume any liability for its *
|
|---|
| 15 | // * use. Please see the license in the file LICENSE and URL above *
|
|---|
| 16 | // * for the full disclaimer and the limitation of liability. *
|
|---|
| 17 | // * *
|
|---|
| 18 | // * This code implementation is the result of the scientific and *
|
|---|
| 19 | // * technical work of the GEANT4 collaboration. *
|
|---|
| 20 | // * By using, copying, modifying or distributing the software (or *
|
|---|
| 21 | // * any work based on the software) you agree to acknowledge its *
|
|---|
| 22 | // * use in resulting scientific publications, and indicate your *
|
|---|
| 23 | // * acceptance of all terms of the Geant4 Software license. *
|
|---|
| 24 | // ********************************************************************
|
|---|
| 25 | //
|
|---|
| 26 | // $Id: MedLinacPhysicsList.cc,v 1.6 2007/07/01 15:19:18 mpiergen Exp $
|
|---|
| 27 | //
|
|---|
| 28 | //
|
|---|
| 29 | // Code developed by: M. Piergentili
|
|---|
| 30 | //
|
|---|
| 31 | #include "globals.hh"
|
|---|
| 32 | #include "MedLinacPhysicsList.hh"
|
|---|
| 33 | #include "MedLinacPhysicsListMessenger.hh"
|
|---|
| 34 |
|
|---|
| 35 | #include "G4ParticleDefinition.hh"
|
|---|
| 36 | #include "G4ParticleWithCuts.hh"
|
|---|
| 37 | #include "G4ProcessManager.hh"
|
|---|
| 38 | #include "G4ProcessVector.hh"
|
|---|
| 39 | #include "G4ParticleTypes.hh"
|
|---|
| 40 | #include "G4ParticleTable.hh"
|
|---|
| 41 | #include "G4Material.hh"
|
|---|
| 42 | #include "G4ios.hh"
|
|---|
| 43 | #include <iomanip>
|
|---|
| 44 | #include "G4UnitsTable.hh"
|
|---|
| 45 | #include "G4Region.hh"
|
|---|
| 46 | #include "G4RegionStore.hh"
|
|---|
| 47 | #include "G4ProductionCuts.hh"
|
|---|
| 48 | #include "G4ProductionCutsTable.hh"
|
|---|
| 49 | #include "G4StepLimiter.hh"
|
|---|
| 50 | MedLinacPhysicsList::MedLinacPhysicsList(): G4VUserPhysicsList()
|
|---|
| 51 | {
|
|---|
| 52 | physicsListMessenger = new MedLinacPhysicsListMessenger(this);
|
|---|
| 53 | //defaultCutValue = defaultCut;
|
|---|
| 54 | //cutForGamma = defaultCutValue;
|
|---|
| 55 | //cutForElectron = defaultCutValue;
|
|---|
| 56 | //cutForPositron = defaultCutValue;
|
|---|
| 57 | SetVerboseLevel(6);
|
|---|
| 58 | }
|
|---|
| 59 |
|
|---|
| 60 | MedLinacPhysicsList::~MedLinacPhysicsList()
|
|---|
| 61 | {;}
|
|---|
| 62 |
|
|---|
| 63 | void MedLinacPhysicsList::ConstructParticle()
|
|---|
| 64 | {
|
|---|
| 65 | // In this method, static member functions should be called
|
|---|
| 66 | // for all particles which you want to use.
|
|---|
| 67 | // This ensures that objects of these particle types will be
|
|---|
| 68 | // created in the program.
|
|---|
| 69 |
|
|---|
| 70 | ConstructBosons();
|
|---|
| 71 | ConstructLeptons();
|
|---|
| 72 | }
|
|---|
| 73 | void MedLinacPhysicsList::ConstructBosons()
|
|---|
| 74 | {
|
|---|
| 75 | // gamma
|
|---|
| 76 | G4Gamma::GammaDefinition();
|
|---|
| 77 | }
|
|---|
| 78 |
|
|---|
| 79 | void MedLinacPhysicsList::ConstructLeptons()
|
|---|
| 80 | {
|
|---|
| 81 | // leptons
|
|---|
| 82 | // e+/-
|
|---|
| 83 | G4Electron::ElectronDefinition();
|
|---|
| 84 | G4Positron::PositronDefinition();
|
|---|
| 85 | }
|
|---|
| 86 |
|
|---|
| 87 | void MedLinacPhysicsList::ConstructProcess()
|
|---|
| 88 | {
|
|---|
| 89 | // Define transportation process
|
|---|
| 90 |
|
|---|
| 91 | AddTransportation();
|
|---|
| 92 | ConstructEM();
|
|---|
| 93 | }
|
|---|
| 94 |
|
|---|
| 95 | //---------------------------------------------------------------------
|
|---|
| 96 |
|
|---|
| 97 | //#include "G4ComptonScattering.hh"
|
|---|
| 98 | //#include "G4GammaConversion.hh"
|
|---|
| 99 | //#include "G4PhotoElectricEffect.hh"
|
|---|
| 100 |
|
|---|
| 101 | #include "G4LowEnergyPhotoElectric.hh"
|
|---|
| 102 | #include "G4LowEnergyCompton.hh"
|
|---|
| 103 | #include "G4LowEnergyGammaConversion.hh"
|
|---|
| 104 | #include "G4LowEnergyRayleigh.hh"
|
|---|
| 105 |
|
|---|
| 106 | //#include "G4PenelopePhotoElectric.hh"
|
|---|
| 107 | //#include "G4PenelopeCompton.hh"
|
|---|
| 108 | //#include "G4PenelopeGammaConversion.hh"
|
|---|
| 109 | //#include "G4PenelopeRayleigh.hh"
|
|---|
| 110 |
|
|---|
| 111 | #include "G4MultipleScattering.hh"
|
|---|
| 112 |
|
|---|
| 113 | #include "G4LowEnergyIonisation.hh"
|
|---|
| 114 | #include "G4LowEnergyBremsstrahlung.hh"
|
|---|
| 115 |
|
|---|
| 116 | //#include "G4PenelopeIonisation.hh"
|
|---|
| 117 | //#include "G4PenelopeBremsstrahlung.hh"
|
|---|
| 118 |
|
|---|
| 119 | #include "G4eIonisation.hh"
|
|---|
| 120 | #include "G4eBremsstrahlung.hh"
|
|---|
| 121 | #include "G4eplusAnnihilation.hh"
|
|---|
| 122 |
|
|---|
| 123 |
|
|---|
| 124 | //---------------------------------------------------------------------
|
|---|
| 125 |
|
|---|
| 126 | void MedLinacPhysicsList::ConstructEM()
|
|---|
| 127 | {
|
|---|
| 128 | theParticleIterator->reset();
|
|---|
| 129 | while( (*theParticleIterator)() ){
|
|---|
| 130 | G4ParticleDefinition* particle = theParticleIterator->value();
|
|---|
| 131 | G4ProcessManager* pmanager = particle->GetProcessManager();
|
|---|
| 132 | G4String particleName = particle->GetParticleName();
|
|---|
| 133 |
|
|---|
| 134 | if (particleName == "gamma") {
|
|---|
| 135 | // gamma
|
|---|
| 136 |
|
|---|
| 137 | lowePhot = new G4LowEnergyPhotoElectric("LowEnPhotoElec");
|
|---|
| 138 | pmanager->AddDiscreteProcess(new G4LowEnergyRayleigh);
|
|---|
| 139 | pmanager->AddDiscreteProcess(lowePhot);
|
|---|
| 140 | pmanager->AddDiscreteProcess(new G4LowEnergyCompton);
|
|---|
| 141 | pmanager->AddDiscreteProcess(new G4LowEnergyGammaConversion);
|
|---|
| 142 | pmanager -> AddProcess(new G4StepLimiter(), -1, -1, 3);
|
|---|
| 143 |
|
|---|
| 144 | //pmanager->AddDiscreteProcess(new G4PhotoElectricEffect);
|
|---|
| 145 | //pmanager->AddDiscreteProcess(new G4ComptonScattering);
|
|---|
| 146 | //pmanager->AddDiscreteProcess(new G4GammaConversion);
|
|---|
| 147 |
|
|---|
| 148 | //pmanager->AddDiscreteProcess(new G4PenelopePhotoElectric);
|
|---|
| 149 | //pmanager->AddDiscreteProcess(new G4PenelopeCompton);
|
|---|
| 150 | //pmanager->AddDiscreteProcess(new G4PenelopeGammaConversion);
|
|---|
| 151 | //pmanager->AddDiscreteProcess(new G4PenelopeRayleigh);
|
|---|
| 152 |
|
|---|
| 153 |
|
|---|
| 154 | } else if (particleName == "e-") {
|
|---|
| 155 | //electron
|
|---|
| 156 |
|
|---|
| 157 | loweIon = new G4LowEnergyIonisation("LowEnergyIoni");
|
|---|
| 158 | loweBrem = new G4LowEnergyBremsstrahlung("LowEnBrem");
|
|---|
| 159 |
|
|---|
| 160 | pmanager->AddProcess(new G4MultipleScattering, -1, 1,1);
|
|---|
| 161 | pmanager->AddProcess(loweIon, -1, 2,2);
|
|---|
| 162 | pmanager->AddProcess(loweBrem, -1,-1,3);
|
|---|
| 163 | pmanager -> AddProcess(new G4StepLimiter(), -1, -1, 3);
|
|---|
| 164 |
|
|---|
| 165 | //pmanager->AddProcess(new G4PenelopeIonisation, -1, 2,2);
|
|---|
| 166 | //pmanager->AddProcess(new G4PenelopeBremsstrahlung, -1,-1,3);
|
|---|
| 167 |
|
|---|
| 168 | //pmanager->AddProcess(new G4eIonisation, -1, 2,2);
|
|---|
| 169 | //pmanager->AddProcess(new G4eBremsstrahlung, -1,-1,3);
|
|---|
| 170 |
|
|---|
| 171 | } else if (particleName == "e+") {
|
|---|
| 172 | //positron
|
|---|
| 173 | pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
|
|---|
| 174 | pmanager->AddProcess(new G4eIonisation, -1, 2,2);
|
|---|
| 175 | pmanager->AddProcess(new G4eBremsstrahlung, -1,-1,3);
|
|---|
| 176 | pmanager->AddProcess(new G4eplusAnnihilation, 0,-1,4);
|
|---|
| 177 | pmanager -> AddProcess(new G4StepLimiter(), -1, -1, 3);
|
|---|
| 178 | }
|
|---|
| 179 | }
|
|---|
| 180 | }
|
|---|
| 181 |
|
|---|
| 182 |
|
|---|
| 183 | //---------------------------------------------------------------------
|
|---|
| 184 |
|
|---|
| 185 | void MedLinacPhysicsList::SetCuts()
|
|---|
| 186 | {
|
|---|
| 187 | // uppress error messages even in case e/gamma/proton do not exist
|
|---|
| 188 | G4int temp = GetVerboseLevel();
|
|---|
| 189 | SetVerboseLevel(6);
|
|---|
| 190 |
|
|---|
| 191 | // " G4VUserPhysicsList::SetCutsWithDefault" method sets
|
|---|
| 192 | // the default cut value for all particle types
|
|---|
| 193 | defaultCutValue = defaultCut;
|
|---|
| 194 | //G4cout <<"--------------------default cut "<< defaultCutValue/mm << " mm " <<G4endl;
|
|---|
| 195 | SetCutsWithDefault();
|
|---|
| 196 |
|
|---|
| 197 | //SetCutValue(cutForGamma, "gamma");
|
|---|
| 198 | //SetCutValue(cutForElectron, "e-");
|
|---|
| 199 | //SetCutValue(cutForPositron, "e+");
|
|---|
| 200 |
|
|---|
| 201 | // Retrieve verbose level
|
|---|
| 202 | SetVerboseLevel(temp);
|
|---|
| 203 |
|
|---|
| 204 | // Production thresholds for detector regions
|
|---|
| 205 |
|
|---|
| 206 | //G4String regName[] = {"PrimaryCollimatorUp","PrimaryCollimatorLow"};
|
|---|
| 207 | //G4double cutValue[] = {1.*mm, 1.*mm};
|
|---|
| 208 | //for(G4int i=0;i<2;i++)
|
|---|
| 209 | // {
|
|---|
| 210 | //G4Region* reg = G4RegionStore::GetInstance()->GetRegion(regName[i]);
|
|---|
| 211 | //G4ProductionCuts* cuts = new G4ProductionCuts;
|
|---|
| 212 | //cuts->SetProductionCut(cutValue[i]);
|
|---|
| 213 | //reg->SetProductionCuts(cuts);
|
|---|
| 214 | //}
|
|---|
| 215 |
|
|---|
| 216 |
|
|---|
| 217 | G4String regName = "PrimaryCollimatorLow";
|
|---|
| 218 | G4double cutValue = 8.*cm;
|
|---|
| 219 | G4Region* reg = G4RegionStore::GetInstance()->GetRegion(regName);
|
|---|
| 220 | G4ProductionCuts* cuts = new G4ProductionCuts;
|
|---|
| 221 | cuts->SetProductionCut(cutValue);
|
|---|
| 222 | reg->SetProductionCuts(cuts);
|
|---|
| 223 |
|
|---|
| 224 | G4String regName1 = "PrimaryCollimatorUp";
|
|---|
| 225 | G4double cutValue1 = 8.*cm;
|
|---|
| 226 | G4Region* reg1 = G4RegionStore::GetInstance()->GetRegion(regName1);
|
|---|
| 227 | G4ProductionCuts* cuts1 = new G4ProductionCuts;
|
|---|
| 228 | cuts1->SetProductionCut(cutValue1);
|
|---|
| 229 | reg1->SetProductionCuts(cuts1);
|
|---|
| 230 |
|
|---|
| 231 |
|
|---|
| 232 |
|
|---|
| 233 | if (verboseLevel >0){
|
|---|
| 234 | G4cout << "MedLinac::SetCuts: default cut length : "
|
|---|
| 235 | << G4BestUnit(defaultCutValue,"Length") << G4endl;
|
|---|
| 236 | }
|
|---|
| 237 |
|
|---|
| 238 |
|
|---|
| 239 | }
|
|---|
| 240 |
|
|---|
| 241 |
|
|---|
| 242 |
|
|---|
| 243 | void MedLinacPhysicsList::SetCut (G4double val)
|
|---|
| 244 | {
|
|---|
| 245 | defaultCut = val;
|
|---|
| 246 | }
|
|---|