source: trunk/source/physics_lists/builders/src/G4EmExtraPhysics.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.8 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: G4EmExtraPhysics.cc,v 1.3 2008/01/08 10:36:32 vnivanch Exp $
27// GEANT4 tag $Name: geant4-09-03 $
28//
29//---------------------------------------------------------------------------
30//
31// ClassName:   G4EmExtraPhysics
32//
33// Author: 2002 J.P. Wellisch
34//
35// Modified:
36// 10.11.2005 V.Ivanchenko edit to provide a standard
37// 19.06.2006 V.Ivanchenko add mu-nuclear process
38//
39//----------------------------------------------------------------------------
40//
41
42#include "G4EmExtraPhysics.hh"
43
44#include "G4SynchrotronRadiation.hh"
45
46#include "G4ParticleDefinition.hh"
47#include "G4ParticleTable.hh"
48#include "G4Gamma.hh"
49#include "G4Electron.hh"
50#include "G4Positron.hh"
51#include "G4MuonPlus.hh"
52#include "G4MuonMinus.hh"
53#include "G4ProcessManager.hh"
54
55G4EmExtraPhysics::G4EmExtraPhysics(const G4String& name): 
56  G4VPhysicsConstructor(name), wasBuilt(false), gnActivated(false), munActivated(false), 
57  synActivated(false), synchOn(false), gammNucOn(true), muNucOn(false), 
58  theElectronSynch(0), thePositronSynch(0), theGNPhysics(0), theMuNuc1(0), 
59  theMuNuc2(0)
60{
61  theMessenger = new G4EmMessenger(this);
62}
63
64G4EmExtraPhysics::~G4EmExtraPhysics()
65{
66  delete theMessenger;
67  delete theElectronSynch;
68  delete thePositronSynch;
69  delete theGNPhysics;
70  delete theMuNuc1;
71  delete theMuNuc2;
72}
73
74void G4EmExtraPhysics::Synch(G4String & newState)
75{
76  if(newState == "on" || newState == "ON") {
77    synchOn = true;
78    if(wasBuilt) BuildSynch();
79  } else synchOn = false;
80}
81
82void G4EmExtraPhysics::GammaNuclear(G4String & newState)
83{
84  if(newState == "on" || newState == "ON") {
85    gammNucOn = true;
86    if(wasBuilt) BuildGammaNuclear();
87  } else  gammNucOn = false;
88}
89
90void G4EmExtraPhysics::MuonNuclear(G4String & newState)
91{
92  if(newState == "on" || newState == "ON") {
93    muNucOn = true;
94    if(wasBuilt) BuildMuonNuclear();
95  } else muNucOn = false;
96}
97
98void G4EmExtraPhysics::ConstructParticle()
99{
100  G4Gamma::Gamma();
101  G4Electron::Electron();
102  G4Positron::Positron();
103  G4MuonPlus::MuonPlus();
104  G4MuonMinus::MuonMinus();
105}
106
107void G4EmExtraPhysics::ConstructProcess()
108{
109  if(wasBuilt) return;
110  wasBuilt = true;
111
112  if (synchOn)   BuildSynch();
113  if (gammNucOn) BuildGammaNuclear();
114  if (muNucOn)   BuildMuonNuclear();
115}
116
117void G4EmExtraPhysics::BuildMuonNuclear()
118{
119  if(munActivated) return;
120  munActivated = true;
121  G4ProcessManager * pManager = 0;
122
123  pManager  = G4MuonPlus::MuonPlus()->GetProcessManager();
124  theMuNuc1 = new G4MuNuclearInteraction("muNucl");
125  pManager->AddDiscreteProcess(theMuNuc1);
126
127  pManager  = G4MuonMinus::MuonMinus()->GetProcessManager();
128  theMuNuc2 = new G4MuNuclearInteraction("muNucl");
129  pManager->AddDiscreteProcess(theMuNuc2);
130}
131
132void G4EmExtraPhysics::BuildGammaNuclear()
133{
134  if(gnActivated) return;
135  gnActivated = true;
136
137  theGNPhysics = new G4ElectroNuclearBuilder();
138  theGNPhysics->Build();
139}
140
141void G4EmExtraPhysics::BuildSynch()
142{
143  if(synActivated) return;
144  synActivated = true;
145  G4ProcessManager * pManager = 0;
146
147  pManager = G4Electron::Electron()->GetProcessManager();
148  theElectronSynch = new G4SynchrotronRadiation();
149  pManager->AddDiscreteProcess(theElectronSynch);
150
151  pManager = G4Positron::Positron()->GetProcessManager();
152  thePositronSynch = new G4SynchrotronRadiation();
153  pManager->AddDiscreteProcess(thePositronSynch);
154}
Note: See TracBrowser for help on using the repository browser.