ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4eplusAnnihilation.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4eplusAnnihilation.cc
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 //
27 // -------------------------------------------------------------------
28 //
29 // GEANT4 Class file
30 //
31 //
32 // File name: G4eplusAnnihilation
33 //
34 // Author: Vladimir Ivanchenko on base of Michel Maire code
35 //
36 // Creation date: 02.08.2004
37 //
38 // Modified by Michel Maire, Vladimir Ivanchenko and Daren Sawkey
39 
40 //
41 // -------------------------------------------------------------------
42 //
43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
45 
46 #include "G4eplusAnnihilation.hh"
47 #include "G4PhysicalConstants.hh"
48 #include "G4MaterialCutsCouple.hh"
49 #include "G4Gamma.hh"
50 #include "G4Positron.hh"
51 #include "G4eeToTwoGammaModel.hh"
52 #include "G4EmBiasingManager.hh"
53 
54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
55 
56 using namespace std;
57 
59  : G4VEmProcess(name), isInitialised(false)
60 {
62  SetIntegral(true);
63  SetBuildTableFlag(false);
64  SetStartFromNullFlag(false);
67  enableAtRestDoIt = true;
68  mainSecondaries = 2;
69 }
70 
71 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
72 
74 {}
75 
76 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
77 
79 {
80  return (&p == G4Positron::Positron());
81 }
82 
83 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
84 
87 {
88  *condition = NotForced;
89  return 0.0;
90 }
91 
92 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
93 
95 {
96  if(!isInitialised) {
97  isInitialised = true;
98  if(!EmModel(0)) { SetEmModel(new G4eeToTwoGammaModel()); }
101  AddEmModel(1, EmModel(0));
102  }
103 }
104 
105 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
106 
107 void G4eplusAnnihilation::StreamProcessInfo(std::ostream&) const
108 {}
109 
110 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
111 
113  const G4Step& step)
114 // Performs the e+ e- annihilation when both particles are assumed at rest.
115 {
118  G4double ene(0.0);
119  G4VEmModel* model = SelectModel(ene, idx);
120 
121  // define new weight for primary and secondaries
123 
124  // sample secondaries
125  secParticles.clear();
126  G4double gammaCut = GetGammaEnergyCut();
128  track.GetDynamicParticle(), gammaCut);
129 
130  G4int num0 = secParticles.size();
131 
132  // splitting or Russian roulette
133  if(biasManager) {
135  G4double eloss = 0.0;
137  secParticles, track, model, &fParticleChange, eloss,
138  idx, gammaCut, step.GetPostStepPoint()->GetSafety());
139  if(eloss > 0.0) {
142  }
143  }
144  }
145  // save secondaries
146  G4int num = secParticles.size();
147  if(num > 0) {
148 
151  G4double time = track.GetGlobalTime();
152 
153  for (G4int i=0; i<num; ++i) {
154  if (secParticles[i]) {
157  G4double e = dp->GetKineticEnergy();
158  G4bool good = true;
159  if(ApplyCuts()) {
160  if (p == theGamma) {
161  if (e < gammaCut) { good = false; }
162  } else if (p == theElectron) {
163  if (e < GetElectronEnergyCut()) { good = false; }
164  }
165  // added secondary if it is good
166  }
167  if (good) {
168  G4Track* t = new G4Track(dp, time, track.GetPosition());
170  if (biasManager) {
171  t->SetWeight(weight * biasManager->GetWeight(i));
172  } else {
173  t->SetWeight(weight);
174  }
176 
177  // define type of secondary
179  else if(i < num0) {
180  if(p == theGamma) {
182  } else {
184  }
185  } else {
187  }
188  /*
189  G4cout << "Secondary(post step) has weight " << t->GetWeight()
190  << ", Ekin= " << t->GetKineticEnergy()/MeV << " MeV "
191  << GetProcessName() << " fluoID= " << fluoID
192  << " augerID= " << augerID <<G4endl;
193  */
194  } else {
195  delete dp;
196  edep += e;
197  }
198  }
199  }
201  }
202  return &fParticleChange;
203 }
204 
205 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
206 
207 void G4eplusAnnihilation::ProcessDescription(std::ostream& out) const
208 {
209  out << " Positron annihilation";
211 }
212 
213 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....