Index: trunk/Mars/msim/MAtmosphere.cc
===================================================================
--- trunk/Mars/msim/MAtmosphere.cc	(revision 19764)
+++ trunk/Mars/msim/MAtmosphere.cc	(revision 19765)
@@ -137,5 +137,5 @@
 
 MAtmRayleigh::MAtmRayleigh() : fR(MCorsikaRunHeader::fgEarthRadius),
-    fHeight{0, 300000, 1e+06, 5e+06, 1e+07},
+    //fHeight{0, 300000, 1e+06, 5e+06, 1e+07},
     //fAtmA{-144.838, -124.071, 0.360027, -0.000824761, 0.00221589},
     fAtmB{1192.34, 1173.98, 1412.08, 810.682, 1},
@@ -171,6 +171,6 @@
         fObsLevel,                     // fObsLevel,                   //   0km
         TMath::Max(fObsLevel, 7.75e5), // TMath::Max(fObsLevel, 4e5),  //   4km
-        16.5e5,                       //  10e5,                       //  10km
-        50.0e5,                       //  40e5,                       //  40km
+        16.5e5,                        //  10e5,                       //  10km
+        50.0e5,                        //  40e5,                       //  40km
         105.0e5,                       // 100e5                        // 100km
     };
@@ -414,9 +414,11 @@
 
         Double_t path_slant = 0;
-        for (Double_t h = fObsLevel; h <= 50e5; h += dh)
+        for (Double_t h=fObsLevel; h<50e5+dh/2; h+=dh)
         {
             // h is the true height vertical above ground
-            if (fmod(h,1e4) == 0)
-                ozone_path[(int)(h/1e4)][j] = path_slant;
+            //if (fmod(h,1e4) == 0)
+            {
+                ozone_path[TMath::FloorNint(h/1e4)][j] = path_slant;
+            }
 
             const Double_t km  = h/1e5;
@@ -450,9 +452,11 @@
 
         Double_t path_slant = 0;
-        for (Double_t h = fObsLevel; h <= 30e5; h += dh)
+        for (Double_t h=fObsLevel; h<=30e5+dh/2; h+=dh)
         {
             // h is the true height vertical above ground
-            if (fmod(h,1e4) == 0)
-                aerosol_path[(int)(h/1e4)][j] = path_slant;
+            //if (fmod(h,1e4) == 0)
+            {
+                aerosol_path[TMath::FloorNint(h/1e4)][j] = path_slant;
+            }
 
             const Double_t km  = h/1e5;
@@ -482,5 +486,5 @@
     }
 
-    if (!HasValidAerosol())
+    if (!HasValidOzone())
         return kFALSE;
 
@@ -539,6 +543,4 @@
 
     //******* Ozone absorption *******
-    if (h > 50.e5)
-        h = 50.e5;
 
     // Vigroux Ozone absorption coefficient a.s.l. through interpolation:
@@ -549,6 +551,6 @@
     // Now use the pre-calculated values of the path integral
     // for h and theta
-    const UInt_t H = TMath::Nint(h/1e4);
-    const UInt_t T = TMath::Min(89, TMath::Nint(theta/STEPTHETA));
+    const UInt_t H = TMath::Min(500, TMath::Nint(h/1e4));
+    const UInt_t T = TMath::Min( 89, TMath::Nint(theta/STEPTHETA));
 
     const Double_t path = ozone_path[H][T];
@@ -563,6 +565,4 @@
 
     //******* Mie (aerosol) *******
-    if (h > 30.e5)
-        h = 30.e5;
 
     //const float aero_betap[15] = {0.27, 0.26, 0.25, 0.24, 0.24, 0.23, 0.20, 0.180, 0.167, 0.158, 0.150, 0.142, 0.135, 0.127, 0.120};
@@ -572,7 +572,6 @@
     // Now use the pre-calculated values of the path integral
     // for h and theta
-    const UInt_t H = TMath::Nint(h/1e4);
-    const UInt_t T = TMath::Min(89, TMath::Nint(theta/STEPTHETA));
-
+    const UInt_t H = TMath::Min(300, TMath::Nint(h/1e4));
+    const UInt_t T = TMath::Min( 89, TMath::Nint(theta/STEPTHETA));
 
     const Double_t path = aerosol_path[H][T];
Index: trunk/Mars/msim/MAtmosphere.h
===================================================================
--- trunk/Mars/msim/MAtmosphere.h	(revision 19764)
+++ trunk/Mars/msim/MAtmosphere.h	(revision 19765)
@@ -98,7 +98,8 @@
         Init(h);//, "ozone.txt", "aerosols.txt");
     }
+    MAtmosphere(Double_t obs=-1, const char *name1=0, const char *name2=0) : fAbsCoeffOzone(0), fAbsCoeffAerosols(0)
+    {
+        MAtmRayleigh::Init(obs);
 
-    MAtmosphere(const char *name1=0, const char *name2=0) : fAbsCoeffOzone(0), fAbsCoeffAerosols(0)
-    {
         if (name1)
             InitOzone(name1);
