source: trunk/source/physics_lists/builders/src/G4QStoppingPhysics.cc @ 1228

Last change on this file since 1228 was 1228, checked in by garnier, 14 years ago

update geant4.9.3 tag

File size: 4.5 KB
Line 
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: G4QStoppingPhysics.cc,v 1.2 2007/04/26 16:03:18 gunter Exp $
27// GEANT4 tag $Name: geant4-09-03 $
28//
29//---------------------------------------------------------------------------
30//
31// ClassName:   G4QStoppingPhysics
32//
33// Author: 11 April 2006 V. Ivanchenko
34//
35// Modified:
36//
37//----------------------------------------------------------------------------
38//
39
40#include "G4QStoppingPhysics.hh"
41
42#include "G4QCaptureAtRest.hh"
43
44#include "G4ParticleDefinition.hh"
45#include "G4ProcessManager.hh"
46
47#include "G4LeptonConstructor.hh"
48#include "G4MesonConstructor.hh"
49#include "G4BaryonConstructor.hh"
50#include "G4MuonMinus.hh"
51
52G4QStoppingPhysics::G4QStoppingPhysics(const G4String& name, G4int ver,
53                G4bool UseMuonMinusCapture)
54  :  G4VPhysicsConstructor(name), verbose(ver), wasActivated(false) ,
55     useMuonMinusCaptureAtRest(UseMuonMinusCapture)
56{
57  if(verbose > 1) G4cout << "### G4QStoppingPhysics" << G4endl;
58}
59
60G4QStoppingPhysics::~G4QStoppingPhysics()
61{
62  if(wasActivated) {
63    if ( muProcess ) delete muProcess;
64    delete hProcess;
65  }
66}
67
68void G4QStoppingPhysics::ConstructParticle()
69{
70// G4cout << "G4QStoppingPhysics::ConstructParticle" << G4endl;
71  G4LeptonConstructor pLeptonConstructor;
72  pLeptonConstructor.ConstructParticle();
73
74  G4MesonConstructor pMesonConstructor;
75  pMesonConstructor.ConstructParticle();
76
77  G4BaryonConstructor pBaryonConstructor;
78  pBaryonConstructor.ConstructParticle();
79
80}
81
82void G4QStoppingPhysics::ConstructProcess()
83{
84  if(verbose > 1) G4cout << "### G4QStoppingPhysics::ConstructProcess " 
85                          << wasActivated << G4endl;
86  if(wasActivated) return;
87  wasActivated = true;
88
89  if ( useMuonMinusCaptureAtRest )
90  {
91     muProcess = new G4MuonMinusCaptureAtRest();
92  } else {
93     muProcess = 0;
94  }   
95  hProcess = new G4QCaptureAtRest();
96
97  G4double mThreshold = 130.*MeV;
98
99  // Add Stopping Process
100  G4ParticleDefinition* particle=0;
101  G4ProcessManager* pmanager=0;
102
103  theParticleIterator->reset();
104  while( (*theParticleIterator)() )
105  {
106    particle = theParticleIterator->value();
107    pmanager = particle->GetProcessManager();
108    if(particle == G4MuonMinus::MuonMinus()) {
109      if ( useMuonMinusCaptureAtRest ) 
110      {
111         pmanager->AddRestProcess(muProcess);
112         if(verbose > 1)
113          G4cout << "### QStoppingPhysics added G4MuonMinusCaptureAtRest for " 
114                 << particle->GetParticleName() << G4endl;
115      } else {
116         pmanager->AddRestProcess(hProcess);
117         if(verbose > 1)
118          G4cout << "### QStoppingPhysics added G4QCaptureAtRest for " 
119                 << particle->GetParticleName() << G4endl;
120      } 
121    }
122    if(particle->GetPDGCharge() < 0.0 && 
123       particle->GetPDGMass() > mThreshold &&
124       !particle->IsShortLived() &&
125       hProcess->IsApplicable(*particle) ) 
126    { 
127      pmanager->AddRestProcess(hProcess);
128      if(verbose > 1)
129        G4cout << "### QStoppingPhysics added for " 
130               << particle->GetParticleName() << G4endl;
131    }
132  }
133}
134
135
Note: See TracBrowser for help on using the repository browser.