[1199] | 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 | // Unit test for Cherenkov models in media with random fluctuations |
---|
| 28 | // |
---|
| 29 | // 18.05.07 V. Grichine |
---|
| 30 | // |
---|
| 31 | // |
---|
| 32 | |
---|
| 33 | #include "G4ios.hh" |
---|
| 34 | #include <fstream> |
---|
| 35 | #include <cmath> |
---|
| 36 | #include "globals.hh" |
---|
| 37 | #include "Randomize.hh" |
---|
| 38 | #include "G4UnitsTable.hh" |
---|
| 39 | #include <iomanip> |
---|
| 40 | #include <complex> |
---|
| 41 | |
---|
| 42 | |
---|
| 43 | #include "G4Element.hh" |
---|
| 44 | #include "G4NistManager.hh" |
---|
| 45 | |
---|
| 46 | |
---|
| 47 | G4double epsilon = 1.2; // 1.05; |
---|
| 48 | |
---|
| 49 | G4double cof = (fine_structure_const/hbarc)*1.*eV; // *50.*0.9*0.3; |
---|
| 50 | |
---|
| 51 | // cof *= 50.*0.9*0.3; // T=0.9, Q=0.3, 1 eV of energy range |
---|
| 52 | |
---|
| 53 | using namespace std; |
---|
| 54 | |
---|
| 55 | |
---|
| 56 | /////////////////////////////////////////////////////////// |
---|
| 57 | // |
---|
| 58 | // CR spectrum in transparent medium with fluctuations |
---|
| 59 | |
---|
| 60 | G4double RandomSpectrum(G4double ratio, G4double x) |
---|
| 61 | { |
---|
| 62 | G4double result; |
---|
| 63 | G4double beta2 = x/(1+x); |
---|
| 64 | G4complex a = G4complex(epsilon*std::sqrt(1.-ratio*ratio)*beta2, ratio*epsilon*beta2); |
---|
| 65 | G4complex b = 1. - 1./a; |
---|
| 66 | G4complex ln = std::log(1./(1.-a)); |
---|
| 67 | G4complex bln = b*ln; |
---|
| 68 | |
---|
| 69 | result = imag(bln); |
---|
| 70 | result *= cof/pi; |
---|
| 71 | |
---|
| 72 | return result; |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | ///////////////////////////////////////////////////////////////////////// |
---|
| 76 | // |
---|
| 77 | // Tamm-Frank spectrum of transparent uniform medium |
---|
| 78 | |
---|
| 79 | G4double TammFrank(G4double x) |
---|
| 80 | { |
---|
| 81 | G4double result; |
---|
| 82 | G4double beta2 = x/(1+x); |
---|
| 83 | G4double a = epsilon*beta2; |
---|
| 84 | |
---|
| 85 | if( a < 1.) result = DBL_MIN; |
---|
| 86 | else result = cof*(1.-1./a); |
---|
| 87 | |
---|
| 88 | return result; |
---|
| 89 | } |
---|
| 90 | |
---|
| 91 | |
---|
| 92 | |
---|
| 93 | |
---|
| 94 | |
---|
| 95 | int main() |
---|
| 96 | { |
---|
| 97 | |
---|
| 98 | G4int i, iMax; |
---|
| 99 | |
---|
| 100 | std::ofstream writef("crspectrum.dat", std::ios::out ) ; |
---|
| 101 | writef.setf( std::ios::scientific, std::ios::floatfield ); |
---|
| 102 | |
---|
| 103 | G4double betagamma, bg2, r, momentum; // , picr, kcr; |
---|
| 104 | G4double tf, cr1, cr2, cr3, cr4; |
---|
| 105 | iMax = 100; // 150; |
---|
| 106 | |
---|
| 107 | writef<<iMax<<G4endl; |
---|
| 108 | |
---|
| 109 | for( i = 0; i < iMax; i++ ) |
---|
| 110 | { |
---|
| 111 | |
---|
| 112 | momentum = std::exp(i*0.1)*0.1*MeV; |
---|
| 113 | |
---|
| 114 | betagamma = momentum; // /139.57018*MeV; |
---|
| 115 | bg2 = betagamma*betagamma; |
---|
| 116 | |
---|
| 117 | r = 0.7; |
---|
| 118 | cr1 = RandomSpectrum(r,bg2); |
---|
| 119 | |
---|
| 120 | r = 0.1; |
---|
| 121 | cr2 = RandomSpectrum(r,bg2); |
---|
| 122 | |
---|
| 123 | // picr = RandomSpectrum(r,bg2); |
---|
| 124 | |
---|
| 125 | //betagamma = momentum/493.677*MeV; |
---|
| 126 | // bg2 = betagamma*betagamma; |
---|
| 127 | // kcr = RandomSpectrum(r,bg2); |
---|
| 128 | |
---|
| 129 | |
---|
| 130 | // r = 0.01; |
---|
| 131 | // cr3 = RandomSpectrum(r,bg2); |
---|
| 132 | |
---|
| 133 | r = 0.001; |
---|
| 134 | cr4 = RandomSpectrum(r,bg2); |
---|
| 135 | |
---|
| 136 | tf = TammFrank(bg2); |
---|
| 137 | |
---|
| 138 | // G4cout<<momentum<<"\t"<<picr<<"\t"<<kcr<<G4endl; |
---|
| 139 | // writef<<momentum<<"\t"<<picr<<"\t"<<kcr<<G4endl; |
---|
| 140 | |
---|
| 141 | G4cout<<momentum<<"\t"<<tf<<"\t"<<cr4<<"\t"<<cr2<<"\t"<<cr1<<G4endl; |
---|
| 142 | writef<<momentum<<"\t"<<tf<<"\t"<<cr4<<"\t"<<cr2<<"\t"<<cr1<<G4endl; |
---|
| 143 | |
---|
| 144 | |
---|
| 145 | } |
---|
| 146 | |
---|
| 147 | return 1; |
---|
| 148 | } // end of main |
---|