Universita' di GenovaINFN Sezione di Genova  
AIRWATCH / EUSO Genova

EarthVector - source file

// ESAF : Euso Simulation and Analysis Framework
// $Id: EarthVector.cc,v 1.9 2005/10/02 14:17:08 thea 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;
using namespace sou;

//______________________________________________________________________
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*mm) {
            cout <<"[Warning] Zv = " <<alt/km <<" km, SHOULD NOT be negativen";
        }
	else 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 < -1*mm) 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)
About Us | EUSO Official Website | Web pages created by Roberto Pesce and Alessandro Thea - Last Update Wed Nov 16 16:57:39 2005 Wed Nov 16 16:29:22 2005