#ifndef MARS_MAtmosphere #define MARS_MAtmosphere #include class TGraph; class MPhotonData; class MCorsikaRunHeader; class MAtmRayleigh { private: static const Double_t fgMeanFreePath; // [g/cm^2] Mean free path for scattering Rayleigh XR static const Double_t fgEarthRadiush; // [cm] Default Earth Radius Double_t fR; // [cm] Earth radius to be used Float_t fHeight[5]; // Layer boundaries (atmospheric layer) // Parameters of the different atmospheres. We use the same parametrization // shape as in Corsika atmospheric models (see Corsika manual, appendix D). // The values here can be/are obtained from the Corsika output // fAtmA is not required as it is an offset which cancels out //Float_t fAtmA[4]; // The index refers to the atmospheric layer (starting from sea level and going upwards) Float_t fAtmB[4]; // The index refers to the atmospheric layer (starting from sea level and going upwards) Float_t fAtmC[4]; // The index refers to the atmospheric layer (starting from sea level and going upwards) Double_t fRho[5]; // Precalculated integrals for rayleigh scatterning void PreCalcRho(); protected: Float_t fObsLevel; // [cm] observation level a.s.l. public: // Default constructor MAtmRayleigh(); // Init an atmosphere from the data stored in MCorsikaRunHeader MAtmRayleigh(const MCorsikaRunHeader &h) { Init(h); } // Check if the ovservation level has been correctly initialized // Used as a marker for correct initialization Bool_t IsValid() const { return fObsLevel>=0; } // Get the Earth radius to be used Double_t R() const { return fR; } void Init(Float_t obs); void Init(Float_t obs, const Float_t *atmb, const Float_t *atmc, const Float_t *height); void Init(const MCorsikaRunHeader &h); Double_t GetVerticalThickness(Double_t height) const; Double_t CalcTransmission(Double_t height, Double_t wavelength, Double_t sin2) const; static Double_t Fcn(const Double_t *xx, const Double_t *par) { const Double_t *A = par; const Double_t *B = par+5; const Double_t *C = par+10; double H[6] = { 0, 0, 0, 0, 0, 1e100 }; const Double_t x = xx[0]*1e5; // km -> cm for (int i=0; i<4; i++) { H[i+1] = log(C[i+1]/C[i] * B[i]/B[i+1]) / (1./C[i] - 1./C[i+1]); if (x>=H[i] && x