| 1 | //=//////////////////////////////////////////////////////////////////////
|
|---|
| 2 | //=
|
|---|
| 3 | //= atm
|
|---|
| 4 | //=
|
|---|
| 5 | //= @file atm.cxx
|
|---|
| 6 | //= @desc Header file
|
|---|
| 7 | //= @author J C Gonzalez
|
|---|
| 8 | //= @email gonzalez@mppmu.mpg.de
|
|---|
| 9 | //= @date Thu May 7 16:24:22 1998
|
|---|
| 10 | //=
|
|---|
| 11 | //=----------------------------------------------------------------------
|
|---|
| 12 | //=
|
|---|
| 13 | //= Created: Thu May 7 16:24:22 1998
|
|---|
| 14 | //= Author: Jose Carlos Gonzalez
|
|---|
| 15 | //= Purpose: Simulation of atmospheric absorption
|
|---|
| 16 | //= Notes:
|
|---|
| 17 | //=
|
|---|
| 18 | //=----------------------------------------------------------------------
|
|---|
| 19 | //=
|
|---|
| 20 | //= $RCSfile: atm.cxx,v $
|
|---|
| 21 | //= $Revision: 1.2 $
|
|---|
| 22 | //= $Author: harald $
|
|---|
| 23 | //= $Date: 1999-11-01 11:05:53 $
|
|---|
| 24 | //=
|
|---|
| 25 | //=//////////////////////////////////////////////////////////////////////
|
|---|
| 26 |
|
|---|
| 27 | // @T \newpage
|
|---|
| 28 |
|
|---|
| 29 | //!@section Source code of |atm.cxx|.
|
|---|
| 30 |
|
|---|
| 31 | /*!@"
|
|---|
| 32 |
|
|---|
| 33 | This section describes briefly the source code for the file
|
|---|
| 34 | |atm.cxx|.
|
|---|
| 35 |
|
|---|
| 36 | @"*/
|
|---|
| 37 |
|
|---|
| 38 | //!@subsection Include files.
|
|---|
| 39 |
|
|---|
| 40 | /*!@"
|
|---|
| 41 |
|
|---|
| 42 | All the defines are located in the file {\tt atm.h}.
|
|---|
| 43 |
|
|---|
| 44 | @"*/
|
|---|
| 45 |
|
|---|
| 46 | //!@{
|
|---|
| 47 |
|
|---|
| 48 | #include "atm.h"
|
|---|
| 49 |
|
|---|
| 50 | //!@}
|
|---|
| 51 |
|
|---|
| 52 | //!@subsection Definition of global variables.
|
|---|
| 53 |
|
|---|
| 54 | //!@{
|
|---|
| 55 |
|
|---|
| 56 | static ATM_MODELS_TYPE Atm_mod_N = ATM_NOATMOSPHERE;
|
|---|
| 57 | static char Atm_mod[ATM_NAME_MAX_LENGTH];
|
|---|
| 58 |
|
|---|
| 59 | //!@}
|
|---|
| 60 |
|
|---|
| 61 | //!@subsection The function |atm()|.
|
|---|
| 62 |
|
|---|
| 63 | //!---------------------------------------------------------------------
|
|---|
| 64 | // @name atm
|
|---|
| 65 | //
|
|---|
| 66 | // @desc simulation of atmospheric absorption
|
|---|
| 67 | //
|
|---|
| 68 | // @var wavelength Wavelength of the photon (nm)
|
|---|
| 69 | // @var height Height of generation (cm)
|
|---|
| 70 | // @var theta Zenith angle of trajectory(rad)
|
|---|
| 71 | //
|
|---|
| 72 | // @return Transmission coefficient
|
|---|
| 73 | //
|
|---|
| 74 | // @date Mon Sep 14 13:27:56 MET DST 1997
|
|---|
| 75 | //----------------------------------------------------------------------
|
|---|
| 76 | // @function
|
|---|
| 77 |
|
|---|
| 78 | //!@{
|
|---|
| 79 | float
|
|---|
| 80 | atm(float wavelength, float height, float theta)
|
|---|
| 81 | {
|
|---|
| 82 |
|
|---|
| 83 | float transmittance; //@< final transmittance of the atm. (returned)
|
|---|
| 84 |
|
|---|
| 85 | transmittance = 1.0;
|
|---|
| 86 |
|
|---|
| 87 | switch ( Atm_mod_N ) {
|
|---|
| 88 |
|
|---|
| 89 | case ATM_NOATMOSPHERE: //@< no atmosphere at all: transmittance = 100%
|
|---|
| 90 |
|
|---|
| 91 | break;
|
|---|
| 92 |
|
|---|
| 93 | case ATM_90PERCENT: //@< atmosphere with transmittance = 90%
|
|---|
| 94 |
|
|---|
| 95 | transmittance = 0.9;
|
|---|
| 96 | break;
|
|---|
| 97 |
|
|---|
| 98 | case ATM_ISOTHERMAL: //@< isothermal approximation
|
|---|
| 99 |
|
|---|
| 100 | // here the transmittance function
|
|---|
| 101 |
|
|---|
| 102 | break;
|
|---|
| 103 |
|
|---|
| 104 | case ATM_CORSIKA: //@< atmosphere as defined in CORSIKA
|
|---|
| 105 |
|
|---|
| 106 | attenu( &wavelength, &height, &theta, &transmittance);
|
|---|
| 107 |
|
|---|
| 108 | break;
|
|---|
| 109 |
|
|---|
| 110 | }
|
|---|
| 111 |
|
|---|
| 112 | return ( transmittance );
|
|---|
| 113 |
|
|---|
| 114 | }
|
|---|
| 115 | //!@}
|
|---|
| 116 |
|
|---|
| 117 | //!---------------------------------------------------------------------
|
|---|
| 118 | // @name set_atm_mod
|
|---|
| 119 | //
|
|---|
| 120 | // @desc set model of atmospheric absorption
|
|---|
| 121 | //
|
|---|
| 122 | // @var i Model of atmospheric absorption to be used
|
|---|
| 123 | //
|
|---|
| 124 | // @date Sat Jun 27 05:58:56 MET DST 1998
|
|---|
| 125 | //----------------------------------------------------------------------
|
|---|
| 126 | // @function
|
|---|
| 127 |
|
|---|
| 128 | //!@{
|
|---|
| 129 | void
|
|---|
| 130 | set_atm_mod(ATM_MODELS_TYPE i)
|
|---|
| 131 | {
|
|---|
| 132 | Atm_mod_N = i;
|
|---|
| 133 | strcpy(Atm_mod, ATM_MODELS_NAMES[ Atm_mod_N ]);
|
|---|
| 134 | }
|
|---|
| 135 | //!@}
|
|---|
| 136 |
|
|---|
| 137 | //!---------------------------------------------------------------------
|
|---|
| 138 | // @name conv_atm_mod
|
|---|
| 139 | //
|
|---|
| 140 | // @desc convert string with name of atm.model to number
|
|---|
| 141 | //
|
|---|
| 142 | // @var *s Name of model of atmospheric absorption
|
|---|
| 143 | //
|
|---|
| 144 | // @return Number for that model
|
|---|
| 145 | //
|
|---|
| 146 | // @date Sat Jun 27 05:58:56 MET DST 1998
|
|---|
| 147 | //----------------------------------------------------------------------
|
|---|
| 148 | // @function
|
|---|
| 149 |
|
|---|
| 150 | //!@{
|
|---|
| 151 | ATM_MODELS_TYPE
|
|---|
| 152 | conv_atm_mod(char *s)
|
|---|
| 153 | {
|
|---|
| 154 | int i;
|
|---|
| 155 | char s2[40];
|
|---|
| 156 |
|
|---|
| 157 | // look at each model
|
|---|
| 158 | for (i=0; i<=ATM_CORSIKA; i++) {
|
|---|
| 159 | strcpy(s2, ATM_MODELS_NAMES[i]);
|
|---|
| 160 | if (strcmp(s, s2) == 0 )
|
|---|
| 161 | break;
|
|---|
| 162 | }
|
|---|
| 163 |
|
|---|
| 164 | // return the name of the model
|
|---|
| 165 | return ( (ATM_MODELS_TYPE) ((i<=ATM_CORSIKA) ? i : -1) );
|
|---|
| 166 |
|
|---|
| 167 | // return ( (ATM_MODELS_TYPE) 0 );
|
|---|
| 168 | }
|
|---|
| 169 | //!@}
|
|---|
| 170 |
|
|---|
| 171 | //!---------------------------------------------------------------------
|
|---|
| 172 | // @name get_atm_mod
|
|---|
| 173 | //
|
|---|
| 174 | // @desc get name of the atmospheric model to be used
|
|---|
| 175 | //
|
|---|
| 176 | // @return Name of the current atmospheric model to be used
|
|---|
| 177 | //
|
|---|
| 178 | // @date Sat Jun 27 05:58:56 MET DST 1998
|
|---|
| 179 | //----------------------------------------------------------------------
|
|---|
| 180 | // @function
|
|---|
| 181 |
|
|---|
| 182 | //!@{
|
|---|
| 183 | char *
|
|---|
| 184 | get_atm_mod(void)
|
|---|
| 185 | {
|
|---|
| 186 | return (Atm_mod);
|
|---|
| 187 | }
|
|---|
| 188 | //!@}
|
|---|
| 189 |
|
|---|
| 190 | //!---------------------------------------------------------------------
|
|---|
| 191 | // @name get_atm_mod_n
|
|---|
| 192 | //
|
|---|
| 193 | // @desc get name of the atmospheric model number i
|
|---|
| 194 | //
|
|---|
| 195 | // @var i Number of atmospheric model
|
|---|
| 196 | //
|
|---|
| 197 | // @return Name of corresponding atmospheric model
|
|---|
| 198 | //
|
|---|
| 199 | // @date Sat Jun 27 05:58:56 MET DST 1998
|
|---|
| 200 | //----------------------------------------------------------------------
|
|---|
| 201 | // @function
|
|---|
| 202 |
|
|---|
| 203 | //!@{
|
|---|
| 204 | char *
|
|---|
| 205 | get_atm_mod_n(ATM_MODELS_TYPE i)
|
|---|
| 206 | {
|
|---|
| 207 | return( ATM_MODELS_NAMES[ Atm_mod_N ] );
|
|---|
| 208 | }
|
|---|
| 209 | //!@}
|
|---|
| 210 |
|
|---|
| 211 |
|
|---|
| 212 | //=------------------------------------------------------------
|
|---|
| 213 | //!@subsection Log of this file.
|
|---|
| 214 |
|
|---|
| 215 | //!@{
|
|---|
| 216 | //
|
|---|
| 217 | // $Log: not supported by cvs2svn $
|
|---|
| 218 | // Revision 1.1.1.1 1999/10/29 07:00:32 harald
|
|---|
| 219 | // This is the startpoint for the futher development of the Reflector program
|
|---|
| 220 | // of Jose Carlos. For all developments use this CVS-controlled directory.
|
|---|
| 221 | //
|
|---|
| 222 | // Revision 1.3 1999/03/24 16:32:59 gonzalez
|
|---|
| 223 | // REFLECTOR 1.1: Release
|
|---|
| 224 | //
|
|---|
| 225 | //
|
|---|
| 226 | //
|
|---|
| 227 | //!@}
|
|---|
| 228 |
|
|---|
| 229 | //=EOF
|
|---|