source: trunk/source/processes/electromagnetic/xrays/test/testCerenkovProx.cc @ 1354

Last change on this file since 1354 was 1199, checked in by garnier, 15 years ago

nvx fichiers dans CVS

File size: 6.2 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//
27//
28//
29// 
30//
31//  Test routine for cerenkov proximity geometry taking into account reflection
32//
33// History:
34//
35// 07.11.07, V. Grichine
36
37#include "G4ios.hh"
38#include <fstream>
39#include <cmath>
40#include "globals.hh"
41#include "Randomize.hh"
42#include "G4UnitsTable.hh"
43
44
45#include <iomanip>
46
47#include "G4Isotope.hh"
48#include "G4Element.hh"
49#include "G4Material.hh"
50#include "G4MaterialCutsCouple.hh"
51#include "G4Region.hh"
52#include "G4ProductionCuts.hh"
53#include "G4RegionStore.hh"
54#include "G4MaterialTable.hh"
55
56#include "G4Box.hh"
57#include "G4LogicalVolume.hh"
58
59#include "G4VXTRenergyLoss.hh"
60#include "G4RegularXTRadiator.hh"
61#include "G4TransparentRegXTRadiator.hh"
62#include "G4GammaXTRadiator.hh"
63#include "G4StrawTubeXTRadiator.hh"
64
65#include "G4XTRGammaRadModel.hh"
66#include "G4XTRRegularRadModel.hh"
67#include "G4XTRTransparentRegRadModel.hh"
68
69#include "G4SynchrotronRadiation.hh"
70#include "G4Cerenkov.hh"
71
72#include "G4ParticleDefinition.hh"
73#include "G4Proton.hh"
74
75//////////////////////////////////////////////////////////////////
76//
77// Return refractive index of C6F14 vs. photon energy in eV
78
79G4double GetRefractiveIndexA(G4double photonEnergy)
80{
81  G4double n;
82  G4double a = 1.177;
83  G4double b = 0.0172;
84  n          = a + b*photonEnergy;
85  return n;
86}
87
88//////////////////////////////////////////////////////////////////
89//
90// Return refractive index of quartz vs. photon energy in eV
91
92G4double GetRefractiveIndexB(G4double photonEnergy)
93{
94  G4double result, n2;
95
96  G4double E1 = 10.666;
97  G4double E2 = 18.125;
98  G4double F1 = 46.411;
99  G4double F2 = 228.71;
100  G4double E  = photonEnergy;
101
102  n2 = 1. + F1/( E1*E1 - E*E ) + F2/( E2*E2 - E*E );
103
104  result = std::sqrt(n2); 
105
106  return result;
107}
108
109///////////////////////////////////////////////////////////////////
110//
111// Photon emitted in B transported to C
112
113G4double TransmissionBC(G4double photonEnergy, G4double gamma)
114{
115  G4double beta, cosB, sinB, nB, thickB, cosC, sinC, tmp, rBC, result;
116
117  if( gamma < 1.) gamma = 1.;
118   
119  beta = std::sqrt(1 - 1/gamma/gamma);
120  nB   = GetRefractiveIndexB(photonEnergy);
121
122  cosB = 1./nB/beta;
123 
124  if( cosB > 1.) cosB = 1.;
125
126  sinB   = std::sqrt(1 - cosB*cosB);
127
128  thickB = 0.5;  // in cm
129
130  sinC   = nB*sinB;
131
132  if( sinC > 1.) sinC = 1.;
133
134  cosC   = std::sqrt(1 - sinC*sinC);
135
136  tmp = ( nB*cosB - cosC )/( nB*cosB + cosC );
137
138  rBC = tmp*tmp;
139
140  if(rBC > 1.)  rBC = 1.;
141
142
143  result = 369.77*thickB*2.;  // 2 eV of band
144
145  result *= sinB*sinB;
146
147  result *= 1. - rBC;
148
149  return result;
150}
151
152///////////////////////////////////////////////////////////////////
153//
154// Photon emitted in A transported to C
155
156G4double TransmissionABC(G4double photonEnergy, G4double gamma)
157{
158  G4double beta, cosA, sinA, cosB, sinB, nA, nB, thickA, cosC, sinC, tmp, rAB, rBC, result;
159
160  if( gamma < 1.) gamma = 1.;
161   
162  beta = std::sqrt(1 - 1/gamma/gamma);
163  nA   = GetRefractiveIndexA(photonEnergy);
164  nB   = GetRefractiveIndexB(photonEnergy);
165
166  cosA = 1./nA/beta;
167 
168  if( cosA > 1.) cosA = 1.;
169
170  sinA   = std::sqrt(1 - cosA*cosA);
171
172  thickA = 1.5;  // in cm
173
174  sinB = nA*sinA/nB; 
175
176  if( sinB > 1.) sinB = 1.;
177
178  cosB   = std::sqrt(1 - sinB*sinB);
179
180  tmp = ( nA*cosA - nB*cosB )/( nA*cosA + nB*cosB );
181
182  rAB = tmp*tmp;
183
184  if(rAB > 1.)  rAB = 1.;
185
186  sinC   = nB*sinB;
187
188  if( sinC > 1.) sinC = 1.;
189
190  cosC   = std::sqrt(1 - sinC*sinC);
191
192  tmp = ( nB*cosB - cosC )/( nB*cosB + cosC );
193
194  rBC = tmp*tmp;
195
196  if(rBC > 1.)  rBC = 1.;
197
198
199  result = 369.77*thickA*2.;  // 2 eV of band
200
201  result *= sinB*sinB;
202
203  result *= 1. - rAB;
204
205  result *= 1. - rBC;
206
207  return result;
208}
209
210
211int main()
212{
213  G4int i, iMax = 20;
214  G4double energy, refA, refB, gamma, numberBC, numberABC, beta, protonMass, protonMom;
215
216  /*
217  for(i=0;i<iMax;i++)
218  {
219    energy = 1. + i*8./iMax;
220    refA = GetRefractiveIndexA(energy);
221    refB = GetRefractiveIndexB(energy);
222    G4cout<<"photon energy = "<<energy<<" eV; C6F14 = "<<refA<<"; quartz = "<<refB<<G4endl; 
223  }
224  */
225
226  energy = 7.;
227  protonMass = 0.938; 
228
229
230  for(i=0;i<iMax;i++)
231  {
232    gamma = 1.1 + i*2./iMax;
233    beta = std::sqrt(1 - 1/gamma/gamma);
234    protonMom = protonMass*beta*gamma;
235    numberBC = TransmissionBC(energy, gamma);
236    // G4cout<<"gamma = "<<gamma<<"; numberBC = "<<number<<G4endl; 
237    G4cout<<"protonMom = "<<protonMom<<"; numberBC = "<<numberBC<<G4endl; 
238  }
239
240  for(i=0;i<iMax;i++)
241  {
242    gamma = 1.1 + i*2./iMax;
243    beta = std::sqrt(1 - 1/gamma/gamma);
244    protonMom = protonMass*beta*gamma;
245    numberABC = TransmissionABC(energy, gamma);
246    numberBC = TransmissionBC(energy, gamma);
247    // G4cout<<"gamma = "<<gamma<<"; number = "<<number<<G4endl; 
248    G4cout<<"protonMom = "<<protonMom<<"; numberBC = "<<numberBC<<"; numberABC = "<<numberABC<<G4endl; 
249  }
250
251
252
253
254  return 1 ;
255}
256
Note: See TracBrowser for help on using the repository browser.