source: trunk/source/physics_lists/builders/src/G4QPhotoNuclearPhysics.cc @ 1231

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

update geant4.9.3 tag

File size: 6.9 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: G4QPhotoNuclearPhysics.cc,v 1.2 2009/11/16 19:12:10 mkossov Exp $
27// GEANT4 tag $Name: geant4-09-03 $
28//
29//---------------------------------------------------------------------------
30//
31// ClassName:   G4QPhotoNuclearPhysics
32//
33// Author: 2009 M. V. Kosov
34//
35// Modified:
36//
37//----------------------------------------------------------------------------
38//
39
40#include "G4QPhotoNuclearPhysics.hh"
41
42
43G4QPhotoNuclearPhysics::G4QPhotoNuclearPhysics(const G4String& name): 
44  G4VPhysicsConstructor(name), wasBuilt(false), SynchRActivated(false),
45  GamNucActivated(false), EleNucActivated(false), MuoNucActivated(false),
46  TauNucActivated(false), synchrOn(true), synchrMinGam(227.), gamNucOn(true),
47  eleNucOn(true), muoNucOn(true), tauNucOn(true), photoNucBias(1.)
48{
49  theMessenger = G4QMessenger::GetPointer();
50  theMessenger->Add(this);
51}
52
53G4QPhotoNuclearPhysics::~G4QPhotoNuclearPhysics()
54{
55  if(wasBuilt)
56  {
57    delete inelastic;
58    if(synchrOn) delete synchrad;
59  }
60}
61
62void G4QPhotoNuclearPhysics::SetSynchRadOnOff(G4String& newSwitch)
63{
64  if(wasBuilt) G4cout<<"G4QPhotoNuclearPhysics:No, processes are already builded!"<<G4endl;
65  else if(newSwitch == "on" || newSwitch == "ON" || newSwitch == "On") synchrOn = true;
66  else synchrOn = false;
67}
68
69void G4QPhotoNuclearPhysics::SetGammaNuclearOnOff(G4String& newSwitch)
70{
71  if(wasBuilt) G4cout<<"G4QPhotoNuclearPhysics:No, processes are already builded!"<<G4endl;
72  else if(newSwitch == "on" || newSwitch == "ON" || newSwitch == "On") gamNucOn = true;
73  else gamNucOn = false;
74}
75
76void G4QPhotoNuclearPhysics::SetElPosNuclearOnOff(G4String& newSwitch)
77{
78  if(wasBuilt) G4cout<<"G4QPhotoNuclearPhysics:No, processes are already builded!"<<G4endl;
79  else if(newSwitch == "on" || newSwitch == "ON" || newSwitch == "On") eleNucOn = true;
80  else eleNucOn = false;
81}
82
83void G4QPhotoNuclearPhysics::SetMuonNuclearOnOff(G4String& newSwitch)
84{
85  if(wasBuilt) G4cout<<"G4QPhotoNuclearPhysics:No, processes are already builded!"<<G4endl;
86  else if(newSwitch == "on" || newSwitch == "ON" || newSwitch == "On") muoNucOn = true;
87  else muoNucOn = false;
88}
89
90void G4QPhotoNuclearPhysics::SetTauNuclearOnOff(G4String& newSwitch)
91{
92  if(wasBuilt) G4cout<<"G4QPhotoNuclearPhysics:No, processes are already builded!"<<G4endl;
93  else if(newSwitch == "on" || newSwitch == "ON" || newSwitch == "On") tauNucOn = true;
94  else tauNucOn = false;
95}
96
97void G4QPhotoNuclearPhysics::SetMinGammaSR(G4double newValue)
98{
99  if(wasBuilt) G4cout<<"G4QPhotoNuclearPhysics:No, processes are already builded!"<<G4endl;
100  else synchrMinGam = newValue;
101}
102
103void G4QPhotoNuclearPhysics::SetPhotoNucBias(G4double newValue)
104{
105  if(wasBuilt) G4cout<<"G4QPhotoNuclearPhysics:No, processes are already builded!"<<G4endl;
106  else photoNucBias = newValue;
107}
108
109void G4QPhotoNuclearPhysics::ConstructParticle()
110{
111  G4Gamma::Gamma();
112  G4Electron::Electron();
113  G4Positron::Positron();
114  G4MuonPlus::MuonPlus();
115  G4MuonMinus::MuonMinus();
116  G4TauPlus::TauPlus();
117  G4TauMinus::TauMinus();
118  if (synchrOn)
119  {
120    G4MesonConstructor pMesonConstructor;
121    pMesonConstructor.ConstructParticle();
122
123    G4BaryonConstructor pBaryonConstructor;
124    pBaryonConstructor.ConstructParticle();
125  }
126}
127
128void G4QPhotoNuclearPhysics::ConstructProcess()
129{
130  if(wasBuilt) return;
131  wasBuilt = true;
132
133  inelastic = new G4QInelastic("photoNuclear");
134  inelastic->SetPhotNucBias(photoNucBias);
135
136  if (synchrOn)   BuildSynchRad();
137  if (gamNucOn)   BuildGammaNuclear();
138  if (eleNucOn)   BuildElectroNuclear();
139  if (muoNucOn)   BuildMuonNuclear();
140  if (tauNucOn)   BuildTauNuclear();
141}
142
143void G4QPhotoNuclearPhysics::BuildGammaNuclear()
144{
145  if(GamNucActivated) return;
146  GamNucActivated = true;
147  G4ProcessManager* pManager  = G4Gamma::Gamma()->GetProcessManager();
148  pManager->AddDiscreteProcess(inelastic);
149}
150
151void G4QPhotoNuclearPhysics::BuildElectroNuclear()
152{
153  if(EleNucActivated) return;
154  EleNucActivated = true;
155  G4ProcessManager * pManager = 0;
156
157  pManager  = G4Electron::Electron()->GetProcessManager();
158  pManager->AddDiscreteProcess(inelastic);
159
160  pManager  = G4Positron::Positron()->GetProcessManager();
161  pManager->AddDiscreteProcess(inelastic);
162}
163
164void G4QPhotoNuclearPhysics::BuildMuonNuclear()
165{
166  if(MuoNucActivated) return;
167  MuoNucActivated = true;
168  G4ProcessManager * pManager = 0;
169
170  pManager  = G4MuonPlus::MuonPlus()->GetProcessManager();
171  pManager->AddDiscreteProcess(inelastic);
172
173  pManager  = G4MuonMinus::MuonMinus()->GetProcessManager();
174  pManager->AddDiscreteProcess(inelastic);
175}
176
177void G4QPhotoNuclearPhysics::BuildTauNuclear()
178{
179  if(TauNucActivated) return;
180  TauNucActivated = true;
181  G4ProcessManager * pManager = 0;
182
183  pManager  = G4TauPlus::TauPlus()->GetProcessManager();
184  pManager->AddDiscreteProcess(inelastic);
185
186  pManager  = G4TauMinus::TauMinus()->GetProcessManager();
187  pManager->AddDiscreteProcess(inelastic);
188}
189
190// The CHIPS Synchrotron radiation process is working for all charged particles
191void G4QPhotoNuclearPhysics::BuildSynchRad()
192{
193  if(SynchRActivated) return;
194  SynchRActivated = true;
195  synchrad = new G4QSynchRad();
196  while( (*theParticleIterator)() )
197  {
198    G4ParticleDefinition* particle = theParticleIterator->value();
199    G4double charge = particle->GetPDGCharge();
200    if(charge != 0.0)
201    {
202      G4ProcessManager* pmanager = particle->GetProcessManager();
203      pmanager->AddDiscreteProcess(synchrad);
204    }
205  }
206}
Note: See TracBrowser for help on using the repository browser.