UsefulAdu5Pat.h
1 
9 #ifndef USEFULADU5PAT_H
10 #define USEFULADU5PAT_H
11 
12 //Includes
13 #include <TObject.h>
14 #include <TGraph.h>
15 #include <TVector3.h>
16 #include "Adu5Pat.h"
17 #include "AnitaConventions.h"
18 #include "RampdemReader.h"
19 #include "AnitaGeomTool.h"
20 
25 namespace AnitaStaticAdu5Offsets{
26  const Double_t heading = 0;
27  const Double_t pitch = 0;
28  const Double_t roll = 0;
29 }
30 
39 class UsefulAdu5Pat: public Adu5Pat
40 {
41 
42  public:
43  UsefulAdu5Pat();
44  UsefulAdu5Pat(const Adu5Pat *patPtr);
45  ~UsefulAdu5Pat();
46 
58  int getSourceLonAndLatAtDesiredAlt(Double_t phiWave, Double_t thetaWave, Double_t &sourceLon, Double_t &sourceLat, Double_t desiredAlt);
59 
60 
61  int getSourceLonAndLatAltZero(Double_t phiWave, Double_t thetaWave, Double_t &sourceLon, Double_t &sourceLat);
62 
75  int getSourceLonAndLatAtAlt(Double_t phiWave, Double_t thetaWave, Double_t &sourceLon, Double_t &sourceLat,Double_t &sourceAltitude);
76 
80  int getSourceLonAndLatAtAlt2(Double_t phiWave, Double_t thetaWave, Double_t &sourceLon, Double_t &sourceLat,Double_t &sourceAltitude, Int_t maxLoopIter = -1, TVector3* sourcePosOptional = NULL) const;
81 
82 
83 
84  TVector3 getUnitVectorAlongThetaWavePhiWave(double thetaWave, double phiWave) const;
85 
86  int getSourceLonAndLatAtAlt3(Double_t phiWave, Double_t thetaWave, Double_t &sourceLon, Double_t &sourceLat,Double_t &sourceAltitude,
87  double* deltaAltIfNoIntersectection = NULL, bool returnBestPositionIfNoIntersection = false) const;
101  int traceBackToContinent3(Double_t phiWave, Double_t thetaWave,
102  Double_t * lon, Double_t * lat, Double_t *alt, Double_t * theta_adjustment_required) const;
103 
104 
105 
106 
107 
124  int traceBackToContinent(Double_t phiWave, Double_t thetaWave,
125  Double_t * lon, Double_t * lat, Double_t *alt, Double_t * theta_adjustment_required,
126  Double_t max_theta_adjustment = TMath::Pi()/180, Int_t max_iter = 10) const;
127 
128 
129 
130 
140  void getThetaAndPhiWave(Double_t sourceLon, Double_t sourceLat, Double_t sourceAlt, Double_t &thetaWave, Double_t &phiWave);
141 
142 
153  void getThetaAndPhiWave2(Double_t sourceLon, Double_t sourceLat, Double_t sourceAlt, Double_t &thetaWave, Double_t &phiWave, TVector3* sourcePos = NULL) const;
154 
156  void getThetaAndPhiWaveCart(TVector3 * sourcePos, Double_t & thetaWave, Double_t & phiWave) const;
157 
161  void getThetaAndPhiWaveOfRayAtInfinity(const TVector3 & p0, const TVector3 & v0 , Double_t & thetaWave, Double_t & phiWave,
162  Bool_t plus_infinity = true, Double_t eps = 0.00001 * TMath::DegToRad(), Double_t step = 10e7, TVector3 * testPosition = 0) const;
163 
170  void getThetaAndPhiWaveWaisDivide(Double_t &thetaWave, Double_t &phiWave);
171 
172 
173 
180  void getThetaAndPhiWaveLDB(Double_t &thetaWave, Double_t &phiWave);
181 
187  void getThetaWaveAtBase(Double_t baseLon, Double_t baseLat, Double_t baseAlt, Double_t &thetaWave);
188 
189 
190 
197  void getThetaAndPhiWaveWillySeavey(Double_t &thetaWave, Double_t &phiWave);
198 
199 
200  /* For a the Williams Field borehole antenna calculates the payload centric azimuthal and elevation angles of the plane wave incident at the payload.
201  * @param phiWave Reference to a Double_t in which to store the azimuthal angle of plane wave (in payload centric coordinates with phi equals zero lying in the direction the ADU5 fore antenna)
202  * @param thetaWave Reference to a Double_t in which to store the elevation angle of plane wave (in payload centric coordinates with phi equals zero lying in the direction the ADU5 fore antenna)
203  */
204  void getThetaAndPhiWaveWillyBorehole(Double_t &thetaWave,Double_t &phiWave);
205 
206 
213  void getThetaAndPhiWaveTaylorDome(Double_t &thetaWave, Double_t &phiWave);
214 
215 
216 
227  Double_t getDeltaTExpected(Int_t ant1, Int_t ant2,Double_t sourceLon, Double_t sourceLat, Double_t sourceAlt);
228 
229 
230 
238  Double_t getDeltaTExpected(Int_t ant1, Int_t ant2,Double_t phiWave, Double_t thetaWave);
239 
249  Double_t getDeltaTExpected(Int_t ant1,Int_t ant2,Double_t cosPhi,Double_t sinPhi,Double_t cosTheta,Double_t sinTheta);
250 
251 
252 
260  Double_t getDeltaTWillySeavey(Int_t ant1, Int_t ant2);
261 
262 
263 
271  Double_t getDeltaTWillyBorehole(Int_t ant1, Int_t ant2);
272 
273 
274 
282  Double_t getDeltaTTaylor(Int_t ant1, Int_t ant2);
283 
284 
285 
291  Double_t getPhiWave() const {
292  return fPhiWave;
293  }
294 
299  Double_t getThetaWave() const {
300  return fThetaWave;
301  }
302 
307  Double_t getSourceLongitude() const {
308  return fSourceLongitude;
309  }
314  Double_t getSourceLatitude() const{
315  return fSourceLatitude;
316  }
317 
322  Double_t getSourceAltitude() const {
323  return fSourceAltitude;
324  }
325 
326  UInt_t getTaylorDomeTriggerTimeNs() const;
327  UInt_t getWaisDivideTriggerTimeNs() const;
328  UInt_t getSipleTriggerTimeNs() const;
329  UInt_t getLDBTriggerTimeNs() const;
330  UInt_t getTriggerTimeNsFromSource(Double_t sourceLat, Double_t sourceLong, Double_t sourceAlt) const;
331  Double_t getDistanceFromSource(Double_t sourceLat, Double_t sourceLong, Double_t sourceAlt) const;
332  void setIncludeGroupDelay(Int_t flag){fIncludeGroupDelay=flag;}
333 
335  AnitaGeomTool * fUPGeomTool;
336 
337  Double_t getAngleBetweenPayloadAndSource(Double_t sourceLon, Double_t sourceLat, Double_t sourceAlt); //ACG additional
338  void getSunPosition(Double_t& phiDeg, Double_t& thetaDeg) const;
339  Double_t getAzimuthOfSunRelativeToNorth() const;
340  Double_t getAzimuthOfSun() const;
341  Double_t getDifferencePointingToSun(Double_t phiAngle, Bool_t inputInDegrees=true) const;
342 
343  void getThetaAndPhiWaveHiCal(Double_t& thetaWave, Double_t& phiWave);
344 
345 
356  static Double_t getReflectionAngle(Double_t plAlt, Double_t imageEl, Double_t imageAlt);
357 
367  Double_t getReflectionAngle(Double_t imageEl, Double_t imageAlt) const;
368 
369 
384  int astronomicalCoordinates(Double_t phiWave, Double_t thetaWave, Double_t * RA = 0, Double_t * dec = 0, Double_t * l = 0, Double_t * b = 0) const;
385 
386  int fromRADec (Double_t RA, Double_t dec, Double_t *phi, Double_t *theta) const;
387  int fromRADec (int N, const Double_t * RA, const Double_t * dec, Double_t *phi, Double_t *theta) const;
388 
389 
394  inline void setDebug(bool db){fDebug = db;}
395 
400  inline bool getDebug() const {return fDebug;}
401 
406  inline void setInterpSurfaceAboveGeoid(bool i){fInterpSurfaceAboveGeoid = i;} // *TOGGLE *GETTER=getInterpSurfaceAboveGeoid
411  inline bool getInterpSurfaceAboveGeoid() const {return fInterpSurfaceAboveGeoid;}
412 
418  inline void setSurfaceCloseEnoughInter(double closeEnough = 1.0){fSurfaceCloseEnoughIter = closeEnough;}
419 
424  inline double getSurfaceCloseEnoughInter() const {return fSurfaceCloseEnoughIter;}
425 
426 
432  inline void setMaxLoopIterations(Int_t n = 50){fMaxLoopIterations = n;}
433 
438  inline int getMaxLoopIterations() const {return fMaxLoopIterations;}
439 
440 
445  inline double surfaceAboveGeoid(Double_t lon, Double_t lat) const {
446  if(fInterpSurfaceAboveGeoid){
448  }
449  else{
450  return RampdemReader::SurfaceAboveGeoid(lon, lat);
451  }
452  }
453 
454 
461 
462  // mutable std::vector<TGraph*> grTests;
463 
464  private:
465  Int_t fIncludeGroupDelay;
466  TVector3 fSourcePos;
467  Double_t fSourceLongitude;
468  Double_t fSourceLatitude;
469  Double_t fSourceAltitude;
470  Double_t fThetaWave;
471  Double_t fPhiWave;
472  Double_t fBalloonCoords[3];
473  TVector3 fBalloonPos;
474  Double_t fBalloonTheta;
475  Double_t fBalloonPhi;
476  Double_t fBalloonHeight;
477  Float_t fBalloonLonCache;
478  Float_t fBalloonLatCache;
479  Float_t fBalloonAltCache;
480  Bool_t fDebug;
481  Bool_t fInterpSurfaceAboveGeoid;
482  Double_t fSurfaceCloseEnoughIter;
483  Int_t fMaxLoopIterations;
484  ClassDef(UsefulAdu5Pat,0);
485 
486  //optimisation stuff
487  Double_t getDeltaTTaylorOpt(Int_t ant1, Int_t ant2, Double_t *deltaR, Double_t *deltaZ, Double_t *deltaPhi);
488  Double_t getDeltaTExpectedOpt(Int_t ant1, Int_t ant2,Double_t sourceLon, Double_t sourceLat, Double_t sourceAlt, Double_t *deltaR, Double_t *deltaZ, Double_t *deltaPhi);
489 
490  Double_t getDeltaTSeaveyOpt(Int_t ant1, Int_t ant2, Double_t *deltaR, Double_t *deltaZ, Double_t *deltaPhi);
491  Double_t getDeltaTExpectedSeaveyOpt(Int_t ant1, Int_t ant2,Double_t sourceLon, Double_t sourceLat, Double_t sourceAlt, Double_t *deltaR, Double_t *deltaZ, Double_t *deltaPhi);
492  Double_t getGroupDelay(Double_t phiToAntBoresight);
493 
494 
501  void accountForPitchAndRollInPhiWaveThetaWave(Double_t& phiWave, Double_t& thetaWave) const;
502 
503 };
504 
505 
506 #endif //USEFULADU5PAT_H
static Double_t BilinearInterpolatedSurfaceAboveGeoid(Double_t longitude, Double_t latitude, RampdemReader::dataSet=rampdem)
Double_t getDeltaTWillyBorehole(Int_t ant1, Int_t ant2)
double getSurfaceCloseEnoughInter() const
int getSourceLonAndLatAtDesiredAlt(Double_t phiWave, Double_t thetaWave, Double_t &sourceLon, Double_t &sourceLat, Double_t desiredAlt)
Destructor.
Double_t getDifferencePointingToSun(Double_t phiAngle, Bool_t inputInDegrees=true) const
Quick way of getting difference between any azimuth phi and the sun&#39;s azimuth phi.
int getSourceLonAndLatAtAlt2(Double_t phiWave, Double_t thetaWave, Double_t &sourceLon, Double_t &sourceLat, Double_t &sourceAltitude, Int_t maxLoopIter=-1, TVector3 *sourcePosOptional=NULL) const
TVector3 getUnitVectorAlongThetaWavePhiWave(double thetaWave, double phiWave) const
static Double_t SurfaceAboveGeoid(Double_t longitude, Double_t latitude, RampdemReader::dataSet=rampdem)
Static value to which the pitch/roll variables are set in UsefulAdu5Pat, currently for ANITA-3...
static Double_t getReflectionAngle(Double_t plAlt, Double_t imageEl, Double_t imageAlt)
Currently just does direct events...
Adu5Pat – The ADU5 Position and Attitude Data.
Definition: Adu5Pat.h:26
void getThetaAndPhiWaveLDB(Double_t &thetaWave, Double_t &phiWave)
UInt_t getWaisDivideTriggerTimeNs() const
Gets the time of flight to Taylor Dome.
bool getInterpSurfaceAboveGeoid() const
void getThetaAndPhiWaveWillySeavey(Double_t &thetaWave, Double_t &phiWave)
UInt_t getTriggerTimeNsFromSource(Double_t sourceLat, Double_t sourceLong, Double_t sourceAlt) const
Gets the time of flight to LDB camp.
void setSurfaceCloseEnoughInter(double closeEnough=1.0)
bool getDebug() const
void getThetaWaveAtBase(Double_t baseLon, Double_t baseLat, Double_t baseAlt, Double_t &thetaWave)
void getThetaAndPhiWave(Double_t sourceLon, Double_t sourceLat, Double_t sourceAlt, Double_t &thetaWave, Double_t &phiWave)
RampdemReader * fRampdemReader
Toggles the silly group delay correction on and off.
void setDebug(bool db)
Double_t getThetaWave() const
UInt_t getLDBTriggerTimeNs() const
Gets the time of flight to Siple.
void setMaxLoopIterations(Int_t n=50)
double surfaceAboveGeoid(Double_t lon, Double_t lat) const
Double_t getSourceLatitude() const
UInt_t getSipleTriggerTimeNs() const
Gets the time of flight to Wais Divide.
Double_t getDeltaTExpected(Int_t ant1, Int_t ant2, Double_t sourceLon, Double_t sourceLat, Double_t sourceAlt)
void getThetaAndPhiWaveWaisDivide(Double_t &thetaWave, Double_t &phiWave)
void getThetaAndPhiWaveTaylorDome(Double_t &thetaWave, Double_t &phiWave)
Double_t getAzimuthOfSunRelativeToNorth() const
Calculates the azimuth position of the sun if ANITA was facing directly north, relies on timeOfDay...
Double_t getDeltaTTaylor(Int_t ant1, Int_t ant2)
Double_t getAzimuthOfSun() const
void getSunPosition(Double_t &phiDeg, Double_t &thetaDeg) const
Uses realTime, latitude, longitude to calculate the sun&#39;s position.
void getThetaAndPhiWaveCart(TVector3 *sourcePos, Double_t &thetaWave, Double_t &phiWave) const
~UsefulAdu5Pat()
Assignment constructor.
int getMaxLoopIterations() const
Double_t getDeltaTWillySeavey(Int_t ant1, Int_t ant2)
As UsefulAnitaEvent is to RawAnitaEvent, UsefulAdu5Pat is to Adu5Pat. Well not quite as useful but yo...
Definition: UsefulAdu5Pat.h:39
int getSourceLonAndLatAtAlt(Double_t phiWave, Double_t thetaWave, Double_t &sourceLon, Double_t &sourceLat, Double_t &sourceAltitude)
Double_t getPhiWave() const
int traceBackToContinent(Double_t phiWave, Double_t thetaWave, Double_t *lon, Double_t *lat, Double_t *alt, Double_t *theta_adjustment_required, Double_t max_theta_adjustment=TMath::Pi()/180, Int_t max_iter=10) const
Double_t getDistanceFromSource(Double_t sourceLat, Double_t sourceLong, Double_t sourceAlt) const
Gets time of flight from any source.
Double_t getSourceLongitude() const
int astronomicalCoordinates(Double_t phiWave, Double_t thetaWave, Double_t *RA=0, Double_t *dec=0, Double_t *l=0, Double_t *b=0) const
void updateCartesianBalloonInfo()
void setInterpSurfaceAboveGeoid(bool i)
void setIncludeGroupDelay(Int_t flag)
Gets distance from any source in meters.
Double_t getSourceAltitude() const
int traceBackToContinent3(Double_t phiWave, Double_t thetaWave, Double_t *lon, Double_t *lat, Double_t *alt, Double_t *theta_adjustment_required) const
void getThetaAndPhiWaveOfRayAtInfinity(const TVector3 &p0, const TVector3 &v0, Double_t &thetaWave, Double_t &phiWave, Bool_t plus_infinity=true, Double_t eps=0.00001 *TMath::DegToRad(), Double_t step=10e7, TVector3 *testPosition=0) const
void getThetaAndPhiWave2(Double_t sourceLon, Double_t sourceLat, Double_t sourceAlt, Double_t &thetaWave, Double_t &phiWave, TVector3 *sourcePos=NULL) const
AnitaGeomTool – The ANITA Geometry Tool.
Definition: AnitaGeomTool.h:48