ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4TransitionRadiation.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4TransitionRadiation.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 // G4TransitionRadiation class -- implementation file
28 
29 // GEANT 4 class implementation file --- Copyright CERN 1995
30 // CERN Geneva Switzerland
31 
32 // For information related to this code, please, contact
33 // CERN, CN Division, ASD Group
34 // History:
35 // 1st version 11.09.97 V. Grichine (Vladimir.Grichine@cern.ch )
36 // 2nd version 16.12.97 V. Grichine
37 // 3rd version 28.07.05, P.Gumplinger add G4ProcessType to constructor
38 
39 
40 #include <cmath>
41 
42 #include "G4TransitionRadiation.hh"
43 #include "G4Material.hh"
44 #include "G4EmProcessSubType.hh"
45 
46 // Local constants
47 
51 
52 
54 //
55 // Constructor for selected couple of materials
56 //
57 
59 G4TransitionRadiation( const G4String& processName, G4ProcessType type )
60  : G4VDiscreteProcess(processName, type)
61 {
63  fMatIndex1 = fMatIndex2 = 0;
64 
66 }
67 
69 //
70 // Destructor
71 //
72 
74 {}
75 
76 G4bool
78 {
79  return ( aParticleType.GetPDGCharge() != 0.0 );
80 }
81 
83  G4double,
85 {
86  *condition = Forced;
87  return DBL_MAX; // so TR doesn't limit mean free path
88 }
89 
91  const G4Step&)
92 {
94  return &aParticleChange;
95 }
96 
98 //
99 // Sympson integral of TR spectral-angle density over energy between
100 // the limits energy 1 and energy2 at fixed varAngle = 1 - std::cos(Theta)
101 
102 G4double
104  G4double energy2,
105  G4double varAngle ) const
106 {
107  G4int i ;
108  G4double h , sumEven = 0.0 , sumOdd = 0.0 ;
109  h = 0.5*(energy2 - energy1)/fSympsonNumber ;
110  for(i=1;i<fSympsonNumber;i++)
111  {
112  sumEven += SpectralAngleTRdensity(energy1 + 2*i*h,varAngle) ;
113  sumOdd += SpectralAngleTRdensity(energy1 + (2*i - 1)*h,varAngle) ;
114  }
115  sumOdd += SpectralAngleTRdensity(energy1 + (2*fSympsonNumber - 1)*h,varAngle) ;
116  return h*( SpectralAngleTRdensity(energy1,varAngle)
117  + SpectralAngleTRdensity(energy2,varAngle)
118  + 4.0*sumOdd + 2.0*sumEven )/3.0 ;
119 }
120 
121 
122 
124 //
125 // Sympson integral of TR spectral-angle density over energy between
126 // the limits varAngle1 and varAngle2 at fixed energy
127 
128 G4double
130  G4double varAngle1,
131  G4double varAngle2 ) const
132 {
133  G4int i ;
134  G4double h , sumEven = 0.0 , sumOdd = 0.0 ;
135  h = 0.5*(varAngle2 - varAngle1)/fSympsonNumber ;
136  for(i=1;i<fSympsonNumber;i++)
137  {
138  sumEven += SpectralAngleTRdensity(energy,varAngle1 + 2*i*h) ;
139  sumOdd += SpectralAngleTRdensity(energy,varAngle1 + (2*i - 1)*h) ;
140  }
141  sumOdd += SpectralAngleTRdensity(energy,varAngle1 + (2*fSympsonNumber - 1)*h) ;
142 
143  return h*( SpectralAngleTRdensity(energy,varAngle1)
144  + SpectralAngleTRdensity(energy,varAngle2)
145  + 4.0*sumOdd + 2.0*sumEven )/3.0 ;
146 }
147 
149 //
150 // The number of transition radiation photons generated in the
151 // angle interval between varAngle1 and varAngle2
152 //
153 
156  G4double varAngle2 ) const
157 {
158  G4int i ;
159  G4double h , sumEven = 0.0 , sumOdd = 0.0 ;
160  h = 0.5*(varAngle2 - varAngle1)/fSympsonNumber ;
161  for(i=1;i<fSympsonNumber;i++)
162  {
163  sumEven += IntegralOverEnergy(fMinEnergy,
165  varAngle1 + 2*i*h)
167  fMaxEnergy,
168  varAngle1 + 2*i*h);
169  sumOdd += IntegralOverEnergy(fMinEnergy,
170  fMinEnergy + 0.3*(fMaxEnergy - fMinEnergy),
171  varAngle1 + (2*i - 1)*h)
173  fMaxEnergy,
174  varAngle1 + (2*i - 1)*h) ;
175  }
176  sumOdd += IntegralOverEnergy(fMinEnergy,
177  fMinEnergy + 0.3*(fMaxEnergy - fMinEnergy),
178  varAngle1 + (2*fSympsonNumber - 1)*h)
180  fMaxEnergy,
181  varAngle1 + (2*fSympsonNumber - 1)*h) ;
182 
183  return h*(IntegralOverEnergy(fMinEnergy,
184  fMinEnergy + 0.3*(fMaxEnergy - fMinEnergy),
185  varAngle1)
187  fMaxEnergy,
188  varAngle1)
190  fMinEnergy + 0.3*(fMaxEnergy - fMinEnergy),
191  varAngle2)
193  fMaxEnergy,
194  varAngle2)
195  + 4.0*sumOdd + 2.0*sumEven )/3.0 ;
196 }
197 
199 //
200 // The number of transition radiation photons, generated in the
201 // energy interval between energy1 and energy2
202 //
203 
206  G4double energy2 ) const
207 {
208  G4int i ;
209  G4double h , sumEven = 0.0 , sumOdd = 0.0 ;
210  h = 0.5*(energy2 - energy1)/fSympsonNumber ;
211  for(i=1;i<fSympsonNumber;i++)
212  {
213  sumEven += IntegralOverAngle(energy1 + 2*i*h,0.0,0.01*fMaxTheta )
214  + IntegralOverAngle(energy1 + 2*i*h,0.01*fMaxTheta,fMaxTheta);
215  sumOdd += IntegralOverAngle(energy1 + (2*i - 1)*h,0.0,0.01*fMaxTheta)
216  + IntegralOverAngle(energy1 + (2*i - 1)*h,0.01*fMaxTheta,fMaxTheta) ;
217  }
218  sumOdd += IntegralOverAngle(energy1 + (2*fSympsonNumber - 1)*h,
219  0.0,0.01*fMaxTheta)
220  + IntegralOverAngle(energy1 + (2*fSympsonNumber - 1)*h,
221  0.01*fMaxTheta,fMaxTheta) ;
222 
223  return h*(IntegralOverAngle(energy1,0.0,0.01*fMaxTheta)
224  + IntegralOverAngle(energy1,0.01*fMaxTheta,fMaxTheta)
225  + IntegralOverAngle(energy2,0.0,0.01*fMaxTheta)
226  + IntegralOverAngle(energy2,0.01*fMaxTheta,fMaxTheta)
227  + 4.0*sumOdd + 2.0*sumEven )/3.0 ;
228 }
229 
230 // end of G4TransitionRadiation implementation file --------------------------