// $Id: Atmosphere.hh,v 1.34 2005/10/27 13:54:34 moreggia Exp $ // S. Moreggia created 27 October 2003 #ifndef __ATMOSPHERE_HH__ #define __ATMOSPHERE_HH__ /***************************************************************************** * ESAF: Euso Simulation and Analysis Framework * * * * Id: Atmosphere * * Package: atmosphere * * Coordinator: S. Moreggia * * * *****************************************************************************/ //////////////////////////////////////////////////////////////////////////////////////////// // Atmosphere // // // // Interface for atmosphere description, atmosphere object is a singleton // // The atmosphere instance can be called from anywhere in the code, via Atmosphere::Get() // // Each atmosphere type holds its associated AtmosphereData object // // // //////////////////////////////////////////////////////////////////////////////////////////// #include "EsafConfigurable.hh" #include "EarthVector.hh" #include "Clouds.hh" #include "EsafMsgSource.hh" class Atmosphere : public EsafConfigurable, public EsafMsgSource { public: // Build (if not done yet) and return the configured atmosphere static const Atmosphere* Get(); // Build the atmosphere virtual void Build() = 0; // reset atmosphere instance static void Reset(); // reset clouds inline void ResetClouds() const {if(fClouds) fClouds->Reset();} // To get the type of atmosphere inline string GetType() const {return fType;} // To get specific parameters of children atmosphere virtual Double_t GetValue(const string& parname) const = 0; // get date and geographic atmosphere parameters virtual Double_t GetLatitude() const = 0; // from -90 (south) to 90 (north) virtual Double_t GetLongitude() const = 0; // from 0 to 360 (east) virtual Double_t GetDate() const = 0; // in sec UT, from 1st Jan 00:00:00 (year not taken into account) // Return relevant pressure, temperature virtual Double_t Pressure(Double_t h) const = 0; Double_t Pressure(const EarthVector& v) const {return Pressure(v.Zv());} Double_t WaterVaporPartialPressure(Double_t h) const {return 28.966/18. * AbsoluteHumidity(h)/Air_Density(h) * Pressure(h);} Double_t WaterVaporPartialPressure(const EarthVector& v) const {return WaterVaporPartialPressure(v.Zv());} virtual Double_t Temperature(Double_t h) const = 0; Double_t Temperature(const EarthVector& v) const {return Temperature(v.Zv());} // Following methods return relevant densities virtual Double_t AbsoluteHumidity(Double_t h) const = 0; Double_t AbsoluteHumidity(const EarthVector& v) const {return AbsoluteHumidity(v.Zv());} virtual Double_t Air_Density(Double_t h) const = 0; Double_t Air_Density(const EarthVector& v) const {return Air_Density(v.Zv());} virtual Double_t O_Density(Double_t h) const = 0; Double_t O_Density(const EarthVector& v) const {return O_Density(v.Zv());} virtual Double_t O2_Density(Double_t h) const = 0; Double_t O2_Density(const EarthVector& v) const {return O2_Density(v.Zv());} virtual Double_t O3_Density(Double_t h) const = 0; Double_t O3_Density(const EarthVector& v) const {return O3_Density(v.Zv());} virtual Double_t N2_Density(Double_t h) const = 0; Double_t N2_Density(const EarthVector& v) const {return N2_Density(v.Zv());} virtual Double_t Aerosols_Density(string& type,Double_t h) const = 0; Double_t Aerosols_Density(string& type,const EarthVector& v) const {return Aerosols_Density(type,v.Zv());} // Index as a function of altitude long double Index(Double_t h, Double_t wl = 350*sou::nm) const; long double Index(const EarthVector& v, Double_t wl = 350*sou::nm) const {return Index(v.Zv(),wl);} Double_t Index_Minus1(Double_t h, Double_t wl = 350*sou::nm) const; // Calculate grammage // - opt = pos : between two positions in the atmosphere // - opt = dir : from a point until atmosphere top, along a track of given angles Double_t Grammage(const EarthVector& pos1, const EarthVector& V2, string opt = "pos",Double_t maxalt=100*sou::km) const; // calculates final position for given track and air depth // returns -1 if pos1 is under sea level // 0 if position found // 1 if sea level reached before // 2 if TOA reached before // optimized means algorithm stopped when 500km pathlength is reached Int_t InvertGrammage(const EarthVector& pos1, const EarthVector& dir, Double_t depth, EarthVector& rtn, Double_t maxtof=-1.) const; // returns impact at sea level of a track defined by starting position and direction EarthVector ImpactASL(const EarthVector&, const EarthVector&) const; // returns impact at Top Of Atmosphere of a track defined by starting position and direction EarthVector ImpactAtTOA(const EarthVector&, const EarthVector&, Double_t TOA_alt=100.*sou::km) const; // used in reco only : obsolete, use Grammage methods instead // Works only when starting point is on MES Z-axis // Calculate Depth in the Atmosphere from the point with given altitude along a zenith angle to infinity // using Root Integration Double_t Depth(const Double_t, const Double_t Theta) const; void SetDepthCalculationPrecision(Double_t t=1.e-5) {fDepthCalculationPrecision = t;} Double_t GetDepthCalculationPrecision() {return fDepthCalculationPrecision;} // GetMembers methods const Clouds* GetClouds() const {return fClouds;} EsafConfigClass(Atmosphere,Atmosphere) protected: // ctor Atmosphere(); // dtor virtual ~Atmosphere(); string fType; // type of atmosphere static Atmosphere* fChild; // contains the configured atmosphere object mutable Clouds* fClouds; // clouds object (mutable for reset) Double_t fDepthCalculationPrecision; // Precision for the Root Integration used to compute the atmosphere depth // (see method Depth() ClassDef(Atmosphere,0) }; #endif /* __ATMOSPHERE_HH__ */