// ESAF : Euso Simulation and Analysis Framework
// $Id: EarthVector.cc,v 1.7 2005/01/13 16:12:23 moreggia Exp $
// Sylvain Moreggia created Mar, 15 2004
//////////////////////////////////////////////////////////////////////////////////////
// //
// EarthVector //
// //
// Position or direction in atmosphere //
// //
//////////////////////////////////////////////////////////////////////////////////////
#include "EarthVector.hh"
#include <stdexcept>
#include <math.h>
#include "EConst.hh"
using EConst::EarthRadius;
//______________________________________________________________________
ostream& operator<<(ostream &os, const EarthVector &v) {
//
// defines the operator <<
//
os<<"("<<v.x()<<", "<<v.y()<<", "<<v.z()<<")";
return os;
}
//______________________________________________________________________
Double_t EarthVector::Zv() const {
//
// return the local altitude of the position in atmosphere
//
Double_t alt = sqrt( pow(EarthRadius() + this->Z(),2) + this->Perp2() ) - EarthRadius();
if(alt < 0) {
if(alt < -1) {
cout <<"[Warning] Zv = " <<alt/km <<" km, SHOULD NOT be negativen";
}
return 0.;
}
return alt;
}
//______________________________________________________________________
Bool_t EarthVector::IsUnderSeaLevel() const {
//
// Test if position is under sea level
//
Double_t alt = sqrt( pow(EarthRadius() + this->Z(),2) + this->Perp2() ) - EarthRadius();
if(alt < 0) return true;
else return false;
}
//______________________________________________________________________
Double_t EarthVector::LocalLongitude() const {
//
// Longitude angle (origin taken at MES origin) //TOFIX
//
return atan(this->X() / (this->Z() + EarthRadius()));
}
//______________________________________________________________________
Double_t EarthVector::LocalLatitude() const {
//
// Latitude angle (origin taken at MES origin) //TOFIX
//
return atan(this->Y() / (this->Z() + EarthRadius()));
}
ClassImp(EarthVector)