Changeset 19763
- Timestamp:
- 10/12/19 15:48:08 (5 years ago)
- Location:
- trunk/Mars/msim
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/msim/MSimAtmosphere.cc
r19009 r19763 53 53 #include "MPhotonData.h" 54 54 55 #include "MAtmosphere.h" 56 55 57 ClassImp(MSimAtmosphere); 56 58 57 59 using namespace std; 58 60 /* 59 61 // ========================================================================== 60 62 // … … 253 255 } 254 256 255 /*256 // The "orginal" code for the vertical thickness257 Double_t GetVerticalThickness(Double_t obslev, Double_t height) const258 {259 // This is a C++-version of the original code from attenu.c260 261 // Limits (height in cm) of the four layers in which atmosphere is parametrized:262 const double lahg[5] =263 {264 obslev,265 TMath::Max(obslev, 4e5),266 1.0e6,267 4.0e6,268 1.0e7269 };270 271 Double_t Rho_Tot = 0.0;272 for (int i=0; i<4; i++)273 {274 const Double_t b = fAtmB[i];275 const Double_t c = fAtmC[i];276 277 const Double_t h0 = TMath::Min(height, lahg[i+1]);278 const Double_t h1 = lahg[i];279 280 // Calculate rho for the i-th layer from the lower281 // to the higher layer boundary.282 // If height is within the layer only calculate up to height.283 Rho_Tot += b*(exp(-h1/c) - exp(-h0/c));284 285 if (lahg[i+1] > height)286 break;287 }288 289 return Rho_Tot;290 }291 */292 257 Double_t CalcTransmission(Double_t height, Double_t wavelength, Double_t sin2) const 293 258 { … … 334 299 // Calculate the traversed "vertical thickness" of air using the 335 300 // US Standard atmosphere: 336 const Double_t Rho_tot = GetVerticalThickness( /*fObsLevel,*/height);301 const Double_t Rho_tot = GetVerticalThickness(height); 337 302 338 303 // We now convert from "vertical thickness" to "slanted thickness" … … 387 352 // checks are done for each call! 388 353 return g.GetN()==0 ? 0 : g.Eval(wavelength)*1e-5; // from km^-1 to cm^-1 389 /*390 // Linear interpolation391 // (FIXME: Is it faster to be replaced with a binary search?)392 // ( This might be faster because we have more photons393 // with smaller wavelengths)394 //int index;395 //for (index = 1; index <g.GetN()-1; index++)396 // if (wavelength < g.GetX()[index])397 // break;398 const Int_t index = TMath::BinarySearch(g.GetN(), g.GetX(), wavelength)+1;399 400 const Double_t t0 = g.GetY()[index-1];401 const Double_t t1 = g.GetY()[index];402 403 const Double_t w0 = g.GetX()[index-1];404 const Double_t w1 = g.GetX()[index];405 406 const Double_t beta0 = t0+(t1-t0)*(wavelength-w0)/(w1-w0);407 408 return beta0 * 1e-5; // from km^-1 to cm^-1409 */410 354 } 411 355 … … 490 434 //const Double_t STEPTHETA = 1.74533e-2; // aprox. 1 degree 491 435 492 / * Mie (aerosol): */436 // Mie (aerosol): 493 437 for (Int_t j = 0; j < 90; j++) 494 438 { … … 566 510 InitAerosols(name2); 567 511 } 568 /*569 Double_t GetOz(Double_t height, Double_t theta) const570 {571 // Distance between two points D = 1km /cos(theta)572 // Density along y within this km: f = (x[i+1]-x[i])/1km * dy573 // Integral of this density f = (x[i+1]-x[i])/1km * (y[i+1]-y[i])574 // f(h) = int [ (c1-c0)/1km*(h-h0)*dh + c0 ] dh575 // = (c-co)*(h-h0)576 577 Double_t rc = 0;578 int i;579 for (i=0; i<49; i++)580 if (i>=2 && i+1<height/1e5) // cm -> km581 rc += oz_conc[i] * 1e5/cos(theta);582 583 rc -= oz_conc[2]*0.2*1e5/cos(theta);584 rc += oz_conc[i+1]*fmod(height/1e5,1)*1e5/cos(theta);585 586 return rc;587 }588 */589 512 590 513 Double_t CalcOzoneAbsorption(Double_t h, Double_t wavelength, Double_t theta) const … … 593 516 return 1; 594 517 595 // ******* Ozone absorption *******518 // ******* Ozone absorption ******* 596 519 if (h > 50.e5) 597 520 h = 50.e5; … … 617 540 return 1; 618 541 619 // ******* Mie (aerosol) *******542 // ******* Mie (aerosol) ******* 620 543 if (h > 30.e5) 621 544 h = 30.e5; … … 665 588 const Double_t h = TMath::Sqrt(H*H + d*d + 2*H*z) - R(); 666 589 667 // **** Rayleigh scattering: *****590 // **** Rayleigh scattering: ***** 668 591 const Double_t T_Ray = CalcTransmission(h, wavelength, sin2); 669 592 if (T_Ray<0) 670 593 return 0; 671 594 672 // ****** Ozone absorption: ******595 // ****** Ozone absorption: ****** 673 596 const Double_t T_Oz = CalcOzoneAbsorption(h, wavelength, theta); 674 597 675 // ******** Mie (aerosol) ********598 // ******** Mie (aerosol) ******** 676 599 const Double_t T_Mie = CalcAerosolAbsorption(h, wavelength, theta); 677 600 … … 690 613 691 614 const Double_t MAtmosphere::oz_conc[51]={0.3556603E-02, 0.3264150E-02, 0.2933961E-02, 0.2499999E-02, 0.2264150E-02, 0.2207546E-02, 0.2160377E-02, 0.2226414E-02, 0.2283018E-02, 0.2811320E-02, 0.3499999E-02, 0.4603772E-02, 0.6207545E-02, 0.8452828E-02, 0.9528299E-02, 0.9905657E-02, 0.1028302E-01, 0.1113207E-01, 0.1216981E-01, 0.1424528E-01, 0.1641509E-01, 0.1839622E-01, 0.1971697E-01, 0.1981131E-01, 0.1933962E-01, 0.1801886E-01, 0.1632075E-01, 0.1405660E-01, 0.1226415E-01, 0.1066037E-01, 0.9028300E-02, 0.7933960E-02, 0.6830187E-02, 0.5820753E-02, 0.4830188E-02, 0.4311319E-02, 0.3613206E-02, 0.3018867E-02, 0.2528301E-02, 0.2169811E-02, 0.1858490E-02, 0.1518867E-02, 0.1188679E-02, 0.9301884E-03, 0.7443394E-03, 0.5764149E-03, 0.4462263E-03, 0.3528301E-03, 0.2792452E-03, 0.2226415E-03, 0.1858490E-03}; 692 615 */ 693 616 // ========================================================================== 694 617 -
trunk/Mars/msim/Makefile
r19561 r19763 29 29 MSimAbsorption.cc \ 30 30 MSimPointingPos.cc \ 31 MClonesArray.cc 31 MClonesArray.cc \ 32 MAtmosphere.cc 32 33 33 34 ############################################################ -
trunk/Mars/msim/SimLinkDef.h
r19561 r19763 20 20 #pragma link C++ class MClonesArray-; // - needed as custom streamer is already implemented 21 21 22 #pragma link C++ class MAtmosphere+; 23 #pragma link C++ class MAtmRayleigh+; 24 22 25 #endif
Note:
See TracChangeset
for help on using the changeset viewer.