00001
00008 class MsgStream;
00009 #include "Event/MonteCarlo/Exposure.h"
00010 #include "FluxSvc/PointingInfo.h"
00011 #include "astro/GPS.h"
00012 #include "astro/SkyDir.h"
00013 #include "astro/JulianDate.h"
00014 #include "astro/EarthCoordinate.h"
00015 #include "ntupleWriterSvc/INTupleWriterSvc.h"
00016
00017
00018
00019 void PointingInfo::set()
00020 {
00021
00022 using namespace astro;
00023
00024
00025 GPS* gps = GPS::instance();
00026 start = gps->time();
00027 CLHEP::Hep3Vector pos_km = gps->position();
00028 CLHEP::Hep3Vector location = 1.e3* pos_km;
00029
00030
00031 sc_position[0] = location.x();
00032 sc_position[1] = location.y();
00033 sc_position[2] = location.z();
00034
00035 ra_zenith = gps->zenithDir().ra();
00036 dec_zenith= gps->zenithDir().dec();
00037
00038 ra_scx = gps->xAxisDir().ra();
00039 dec_scx = gps->xAxisDir().dec();
00040
00041 ra_scz = gps->zAxisDir().ra();
00042 dec_scz = gps->zAxisDir().dec();
00043
00044 lat_geo = gps->lat();
00045 lon_geo = gps->lon();
00046
00047
00048 EarthCoordinate loc = gps->earthpos();
00049 rad_geo = loc.altitude();
00050 L=loc.L();
00051 B=loc.B();
00052 lat_mag = loc.geolat();
00053 in_saa= loc.insideSAA()? 1:0;
00054 zenith_scz = 180/M_PI* gps->zenithDir().difference(gps->zAxisDir());
00055
00056 }
00057
00058 Event::Exposure* PointingInfo::forTDS()const
00059 {
00060
00061 Event::Exposure* entry = new Event::Exposure;
00062 entry->init(start,lat_geo,lon_geo,rad_geo,
00063 sc_position[0],sc_position[1],sc_position[2],ra_scx,dec_scx,ra_scz,dec_scz);
00064 return entry;
00065
00066 }
00067
00068 void PointingInfo::finish(double stop_time, double live)
00069 {
00070 stop = stop_time;
00071 livetime = live;
00072
00073 }
00074
00075 void PointingInfo::setFT2Tuple(INTupleWriterSvc* tuple, const std::string& tname)
00076 {
00077 if( tuple==0 ) return;
00078 tuple->addItem(tname, "start", &start);
00079 tuple->addItem(tname, "stop", &stop);
00080 tuple->addItem(tname, "sc_position[3]", sc_position);
00081 tuple->addItem(tname, "lat_geo", &lat_geo);
00082 tuple->addItem(tname, "lat_mag", &lat_mag);
00083 tuple->addItem(tname, "lon_geo", &lon_geo);
00084 tuple->addItem(tname, "rad_geo", &rad_geo);
00085 tuple->addItem(tname, "ra_zenith", &ra_zenith);
00086 tuple->addItem(tname, "dec_zenith",&dec_zenith);
00087 tuple->addItem(tname, "B_McIlwain",&B);
00088 tuple->addItem(tname, "L_McIlwain",&L);
00089 tuple->addItem(tname, "ra_scz", &ra_scz);
00090 tuple->addItem(tname, "dec_scz", &dec_scz);
00091 tuple->addItem(tname, "ra_scx", &ra_scx);
00092 tuple->addItem(tname, "dec_scx", &dec_scx);
00093 tuple->addItem(tname, "in_saa", &in_saa);
00094 tuple->addItem(tname, "livetime", &livetime);
00095 }
00096
00097 void PointingInfo::setPtTuple(INTupleWriterSvc* tuple, const std::string& tname)
00098 {
00099
00114 if( tuple==0 ) return;
00115 tuple->addItem(tname, "PtTime", &start);
00116 tuple->addItem(tname, "PtPos[3]", sc_position);
00117 tuple->addItem(tname, "PtLat", &lat_geo);
00118 tuple->addItem(tname, "PtLon", &lon_geo);
00119 tuple->addItem(tname, "PtMagLat", &lat_mag);
00120 tuple->addItem(tname, "PtAlt", &rad_geo);
00121 tuple->addItem(tname, "PtRaz", &ra_scz);
00122 tuple->addItem(tname, "PtDecz", &dec_scz);
00123 tuple->addItem(tname, "PtRax", &ra_scx);
00124 tuple->addItem(tname, "PtDecx", &dec_scx);
00125 tuple->addItem(tname, "PtSCzenith", &zenith_scz);
00126 tuple->addItem(tname, "PtMcIlwainB", &B);
00127 tuple->addItem(tname, "PtMcIlwainL", &L);
00128
00129 }