Last change
on this file since 7217 was 5110, checked in by moralejo, 20 years ago |
Commited to CVS all changes to adapt headers to current C++ syntaxis
|
File size:
1.5 KB
|
Line | |
---|
1 | // Include header files
|
---|
2 |
|
---|
3 | #ifndef _STARFIELD_H_
|
---|
4 | #define _STARFIELD_H_
|
---|
5 |
|
---|
6 | #include <iostream>
|
---|
7 | #include <fstream>
|
---|
8 | #include <stdlib.h>
|
---|
9 | #include <stdio.h>
|
---|
10 | #include <math.h>
|
---|
11 | #include <sys/types.h>
|
---|
12 | #include <dirent.h>
|
---|
13 | #include <unistd.h>
|
---|
14 |
|
---|
15 | // Include header files from the project.
|
---|
16 |
|
---|
17 | #include "convertcorsika.h"
|
---|
18 |
|
---|
19 | //#include "rand_time.h"
|
---|
20 |
|
---|
21 | //#include "rand_coord.h"
|
---|
22 |
|
---|
23 | #include "star.hxx"
|
---|
24 |
|
---|
25 | #include "photon.hxx"
|
---|
26 |
|
---|
27 | #include "jcmacros.h"
|
---|
28 |
|
---|
29 | #include "parameters.h"
|
---|
30 |
|
---|
31 | // Global constants.
|
---|
32 |
|
---|
33 |
|
---|
34 | // Maximum number of stars and maximum number of photons for
|
---|
35 | // memory allocation
|
---|
36 |
|
---|
37 |
|
---|
38 | #ifndef iMAXSTARS
|
---|
39 | #define iMAXSTARS 5000
|
---|
40 | #endif
|
---|
41 |
|
---|
42 | #ifndef iMAXPHOT
|
---|
43 | #define iMAXPHOT 250000
|
---|
44 | #endif
|
---|
45 |
|
---|
46 | #ifndef PI
|
---|
47 | #define PI 3.1415927
|
---|
48 | #endif
|
---|
49 |
|
---|
50 |
|
---|
51 | //Seed for the random generators.
|
---|
52 |
|
---|
53 | long int idum=-1;
|
---|
54 |
|
---|
55 |
|
---|
56 | //Function definitions
|
---|
57 |
|
---|
58 |
|
---|
59 | //Random generator functions.
|
---|
60 |
|
---|
61 | float rand_un_gen(long *idum);
|
---|
62 |
|
---|
63 |
|
---|
64 |
|
---|
65 | inline float rand_coord(float radius){
|
---|
66 | // generate a coordinate on the floor for every photon arriving from the star.
|
---|
67 |
|
---|
68 | float p_m;
|
---|
69 | float randc;
|
---|
70 |
|
---|
71 | randc=rand_un_gen(&idum);
|
---|
72 |
|
---|
73 | p_m= 2.0*radius * randc - radius;
|
---|
74 |
|
---|
75 | return (p_m);
|
---|
76 | }
|
---|
77 |
|
---|
78 | // generate for every photon a random arrival time within a time window
|
---|
79 | // defined by the intgreation time.
|
---|
80 |
|
---|
81 | inline float rand_time(float inttime_s){
|
---|
82 |
|
---|
83 | float randt;
|
---|
84 |
|
---|
85 | randt= inttime_s * rand_un_gen(&idum);
|
---|
86 |
|
---|
87 | return(randt);
|
---|
88 | }
|
---|
89 |
|
---|
90 | // The rand_lambda function will generate for every photon a random wavelength
|
---|
91 | // in the given waveband
|
---|
92 |
|
---|
93 | inline float rand_lambda(float lmin, float lmax){
|
---|
94 |
|
---|
95 | float randt;
|
---|
96 |
|
---|
97 | randt=(lmax - lmin) * rand_un_gen(&idum) + lmin ;
|
---|
98 |
|
---|
99 | return(randt);
|
---|
100 | }
|
---|
101 |
|
---|
102 |
|
---|
103 | #endif
|
---|
104 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.