| 1 | #ifndef MARS_MAtmosphere
|
|---|
| 2 | #define MARS_MAtmosphere
|
|---|
| 3 |
|
|---|
| 4 | #include <TROOT.h>
|
|---|
| 5 |
|
|---|
| 6 | class TGraph;
|
|---|
| 7 | class MPhotonData;
|
|---|
| 8 | class MCorsikaRunHeader;
|
|---|
| 9 |
|
|---|
| 10 | class MAtmRayleigh
|
|---|
| 11 | {
|
|---|
| 12 | private:
|
|---|
| 13 | static const Double_t fgMeanFreePath; // [g/cm^2] Mean free path for scattering Rayleigh XR
|
|---|
| 14 | static const Double_t fgEarthRadiush; // [cm] Default Earth Radius
|
|---|
| 15 |
|
|---|
| 16 | Double_t fR; // [cm] Earth radius to be used
|
|---|
| 17 |
|
|---|
| 18 | Double_t fHeight[5]; // Layer boundaries (atmospheric layer)
|
|---|
| 19 |
|
|---|
| 20 | // Parameters of the different atmospheres. We use the same parametrization
|
|---|
| 21 | // shape as in Corsika atmospheric models (see Corsika manual, appendix D).
|
|---|
| 22 | // The values here can be/are obtained from the Corsika output
|
|---|
| 23 | //Float_t fAtmA[5]; // The index refers to the atmospheric layer (starting from sea level and going upwards)
|
|---|
| 24 | Float_t fAtmB[5]; // The index refers to the atmospheric layer (starting from sea level and going upwards)
|
|---|
| 25 | Float_t fAtmC[5]; // The index refers to the atmospheric layer (starting from sea level and going upwards)
|
|---|
| 26 |
|
|---|
| 27 | Double_t fRho[5]; // Precalculated integrals for rayleigh scatterning
|
|---|
| 28 |
|
|---|
| 29 | void PreCalcRho();
|
|---|
| 30 |
|
|---|
| 31 | protected:
|
|---|
| 32 | Double_t fObsLevel; // [cm] observation level a.s.l.
|
|---|
| 33 |
|
|---|
| 34 | public:
|
|---|
| 35 | // Default constructor
|
|---|
| 36 | MAtmRayleigh();
|
|---|
| 37 |
|
|---|
| 38 | // Init an atmosphere from the data stored in MCorsikaRunHeader
|
|---|
| 39 | MAtmRayleigh(const MCorsikaRunHeader &h)
|
|---|
| 40 | {
|
|---|
| 41 | Init(h);
|
|---|
| 42 | }
|
|---|
| 43 |
|
|---|
| 44 | // Check if the ovservation level has been correctly initialized
|
|---|
| 45 | // Used as a marker for correct initialization
|
|---|
| 46 | Bool_t IsValid() const { return fObsLevel>=0; }
|
|---|
| 47 |
|
|---|
| 48 | // Get the Earth radius to be used
|
|---|
| 49 | Double_t R() const { return fR; }
|
|---|
| 50 |
|
|---|
| 51 | void Init(Double_t obs, const Float_t *atmb=0, const Float_t *atmc=0);
|
|---|
| 52 | void Init(const MCorsikaRunHeader &h);
|
|---|
| 53 |
|
|---|
| 54 | Double_t GetVerticalThickness(Double_t height) const;
|
|---|
| 55 | Double_t CalcTransmission(Double_t height, Double_t wavelength, Double_t sin2) const;
|
|---|
| 56 | };
|
|---|
| 57 |
|
|---|
| 58 | // ==========================================================================
|
|---|
| 59 |
|
|---|
| 60 | class MAtmosphere : public MAtmRayleigh
|
|---|
| 61 | {
|
|---|
| 62 | private:
|
|---|
| 63 | static const Double_t STEPTHETA; // aprox. 1 degree
|
|---|
| 64 |
|
|---|
| 65 | // Aerosol number density for 31 heights a.s.l., from 0 to 30 km,
|
|---|
| 66 | // in 1 km steps (units: cm^-3)
|
|---|
| 67 | static const Double_t aero_n[31];
|
|---|
| 68 |
|
|---|
| 69 | // Ozone concentration for 51 heights a.s.l., from 0 to 50 km,
|
|---|
| 70 | // in 1 km steps (units: cm/km)
|
|---|
| 71 | static const Double_t oz_conc[51];
|
|---|
| 72 |
|
|---|
| 73 | // aerosol_path contains the path integrals for the aerosol number
|
|---|
| 74 | // density (relative to the number density at sea level) between the
|
|---|
| 75 | // observation level and a height h for different zenith angles. The
|
|---|
| 76 | // first index indicate height above sea level in units of 100m, the
|
|---|
| 77 | // second is the zenith angle in degrees.
|
|---|
| 78 | float aerosol_path[301][90];
|
|---|
| 79 |
|
|---|
| 80 | // ozone_path contains the path integrals for the ozone concentration
|
|---|
| 81 | // between the observation level and a height h for different zenith
|
|---|
| 82 | // angles. The first index indicate height above sea level in units
|
|---|
| 83 | // of 100m, the second is the zenith angle in degrees.
|
|---|
| 84 | float ozone_path[501][90];
|
|---|
| 85 |
|
|---|
| 86 | // Interpolate the graph at wavelength
|
|---|
| 87 | Double_t GetBeta(Double_t wavelength, const TGraph &g) const;
|
|---|
| 88 |
|
|---|
| 89 | //MSpline3 *fAbsCoeffOzone;
|
|---|
| 90 | //MSpline3 *fAbsCoeffAerosols;
|
|---|
| 91 |
|
|---|
| 92 | TGraph *fAbsCoeffOzone;
|
|---|
| 93 | TGraph *fAbsCoeffAerosols;
|
|---|
| 94 |
|
|---|
| 95 | public:
|
|---|
| 96 | MAtmosphere(const MCorsikaRunHeader &h) : fAbsCoeffOzone(0), fAbsCoeffAerosols(0)
|
|---|
| 97 | {
|
|---|
| 98 | Init(h);//, "ozone.txt", "aerosols.txt");
|
|---|
| 99 | }
|
|---|
| 100 | MAtmosphere(Double_t obs=0, const char *name1=0, const char *name2=0) : fAbsCoeffOzone(0), fAbsCoeffAerosols(0)
|
|---|
| 101 | {
|
|---|
| 102 | MAtmRayleigh::Init(obs);
|
|---|
| 103 |
|
|---|
| 104 | if (name1)
|
|---|
| 105 | InitOzone(name1);
|
|---|
| 106 | if (name2)
|
|---|
| 107 | InitAerosols(name2);
|
|---|
| 108 | }
|
|---|
| 109 | MAtmosphere(const char *name1, const char *name2) : fAbsCoeffOzone(0), fAbsCoeffAerosols(0)
|
|---|
| 110 | {
|
|---|
| 111 | MAtmRayleigh::Init(0);
|
|---|
| 112 |
|
|---|
| 113 | if (name1)
|
|---|
| 114 | InitOzone(name1);
|
|---|
| 115 | if (name2)
|
|---|
| 116 | InitAerosols(name2);
|
|---|
| 117 | }
|
|---|
| 118 |
|
|---|
| 119 | ~MAtmosphere();
|
|---|
| 120 |
|
|---|
| 121 | Float_t GetWavelengthMin() const;
|
|---|
| 122 | Float_t GetWavelengthMax() const;
|
|---|
| 123 |
|
|---|
| 124 | Bool_t HasValidOzone() const;
|
|---|
| 125 | Bool_t HasValidAerosol() const;
|
|---|
| 126 |
|
|---|
| 127 | Bool_t IsAllValid() const { return IsValid() && HasValidOzone() && HasValidAerosol(); }
|
|---|
| 128 |
|
|---|
| 129 | void PreCalcOzone();
|
|---|
| 130 | void PreCalcAerosol();
|
|---|
| 131 | Bool_t InitOzone(const TString name="");
|
|---|
| 132 | Bool_t InitAerosols(const TString name="");
|
|---|
| 133 |
|
|---|
| 134 | void Init(const MCorsikaRunHeader &h, const char *name1=0, const char *name2=0)
|
|---|
| 135 | {
|
|---|
| 136 | MAtmRayleigh::Init(h);
|
|---|
| 137 |
|
|---|
| 138 | InitOzone(name1);
|
|---|
| 139 | InitAerosols(name2);
|
|---|
| 140 | }
|
|---|
| 141 |
|
|---|
| 142 | Double_t CalcOzoneAbsorption(Double_t h, Double_t wavelength, Double_t theta) const;
|
|---|
| 143 | Double_t CalcAerosolAbsorption(Double_t h, Double_t wavelength, Double_t theta) const;
|
|---|
| 144 | Double_t GetTransmission(const MPhotonData &ph) const;
|
|---|
| 145 | };
|
|---|
| 146 |
|
|---|
| 147 | #endif
|
|---|