source: trunk/source/processes/electromagnetic/xrays/test/testCerenkovCrystalPWO.cc

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

nvx fichiers dans CVS

File size: 9.7 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 "G4RandomDirection.hh"
43#include "G4UnitsTable.hh"
44#include "G4Timer.hh"
45
46
47#include <iomanip>
48
49#include "G4Isotope.hh"
50#include "G4Element.hh"
51#include "G4Material.hh"
52#include "G4MaterialCutsCouple.hh"
53#include "G4Region.hh"
54#include "G4ProductionCuts.hh"
55#include "G4RegionStore.hh"
56#include "G4MaterialTable.hh"
57
58#include "G4Box.hh"
59#include "G4LogicalVolume.hh"
60
61#include "G4Cerenkov.hh"
62
63#include "G4ParticleDefinition.hh"
64#include "G4Proton.hh"
65
66
67int main()
68{
69  G4int i, iMax = 20;  // , k, kMax;
70
71  // G4double energy, refA, refB, gamma, numberBC, numberABC, beta, protonMass, protonMom;
72
73  std::ofstream writef("PbWO4.dat", std::ios::out ) ;
74  writef.setf( std::ios::scientific, std::ios::floatfield );
75
76  /*
77 
78
79  // Arrays of CMS crystal dimensions, table 3.2 from ECAL TDR
80
81  G4double cmsAF[17] = { 21.83, 21.83, 21.83, 21.83, 21.83,
82                         21.83, 21.83, 21.83, 21.83,
83                         21.83, 21.83, 21.83, 21.83,
84                         21.83, 21.83, 21.83, 21.83         };
85
86  G4double cmsBF[17] = { 23.59, 22.22, 22.34, 22.47, 22.61,
87                         22.60, 22.55, 22.67, 22.82,
88                         23.08, 23.14, 23.29, 23.47,
89                         23.71, 23.88, 24.06, 24.29         };
90
91  G4double cmsCF[17] = { 21.85, 21.87, 21.91, 21.94, 21.97,
92                         22.00, 22.03, 22.05, 22.08,
93                         22.10, 22.12, 22.14, 22.15,
94                         22.17, 22.18, 22.20, 22.21         };
95
96
97  G4double cmsAR[17] = { 25.84, 25.81, 25.75, 25.67, 25.56,
98                         25.43, 25.29, 25.14, 24.98,
99                         24.82, 24.65, 24.49, 24.33,
100                         24.17, 24.02, 23.88, 23.74         };
101
102  G4double cmsBR[17] = { 25.48, 26.22, 26.28, 26.32, 26.34,
103                         26.18, 25.96, 25.92, 25.90,
104                         26.00, 25.89, 25.86, 25.87,
105                         25.95, 25.96, 25.99, 26.07         };
106
107  G4double cmsCR[17] = { 25.86, 25.86, 25.84, 25.80, 25.72,
108                         25.63, 25.52, 25.39, 25.26,
109                         25.12, 24.97, 24.83, 24.68,
110                         24.54, 24.40, 24.27, 24.15         };
111
112  iMax = 17;
113
114  G4double meanAF = 0.,  meanBF = 0.,  meanCF = 0., 
115           meanAR = 0.,  meanBR = 0.,  meanCR = 0.;
116 
117  for(i=0;i<iMax;i++)
118  {
119    meanAF += cmsAF[i];
120    meanBF += cmsBF[i];
121    meanCF += cmsCF[i];
122    meanAR += cmsAR[i];
123    meanBR += cmsBR[i];
124    meanCR += cmsCR[i];
125  }
126  meanAF /= iMax;
127  meanCF /= iMax;
128  meanBF /= iMax;
129  meanAR /= iMax;
130  meanBR /= iMax;
131  meanCR /= iMax;
132
133  G4double meanBFR  = 0.5*(meanBF + meanBR);
134  G4double meanAFR  = 0.5*(meanAF + meanAR);
135  G4double meanCFR  = 0.5*(meanCF + meanCR);
136  G4double meanACFR = 0.5*(meanCFR + meanAFR);
137
138  G4cout <<"meanAF = " << meanAF << "; meanBF = "<<meanBF << "; meanCF = " << meanCF << G4endl;
139
140  G4cout << "meanAR = " << meanAR << "; meanBR = "<<meanBR << "; meanCR = "<<meanCR << G4endl;
141
142  G4cout << "meanACFR = " << meanACFR << "; meanBFR = "<<meanBFR << G4endl;
143
144  */
145
146  G4double lambda[14] = { 375., 400., 425., 450., 475., 
147                          500., 525., 550., 575., 600., 
148                          625., 650., 675., 700.               };
149
150  G4double omega, photonEnergy[14], meanRefInd[14], isoRefInd[14], ratio, ratio2, cofInd, pmsqrt, 
151           isoratio, isolog;
152
153  iMax = 14;
154
155  for( i = 0; i < iMax; i++ ) lambda[i] *= nanometer;
156
157  for( i = 0; i < iMax; i++ )
158  {
159    omega = 2*pi*hbarc/lambda[i];
160    photonEnergy[i] = omega;
161    G4cout<<lambda[i]/nanometer<<" nm;      "<<omega/eV<<" eV"<<G4endl;
162  }
163
164
165  G4double ordinaryRefInd[14] =  { 2.452, 2.393, 2.353, 2.323, 2.301,
166                                   2.284, 2.270, 2.259, 2.250, 2.242, 
167                                   2.236, 2.230, 2.226, 2.221              };
168
169
170  G4double extraordinaryRefInd[14] =  { 2.297, 2.260, 2.236, 2.218, 2.205, 
171                                        2.194, 2.186, 2.178, 2.173, 2.169,
172                                        2.164, 2.161, 2.158, 2.156            };
173
174  G4double fastSpectrum[14] =  { 37., 84., 117., 121., 102., 
175                                        72., 46., 23., 9., 0.,
176                                        0., 0., 0., 0.        };
177
178  // in mm from plot
179
180  G4double alphaCof[14] =  { 42, 34, 34, 27, 20, 
181                             15, 13, 11, 10, 10, 
182                             10, 10, 10, 10           };
183
184
185  G4cout<<G4endl;
186
187  for( i = 0; i < iMax; i++ )
188  {
189    ratio  = ordinaryRefInd[i]/extraordinaryRefInd[i];
190    pmsqrt = std::sqrt( (ordinaryRefInd[i]-extraordinaryRefInd[i])* 
191                        (ordinaryRefInd[i]+extraordinaryRefInd[i]) );
192    ratio2 = ratio*ratio;
193    cofInd = std::sqrt( ratio2 - 1. );
194    meanRefInd[i] = std::asin(cofInd/ratio)*ordinaryRefInd[i]/cofInd;
195
196    isolog = std::log( ratio + pmsqrt/extraordinaryRefInd[i] ); 
197    isoratio = ordinaryRefInd[i]*pmsqrt/isolog;
198    isoRefInd[i] = std::sqrt(isoratio);
199    G4cout << lambda[i]/nanometer<<" nm; " << photonEnergy[i]/eV << " eV"
200           << "\t"<< ordinaryRefInd[i]<< "\t"<< meanRefInd[i]<<"\t" 
201           << isoRefInd[i]<<"\t" << extraordinaryRefInd[i] << G4endl;
202
203    writef
204      // <<lambda[i]/nanometer<<" * nanometer      "<<photonEnergy[i]/eV<<" * eV"
205          <<"\t"<<ordinaryRefInd[i]<< "\t"<< meanRefInd[i]<<"\t"
206          << isoRefInd[i]<<"\t" <<extraordinaryRefInd[i]<<G4endl;
207  }
208  G4cout<<G4endl;
209
210  for( i = iMax - 1; i >= 0; i-- )
211  {
212    G4cout << photonEnergy[i]/eV << "*eV, " ; // << G4endl;
213  }
214
215  G4cout<<G4endl;
216
217  for( i = iMax - 1; i >= 0; i-- )
218  {
219    G4cout << isoRefInd[i]  << ", " ; // << G4endl;
220  }
221  G4cout<<G4endl;
222
223  for( i = iMax - 1; i >= 0; i-- )
224  {
225    G4cout << fastSpectrum[i]  << ", " ; // << G4endl;
226  }
227  G4cout<<G4endl;
228
229  G4double aCof, absLength;
230
231  for( i = iMax - 1; i >= 0; i-- )
232  {
233    aCof = alphaCof[i]*0.025/166.5;
234
235    absLength = 1/aCof;
236
237    G4cout << absLength  << "*cm, " ; // << G4endl;
238  }
239  G4cout<<G4endl;
240
241  /*
242
243  G4double aE, bE, delta, sinT, cosT, sinP, BA, B, D, theta, phi, beta2;
244  G4double  det2, det, y1, y2, y3, y4, b2pm, b2re;
245   
246  iMax = 10;
247  kMax = 12;
248
249  // ref. index values for
250
251  aE    = 2.323*2.323;
252  bE    = 2.218*2.218;
253  delta = bE - aE;
254  beta2 = 0.195;   // 0.194; // 1.;
255  G4cout<<"1/aE ="<<1/aE<<"\t"<<"1/bE ="<<1/bE<<G4endl<<G4endl;
256  writef<<"1/aE ="<<1/aE<<"\t"<<"1/bE ="<<1/bE<<G4endl<<G4endl;
257  G4cout<<"beta = "<<std::sqrt(beta2)<<"\t"<<"beta2 = "<<beta2<<G4endl<<G4endl;
258  writef<<"beta = "<<std::sqrt(beta2)<<"\t"<<"beta2 = "<<beta2<<G4endl<<G4endl;
259
260  for( i = 0; i <= iMax; i++)
261  {
262    theta = i*90*degree/iMax;
263    cosT  = std::cos(theta);
264    sinT  = std::sin(theta);
265
266    b2pm  = cosT*cosT/aE + sinT*sinT/bE;
267
268    G4cout<<"theta = "<<theta/degree<<" degrees"<<";    b2pm = "<<b2pm<<G4endl<<G4endl;
269    writef<<"theta = "<<theta/degree<<" degrees"<<";    b2pm = "<<b2pm<<G4endl<<G4endl;
270
271G4cout<<"phi "<<"\t"<<"y1    "<<"\t"<<"y2    "<<"\t"<<"b2re   "<<"\t"<<"b2pm-b2re  "<<G4endl<<G4endl;
272writef<<"phi "<<"\t"<<"y1    "<<"\t"<<"y2    "<<"\t"<<"b2re   "<<"\t"<<"b2pm-b2re  "<<G4endl<<G4endl;
273
274
275    for( k = 0; k <= kMax; k++)
276    {
277      phi = k*360*degree/kMax;
278      sinP = std::sin(phi);
279     
280      B    =  delta*sinT*sinT*sinP*sinP + aE;
281      BA   =  delta*cosT*cosT + aE*(1 - bE*beta2);
282      D    = -delta*cosT*sinT*sinP;
283      det2 =  D*D - B*BA;
284      b2re =  ( 1 + delta*cosT*cosT/B )/bE;
285
286      if( det2 < 0.)
287      {
288        G4cout<<phi/degree<<"\t"<<"no y1   "<<"\t"<<"no y2   "<<"\t"<<b2re<<"\t"<<b2pm-b2re<<G4endl;
289        writef<<phi/degree<<"\t"<<"no y1   "<<"\t"<<"no y2   "<<"\t"<<b2re<<"\t"<<b2pm-b2re<<G4endl;
290      }
291      else
292      {
293        det = std::sqrt(det2);
294        y1  = (-D + det)/B;
295        y2  = (-D - det)/B;
296        // y3  = (D + det)/B;
297        // y4  = (D - det)/B;
298        G4cout<<phi/degree<<"\t"<<y1<<"\t"<<y2<<"\t"<<b2re<<"\t"<<b2pm-b2re<<G4endl;
299        writef<<phi/degree<<"\t"<<y1<<"\t"<<y2<<"\t"<<b2re<<"\t"<<b2pm-b2re<<G4endl;
300      }
301    }   
302    G4cout<<"aE/bE = "<<aE/bE<<G4endl;
303    writef<<G4endl;
304  }
305
306  */
307
308
309
310
311  return 1 ;
312}
313
Note: See TracBrowser for help on using the repository browser.