Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4QStoppingPhysics.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$
27 //
28 //---------------------------------------------------------------------------
29 //
30 // ClassName: G4QStoppingPhysics
31 //
32 // Author: 11 April 2006 V. Ivanchenko
33 //
34 // Modified:
35 // 20120921 M. Kelsey -- Replace G4MuonMinusCaptureAtRest with new
36 // G4MuonMinusCapture.
37 //----------------------------------------------------------------------------
38 //
39 
40 #include "G4QStoppingPhysics.hh"
41 
42 #include "G4SystemOfUnits.hh"
43 #include "G4QCaptureAtRest.hh"
45 
46 #include "G4ParticleDefinition.hh"
47 #include "G4ProcessManager.hh"
48 
49 #include "G4LeptonConstructor.hh"
50 #include "G4MesonConstructor.hh"
51 #include "G4BaryonConstructor.hh"
52 #include "G4MuonMinus.hh"
53 #include "G4HadronicDeprecate.hh"
54 
55 
57  : G4VPhysicsConstructor("stopping")
58  , muProcess(0), hProcess(0)
59 , verbose(ver), wasActivated(false) ,
60  useMuonMinusCapture(true)
61 {
62  G4HadronicDeprecate("G4QStoppingPhysics");
63  if(verbose > 1) G4cout << "### G4QStoppingPhysics" << G4endl;
64 }
65 
67  G4bool UseMuonMinusCapture)
68  : G4VPhysicsConstructor(name)
69  , muProcess(0), hProcess(0)
70  , verbose(ver), wasActivated(false) ,
71  useMuonMinusCapture(UseMuonMinusCapture)
72 {
73  G4HadronicDeprecate("G4QStoppingPhysics");
74  if(verbose > 1) G4cout << "### G4QStoppingPhysics" << G4endl;
75 }
76 
78 {
79  if(wasActivated) {
80  if ( muProcess ) delete muProcess;
81  delete hProcess;
82  }
83 }
84 
86 {
87 // G4cout << "G4QStoppingPhysics::ConstructParticle" << G4endl;
88  G4LeptonConstructor pLeptonConstructor;
89  pLeptonConstructor.ConstructParticle();
90 
91  G4MesonConstructor pMesonConstructor;
92  pMesonConstructor.ConstructParticle();
93 
94  G4BaryonConstructor pBaryonConstructor;
95  pBaryonConstructor.ConstructParticle();
96 
97 }
98 
100 {
101  if(verbose > 1) G4cout << "### G4QStoppingPhysics::ConstructProcess "
102  << wasActivated << G4endl;
103  if(wasActivated) return;
104  wasActivated = true;
105 
106  if ( useMuonMinusCapture )
107  {
108  muProcess = new G4MuonMinusCaptureAtRest();
109  } else {
110  muProcess = 0;
111  }
112  hProcess = new G4QCaptureAtRest();
113 
114  G4double mThreshold = 130.*MeV;
115 
116  // Add Stopping Process
117  G4ParticleDefinition* particle=0;
118  G4ProcessManager* pmanager=0;
119 
121  while( (*theParticleIterator)() )
122  {
123  particle = theParticleIterator->value();
124  pmanager = particle->GetProcessManager();
125  if(particle == G4MuonMinus::MuonMinus()) {
126  if ( useMuonMinusCapture )
127  {
128  pmanager->AddRestProcess(muProcess);
129  if(verbose > 1)
130  G4cout << "### QStoppingPhysics added G4MuonMinusCaptureAtRest for "
131  << particle->GetParticleName() << G4endl;
132  } else {
133  pmanager->AddRestProcess(hProcess);
134  if(verbose > 1)
135  G4cout << "### QStoppingPhysics added G4QCaptureAtRest for "
136  << particle->GetParticleName() << G4endl;
137  }
138  }
139  if(particle->GetPDGCharge() < 0.0 &&
140  particle->GetPDGMass() > mThreshold &&
141  !particle->IsShortLived() &&
142  hProcess->IsApplicable(*particle) )
143  {
144  pmanager->AddRestProcess(hProcess);
145  if(verbose > 1)
146  G4cout << "### QStoppingPhysics added for "
147  << particle->GetParticleName() << G4endl;
148  }
149  }
150 }
151 
152