neic-glass3  1.4.6
Glass.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 GLASS_H
8 #define GLASS_H
9 
10 #include <json.h>
11 #include <TTT.h>
12 #include <TravelTime.h>
13 #include <string>
14 #include <memory>
15 #include <atomic>
16 #include <vector>
17 namespace glasscore {
18 
19 // forward declarations
20 class CWebList;
21 class CSiteList;
22 class CPickList;
23 class CHypoList;
24 class CDetection;
25 class CCorrelationList;
26 struct IGlassSend;
27 
48 class CGlass {
49  public:
57  CGlass();
58 
65  ~CGlass();
66 
71  static void clear();
72 
89  static bool receiveExternalMessage(std::shared_ptr<json::Object> com);
90 
103  static bool sendExternalMessage(std::shared_ptr<json::Object> com);
104 
113  static void setExternalInterface(glasscore::IGlassSend *newSend);
114 
130  static bool initialize(std::shared_ptr<json::Object> com);
131 
137  static bool healthCheck();
138 
145  static double getBeamMatchingAzimuthWindow();
146 
153  static double getBeamMatchingDistanceWindow();
154 
162  static int getCorrelationCancelAge();
163 
170  static double getCorrelationMatchingTimeWindow();
171 
178  static double getCorrelationMatchingDistanceWindow();
179 
186  static double getHypoMergingTimeWindow();
187 
194  static double getHypoMergingDistanceWindow();
195 
201  static double getDistanceCutoffFactor();
202 
208  static double getMinDistanceCutoff();
209 
215  static double getDistanceCutoffRatio();
216 
222  static double getReportingStackThreshold();
223 
229  static double getNucleationStackThreshold();
230 
236  static double getPickAffinityExpFactor();
237 
244  static bool getGraphicsOut();
245 
251  static const std::string& getGraphicsOutFolder();
252 
257  static double getGraphicsStepKm();
258 
263  static int getGraphicsSteps();
264 
270  static int getProcessLimit();
271 
278  static bool getMinimizeTTLocator();
279 
286  static void setMinimizeTTLocator(bool use);
287 
293  static int getNumStationsPerNode();
294 
300  static int getNucleationDataCountThreshold();
301 
307  static int getReportingDataThreshold();
308 
315  static double getPickDuplicateTimeWindow();
316 
324  static double getAssociationSDCutoff();
325 
333  static double getPruningSDCutoff();
334 
341  static double getNonLocatingPhaseCutoffFactor();
342 
348  static double getTeleseismicDistanceLimit();
349 
356 
362  static bool getTestLocator();
363 
368  static bool getTestTravelTimes();
369 
374  static int getMaxNumPicks();
375 
380  static void setMaxNumPicks(int max);
381 
386  static int getMaxNumCorrelations();
387 
392  static void setMaxNumCorrelations(int max);
393 
399  static void setMaxNumPicksPerSite(int max);
400 
405  static int getMaxNumHypos();
406 
411  static void setMaxNumHypos(int max);
412 
417  static double getEventFragmentDepthThreshold();
418 
423  static double getEventFragmentAzimuthThreshold();
424 
429  static bool getAllowPickUpdates();
430 
436  static double getPickNoiseClassificationThreshold();
437 
443  static double getPickPhaseClassificationThreshold();
444 
451 
455  static double getDistanceClassUpperBound(double distClass);
456 
460  static double getDistanceClassLowerBound(double distClass);
461 
468 
474 
480 
487 
492  static CHypoList* getHypoList();
493 
498  static CPickList* getPickList();
499 
504  static CSiteList* getSiteList();
505 
510  static CWebList* getWebList();
511 
517  static std::shared_ptr<traveltime::CTravelTime>& getDefaultNucleationTravelTime(); // NOLINT
518 
524  static std::shared_ptr<traveltime::CTTT>& getAssociationTravelTimes();
525 
526  // constants
531  static const int iMaxQueueLenPerThreadFactor = 10;
532 
537  static constexpr double k_dAssociationSecondsPerSigma = 1.0;
538 
543  static constexpr double k_dNucleationSecondsPerSigma = 5.0;
544 
548  static constexpr double k_dMaximumDepth = 800.0;
549 
550  private:
557  static std::atomic<int> m_iNucleationDataCountThreshold;
558 
565  static std::atomic<double> m_dNucleationStackThreshold;
566 
573  static std::atomic<int> m_iNumStationsPerNode;
574 
580  static std::atomic<double> m_dAssociationSDCutoff;
581 
587  static std::atomic<double> m_dPruningSDCutoff;
588 
594  static std::atomic<double> m_dNonLocatingPhaseCutoffFactor;
595 
599  static std::atomic<double> m_dTeleseismicDistanceLimit;
600 
604  static std::atomic<int> m_iTeleseismicPhaseCountThreshold;
605 
610  static std::atomic<double> m_dPickAffinityExpFactor;
611 
616  static std::atomic<double> m_dDistanceCutoffFactor;
617 
622  static std::atomic<double> m_dDistanceCutoffRatio;
623 
627  static std::atomic<double> m_dMinDistanceCutoff;
628 
633  static std::atomic<int> m_iMaxNumPicks;
634 
639  static std::atomic<int> m_iMaxNumCorrelations;
640 
645  static std::atomic<int> m_iMaxNumHypos;
646 
651  static std::atomic<double> m_dPickDuplicateTimeWindow;
652 
658  static std::atomic<double> m_dCorrelationMatchingTimeWindow;
659 
665  static std::atomic<double> m_dCorrelationMatchingDistanceWindow;
666 
671  static std::atomic<double> m_dHypoMergingTimeWindow;
672 
677  static std::atomic<double> m_dHypoMergingDistanceWindow;
678 
682  static std::atomic<int> m_iCorrelationCancelAge;
683 
688  static std::atomic<double> m_dBeamMatchingAzimuthWindow;
689 
694  static std::atomic<double> m_dBeamMatchingDistanceWindow;
695 
699  static std::atomic<bool> m_bTestTravelTimes;
700 
704  static std::atomic<bool> m_bTestLocator;
705 
709  static std::atomic<bool> m_bGraphicsOut;
710 
714  static std::string m_sGraphicsOutFolder;
715 
719  static std::atomic<double> m_dGraphicsStepKM;
720 
724  static std::atomic<int> m_iGraphicsSteps;
725 
730  static std::atomic<int> m_iProcessLimit;
731 
736  static std::atomic<bool> m_bMinimizeTTLocator;
737 
741  static std::atomic<int> m_iReportingDataThreshold;
742 
747  static std::atomic<double> m_dReportingStackThreshold;
748 
753  static std::atomic<double> m_dEventFragmentDepthThreshold;
754 
759  static std::atomic<double> m_dEventFragmentAzimuthThreshold;
760 
765  static std::atomic<bool> m_bAllowPickUpdates;
766 
771  static std::atomic<double> m_dPickNoiseClassificationThreshold;
772 
778  static std::atomic<double> m_dPickPhaseClassificationThreshold;
779 
785  static std::atomic<double> m_dPickDistanceClassificationThreshold;
786 
790  static std::vector<double> m_dPickDistClassificationClasses;
791 
796  static std::vector<double> m_dPickDistClassificationClassesUpperBound;
797 
802  static std::vector<double> m_dPickDistClassificationClassesLowerBound;
803 
809  static std::atomic<double> m_dPickAzimuthClassificationThreshold;
810 
815  static std::atomic<double> m_dPickAzimuthClassificationUncertainty;
816 
821  static glasscore::IGlassSend *m_pExternalInterface;
822 
826  static CWebList * m_pWebList;
827 
832  static CSiteList * m_pSiteList;
833 
839  static CPickList * m_pPickList;
840 
845  static CHypoList * m_pHypoList;
846 
851  static CCorrelationList * m_pCorrelationList;
852 
857  static CDetection * m_pDetectionProcessor;
858 
863  static std::shared_ptr<traveltime::CTravelTime> m_pDefaultNucleationTravelTime;
864 
869  static std::shared_ptr<traveltime::CTTT> m_pAssociationTravelTimes;
870 
874  static std::mutex m_TTTMutex;
875 
876  // constants
880  static const unsigned int k_nRangeArraySize = 4;
881 
885  static const unsigned int k_iTaperUpStart = 0;
886 
890  static const unsigned int k_iFullStart = 1;
891 
895  static const unsigned int k_iFullEnd = 2;
896 
900  static const unsigned int k_iTaperDownEnd = 3;
901 
905  static const unsigned int k_nAssocArraySize = 2;
906 
910  static const unsigned int k_iAssocRangeStart = 0;
911 
915  static const unsigned int k_iAssocRangeEnd = 1;
916 
920  static const unsigned int k_DefaultNumNucleationThreads = 5;
921 
925  static const unsigned int k_DefaultNumHypoThreads = 3;
926 
930  static const unsigned int k_DefaultNumWebThreads = 0;
931 
935  static const int k_nParamDisabled = -1;
936 
940  static const int k_DefaultHoursWithoutPicking = k_nParamDisabled;
941 
945  static const int k_DefaultHoursBeforeLookingUp = k_nParamDisabled;
946 
950  static const int k_DefaultMaxPicksPerHour = k_nParamDisabled;
951 };
952 } // namespace glasscore
953 #endif // GLASS_H
static std::shared_ptr< traveltime::CTTT > & getAssociationTravelTimes()
Gets the list of association travel times.
Definition: Glass.cpp:1719
static void setMaxNumPicksPerSite(int max)
Set the maximum number of picks to store with a site.
static double getPickAzimuthClassificationUncertainty()
Gets the optional uncertainty used for accepting the classification of a pick Azimuth by an external ...
Definition: Glass.cpp:1790
glasscore pick list class
Definition: PickList.h:62
static int getCorrelationCancelAge()
Gets the correlation cancel age used to determine when a hypo created by a correlation can be cancele...
Definition: Glass.cpp:1537
static const std::string & getGraphicsOutFolder()
Gets a string indicating the desired graphics output folder.
Definition: Glass.cpp:1597
static int getMaxNumCorrelations()
Get the maximum number of correlations to store in glass.
Definition: Glass.cpp:1653
static bool sendExternalMessage(std::shared_ptr< json::Object > com)
CGlass communication sending function.
Definition: Glass.cpp:206
static int getMaxNumPicks()
Get the maximum number of picks to store in glass.
Definition: Glass.cpp:1643
static double getPickDistanceClassificationThreshold()
Gets the optional threshold used for accepting the classification of a pick Distance by an external a...
Definition: Glass.cpp:1780
static double getNonLocatingPhaseCutoffFactor()
Gets the multiplicative factor used to expand the SD cutoff to keep data associated to a hypocenter w...
Definition: Glass.cpp:1740
static int getProcessLimit()
Gets the maximum number of times a hypocenter can reprocess without new data being associated to it...
Definition: Glass.cpp:1613
static double getBeamMatchingAzimuthWindow()
Gets the azimuth window used to determine whether a beam can be matched with an existing hypo...
Definition: Glass.cpp:1527
static constexpr double k_dAssociationSecondsPerSigma
The seconds per sigma value used for association, intentionally a tighter sigma value than nucleation...
Definition: Glass.h:537
glasscore site list class
Definition: SiteList.h:40
static void setMaxNumHypos(int max)
Set the maximum number of hypos to store in glass.
Definition: Glass.cpp:1668
static CWebList * getWebList()
Gets a pointer to the Web list.
Definition: Glass.cpp:1725
static double getCorrelationMatchingDistanceWindow()
Gets the distance window used to determine whether a correlation can be matched with an existing hypo...
Definition: Glass.cpp:1547
static double getPickAzimuthClassificationThreshold()
Gets the optional threshold used for accepting the classification of a pick Azimuth by an external al...
Definition: Glass.cpp:1785
static bool getTestTravelTimes()
Gets a flag indicating whether to test travel times.
Definition: Glass.cpp:1760
static int getGraphicsSteps()
Gets the number steps used in generating graphic output files.
Definition: Glass.cpp:1608
static double getTeleseismicDistanceLimit()
Gets the distance limit in degrees used to designate a phase as teleseismic.
Definition: Glass.cpp:1745
static double getPruningSDCutoff()
Gets the cutoff threshold in terms of number of standard deviations for pruning data (eg...
Definition: Glass.cpp:1735
glasscore interface class
Definition: Glass.h:48
static double getDistanceClassUpperBound(double distClass)
Gets the upper distance bound for a given distance class.
Definition: Glass.cpp:1795
static int getReportingDataThreshold()
Gets the minimum number of data required to report an event.
Definition: Glass.cpp:1638
static void setMaxNumPicks(int max)
Set the maximum number of picks to store in glass.
Definition: Glass.cpp:1648
static int getMaxNumHypos()
Get the maximum number of hypos to store in glass.
Definition: Glass.cpp:1663
static double getDistanceCutoffFactor()
Gets the factor used in calculating the association distance cutoff factor for pick data...
Definition: Glass.cpp:1562
glasscore detection node class The detection fabric consists of a collection of nets which in turn co...
Definition: WebList.h:32
glasscore detection class
Definition: Detection.h:29
static bool initialize(std::shared_ptr< json::Object > com)
CGlass initialization function.
Definition: Glass.cpp:270
static void clear()
CGlass clear function.
Definition: Glass.cpp:221
static bool receiveExternalMessage(std::shared_ptr< json::Object > com)
CGlass communication receiving function.
Definition: Glass.cpp:146
static CSiteList * getSiteList()
Gets a pointer to the Site list.
Definition: Glass.cpp:1708
static CHypoList * getHypoList()
Gets a pointer to the Hypo list.
Definition: Glass.cpp:1693
static CPickList * getPickList()
Gets a pointer to the Pick list.
Definition: Glass.cpp:1703
static double getEventFragmentAzimuthThreshold()
Gets the azimuth threshold used for declaring a hypo an event fragment, in combination with m_dEventF...
Definition: Glass.cpp:1678
static double getAssociationSDCutoff()
Gets the cutoff threshold in terms of number of standard deviations for associating data (eg...
Definition: Glass.cpp:1730
static double getDistanceClassLowerBound(double distClass)
Gets the lower distance bound for a given distance class.
Definition: Glass.cpp:1805
static std::shared_ptr< traveltime::CTravelTime > & getDefaultNucleationTravelTime()
Gets the default nucleation travel time.
Definition: Glass.cpp:1713
static int getNucleationDataCountThreshold()
Gets the minimum number of data required to nucleate an event.
Definition: Glass.cpp:1633
static bool getAllowPickUpdates()
Gets a boolean flag indicating whether to allow picks in the pick list to be updated.
Definition: Glass.cpp:1765
CGlass()
CGlass constructor.
Definition: Glass.cpp:109
static double getNucleationStackThreshold()
Gets the minimum bayesian stack threshold required to nucleate an event.
Definition: Glass.cpp:1582
static double getHypoMergingDistanceWindow()
Gets the distance window used to determine whether a hypo could be merged with an existing hypo...
Definition: Glass.cpp:1557
static double getBeamMatchingDistanceWindow()
Gets the distance window used to determine whether a beam can be matched with an existing hypo...
Definition: Glass.cpp:1532
static double getEventFragmentDepthThreshold()
Gets the depth threshold used for declaring a hypo an event fragment, in combination with m_dEventFra...
Definition: Glass.cpp:1673
static bool healthCheck()
check to see if each thread is still functional
Definition: Glass.cpp:1496
static void setMaxNumCorrelations(int max)
Set the maximum number of correlations to store in glass.
Definition: Glass.cpp:1658
static void setExternalInterface(glasscore::IGlassSend *newSend)
Sets the IGlassSend interface pointer used to send communication (such as output data), to outside the glasscore library.
Definition: Glass.cpp:201
static double getHypoMergingTimeWindow()
Gets the time window used to determine whether a hypo could be merged with an existing hypo...
Definition: Glass.cpp:1552
glasscore hypocenter list class
Definition: HypoList.h:67
static double getPickAffinityExpFactor()
Gets the exponential pick affinity factor used in association.
Definition: Glass.cpp:1587
static CCorrelationList * getCorrelationList()
Gets a pointer to the Correlation list.
Definition: Glass.cpp:1683
static double getGraphicsStepKm()
Get the size of the step used in generating graphic output files.
Definition: Glass.cpp:1603
static bool getTestLocator()
Gets a flag indicating whether to output locator testing files.
Definition: Glass.cpp:1755
static double getDistanceCutoffRatio()
Gets the percentage used in calculating the association distance cutoff factor for pick data...
Definition: Glass.cpp:1572
static constexpr double k_dMaximumDepth
The maximum allowed depth.
Definition: Glass.h:548
~CGlass()
CGlass destructor.
Definition: Glass.cpp:124
glasscore messaging interface
Definition: IGlassSend.h:31
static const int iMaxQueueLenPerThreadFactor
The factor used to scale thread count to implement maximum queue lengths for processing.
Definition: Glass.h:531
static double getMinDistanceCutoff()
Gets the minimum allowed association distance cutoff.
Definition: Glass.cpp:1567
static void setMinimizeTTLocator(bool use)
Sets a flag indicating whether to use the minimizing travel time locator.
Definition: Glass.cpp:1623
static int getTeleseismicPhaseCountThreshold()
Gets the teleseismic phase count threshold.
Definition: Glass.cpp:1750
static double getPickNoiseClassificationThreshold()
Gets the optional threshold used for accepting the classification of a pick as noise by an external a...
Definition: Glass.cpp:1770
glasscore correlation list class
Definition: CorrelationList.h:54
static double getReportingStackThreshold()
Gets the minimum bayesian stack threshold needed to report a hypo out of glass.
Definition: Glass.cpp:1577
static CDetection * getDetectionProcessor()
Gets a pointer to the CDetection object used to process detections made external to glasscore...
Definition: Glass.cpp:1688
static double getPickDuplicateTimeWindow()
Gets the time window used when checking whether an input pick is a duplicate of a pick already in the...
Definition: Glass.cpp:1698
static double getPickPhaseClassificationThreshold()
Gets the optional threshold used for accepting the classification of a pick phase by an external algo...
Definition: Glass.cpp:1775
The namespace containing the core algorithm.
Definition: Correlation.h:17
static int getNumStationsPerNode()
Get the maximum number of sites link to a node.
Definition: Glass.cpp:1628
static double getCorrelationMatchingTimeWindow()
Gets the time window used to determine whether a correlation can be matched with an existing hypo...
Definition: Glass.cpp:1542
static constexpr double k_dNucleationSecondsPerSigma
The seconds per sigma value used for nucleation, intentionally a looser sigma value than association...
Definition: Glass.h:543
static bool getGraphicsOut()
Gets a flag indicating whether to produce graphics files for location tuning.
Definition: Glass.cpp:1592
static bool getMinimizeTTLocator()
Gets a flag indicating whether to use the minimizing travel time locator.
Definition: Glass.cpp:1618