source: trunk/MagicSoft/Simulation/Detector/ReflectorII/atm.c@ 738

Last change on this file since 738 was 725, checked in by harald, 24 years ago
Ciro and Denis changed the reflector to read in the changed MMCS output (single file version). They made a big change of all the code. That is the reason why I put here a new reflector directory in the repository. This is the future development point for reflector. Until the next drastic change. WARNING: Reflector here is only proved on OSF!!!
File size: 1.7 KB
Line 
1#include <stdio.h>
2#include <string.h>
3#include <math.h>
4#include "diag.h"
5#include "atm.h"
6#include "init.h"
7
8/* random numbers */
9#define RandomNumber ranf()
10
11/* Local declarations */
12static int atmModel=0; /* current atm. model */
13
14/* Function declarations */
15static float atm(float wavelength, float height, float theta);
16void SetAtmModel(char *model);
17int absorption(float wlen, float height, float theta);
18extern void attenu_(float *, float *, float *, float *); /* in Fortran */
19extern float ranf(void);
20
21void SetAtmModel(char *model)
22{
23 while (strcmp(model, AtmModelNames[atmModel]))
24 if (++atmModel == sizeof(AtmModelNames)/sizeof(AtmModelNames[0]))
25 { atmModel = 0;
26 Error(ATM__NFND__ERR, model);
27 break; }
28
29 Log(ATM__SET___LOG, AtmModelNames[atmModel]);
30} /* end of SetAtmModel */
31
32static float atm(float wavelength, float height, float theta)
33{ float transmittance = 1.0; /* final atm transmittance (ret. value) */
34
35 switch(atmModel)
36 { case ATM_NOATMOSPHERE: /* no atm at all: transmittance = 100% */
37 break;
38 case ATM_90PERCENT: /* atm. with transmittance = 90% */
39 transmittance = 0.9;
40 break;
41 case ATM_ISOTHERMAL: /* isothermal approximation */
42 /********************/
43 break;
44 case ATM_CORSIKA: /* atmosphere as defined in CORSIKA */
45 attenu_(&wavelength, &height, &theta, &transmittance);
46 break;
47 } /* end of atm switch */
48
49 return transmittance;
50} /* end of atm */
51
52int absorption(float wlen, float height, float theta)
53{ int ret = 0; /* 0: passed, 1: absorbed */
54
55 if ( RandomNumber > atm(wlen, height, theta)) return 1;
56
57 return ret;
58} /* end of absorption */
Note: See TracBrowser for help on using the repository browser.