| 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 | //
|
|---|
| 27 | //
|
|---|
| 28 |
|
|---|
| 29 | #include "F04PhysicsList.hh"
|
|---|
| 30 | #include "F04PhysicsListMessenger.hh"
|
|---|
| 31 |
|
|---|
| 32 | #include "F04ExtraPhysics.hh"
|
|---|
| 33 | #include "G4OpticalPhysics.hh"
|
|---|
| 34 |
|
|---|
| 35 | #include "G4LossTableManager.hh"
|
|---|
| 36 |
|
|---|
| 37 | #include "G4ProcessManager.hh"
|
|---|
| 38 | #include "G4ParticleTypes.hh"
|
|---|
| 39 | #include "G4ParticleTable.hh"
|
|---|
| 40 |
|
|---|
| 41 | #include "G4PhysListFactory.hh"
|
|---|
| 42 |
|
|---|
| 43 | #include "G4Gamma.hh"
|
|---|
| 44 | #include "G4Electron.hh"
|
|---|
| 45 | #include "G4Positron.hh"
|
|---|
| 46 |
|
|---|
| 47 | #include "F04StepMax.hh"
|
|---|
| 48 |
|
|---|
| 49 | #include "G4ProcessTable.hh"
|
|---|
| 50 |
|
|---|
| 51 | #include "G4PionDecayMakeSpin.hh"
|
|---|
| 52 | #include "G4DecayWithSpin.hh"
|
|---|
| 53 |
|
|---|
| 54 | #include "G4DecayTable.hh"
|
|---|
| 55 | #include "G4MuonDecayChannelWithSpin.hh"
|
|---|
| 56 | #include "G4MuonRadiativeDecayChannelWithSpin.hh"
|
|---|
| 57 |
|
|---|
| 58 | F04PhysicsList::F04PhysicsList(G4String physicsList) : G4VModularPhysicsList()
|
|---|
| 59 | {
|
|---|
| 60 | G4LossTableManager::Instance();
|
|---|
| 61 |
|
|---|
| 62 | defaultCutValue = 1.*mm;
|
|---|
| 63 | fCutForGamma = defaultCutValue;
|
|---|
| 64 | fCutForElectron = defaultCutValue;
|
|---|
| 65 | fCutForPositron = defaultCutValue;
|
|---|
| 66 |
|
|---|
| 67 | fMessenger = new F04PhysicsListMessenger(this);
|
|---|
| 68 |
|
|---|
| 69 | SetVerboseLevel(1);
|
|---|
| 70 |
|
|---|
| 71 | G4PhysListFactory factory;
|
|---|
| 72 | G4VModularPhysicsList* phys = 0;
|
|---|
| 73 |
|
|---|
| 74 | if(factory.IsReferencePhysList(physicsList))
|
|---|
| 75 | phys =factory.GetReferencePhysList(physicsList);
|
|---|
| 76 |
|
|---|
| 77 | // Physics List is defined via environment variable PHYSLIST
|
|---|
| 78 | if(!phys) phys = factory.ReferencePhysList();
|
|---|
| 79 |
|
|---|
| 80 | for (G4int i = 0; ; ++i) {
|
|---|
| 81 | G4VPhysicsConstructor* elem =
|
|---|
| 82 | const_cast<G4VPhysicsConstructor*> (phys->GetPhysics(i));
|
|---|
| 83 | if (elem == NULL) break;
|
|---|
| 84 | G4cout << "RegisterPhysics: " << elem->GetPhysicsName() << G4endl;
|
|---|
| 85 | RegisterPhysics(elem);
|
|---|
| 86 | }
|
|---|
| 87 |
|
|---|
| 88 | RegisterPhysics(new F04ExtraPhysics());
|
|---|
| 89 | RegisterPhysics(new G4OpticalPhysics());
|
|---|
| 90 |
|
|---|
| 91 | stepMaxProcess = new F04StepMax();
|
|---|
| 92 | }
|
|---|
| 93 |
|
|---|
| 94 | F04PhysicsList::~F04PhysicsList()
|
|---|
| 95 | {
|
|---|
| 96 | delete fMessenger;
|
|---|
| 97 |
|
|---|
| 98 | delete stepMaxProcess;
|
|---|
| 99 | }
|
|---|
| 100 |
|
|---|
| 101 | void F04PhysicsList::ConstructParticle()
|
|---|
| 102 | {
|
|---|
| 103 | G4VModularPhysicsList::ConstructParticle();
|
|---|
| 104 |
|
|---|
| 105 | G4DecayTable* MuonPlusDecayTable = new G4DecayTable();
|
|---|
| 106 | MuonPlusDecayTable -> Insert(new
|
|---|
| 107 | G4MuonDecayChannelWithSpin("mu+",0.986));
|
|---|
| 108 | MuonPlusDecayTable -> Insert(new
|
|---|
| 109 | G4MuonRadiativeDecayChannelWithSpin("mu+",0.014));
|
|---|
| 110 | G4MuonPlus::MuonPlusDefinition() -> SetDecayTable(MuonPlusDecayTable);
|
|---|
| 111 |
|
|---|
| 112 | G4DecayTable* MuonMinusDecayTable = new G4DecayTable();
|
|---|
| 113 | MuonMinusDecayTable -> Insert(new
|
|---|
| 114 | G4MuonDecayChannelWithSpin("mu-",0.986));
|
|---|
| 115 | MuonMinusDecayTable -> Insert(new
|
|---|
| 116 | G4MuonRadiativeDecayChannelWithSpin("mu-",0.014));
|
|---|
| 117 | G4MuonMinus::MuonMinusDefinition() -> SetDecayTable(MuonMinusDecayTable);
|
|---|
| 118 | }
|
|---|
| 119 |
|
|---|
| 120 | void F04PhysicsList::ConstructProcess()
|
|---|
| 121 | {
|
|---|
| 122 | G4VModularPhysicsList::ConstructProcess();
|
|---|
| 123 |
|
|---|
| 124 | G4DecayWithSpin* decayWithSpin = new G4DecayWithSpin();
|
|---|
| 125 |
|
|---|
| 126 | G4ProcessTable* processTable = G4ProcessTable::GetProcessTable();
|
|---|
| 127 |
|
|---|
| 128 | G4VProcess* decay;
|
|---|
| 129 | decay = processTable->FindProcess("Decay",G4MuonPlus::MuonPlus());
|
|---|
| 130 |
|
|---|
| 131 | G4ProcessManager* fManager;
|
|---|
| 132 | fManager = G4MuonPlus::MuonPlus()->GetProcessManager();
|
|---|
| 133 |
|
|---|
| 134 | if (fManager) {
|
|---|
| 135 | if (decay) fManager->RemoveProcess(decay);
|
|---|
| 136 | fManager->AddProcess(decayWithSpin);
|
|---|
| 137 | // set ordering for PostStepDoIt and AtRestDoIt
|
|---|
| 138 | fManager ->SetProcessOrdering(decayWithSpin, idxPostStep);
|
|---|
| 139 | fManager ->SetProcessOrdering(decayWithSpin, idxAtRest);
|
|---|
| 140 | }
|
|---|
| 141 |
|
|---|
| 142 | decay = processTable->FindProcess("Decay",G4MuonMinus::MuonMinus());
|
|---|
| 143 |
|
|---|
| 144 | fManager = G4MuonMinus::MuonMinus()->GetProcessManager();
|
|---|
| 145 |
|
|---|
| 146 | if (fManager) {
|
|---|
| 147 | if (decay) fManager->RemoveProcess(decay);
|
|---|
| 148 | fManager->AddProcess(decayWithSpin);
|
|---|
| 149 | // set ordering for PostStepDoIt and AtRestDoIt
|
|---|
| 150 | fManager ->SetProcessOrdering(decayWithSpin, idxPostStep);
|
|---|
| 151 | fManager ->SetProcessOrdering(decayWithSpin, idxAtRest);
|
|---|
| 152 | }
|
|---|
| 153 |
|
|---|
| 154 | G4PionDecayMakeSpin* poldecay = new G4PionDecayMakeSpin();
|
|---|
| 155 |
|
|---|
| 156 | decay = processTable->FindProcess("Decay",G4PionPlus::PionPlus());
|
|---|
| 157 |
|
|---|
| 158 | fManager = G4PionPlus::PionPlus()->GetProcessManager();
|
|---|
| 159 |
|
|---|
| 160 | if (fManager) {
|
|---|
| 161 | if (decay) fManager->RemoveProcess(decay);
|
|---|
| 162 | fManager->AddProcess(poldecay);
|
|---|
| 163 | // set ordering for PostStepDoIt and AtRestDoIt
|
|---|
| 164 | fManager ->SetProcessOrdering(poldecay, idxPostStep);
|
|---|
| 165 | fManager ->SetProcessOrdering(poldecay, idxAtRest);
|
|---|
| 166 | }
|
|---|
| 167 |
|
|---|
| 168 | decay = processTable->FindProcess("Decay",G4PionMinus::PionMinus());
|
|---|
| 169 |
|
|---|
| 170 | fManager = G4PionMinus::PionMinus()->GetProcessManager();
|
|---|
| 171 |
|
|---|
| 172 | if (fManager) {
|
|---|
| 173 | if (decay) fManager->RemoveProcess(decay);
|
|---|
| 174 | fManager->AddProcess(poldecay);
|
|---|
| 175 | // set ordering for PostStepDoIt and AtRestDoIt
|
|---|
| 176 | fManager ->SetProcessOrdering(poldecay, idxPostStep);
|
|---|
| 177 | fManager ->SetProcessOrdering(poldecay, idxAtRest);
|
|---|
| 178 | }
|
|---|
| 179 |
|
|---|
| 180 | AddStepMax();
|
|---|
| 181 | }
|
|---|
| 182 |
|
|---|
| 183 | /*
|
|---|
| 184 | void F04PhysicsList::RemoveFromPhysicsList(const G4String& name)
|
|---|
| 185 | {
|
|---|
| 186 | G4bool success = false;
|
|---|
| 187 | for (G4PhysConstVector::iterator p = physicsVector->begin();
|
|---|
| 188 | p != physicsVector->end(); ++p) {
|
|---|
| 189 | G4VPhysicsConstructor* e = (*p);
|
|---|
| 190 | if (e->GetPhysicsName() == name) {
|
|---|
| 191 | physicsVector->erase(p);
|
|---|
| 192 | success = true;
|
|---|
| 193 | break;
|
|---|
| 194 | }
|
|---|
| 195 | }
|
|---|
| 196 | if (!success) {
|
|---|
| 197 | std::ostringstream message;
|
|---|
| 198 | message << "PhysicsList::RemoveFromPhysicsList "<< name << "not found";
|
|---|
| 199 | G4Exception(message.str().c_str());
|
|---|
| 200 | }
|
|---|
| 201 | }
|
|---|
| 202 |
|
|---|
| 203 | void F04PhysicsList::ClearPhysics()
|
|---|
| 204 | {
|
|---|
| 205 | for (G4PhysConstVector::iterator p = physicsVector->begin();
|
|---|
| 206 | p != physicsVector->end(); ++p) {
|
|---|
| 207 | delete (*p);
|
|---|
| 208 | }
|
|---|
| 209 | physicsVector->clear();
|
|---|
| 210 | }
|
|---|
| 211 | */
|
|---|
| 212 |
|
|---|
| 213 | void F04PhysicsList::SetCuts()
|
|---|
| 214 | {
|
|---|
| 215 | if (verboseLevel >0) {
|
|---|
| 216 | G4cout << "F04PhysicsList::SetCuts:";
|
|---|
| 217 | G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length")
|
|---|
| 218 | << G4endl;
|
|---|
| 219 | }
|
|---|
| 220 |
|
|---|
| 221 | // set cut values for gamma at first and for e- second and next for e+,
|
|---|
| 222 | // because some processes for e+/e- need cut values for gamma
|
|---|
| 223 | SetCutValue(fCutForGamma, "gamma");
|
|---|
| 224 | SetCutValue(fCutForElectron, "e-");
|
|---|
| 225 | SetCutValue(fCutForPositron, "e+");
|
|---|
| 226 |
|
|---|
| 227 | if (verboseLevel>0) DumpCutValuesTable();
|
|---|
| 228 | }
|
|---|
| 229 |
|
|---|
| 230 | void F04PhysicsList::SetCutForGamma(G4double cut)
|
|---|
| 231 | {
|
|---|
| 232 | fCutForGamma = cut;
|
|---|
| 233 | SetParticleCuts(fCutForGamma, G4Gamma::Gamma());
|
|---|
| 234 | }
|
|---|
| 235 |
|
|---|
| 236 | void F04PhysicsList::SetCutForElectron(G4double cut)
|
|---|
| 237 | {
|
|---|
| 238 | fCutForElectron = cut;
|
|---|
| 239 | SetParticleCuts(fCutForElectron, G4Electron::Electron());
|
|---|
| 240 | }
|
|---|
| 241 |
|
|---|
| 242 | void F04PhysicsList::SetCutForPositron(G4double cut)
|
|---|
| 243 | {
|
|---|
| 244 | fCutForPositron = cut;
|
|---|
| 245 | SetParticleCuts(fCutForPositron, G4Positron::Positron());
|
|---|
| 246 | }
|
|---|
| 247 |
|
|---|
| 248 | void F04PhysicsList::SetStepMax(G4double step)
|
|---|
| 249 | {
|
|---|
| 250 | MaxChargedStep = step ;
|
|---|
| 251 | stepMaxProcess->SetStepMax(MaxChargedStep);
|
|---|
| 252 | }
|
|---|
| 253 |
|
|---|
| 254 | F04StepMax* F04PhysicsList::GetStepMaxProcess()
|
|---|
| 255 | {
|
|---|
| 256 | return stepMaxProcess;
|
|---|
| 257 | }
|
|---|
| 258 |
|
|---|
| 259 | void F04PhysicsList::AddStepMax()
|
|---|
| 260 | {
|
|---|
| 261 | // Step limitation seen as a process
|
|---|
| 262 |
|
|---|
| 263 | theParticleIterator->reset();
|
|---|
| 264 | while ((*theParticleIterator)()){
|
|---|
| 265 | G4ParticleDefinition* particle = theParticleIterator->value();
|
|---|
| 266 | G4ProcessManager* pmanager = particle->GetProcessManager();
|
|---|
| 267 |
|
|---|
| 268 | if (stepMaxProcess->IsApplicable(*particle) && !particle->IsShortLived())
|
|---|
| 269 | {
|
|---|
| 270 | if (pmanager) pmanager ->AddDiscreteProcess(stepMaxProcess);
|
|---|
| 271 | }
|
|---|
| 272 | }
|
|---|
| 273 | }
|
|---|