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

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

tag geant4.9.4 beta 1 + modifs locales

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