Index: trunk/MagicSoft/Simulation/Detector/Reflector/Makefile
===================================================================
--- trunk/MagicSoft/Simulation/Detector/Reflector/Makefile	(revision 427)
+++ trunk/MagicSoft/Simulation/Detector/Reflector/Makefile	(revision 428)
@@ -19,7 +19,7 @@
 #
 # $RCSfile: Makefile,v $
-# $Revision: 1.4 $
+# $Revision: 1.5 $
 # $Author: harald $ 
-# $Date: 2000-01-28 09:19:54 $
+# $Date: 2000-07-25 13:48:09 $
 #
 ##################################################################
@@ -40,5 +40,5 @@
 	   -I${INCLUDE_MC}   \
 	   -I${INCLUDE_REFL} \
-           -I/usr/include  -I/usr/include/g++
+           -I/usr/include  -I/usr/include/cxx
 
 #CERNLIBDIR = ${CERNDIR}/pro/lib/
@@ -49,5 +49,5 @@
 # special flags
 
-osf_FORLIBS = -lUfor -lfor -lutil -lots -lm 
+osf_FORLIBS = -L/usr/lib -lUfor -lFutil -lfor -lutil -lots -lm
 linux_FORLIBS = -lm 
 generic_FORLIBS = -lm 
@@ -61,5 +61,5 @@
 FFLAGS    = ${CXXFLAGS}
 LIBS      = ${RANLIB} ${FORLIBS} 
-#LIBS      = ${CERNLIB} ${RANLIB} ${FORLIBS} 
+LIBS      = ${CERNLIB} ${RANLIB} ${FORLIBS} 
 
 #------------------------------------------------------------------------------
@@ -100,5 +100,5 @@
 	attenu.o \
 	readparam.o \
-	reflector.o      
+	reflector.o
 
 PROGRAM=reflector
Index: trunk/MagicSoft/Simulation/Detector/Reflector/attenu.f
===================================================================
--- trunk/MagicSoft/Simulation/Detector/Reflector/attenu.f	(revision 427)
+++ trunk/MagicSoft/Simulation/Detector/Reflector/attenu.f	(revision 428)
@@ -37,4 +37,8 @@
      + RHO_TOT, RHO_FI, RHOFP
       
+      DOUBLE PRECISION Rcos2, Rsin2
+      DOUBLE PRECISION x1, x2, x3, x4
+      DOUBLE PRECISION e1, e2, e3, e4
+
       REAL wavelength, height, theta, tr_atmos
       real trr, trm, tro
@@ -278,9 +282,8 @@
       DATA BATM / 1222.6562D0,1144.9069D0,1305.5948D0,540.1778D0,0.D0  /
       DATA CATM / 994186.38D0,878153.55D0,636143.04D0,772170.16D0,1.D-9/
-c fs 190400: lowest Layer is 2200.d0 (observation level)
-c      DATA LAHG / 2000.0D2,4.0D5,1.0D6,4.0D6,1.0D7 /  
+
       DATA LAHG / 2200.0D2,4.0D5,1.0D6,4.0D6,1.0D7 /
       DATA Lm /3.70D5,3.85D5,4.0D5,4.17D5,4.17D5,4.35D5,5.0D5,5.56D5,
-     + 5.99D5,6.33D5, 6.67D5,7.04D5 /
+     +         5.99D5,6.33D5, 6.67D5,7.04D5 /
       DATA LONG /
      +    280.0, 
@@ -297,7 +300,10 @@
      +    650.0 /
       DATA PI / 3.141592654D0 /
-c fs 191999: take same Earth radius as in CORSIKA
-c      PARAMETER (RT=6348.0D5)
+
+c--   Take same Earth radius as in CORSIKA
       parameter (rt = 6371315.D2)
+
+c--   Scale-height for Exponential density profile
+      parameter (hscale = 7.4d5)
 
 ***********************************************************************
@@ -309,5 +315,5 @@
 ***********************************************************************
         
-c fs observation level at La Palma
+c-- Observation level at La Palma
       parameter (obslev = 2200.d2)
       
@@ -316,5 +322,5 @@
       T_Oz = 1.0
       
-c fs : error: height with obslev = 0. !!!!
+c-- Height calculated using an obslev = H(LaPalma) <> 0
 c      H = -RT + SQRT(RT**2 + (height/COS(theta))**2 +
 c     +     (2.0D0*RT*height))
@@ -333,12 +339,34 @@
 c      => pure geometric correction on 
 c         absorption lenght measured at vertical height [km^-1]   
-c      m= (1.D0/H)*(SQRT((RT*COS(theta))**2+(2*RT*H)+H**2)-
+c--
+c      ma = (1.D0/H)*(SQRT((RT*COS(theta))**2+(2*RT*H)+H**2)-
 c     +     (RT*COS(theta)))
-      m = (1.d0/(h-obslev)) * 
-     &   ( -(rt+obslev)*cos(theta) 
-     &     +sqrt( (rt+h)**2 - ((rt+obslev)*sin(theta))**2) )
+c--
+c      mb = (1.d0/(h-obslev)) * 
+c     &     ( -(rt+obslev)*cos(theta) 
+c     &     +sqrt( (rt+h)**2 - ((rt+obslev)*sin(theta))**2) )
+c--
+
+c-- Air mass "m" calcualted using a one-exponential density
+c-- profile for the atmosphere, rho = rho_0 exp(-h/Hs)
+c-- with Hs = hscale = 7.4 km
+
+      Rcos2 = rt * cos(theta)**2
+      Rsin2 = rt * sin(theta)**2
+      
+      x1 = sqrt((2. * obslev + Rcos2) / (2. * hscale))
+      x2 = sqrt((2. * h      + Rcos2) / (2. * hscale))
+      x3 = sqrt((2. * obslev + rt)    / (2. * hscale))
+      x4 = sqrt((2. * h      + rt)    / (2. * hscale))
+
+      e1 = derfc(x1)
+      e2 = derfc(x2)
+      e3 = derfc(x3)
+      e4 = derfc(x4)
+
+      m = exp(-Rsin2 / (2. * hscale)) * ((e1 - e2) / (e3 - e4))
+
 **********************************************************************   
-          
-
+*          
 *     RAYLEIGH SCATTERING
 
