- Timestamp:
- 06/12/02 09:35:01 (22 years ago)
- Location:
- trunk/WuerzburgSoft/Thomas/mphys
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WuerzburgSoft/Thomas/mphys/Changelog
r1352 r1356 1 1 -*-*- END -*-*- 2 2002/06/12: Thomas Bretz 3 4 * MElectron.[h,cc]: 5 - added a primitive theta dependancy to DoInvCompton 6 - added DrawInteractionLength 7 8 * MParticle.[h,cc]: 9 - added RofZ and ZofR as static functions 10 11 * MPhoton.[h,cc]: 12 - added DrawInteractionLength 13 - fixed the bug causing the 'strange factor': sigma_gg needs 14 the sqrt of s. 15 16 * energyloss.C: 17 - added 18 19 20 2 21 2002/06/10: Thomas Bretz 3 22 -
trunk/WuerzburgSoft/Thomas/mphys/MElectron.cc
r1352 r1356 33 33 34 34 #include <TF1.h> 35 #include <TH1.h> 36 #include <TPad.h> 37 #include <TCanvas.h> 38 #include <TRandom.h> 35 39 36 40 #include "MPhoton.h" … … 286 290 #include <iostream.h> 287 291 288 MPhoton *MElectron::DoInvCompton() 289 { 292 MPhoton *MElectron::DoInvCompton(Double_t theta) 293 { 294 static TRandom rand(0); 295 290 296 Double_t E0 = 511e-6; //[GeV] 291 297 292 298 Double_t epsilon; 293 299 Double_t e = GetEnergyLoss(&epsilon); 300 301 // er: photon energy before interaction, rest frame 302 // e: photon energy after interaction, lab 303 304 Double_t gamma = fEnergy/E0; 305 Double_t beta = sqrt(1.-1./(gamma*gamma)); 306 //Double_t gammabeta = sqrt(gamma*gamma-1); 307 308 Double_t f = fEnergy/e; 309 310 Double_t t; 311 Double_t arg; 312 do 313 { 314 t = rand.Uniform(TMath::Pi()*2); 315 Double_t er = gamma*epsilon*(1.-beta*cos(t)); // photon energy rest frame 316 arg = (f - E0/er - 1)/(f*beta+1); 317 cout << "~" << flush; 318 319 } while (arg<-1 || arg>1); 320 321 Double_t theta1s = acos(arg); 322 Double_t thetas = atan(sin(t)/(gamma*(cos(t)-beta))); 323 324 Double_t thetastar = thetas-theta1s; 325 326 Double_t theta1 = atan(sin(thetastar)/(gamma*(cos(thetastar)+beta))); 327 294 328 /* 295 Double_t gamma = fEnergy/E0; 296 Double_t beta = sqrt(1-1/(gamma*gamma)); 297 Double_t bega = sqrt(gamma*gamma-1); 298 299 Double_t theta = TMath::Pi()/4; 300 301 // er: photon energy before interaction rest frame 302 // e: photon energy after interaction lab 303 Double_t er = gamma*epsilon*(1-beta*cos(theta)); // photon energy rest frame 304 Double_t r1 = fEnergy/e; 305 Double_t r2 = E0/er; 306 Double_t ctheta = (r1-r2-1)/(beta*r1-1); 307 Double_t tg = sqrt(1-ctheta*ctheta)/gamma/(beta+ctheta); 308 */ 329 cout << "(" << theta1/TMath::Pi()*180 << ","; 330 cout << theta1s/TMath::Pi()*180<< ","; 331 cout << arg << ")" << flush; 332 */ 333 309 334 fEnergy -= e; 310 335 311 336 MPhoton &p = *new MPhoton(e, fZ); 312 337 p = *this; 313 314 /* 315 cout << "(" << atan(tg)*180/TMath::Pi() << ")" << flush; 316 317 static TRandom rand(0); 318 p->SetNewDirection(atan(tg), rand.Uniform(TMath::Pi()*2)); 319 */ 338 p.SetNewDirection(theta1, rand.Uniform(TMath::Pi()*2)); 320 339 321 340 // MISSING: Electron angle … … 327 346 return &p; 328 347 } 348 349 void MElectron::DrawInteractionLength(Double_t z) 350 { 351 if (!gPad) 352 new TCanvas("IL_Electron", "Mean Interaction Length Electron"); 353 else 354 gPad->GetVirtCanvas()->cd(3); 355 356 TF1 f2("length", MElectron::InteractionLength, 1e3, 1e10, 0); 357 f2.SetParameter(0, z); 358 359 gPad->SetLogx(); 360 gPad->SetLogy(); 361 gPad->SetGrid(); 362 f2.SetLineWidth(1); 363 364 TH1 &h=*f2.DrawCopy()->GetHistogram(); 365 366 h.SetTitle("Mean Interaction Length (Electron)"); 367 h.SetXTitle("E [GeV]"); 368 h.SetYTitle("x [kpc]"); 369 370 gPad->Modified(); 371 gPad->Update(); 372 } 373 374 void MElectron::DrawInteractionLength() const 375 { 376 DrawInteractionLength(fZ); 377 } -
trunk/WuerzburgSoft/Thomas/mphys/MElectron.h
r1352 r1356 40 40 Double_t GetEnergyLoss(Double_t *ep) const; 41 41 42 MPhoton *DoInvCompton(); 42 MPhoton *DoInvCompton(Double_t theta); 43 44 // ---------------------------------------------------------------- 45 46 static void DrawInteractionLength(Double_t z); 47 void DrawInteractionLength() const; 43 48 44 49 ClassDef(MElectron, 1) -
trunk/WuerzburgSoft/Thomas/mphys/MParticle.cc
r1352 r1356 25 25 */ 26 26 27 Double_t ZofR(Double_t *x, Double_t *k=NULL)27 Double_t MParticle::ZofR(Double_t *x, Double_t *k) 28 28 { 29 29 const Double_t c = 299792458; // [m/s] … … 39 39 } 40 40 41 Double_t RofZ(Double_t *x, Double_t *k=NULL)41 Double_t MParticle::RofZ(Double_t *x, Double_t *k) 42 42 { 43 43 Double_t z1 = x[0] + 1; -
trunk/WuerzburgSoft/Thomas/mphys/MParticle.h
r1352 r1356 16 16 protected: 17 17 Double_t fEnergy; // [GeV] Energy 18 Double_t fBeta; // [1] beta18 // Double_t fBeta; // [1] beta 19 19 20 20 Double_t fZ; // [1] Red shift … … 38 38 } 39 39 40 static Double_t MParticle::ZofR(Double_t *x, Double_t *k=NULL); 41 static Double_t MParticle::RofZ(Double_t *x, Double_t *k=NULL); 42 40 43 // void Fill(const MParContainer *inp); 41 44 … … 44 47 45 48 void SetEnergy(Double_t e) { fEnergy = e; } 46 void SetBeta(Double_t b) { fBeta = b; }49 // void SetBeta(Double_t b) { fBeta = b; } 47 50 48 51 void SetZ(Double_t z) { fZ = z; } -
trunk/WuerzburgSoft/Thomas/mphys/MPhoton.cc
r1349 r1356 33 33 34 34 #include <TF1.h> 35 #include <TH1.h> 36 #include <TPad.h> 37 #include <TCanvas.h> 35 38 36 39 ClassImp(MPhoton); … … 43 46 // constants moved out of function, see below 44 47 // 45 Double_t E = x[0]; // [GeV]46 Double_t z = k ? k[0] : 0;47 48 Double_t T = 2.96*(z+1); // [K]49 Double_t e = 1.602176462e-19; // [C]50 Double_t kB = 1e-9/e*1.3806503e-23; // [GeV/K]51 52 Double_t EkT = E/kB/T;48 const Double_t E = x[0]; // [GeV] 49 const Double_t z = k ? k[0] : 0; 50 51 const Double_t T = 2.96*(z+1); // [K] 52 const Double_t e = 1.602176462e-19; // [C] 53 const Double_t kB = 1e-9/e*1.3806503e-23; // [GeV/K] 54 55 const Double_t EkT = E/kB/T; 53 56 54 57 /* … … 66 69 Double_t MPhoton::Sigma_gg(Double_t *x, Double_t *k=NULL) 67 70 { 68 Double_t s = x[0]; // omega: CM mass 69 70 Double_t E0 = 511e-6; // [GeV] 71 Double_t r0 = 2.81794092e-15; // [m] = e^2/4/pi/m/eps0/c^2 72 73 Double_t m = E0/s; 74 75 Double_t m2 = m*m; 76 Double_t beta = sqrt(1.-m2); 77 Double_t beta2 = 1.-m2; 78 79 Double_t p1 = r0*r0*TMath::Pi()/2; 80 81 // ----- Extreme Relativistic ----- 71 const Double_t m2 = x[0]; // m2: (E0/sqrt(s))^2 72 73 const Double_t r0 = 2.81794092e-15; // [m] = e^2/4/pi/m/eps0/c^2 74 75 const Double_t beta2 = 1.-m2; 76 const Double_t beta = sqrt(beta2); 77 78 const Double_t p1 = r0*r0*TMath::Pi()/2; 79 80 // ----- Extreme Relativistic ------- 82 81 // return p1*2 * m*m*m* (log(2./m)-1); 83 // -------------------------------- 84 85 Double_t p2 = m2; 86 Double_t p3 = 3.-beta2*beta2; 87 Double_t p4 = log((1.+beta)/(1.-beta)); 88 Double_t p5 = beta*2*(1.+m2); 89 90 Double_t sigma = p1*p2*(p3*p4-p5); // [m^2] 82 // ---------------------------------- 83 84 const Double_t p2 = 3.-beta2*beta2; 85 const Double_t p3 = log((1.+beta)/(1.-beta)); 86 const Double_t p4 = beta*2*(1.+m2); 87 88 const Double_t sigma = p1*m2*(p2*p3-p4); // [m^2] 91 89 92 90 return sigma; … … 95 93 Double_t MPhoton::Int1(Double_t *x, Double_t *k=NULL) 96 94 { 97 Double_t costheta = x[0]; 98 99 Double_t Eg = k[0]; 100 Double_t Ep = k[1]; 101 102 Double_t E0 = 511e-6; // [GeV] 103 104 Double_t s = Eg*Ep/E0*(1.-costheta)*2; 105 106 if (s<E0) // Why is this necessary??? 95 const Double_t costheta = x[0]; 96 97 const Double_t Eg = k[0]; 98 const Double_t Ep = k[1]; 99 100 const Double_t E0 = 511e-6; // [GeV] 101 102 Double_t s = E0/Eg*E0/Ep/(1.-costheta)/2; 103 if (s>1) // Why is this necessary??? 107 104 return 0; 108 105 109 Double_t sigma = Sigma_gg(&s); // [m^2]106 const Double_t sigma = Sigma_gg(&s); // [m^2] 110 107 111 108 return sigma/2 * (1.-costheta); // [m^2] … … 114 111 Double_t MPhoton::Int2(Double_t *x, Double_t *k) 115 112 { 116 Double_t E0 = 511e-6; // [GeV]113 const Double_t E0 = 511e-6; // [GeV] 117 114 118 115 Double_t Ep = x[0]; 119 Double_t Eg = k[0];120 121 116 Double_t z = k[1]; 122 117 118 const Double_t Eg = k[0]; 119 123 120 Double_t val[2] = { Eg, Ep }; 124 121 125 Double_t from = -1.0;126 Double_t to = 1.-E0*E0/2./Eg/Ep; // Originally Was: 1.122 const Double_t from = -1.0; 123 const Double_t to = 1.-E0*E0/(2.*Eg*Ep); // Originally Was: 1. 127 124 128 125 TF1 f("int1", Int1, from, to, 2); 129 Double_t int1 = f.Integral(from, to, val); // [m^2] 130 Double_t planck = Planck(&Ep, &z); // [GeV^2] 131 132 Double_t res = planck * int1; 133 134 res *= Eg/E0*1e-9; // FIXME!!!!!!!!!! WHICH FACTOR IS THIS???? 126 127 const Double_t int1 = f.Integral(from, to, val); // [m^2] 128 const Double_t planck = Planck(&Ep, &z); // [GeV^2] 129 130 const Double_t res = planck * int1; 135 131 136 132 return res; // [GeV^2 m^2] … … 156 152 Double_t val[2] = { Eg, z }; 157 153 158 Double_t lolim = E0*E0 /Eg;159 Double_t inf = 4e-12; //E0*E0/Eg * sqrt(Eg);154 Double_t lolim = E0*E0 > 1e-8 ? E0*E0/Eg : 1e-8/Eg; 155 Double_t inf = 3e-11; 160 156 161 157 TF1 f("int2", Int2, lolim, inf, 2); … … 192 188 } 193 189 190 void MPhoton::DrawInteractionLength(Double_t z) 191 { 192 if (!gPad) 193 new TCanvas("ILPhoton", "Mean Interaction Length Photon"); 194 else 195 gPad->GetVirtCanvas()->cd(4); 196 197 TF1 f1("length", InteractionLength, 1e4, 1e11, 1); 198 f1.SetParameter(0, z); 199 200 gPad->SetLogx(); 201 gPad->SetLogy(); 202 gPad->SetGrid(); 203 f1.SetMaximum(1e5); 204 f1.SetLineWidth(1); 205 206 TH1 &h=*f1.DrawCopy()->GetHistogram(); 207 208 h.SetTitle("Mean Interaction Length (Photon)"); 209 h.SetXTitle("E [GeV]"); 210 h.SetYTitle("x [kpc]"); 211 212 gPad->Modified(); 213 gPad->Update(); 214 } 215 216 void MPhoton::DrawInteractionLength() const 217 { 218 DrawInteractionLength(fZ); 219 } -
trunk/WuerzburgSoft/Thomas/mphys/MPhoton.h
r1352 r1356 17 17 void operator=(MParticle &p) { MParticle::operator=(p); } 18 18 19 // ---------------------------------------------------------------- 20 19 21 static Double_t Planck(Double_t *x, Double_t *k=NULL); 20 22 static Double_t Sigma_gg(Double_t *x, Double_t *k=NULL); … … 26 28 Double_t GetInteractionLength() const; 27 29 30 // ---------------------------------------------------------------- 31 32 static void DrawInteractionLength(Double_t z); 33 void DrawInteractionLength() const; 34 28 35 ClassDef(MPhoton, 1) 29 36 };
Note:
See TracChangeset
for help on using the changeset viewer.