/******************************************************************************/ /* */ /* COINCIDENCEEVENTCRITERIA.HH */ /* */ /******************************************************************************/ // Shourov K. Chatterji // shourov@ligo.mit.edu // 2004-Sep-27 /* Protect against double inclusion */ /* -------------------------------- */ #ifndef COINCIDENTEVENTCRITERIA_HH #define COINCIDENTEVENTCRITERIA_HH /* Include header files */ /* -------------------- */ #include #include "event.hh" #include "segment.hh" #include "coincidentevent.hh" /* Begin namespace event */ /* --------------------- */ namespace event { /* Coincident Event Sort Criteria */ /* ------------------------------ */ // base class for coincident event sort criteria struct CoincidentEventSortCriterion : public std::binary_function { CoincidentEventSortCriterion() {} virtual ~CoincidentEventSortCriterion() {} virtual bool operator()(const CoincidentEvent& coincidentEvent1, const CoincidentEvent& coincidentEvent2) = 0; }; // sort coincident events by increasing center time struct IncreasingCoincidentEventCenterTimeSortCriterion : public CoincidentEventSortCriterion { bool operator()(const CoincidentEvent& coincidentEvent1, const CoincidentEvent& coincidentEvent2) { return coincidentEvent1.getCenterTime() < coincidentEvent2.getCenterTime(); } }; // sort coincident events by decreasing center time struct DecreasingCoincidentEventCenterTimeSortCriterion : public CoincidentEventSortCriterion { bool operator()(const CoincidentEvent& coincidentEvent1, const CoincidentEvent& coincidentEvent2) { return coincidentEvent1.getCenterTime() > coincidentEvent2.getCenterTime(); } }; // sort coincident events by increasing center frequency struct IncreasingCoincidentEventCenterFrequencySortCriterion : public CoincidentEventSortCriterion { bool operator()(const CoincidentEvent& coincidentEvent1, const CoincidentEvent& coincidentEvent2) { return coincidentEvent1.getCenterFrequency() < coincidentEvent2.getCenterFrequency(); } }; // sort coincident events by decreasing center frequency struct DecreasingCoincidentEventCenterFrequencySortCriterion : public CoincidentEventSortCriterion { bool operator()(const CoincidentEvent& coincidentEvent1, const CoincidentEvent& coincidentEvent2) { return coincidentEvent1.getCenterFrequency() > coincidentEvent2.getCenterFrequency(); } }; // sort coincident events by increasing duration struct IncreasingCoincidentEventDurationSortCriterion : public CoincidentEventSortCriterion { bool operator()(const CoincidentEvent& coincidentEvent1, const CoincidentEvent& coincidentEvent2) { return coincidentEvent1.getDuration() < coincidentEvent2.getDuration(); } }; // sort coincident events by decreasing duration struct DecreasingCoincidentEventDurationSortCriterion : public CoincidentEventSortCriterion { bool operator()(const CoincidentEvent& coincidentEvent1, const CoincidentEvent& coincidentEvent2) { return coincidentEvent1.getDuration() > coincidentEvent2.getDuration(); } }; // sort coincident events by increasing bandwidth struct IncreasingCoincidentEventBandwidthSortCriterion : public CoincidentEventSortCriterion { bool operator()(const CoincidentEvent& coincidentEvent1, const CoincidentEvent& coincidentEvent2) { return coincidentEvent1.getBandwidth() < coincidentEvent2.getBandwidth(); } }; // sort coincident events by decreasing bandwidth struct DecreasingCoincidentEventBandwidthSortCriterion : public CoincidentEventSortCriterion { bool operator()(const CoincidentEvent& coincidentEvent1, const CoincidentEvent& coincidentEvent2) { return coincidentEvent1.getBandwidth() > coincidentEvent2.getBandwidth(); } }; // sort coincident events by increasing normalized energy struct IncreasingCoincidentEventNormalizedEnergySortCriterion : public CoincidentEventSortCriterion { bool operator()(const CoincidentEvent& coincidentEvent1, const CoincidentEvent& coincidentEvent2) { return coincidentEvent1.getNormalizedEnergy() < coincidentEvent2.getNormalizedEnergy(); } }; // sort coincident events by decreasing normalized energy struct DecreasingCoincidentEventNormalizedEnergySortCriterion : public CoincidentEventSortCriterion { bool operator()(const CoincidentEvent& coincidentEvent1, const CoincidentEvent& coincidentEvent2) { return coincidentEvent1.getNormalizedEnergy() > coincidentEvent2.getNormalizedEnergy(); } }; /* Coincident Event Cut Criteria */ /* ----------------------------- */ // base class for coincident event cut criteria struct CoincidentEventCutCriterion : public std::unary_function { CoincidentEventCutCriterion() {} virtual ~CoincidentEventCutCriterion() {} virtual bool operator()(const CoincidentEvent& coincidentEvent) = 0; }; // cut coincident events with center time less than threshold struct CoincidentEventCenterTimeLessThanCutCriterion : public CoincidentEventCutCriterion { CoincidentEventCenterTimeLessThanCutCriterion(double threshold) : threshold(threshold) {} bool operator()(const CoincidentEvent& coincidentEvent) { return coincidentEvent.getCenterTime() < threshold; } double threshold; }; // cut coincident events with center time greater than threshold struct CoincidentEventCenterTimeGreaterThanCutCriterion : public CoincidentEventCutCriterion { CoincidentEventCenterTimeGreaterThanCutCriterion(double threshold) : threshold(threshold) {} bool operator()(const CoincidentEvent& coincidentEvent) { return coincidentEvent.getCenterTime() >= threshold; } double threshold; }; // cut coincident events with center frequency less than threshold struct CoincidentEventCenterFrequencyLessThanCutCriterion : public CoincidentEventCutCriterion { CoincidentEventCenterFrequencyLessThanCutCriterion(double threshold) : threshold(threshold) {} bool operator()(const CoincidentEvent& coincidentEvent) { return coincidentEvent.getCenterFrequency() < threshold; } double threshold; }; // cut coincident events with center frequency greater than threshold struct CoincidentEventCenterFrequencyGreaterThanCutCriterion : public CoincidentEventCutCriterion { CoincidentEventCenterFrequencyGreaterThanCutCriterion(double threshold) : threshold(threshold) {} bool operator()(const CoincidentEvent& coincidentEvent) { return coincidentEvent.getCenterFrequency() >= threshold; } double threshold; }; // cut coincident events with duration less than threshold struct CoincidentEventDurationLessThanCutCriterion : public CoincidentEventCutCriterion { CoincidentEventDurationLessThanCutCriterion(double threshold, double durationInflation = 1.0) : threshold(threshold), durationInflation(durationInflation) {} bool operator()(const CoincidentEvent& coincidentEvent) { return coincidentEvent.getDuration(durationInflation) < threshold; } double threshold; double durationInflation; }; // cut coincident events with duration greater than threshold struct CoincidentEventDurationGreaterThanCutCriterion : public CoincidentEventCutCriterion { CoincidentEventDurationGreaterThanCutCriterion(double threshold, double durationInflation = 1.0) : threshold(threshold), durationInflation(durationInflation) {} bool operator()(const CoincidentEvent& coincidentEvent) { return coincidentEvent.getDuration(durationInflation) >= threshold; } double threshold; double durationInflation; }; // cut coincident events with bandwidth less than threshold struct CoincidentEventBandwidthLessThanCutCriterion : public CoincidentEventCutCriterion { CoincidentEventBandwidthLessThanCutCriterion(double threshold, double bandwidthInflation = 1.0) : threshold(threshold), bandwidthInflation(bandwidthInflation) {} bool operator()(const CoincidentEvent& coincidentEvent) { return coincidentEvent.getBandwidth(bandwidthInflation) < threshold; } double threshold; double bandwidthInflation; }; // cut coincident events with bandwidth greater than threshold struct CoincidentEventBandwidthGreaterThanCutCriterion : public CoincidentEventCutCriterion { CoincidentEventBandwidthGreaterThanCutCriterion(double threshold, double bandwidthInflation = 1.0) : threshold(threshold), bandwidthInflation(bandwidthInflation) {} bool operator()(const CoincidentEvent& coincidentEvent) { return coincidentEvent.getBandwidth(bandwidthInflation) >= threshold; } double threshold; double bandwidthInflation; }; // cut coincident events with normalized energy less than threshold struct CoincidentEventNormalizedEnergyLessThanCutCriterion : public CoincidentEventCutCriterion { CoincidentEventNormalizedEnergyLessThanCutCriterion(double threshold, double uncertaintyFactor = 0.0) : threshold(threshold), uncertaintyFactor(uncertaintyFactor) {} bool operator()(const CoincidentEvent& coincidentEvent) { return coincidentEvent.getNormalizedEnergy() < threshold + coincidentEvent.getIncoherentEnergy(); } double threshold; double uncertaintyFactor; }; // cut coincident events with normalized energy greater than threshold struct CoincidentEventNormalizedEnergyGreaterThanCutCriterion : public CoincidentEventCutCriterion { CoincidentEventNormalizedEnergyGreaterThanCutCriterion(double threshold, double uncertaintyFactor = 0.0) : threshold(threshold), uncertaintyFactor(uncertaintyFactor) {} bool operator()(const CoincidentEvent& coincidentEvent) { return coincidentEvent.getNormalizedEnergy() >= threshold + coincidentEvent.getIncoherentEnergy(); } double threshold; double uncertaintyFactor; }; /* End namespace event */ /* ------------------- */ } /* End protection against double inclusion */ /* --------------------------------------- */ #endif