Changeset 1448
- Timestamp:
- 07/26/02 14:49:58 (22 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r1446 r1448 6 6 - Fix: removed default arguments of ScaleAxis(...) (did not 7 7 compile on alphas). 8 9 8 10 9 11 2002/07/25: Abelardo Moralejo … … 16 18 * macros/MagicHillas.C: 17 19 - changed accordingly 20 21 18 22 19 23 2002/07/25: Wolfgang Wittek, Thomas Bretz -
trunk/WuerzburgSoft/Thomas/mphys/Changelog
r1429 r1448 1 1 -*-*- END -*-*- 2 2002/06/26: Thomas Bretz 3 4 * MParticle.[h,cc]: 5 - added fX data member 6 - corrected a small bug in the SetNewPosition calculation 7 (dr*cos(fTheta)>R*cos(fTheta) --> x(2)>R*cos(fTheta)) 8 - added usage of fX to the =-operator and SetNewPosition 9 - added fSrcR (unsaved) 10 11 * MElectron.cc: 12 - added usage of fX to the =-operator and SetNewPosition 13 - changed to use the more accurate SetNewPosition in case B==0 14 15 * MPhoton.cc: 16 - return 1e50 as InteractionLength in case Eg<100GeV 17 18 * phys.C: 19 - added support for a B-Field-Bubble 20 21 22 2 23 2002/06/21: Thomas Bretz 3 24 -
trunk/WuerzburgSoft/Thomas/mphys/MElectron.cc
r1430 r1448 371 371 Bool_t MElectron::SetNewPositionB(Double_t B) 372 372 { 373 if (B==0) 374 return SetNewPosition(); 375 373 376 static TRandom rand(0); 374 377 Double_t x = rand.Exp(GetInteractionLength()); … … 456 459 p(0) = beta_p/beta*x; 457 460 p(1) = GetPType()==kEElectron?r*sin(rho):-r*sin(rho); 458 p(2) = r*(1 -cos(rho));461 p(2) = r*(1.-cos(rho)); 459 462 } 460 463 else … … 463 466 p(1) = beta_o/beta*x; 464 467 p(2) = 0; 468 cout << "------------- HEY! --------------" << endl; 465 469 } 466 470 … … 474 478 p *= N2; 475 479 p *= M2; 480 481 if (p(2)<x) // happens sometimes in case B==0 482 { 483 cout << "----- HA: " << B << " " << x << " " << p(2) << " " << x-p(2) << endl; 484 p(2)=x; 485 } 486 476 487 s -= p; 477 488 … … 479 490 fPhi = atan2(s(1), s(0)); 480 491 fZ = ZofR(&s(2)); 492 fX += x-p(2); 481 493 482 494 // ----------------------------- -
trunk/WuerzburgSoft/Thomas/mphys/MParticle.cc
r1430 r1448 198 198 199 199 MParticle::MParticle(ParticleType_t t, const char *name, const char *title) 200 : fPType(t), fZ(0), fR(0), fPhi(0), fTheta(0), fPsi(0) 200 : fPType(t), fZ(0), fR(0), fPhi(0), fTheta(0), fPsi(0), fX(0) 201 201 { 202 202 // … … 259 259 x(2) = cos(fTheta); 260 260 261 x *= dr;262 263 261 // ------------------------------ 264 262 265 263 const Double_t R = RofZ(&fZ); 266 264 267 if (x(2) > R*cos(fTheta)) 265 const Double_t dx = R - dr*x(2); 266 267 if (dx < 0) 268 268 { 269 x *= R/dr;269 dr = R/x(2); // R>0 --> x(2)>0 270 270 rc = kFALSE; 271 271 } 272 else 273 fX += dr*(1.-x(2)); 274 275 x *= dr; 272 276 273 277 // ------------------------------ … … 283 287 r -= x; 284 288 285 fR = sqrt(r(0)*r(0)+r(1)*r(1)); 286 fPhi = atan2(r(1), r(0)); 287 fZ = ZofR(&r(2)); 289 if (fR!=0) 290 fPhi = atan2(r(1), r(0)); 291 292 fR = sqrt(r(0)*r(0)+r(1)*r(1)); 293 fZ = ZofR(&r(2)); 288 294 289 295 return rc; -
trunk/WuerzburgSoft/Thomas/mphys/MParticle.h
r1447 r1448 22 22 23 23 protected: 24 Double_t fSrcR; //! [kpc] Distance from observer to source 25 24 26 Double_t fEnergy; // [GeV] Energy 25 27 … … 31 33 Double_t fPsi; // [rad] Direction of momentum, az. angle 32 34 33 Double_t fX; // [kpc] real traveled distance (added in version 2)35 Double_t fX; // [kpc] real traveled distance minus observers distance (added in version 2) 34 36 35 37 public: … … 43 45 void operator=(MParticle &p) 44 46 { 47 fSrcR = p.fSrcR; 45 48 fZ = p.fZ; 46 49 fR = p.fR; … … 60 63 void SetIsPrimary(Bool_t is=kTRUE) { is ? SetBit(kEIsPrimary) : ResetBit(kEIsPrimary); } 61 64 Bool_t IsPrimary() const { return TestBit(kEIsPrimary); } 65 66 void SetSrcR(Double_t r) { fSrcR = r; } 62 67 63 68 // ---------------------------------------------------------------- -
trunk/WuerzburgSoft/Thomas/mphys/MPhoton.cc
r1430 r1448 121 121 Double_t z = k ? k[0] : 0; 122 122 123 if (Eg<100) 124 return 1e50; 125 123 126 Double_t val[2] = { Eg, z }; 124 127 -
trunk/WuerzburgSoft/Thomas/mphys/phys.C
r1430 r1448 33 33 Double_t PhotonSpect(Double_t *x, Double_t *k=NULL) 34 34 { 35 Double_t Ep 35 Double_t Ep = pow(10, x[0]); 36 36 37 37 Double_t res = MPhoton::Int2(&Ep, k); … … 137 137 Double_t R = MParticle::RofZ(&startz); // [kpc] 138 138 139 const char *filename = "cascade_0.03_24_1e2_1e6_256_1.root"; 140 141 const Double_t B = 0; // [T] mean magnetic field 142 143 Double_t runtime = 3.5*60*60; // [s] maximum time to run the simulation 144 145 Int_t nbins = 24; // number of bins produced in energy spectrum 146 147 Double_t lo = 1e2; // lower limit of displayed spectrum 148 Double_t hi = 1e6; // upper limit of spectrum (cutoff) 149 150 Int_t counter = 256; // maximum number of inv. Compton (-1 means infinite) 151 152 Double_t alpha = -1; // -1 means a E^2 plot 153 Double_t plot = 1; // 1 means a E^-2 spectrum 139 const char *filename = "cascade_0.03_18_1e2_1e5_B0_256_1.root"; 140 //const char *filename = "test.root"; 141 142 const Double_t B = 0;//1e-6*1e-4; // [T=1e4G] mean magnetic field 143 144 Double_t runtime = 45*60; // [s] maximum time to run the simulation 145 146 Int_t nbins = 18; // number of bins produced in energy spectrum 147 148 Double_t lo = 1e2; // lower limit of displayed spectrum 149 Double_t hi = 1e5; // upper limit of spectrum (cutoff) 150 151 Int_t counter = 256; // maximum number of inv. Compton (-1 means infinite) 152 153 Double_t alpha = -1; // -1 means a E^2 plot 154 Double_t plot = 1; // 1 means a E^-2 spectrum 155 156 Double_t bubbler = R-1e3*10; // [kpc] 157 Double_t bubblez = MParticle::ZofR(&bubbler); 154 158 155 159 // -------------------------------------------------------------------- … … 250 254 MPhoton *gamma=new MPhoton(E, startz); 251 255 gamma->SetIsPrimary(); 256 gamma->SetSrcR(R); 252 257 gamma->InitRandom(); 253 258 listg.Add(gamma); … … 304 309 // 305 310 phot.SetParameter(1, p->GetZ()); 306 307 Double_t Ep = pow(10, phot.GetRandom()); 308 if (Ep==pow(10,0)) 311 Double_t pe = phot.GetRandom(); 312 if (pe==0) 309 313 { 310 314 cout << "z" << flush; … … 312 316 } 313 317 318 Double_t Ep = pow(10, pe); 314 319 Double_t theta = RandomTheta(Eg, Ep); 315 320 if (theta==0) … … 355 360 while (test<0 ? true : (test++<counter)) 356 361 { 357 358 if (!e->SetNewPositionB(B)) 362 if (!e->SetNewPositionB(e->GetZ()>bubblez ? B : 0)) 359 363 { 360 364 cout << "!" << flush; … … 423 427 file.Write(); 424 428 429 cout << "Wrote: " << filename << endl; 425 430 cout << "Created " << n << " gammas from source with E^" << alpha << endl; 426 431 cout << "Processing time: " << Form("%.1f", (TStopwatch::GetRealTime()-starttime)/n) << " sec/gamma." << endl; … … 441 446 void phys() 442 447 { 448 /* 449 Double_t Eg = 10; 450 Double_t E0 = 511e-6; 451 Double_t z = 0.03; 452 Double_t lolim = E0*E0/Eg; 453 Double_t inf = (Eg<1e6 ? 3e-11*(z+1) : 3e-12*(z+1)); 454 if (Eg<5e4) 455 inf = 3e-11*(z+1)*pow(10, 9.4-log10(Eg)*2); 456 TF1 phot("PhotonSpectrum", PhotonSpect, log10(lolim), log10(inf), 2); 457 phot.SetParameter(0, Eg); 458 phot.SetParameter(1, z); 459 460 Double_t val[2] = {Eg,z}; 461 cout << phot.Integral(log10(lolim), log10(inf), val, 1e-2) << endl; 462 463 cout << lolim << " " << inf << endl; 464 465 phot.DrawCopy(); 466 return; 467 */ 468 443 469 DoIt(); 444 470
Note:
See TracChangeset
for help on using the changeset viewer.