CelestialLocator_service.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file CelestialLocator.cxx
3 /// \brief
4 /// \author serdar@fnal.org
5 /// \Updated by atsaris@fnal.gov
6 ////////////////////////////////////////////////////////////////////////
7 
9 
10 #include <sys/stat.h>
11 #include <sstream>
12 
17 
19 
20 namespace locator
21 {
22  //......................................................................
25  :
26  fLocate(FindEphemerisFile()),
27  fRndmTable(0)
28  {
29  this->reconfigure(pset);
31  }
32 
33  //......................................................................
35  {
36  delete fRndmTable;
37  }
38 
39 
41 
42  cet::search_path sp("FW_SEARCH_PATH");
43  std::string random_mode = pset.get< std::string>("RndmTable_Mode");
44  if (random_mode == "default") fLocatorMode = 0;
45  else fLocatorMode =1;
46  fhicl::ParameterSet fPSetFiles = pset.get<fhicl::ParameterSet>(random_mode);
47 
48  sp.find_file(fPSetFiles.get< std::string >("ObjectName"), fTableFilenameFD);
49 
50  if(fTableFilenameFD.empty()){
51  std::cout << "The locator file is empty" << std::endl;
52  exit(-1);
53  }
54 
55  }
56 
58  {
59  cet::search_path sp("FW_SEARCH_PATH");
60  std::string ephemerisFname;
61  sp.find_file(("CelestialLocator/novas/JPLEPH"), ephemerisFname);
62  assert(!ephemerisFname.empty());
63  return ephemerisFname;
64  }
65 
66  void CelestialLocator::GetCelestialPosition_FD(int objectID, time_t time, double& zen, double& azi)
67  {
68  throw std::string("This function needs to be implemented.");
69  }
70 
71  void CelestialLocator::GetMoonPosition_FD(time_t t, double& zen, double& azi)
72  {
73  fLocate.GetMoonPosition(t, zen, azi);
74  }
75 
76  void CelestialLocator::GetSunPosition_FD(time_t t, double& zen, double& azi)
77  {
78  fLocate.GetSunPosition(t, zen, azi);
79  }
80 
82  double& zen, double& azi)
83  {
84  fRndmTable->TNS(t, tR);
85  fLocate.GetSunPosition(tR, zen, azi);
86 
87  }
88 
89  void CelestialLocator::GetRaDec(const double zen, const double azi,
90  const time_t time, double & ra,
91  double & dec)
92  {
93  fLocate.GetRaDec(zen, azi, shadow::NOVASLocate::JulianDate(time), ra, dec);
94  }
95 
96  void CelestialLocator::GetTrackRaDec(const TVector3 & trkdir,
97  const time_t time, double & ra,
98  double & dec)
99  {
100  fLocate.GetTrackRaDec(trkdir, shadow::NOVASLocate::JulianDate(time), ra, dec);
101  }
102 
104  {
105  fLocate.SetDetector(det);
106  }
107 
109 } // end namespace geo
110 ////////////////////////////////////////////////////////////////////////
void SetDetector(const novadaq::cnv::DetId det)
void GetTrackRaDec(const TVector3 &trkdir, const time_t time, double &ra, double &dec)
void TNS(struct timespec ts, time_t &tRU) const
Definition: RndmLocator.cxx:46
void GetCelestialPosition_FD(int objectID, time_t time, double &zen, double &azi)
#define DEFINE_ART_SERVICE(svc)
Definition: ServiceMacros.h:93
void GetMoonPosition_FD(time_t time, double &zen, double &azi)
std::string FindEphemerisFile() const
std::string find_file(std::string const &filename) const
void SetDetector(const novadaq::cnv::DetId det)
Locate positions of celestial bodies.
void reconfigure(fhicl::ParameterSet const &pset)
void GetMoonPosition(time_t t, double &zen, double &azi)
void GetTrackRaDec(const TVector3 &trkdir, double jd_utc, double &ra, double &dec)
T get(std::string const &key) const
Definition: ParameterSet.h:231
void GetSunPosition_FD(time_t time, double &zen, double &azi)
static double JulianDate(time_t t)
OStream cout
Definition: OStream.cxx:6
void GetSunPosition(time_t t, double &zen, double &azi)
shadow::NOVASLocate fLocate
RndmLocatorTable * fRndmTable
Detector geometry information.
void GetRaDec(const double zen, const double azi, double jd_utc, double &ra, double &dec)
CelestialLocator(fhicl::ParameterSet const &pset, art::ActivityRegistry &reg)
exit(0)
assert(nhit_max >=nhit_nbins)
void GetRndmSunPosition_FD(struct timespec t, double &zen, double &azi)
void GetRaDec(const double zen, const double azi, const time_t time, double &ra, double &dec)
enum BeamMode string