Changeset 1363 for trunk/WuerzburgSoft/Thomas/mphys/MElectron.cc
- Timestamp:
- 06/13/02 16:36:19 (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WuerzburgSoft/Thomas/mphys/MElectron.cc
r1358 r1363 49 49 // constants moved out of function 50 50 // 51 Double_t E = x[0]; // [GeV]52 Double_t z = k ? k[0] : 0;53 54 Double_t T = 2.96*(z+1); // [K]55 Double_t e = 1.602176462e-19; // [C]56 Double_t kB = 1e-9/e*1.3806503e-23; // [GeV/K]57 58 Double_t EkT = E/kB/T;51 const Double_t E = x[0]; // [GeV] 52 const Double_t z = k ? k[0] : 0; 53 54 const Double_t T = 2.96*(z+1); // [K] 55 const Double_t e = 1.602176462e-19; // [C] 56 const Double_t kB = 1e-9/e*1.3806503e-23; // [GeV/K] 57 58 const Double_t EkT = E/kB/T; 59 59 60 60 /* … … 71 71 Double_t MElectron::Li(Double_t *x, Double_t *k) 72 72 { 73 Double_t t = x[0];73 const Double_t t = x[0]; 74 74 75 75 return log(1.-t)/t; … … 84 84 85 85 TF1 IntLi("Li", Li, 0, z, 0); 86 Double_t integ = IntLi.Integral(0, z);86 const Double_t integ = IntLi.Integral(0, z); 87 87 88 88 /* … … 105 105 Double_t MElectron::Flim(Double_t *x, Double_t *k=NULL) // F(omegap)-F(omegam) mit b-->1 (Maple) 106 106 { 107 Double_t w = x[0];108 109 Double_t w4 = w*4;110 Double_t wsqr = w*w;111 112 Double_t u1 = (w*wsqr*16 + wsqr*40 + w*17 + 2)*log(w4 + 1);113 Double_t u2 = -w4*(wsqr*2 + w*9 + 2);114 Double_t d = w4*(w4 + 1);107 const Double_t w = x[0]; 108 109 const Double_t w4 = w*4; 110 const Double_t wsqr = w*w; 111 112 const Double_t u1 = (w*wsqr*16 + wsqr*40 + w*17 + 2)*log(w4 + 1); 113 const Double_t u2 = -w4*(wsqr*2 + w*9 + 2); 114 const Double_t d = w4*(w4 + 1); 115 115 116 116 Double_t s = -w*2*(1+1); // -2*omega*(1+beta) 117 Double_t li2 = Li2(&s);118 119 Double_t res = (u1+u2)/d + li2;117 const Double_t li2 = Li2(&s); 118 119 const Double_t res = (u1+u2)/d + li2; 120 120 121 121 return res; //<1e-10? 0 : res; … … 124 124 Double_t MElectron::Compton(Double_t *x, Double_t *k) 125 125 { 126 Double_t E0 = 511e-6; //[GeV]127 Double_t E02 = E0*E0;126 const Double_t E0 = 511e-6; //[GeV] 127 const Double_t E02 = E0*E0; 128 128 129 129 Double_t epsilon = x[0]; … … 134 134 Double_t omega = epsilon*E/E02; 135 135 136 Double_t n = Planck(&epsilon, &z)/epsilon/epsilon; // [1]136 const Double_t n = Planck(&epsilon, &z)/epsilon/epsilon; // [1] 137 137 return Flim(&omega)*n; 138 138 } … … 160 160 // F(o-)~F(0) = 14/8 = 1.75 161 161 162 Double_t E0 = 511e-6; // [GeV]163 Double_t E02 = E0*E0; // [GeV^2]164 Double_t c = 299792458; // [m/s]165 Double_t e = 1.602176462e-19; // [C]166 Double_t h = 1e-9/e*6.62606876e-34; // [GeVs]167 Double_t hc = h*c; // [GeVm]168 Double_t alpha = 1./137.; // [1]169 170 Double_t z = k ? k[0] : 0;162 const Double_t E0 = 511e-6; // [GeV] 163 const Double_t E02 = E0*E0; // [GeV^2] 164 const Double_t c = 299792458; // [m/s] 165 const Double_t e = 1.602176462e-19; // [C] 166 const Double_t h = 1e-9/e*6.62606876e-34; // [GeVs] 167 const Double_t hc = h*c; // [GeVm] 168 const Double_t alpha = 1./137.; // [1] 169 170 const Double_t z = k ? k[0] : 0; 171 171 172 172 // Double_t beta = sqrt(1-E0/E*E0/E); 173 Double_t beta = 1; //0.999999999999999999999999999;173 const Double_t beta = 1; //0.999999999999999999999999999; 174 174 175 175 Double_t val[3] = { E[0], beta, z }; // E[GeV] 176 176 177 Double_t from = 1e-17;178 Double_t to = 1e-11;177 const Double_t from = 1e-17; 178 const Double_t to = 1e-11; 179 179 180 180 /* -------------- old ---------------- … … 186 186 TF1 func("Compton", Compton, from, to, 3); // [0, inf] 187 187 188 Double_t integ = func.Integral(from, to, val, 1e-15); // [Gev] [0, inf]189 190 Double_t aE = alpha/E[0]; // [1/GeV]191 192 Double_t konst = 2.*E02/hc/beta; // [1 / GeV m]193 Double_t ret = konst * (aE*aE) * integ; // [1 / m]194 195 Double_t ly = 3600.*24.*365.*c; // [m/ly]196 Double_t pc = 1./3.258; // [pc/ly]188 const Double_t integ = func.Integral(from, to, val, 1e-15); // [Gev] [0, inf] 189 190 const Double_t aE = alpha/E[0]; // [1/GeV] 191 192 const Double_t konst = 2.*E02/hc/beta; // [1 / GeV m] 193 const Double_t ret = konst * (aE*aE) * integ; // [1 / m] 194 195 const Double_t ly = 3600.*24.*365.*c; // [m/ly] 196 const Double_t pc = 1./3.258; // [pc/ly] 197 197 198 198 return (1./ret)/ly*pc/1000; // [kpc] … … 214 214 { 215 215 Double_t e = pow(10, x[0]); 216 Double_t E = k[0];217 216 Double_t z = k[1]; 218 217 219 Double_t E0 = 511e-6; //[GeV] 220 Double_t E02 = E0*E0; 218 const Double_t E = k[0]; 219 220 const Double_t E0 = 511e-6; //[GeV] 221 const Double_t E02 = E0*E0; 221 222 222 223 Double_t omega = e*E/E02; 223 224 224 Double_t n = Planck(&e, &z);225 226 Double_t F = Flim(&omega)/omega/omega;225 const Double_t n = Planck(&e, &z); 226 227 const Double_t F = Flim(&omega)/omega/omega; 227 228 228 229 return n*F*1e26; … … 231 232 Double_t MElectron::G_q(Double_t *x, Double_t *k) 232 233 { 233 Double_t q = x[0];234 Double_t Gamma = k[0];235 236 Double_t Gq = Gamma*q;237 238 Double_t s1 = 2.*q*log(q);239 Double_t s2 = (1.+2.*q);240 Double_t s3 = (Gq*Gq)/(1.+Gq)/2.;234 const Double_t q = x[0]; 235 const Double_t Gamma = k[0]; 236 237 const Double_t Gq = Gamma*q; 238 239 const Double_t s1 = 2.*q*log(q); 240 const Double_t s2 = (1.+2.*q); 241 const Double_t s3 = (Gq*Gq)/(1.+Gq)/2.; 241 242 242 243 return s1+(s2+s3)*(1.-q); … … 246 247 Double_t MElectron::EnergyLoss(Double_t *x, Double_t *k, Double_t *ep) 247 248 { 248 Double_t E = x[0];249 Double_t z = k ? k[0] : 0;250 251 Double_t E0 = 511e-6; //[GeV]252 253 Double_t lolim = -log10(E)/7*4-13;249 const Double_t E = x[0]; 250 const Double_t z = k ? k[0] : 0; 251 252 const Double_t E0 = 511e-6; //[GeV] 253 254 const Double_t lolim = -log10(E)/7*4-13; 254 255 255 256 TF1 fP("p_e", p_e, lolim, -10.8, 2); … … 259 260 fP.SetParameter(1, z); 260 261 261 Double_t e = pow(10, fP.GetRandom());262 const Double_t e = pow(10, fP.GetRandom()); 262 263 263 264 if (ep) 264 265 *ep = e; 265 266 266 Double_t omega = e*E/E0/E0;267 Double_t Gamma = 4.*omega;267 const Double_t omega = e*E/E0/E0; 268 const Double_t Gamma = 4.*omega; 268 269 269 270 // --old-- fQ.SetRange(1e-6, 1./(1.+ 2.*Gamma)); 270 271 fQ.SetParameter(0, Gamma); 271 272 272 Double_t q = fQ.GetRandom();273 Double_t Gq = Gamma*q;274 275 Double_t e1 = Gq*E/(1.+Gq);273 const Double_t q = fQ.GetRandom(); 274 const Double_t Gq = Gamma*q; 275 276 const Double_t e1 = Gq*E/(1.+Gq); 276 277 277 278 return e1; … … 292 293 static TRandom rand(0); 293 294 294 Double_t E0 = 511e-6; //[GeV]295 const Double_t E0 = 511e-6; //[GeV] 295 296 296 297 Double_t epsilon; 297 Double_t e = GetEnergyLoss(&epsilon);298 const Double_t e = GetEnergyLoss(&epsilon); 298 299 299 300 // er: photon energy before interaction, rest frame 300 301 // e: photon energy after interaction, lab 301 302 302 Double_t gamma = fEnergy/E0; 303 Double_t beta = sqrt(1.-1./(gamma*gamma)); 304 //Double_t gammabeta = sqrt(gamma*gamma-1); 305 306 Double_t f = fEnergy/e; 307 308 Double_t t; 303 const Double_t gamma = fEnergy/E0; 304 const Double_t beta = sqrt(1.-1./(gamma*gamma)); 305 306 const Double_t f = fEnergy/e; 307 308 Double_t t=-1; 309 309 Double_t arg; 310 310 do 311 311 { 312 t = rand.Uniform(TMath::Pi()*2); 312 if (t>0) 313 cout << "~" << flush; 314 t = rand.Uniform(TMath::Pi()/2)+TMath::Pi()*3/4; 313 315 Double_t er = gamma*epsilon*(1.-beta*cos(t)); // photon energy rest frame 314 316 arg = (f - E0/er - 1)/(f*beta+1); 315 cout << "~" << flush;316 317 317 318 } while (arg<-1 || arg>1); 318 319 319 Double_t theta1s = acos(arg); 320 Double_t thetas = atan(sin(t)/(gamma*(cos(t)-beta))); 321 322 Double_t thetastar = thetas-theta1s; 323 324 Double_t theta1 = atan(sin(thetastar)/(gamma*(cos(thetastar)+beta))); 325 326 /* 327 cout << "(" << theta1/TMath::Pi()*180 << ","; 328 cout << theta1s/TMath::Pi()*180<< ","; 329 cout << arg << ")" << flush; 330 */ 320 const Double_t theta1s = acos(arg); 321 const Double_t thetas = atan(sin(t)/(gamma*(cos(t)-beta))); 322 323 const Double_t thetastar = thetas-theta1s; 324 325 const Double_t theta1 = atan(sin(thetastar)/(gamma*(cos(thetastar)+beta))); 331 326 332 327 fEnergy -= e; … … 335 330 p = *this; 336 331 p.SetNewDirection(theta1, rand.Uniform(TMath::Pi()*2)); 337 338 // MISSING: Electron angle339 //340 // E1 = fEnergy (after!)341 //342 // sin(t) = (epsilon sin(theta) - e sin(atan(tg)))/sqrt(E1*E1-E0*E0)343 332 344 333 return &p;
Note:
See TracChangeset
for help on using the changeset viewer.