neic-glass3  1.4.6
Pick.h
Go to the documentation of this file.
1 /*****************************************
2  * This file is documented for Doxygen.
3  * If you modify this file please update
4  * the comments so that Doxygen will still
5  * be able to work.
6  ****************************************/
7 #ifndef PICK_H
8 #define PICK_H
9 
10 #include <json.h>
11 #include <memory>
12 #include <string>
13 #include <vector>
14 #include <mutex>
15 #include <atomic>
16 
17 namespace glasscore {
18 
19 // forward declarations
20 class CSite;
21 class CHypo;
22 class CSiteList;
23 class CPickList;
24 
45 class CPick {
46  public:
53  CPick();
54 
70  CPick(std::shared_ptr<CSite> pickSite, double pickTime,
71  std::string pickIdString, double backAzimuth, double slowness);
72 
109  CPick(std::shared_ptr<CSite> pickSite, double pickTime,
110  std::string pickIdString, std::string source, double backAzimuth,
111  double slowness, std::string phase, double phaseProb, double distance,
112  double distanceProb, double azimuth, double azimuthProb,
113  double depth, double depthProb, double magnitude,
114  double magnitudeProb);
115 
129  CPick(std::shared_ptr<json::Object> pick, CSiteList *pSiteList);
130 
134  ~CPick();
135 
139  void clear();
140 
177  bool initialize(std::shared_ptr<CSite> pickSite, double pickTime,
178  std::string pickIdString, std::string source,
179  double backAzimuth, double slowness, std::string phase,
180  double phaseProb, double distance, double distanceProb,
181  double azimuth, double azimuthProb, double depth,
182  double depthProb, double magnitude, double magnitudeProb);
183 
201  void addHypoReference(std::shared_ptr<CHypo> hyp, bool force = false);
202 
215  void removeHypoReference(std::shared_ptr<CHypo> hyp);
216 
228  void removeHypoReference(std::string pid);
229 
242  bool nucleate(CPickList* parentThread);
243 
249  double getBackAzimuth() const;
250 
256  double getSlowness() const;
257 
262  const std::shared_ptr<json::Object>& getJSONPick() const;
263 
273  const std::shared_ptr<CHypo> getHypoReference() const;
274 
280  const std::shared_ptr<CSite> getSite() const;
281 
286  const std::string& getPhaseName() const;
287 
292  const std::string& getID() const;
293 
298  double getTPick() const;
299 
304  void setTPick(double tPick);
305 
311  double getTSort() const;
312 
318  void setTSort(double newTSort);
319 
325  double getTInsertion() const;
326 
332  double getTFirstAssociation() const;
333 
339  double getTNucleation() const;
340 
345  const std::string& getClassifiedPhase() const;
346 
351  double getClassifiedPhaseProbability() const;
352 
357  double getClassifiedDistance() const;
358 
364  double getClassifiedDistanceProbability() const;
365 
370  double getClassifiedAzimuth() const;
371 
377  double getClassifiedAzimuthProbability() const;
378 
383  double getClassifiedDepth() const;
384 
390  double getClassifiedDepthProbability() const;
391 
396  double getClassifiedMagnitude() const;
397 
403  double getClassifiedMagnitudeProbability() const;
404 
409  const std::string& getSource() const;
410 
411  protected:
421  void clearHypoReference();
422 
426  void setTFirstAssociation();
427 
431  void setTNucleation();
432 
433  private:
441  std::weak_ptr<CSite> m_wpSite;
442 
449  std::weak_ptr<CHypo> m_wpHypo;
450 
454  std::string m_sPhaseName;
455 
459  std::string m_sID;
460 
464  std::string m_sSource;
465 
469  std::atomic<double> m_dBackAzimuth;
470 
474  std::atomic<double> m_dSlowness;
475 
479  std::atomic<double> m_tPick;
480 
484  std::string m_sClassifiedPhase;
485 
490  std::atomic<double> m_dClassifiedPhaseProbability;
491 
495  std::atomic<double> m_dClassifiedDistance;
496 
501  std::atomic<double> m_dClassifiedDistanceProbability;
502 
506  std::atomic<double> m_dClassifiedAzimuth;
507 
512  std::atomic<double> m_dClassifiedAzimuthProbability;
513 
517  std::atomic<double> m_dClassifiedDepth;
518 
523  std::atomic<double> m_dClassifiedDepthProbability;
524 
528  std::atomic<double> m_dClassifiedMagnitude;
529 
534  std::atomic<double> m_dClassifiedMagnitudeProbability;
535 
541  std::shared_ptr<json::Object> m_JSONPick;
542 
553  std::atomic<double> m_tSort;
554 
558  std::atomic<double> m_tInsertion;
559 
564  std::atomic<double> m_tFirstAssociation;
565 
570  std::atomic<double> m_tNucleation;
571 
579  mutable std::recursive_mutex m_PickMutex;
580 
581  // constants
585  static const unsigned int k_nNucleateAnnealPasses = 3;
586 
590  static const unsigned int k_nNucleateNumberOfAnnealIterations = 20000;
591 
595  static constexpr double k_dNucleateInitialAnnealTimeStepSize = 10.0;
596 
600  static constexpr double k_dNucleateFinalAnnealTimeStepSize = 0.1;
601 };
602 } // namespace glasscore
603 #endif // PICK_H
const std::string & getID() const
Get the ID of this pick.
Definition: Pick.cpp:858
double getSlowness() const
Get the optional slowness related to this pick.
Definition: Pick.cpp:869
glasscore pick list class
Definition: PickList.h:62
double getBackAzimuth() const
Get the optional back azimuth related to this pick.
Definition: Pick.cpp:864
double getClassifiedMagnitude() const
Get the classified magnitude for this pick.
Definition: Pick.cpp:960
void clearHypoReference()
Remove hypo reference to this pick.
Definition: Pick.cpp:533
void clear()
CPick clear function.
Definition: Pick.cpp:411
void setTPick(double tPick)
Set the arrival time for this pick.
Definition: Pick.cpp:879
glasscore site list class
Definition: SiteList.h:40
CPick()
CPick default constructor.
Definition: Pick.cpp:31
void removeHypoReference(std::shared_ptr< CHypo > hyp)
Remove hypo reference to this pick.
Definition: Pick.cpp:505
bool nucleate(CPickList *parentThread)
Attempt to nucleate new hypo based on the addition of this pick.
Definition: Pick.cpp:539
double getTInsertion() const
Get the insertion time for this pick.
Definition: Pick.cpp:894
void setTSort(double newTSort)
Set the sorting time for this pick.
Definition: Pick.cpp:889
const std::shared_ptr< CSite > getSite() const
Get the site for this pick.
Definition: Pick.cpp:846
double getClassifiedMagnitudeProbability() const
Get the classified magnitude probability for this pick.
Definition: Pick.cpp:965
bool initialize(std::shared_ptr< CSite > pickSite, double pickTime, std::string pickIdString, std::string source, double backAzimuth, double slowness, std::string phase, double phaseProb, double distance, double distanceProb, double azimuth, double azimuthProb, double depth, double depthProb, double magnitude, double magnitudeProb)
CPick initialization function.
Definition: Pick.cpp:441
double getTNucleation() const
Get the nucleation time for this pick.
Definition: Pick.cpp:909
double getClassifiedPhaseProbability() const
Get the classified phase probability for this pick.
Definition: Pick.cpp:925
void setTNucleation()
Set the nucleation time for this pick to Now.
Definition: Pick.cpp:914
double getClassifiedDepth() const
Get the classified depth for this pick.
Definition: Pick.cpp:950
glasscore pick class
Definition: Pick.h:45
const std::shared_ptr< CHypo > getHypoReference() const
Get the current hypo referenced by this pick.
Definition: Pick.cpp:840
double getClassifiedDepthProbability() const
Get the classified depth probability for this pick.
Definition: Pick.cpp:955
const std::shared_ptr< json::Object > & getJSONPick() const
Get input JSON pick message.
Definition: Pick.cpp:834
void addHypoReference(std::shared_ptr< CHypo > hyp, bool force=false)
Add hypo reference to this pick.
Definition: Pick.cpp:482
void setTFirstAssociation()
Set the first-assoc time for this pick to Now.
Definition: Pick.cpp:904
const std::string & getPhaseName() const
Get the phase name for this pick.
Definition: Pick.cpp:852
double getTSort() const
Get the sorting time for this pick.
Definition: Pick.cpp:884
double getClassifiedDistanceProbability() const
Get the classified distance probability for this pick.
Definition: Pick.cpp:935
double getTFirstAssociation() const
Get the first assoc time for this pick.
Definition: Pick.cpp:899
double getClassifiedAzimuth() const
Get the classified azimuth for this pick.
Definition: Pick.cpp:940
~CPick()
CPick destructor.
Definition: Pick.cpp:407
The namespace containing the core algorithm.
Definition: Correlation.h:17
const std::string & getSource() const
Get the source for this pick.
Definition: Pick.cpp:970
double getTPick() const
Get the arrival time for this pick.
Definition: Pick.cpp:874
double getClassifiedDistance() const
Get the classified distance for this pick.
Definition: Pick.cpp:930
double getClassifiedAzimuthProbability() const
Get the classified azimuth probability for this pick.
Definition: Pick.cpp:945
const std::string & getClassifiedPhase() const
Get the classified phase for this pick.
Definition: Pick.cpp:919