Geant4  10.01.p02
ExUCNExtraPhysics.cc
Go to the documentation of this file.
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: ExUCNExtraPhysics.cc 69762 2013-05-14 08:08:54Z gcosmo $
27 //
30 //
31 //
32 #include "G4ParticleDefinition.hh"
33 #include "G4ProcessManager.hh"
34 
35 #include "G4Transportation.hh"
36 #include "G4PhysicsListHelper.hh"
37 
38 #include "G4Decay.hh"
39 #include "G4DecayTable.hh"
41 
42 #include "G4UserSpecialCuts.hh"
43 #include "G4StepLimiter.hh"
44 #include "G4SystemOfUnits.hh"
45 
46 #include "G4UCNLoss.hh"
47 #include "G4UCNAbsorption.hh"
48 #include "G4UCNMultiScattering.hh"
49 #include "G4UCNBoundaryProcess.hh"
50 
51 #include "ExUCNExtraPhysics.hh"
52 
53 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
54 
56  : G4VPhysicsConstructor("Extra") {;}
57 
58 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
59 
61 
62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
63 
65 
66 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
67 
69 {
70  aParticleIterator->reset();
71 
72  while ((*aParticleIterator)()) {
73  G4ParticleDefinition* particle = aParticleIterator->value();
74  G4ProcessManager* pmanager = particle->GetProcessManager();
75  G4String particleName = particle->GetParticleName();
76 
77  if (!pmanager) {
78  std::ostringstream o;
79  o << "Particle " << particleName << "without a Process Manager";
80  G4Exception("ExUCNExtraPhysics::ConstructProcess()","",
81  FatalException,o.str().c_str());
82  }
83 
84  pmanager->AddDiscreteProcess(new G4StepLimiter());
85  pmanager->AddDiscreteProcess(new G4UserSpecialCuts());
86  }
87 
88  AddBetaDecay();
89 
90  ConstructUCN();
91 
92 // G4Transportation* transportation = NULL;
93 // G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
94 // transportation = (G4Transportation*) ph->GetTransportation();
95 
96 // if (transportation) transportation->EnableUseMagneticMoment();
97 }
98 
99 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
100 
102 {
103  aParticleIterator->reset();
104 
105  while ((*aParticleIterator)()) {
106 
107  G4ParticleDefinition* particle = aParticleIterator->value();
108  G4String particleName = particle->GetParticleName();
109 
110  if ( particleName == "neutron" ) {
111 
112  particle->SetPDGLifeTime(886.7*second);
113  particle->SetPDGStable(false);
114 
115  G4DecayTable * table = new G4DecayTable();
116  G4VDecayChannel* mode =
117  new G4NeutronBetaDecayChannel("neutron",1.00);
118  table->Insert(mode);
119  particle->SetDecayTable(table);
120 
121  G4ProcessManager* pmanager = particle->GetProcessManager();
122  if (!pmanager) {
123  std::ostringstream o;
124  o << "Particle " << particleName << "without a Process Manager";
125  G4Exception("ExUCNExtraPhysics::ConstructProcess()","",
126  FatalException,o.str().c_str());
127  }
128 
129  G4Decay* theDecayProcess = new G4Decay();
130  pmanager->AddProcess(theDecayProcess);
131  pmanager->SetProcessOrdering(theDecayProcess,idxPostStep);
132  pmanager->SetProcessOrdering(theDecayProcess,idxAtRest);
133  }
134  }
135 }
136 
137 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
138 
140 {
141  aParticleIterator->reset();
142  G4ProcessManager* pmanager = NULL;
143 
144  while ((*aParticleIterator)()) {
145  G4ParticleDefinition* particle = aParticleIterator->value();
146  pmanager = particle->GetProcessManager();
147  G4String particleName = particle->GetParticleName();
148 
149  if (!pmanager) {
150  std::ostringstream o;
151  o << "Particle " << particleName << "without a Process Manager";
152  G4Exception("ExUCNExtraPhysics::ConstructProcess()","",
153  FatalException,o.str().c_str());
154  }
155 
156  if (particleName == "neutron") {
157  pmanager->AddDiscreteProcess(new G4UCNLoss());
158  pmanager->AddDiscreteProcess(new G4UCNAbsorption());
159  pmanager->AddDiscreteProcess(new G4UCNMultiScattering());
160 
161  G4UCNBoundaryProcess* ucnBoundaryProcess =
162  new G4UCNBoundaryProcess();
163  ucnBoundaryProcess->SetMicroRoughness(true);
164  ucnBoundaryProcess->SetVerboseLevel(0);
165 
166  pmanager->AddDiscreteProcess(ucnBoundaryProcess);
167  }
168  }
169 }
170 
171 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SetDecayTable(G4DecayTable *aDecayTable)
Definition of the ExUCNExtraPhysics class.
void SetPDGStable(const G4bool aFlag)
virtual void ConstructProcess()
G4int AddDiscreteProcess(G4VProcess *aProcess, G4int ord=ordDefault)
void SetPDGLifeTime(G4double aLifeTime)
G4ProcessManager * GetProcessManager() const
const G4String & GetParticleName() const
virtual void ConstructParticle()
#define aParticleIterator
G4int AddProcess(G4VProcess *aProcess, G4int ordAtRestDoIt=ordInActive, G4int ordAlongSteptDoIt=ordInActive, G4int ordPostStepDoIt=ordInActive)
static const double second
Definition: G4SIunits.hh:138
void SetProcessOrdering(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt, G4int ordDoIt=ordDefault)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
void Insert(G4VDecayChannel *aChannel)
Definition: G4DecayTable.cc:60
virtual ~ExUCNExtraPhysics()
void SetVerboseLevel(G4int value)
Definition: G4VProcess.hh:437