Changeset 1356 for trunk/WuerzburgSoft/Thomas/mphys/MElectron.cc
- Timestamp:
- 06/12/02 09:35:01 (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note:
See TracChangeset
for help on using the changeset viewer.