/** \file SEvent top of surface event hierarchy \author Stefano Argiro' \date 28 january 2003 \version $Id: SEvent.h 23491 2013-04-23 18:56:33Z schulz-a $ */ #ifndef _sevt_SEvent_h_ #define _sevt_SEvent_h_ #include #include #include #include #include #include #include #include static const char CvsId_sevt_SEvent[] = "$Id: SEvent.h 23491 2013-04-23 18:56:33Z schulz-a $"; namespace evt { class Event; } namespace sevt { //class Station; class EventTrigger; class Header; class SQualityCuts; class Meteo; /** \class SEvent SEvent.h sevt/SEvent.h \brief Interface class to access to the SD part of an event \author Stefano Argiro' \date 28 january 2003 \version $Id: SEvent.h 23491 2013-04-23 18:56:33Z schulz-a $ \ingroup sevt */ class SEvent { private: typedef std::vector InternalStationCollection; typedef InternalStationCollection::iterator InternalStationIterator; typedef InternalStationCollection::const_iterator InternalConstStationIterator; public: SEvent(const SEvent& sEvent); SEvent& operator=(const SEvent& sEvent); /// Iterator over all stations typedef boost::indirect_iterator StationIterator; typedef boost::indirect_iterator ConstStationIterator; /// Beginning of all stations StationIterator StationsBegin() { return StationIterator(fStations.begin()); } /// End of all stations StationIterator StationsEnd() { return StationIterator(fStations.end()); } /// Beginning of all const stations ConstStationIterator StationsBegin() const { return ConstStationIterator(fStations.begin()); } /// End of all const stations ConstStationIterator StationsEnd() const { return ConstStationIterator(fStations.end()); } /// Iterator over candidate stations typedef boost::filter_iterator CandidateStationIterator; typedef boost::filter_iterator ConstCandidateStationIterator; CandidateStationIterator CandidateStationsBegin() { return CandidateStationIterator(StationsBegin(), StationsEnd()); } CandidateStationIterator CandidateStationsEnd() { return CandidateStationIterator(StationsEnd(), StationsEnd()); } ConstCandidateStationIterator CandidateStationsBegin() const { return ConstCandidateStationIterator(StationsBegin(), StationsEnd()); } ConstCandidateStationIterator CandidateStationsEnd() const { return ConstCandidateStationIterator(StationsEnd(), StationsEnd()); } /// Iterator over silent stations typedef boost::filter_iterator SilentStationIterator; typedef boost::filter_iterator ConstSilentStationIterator; SilentStationIterator SilentStationsBegin() { return SilentStationIterator(StationsBegin(), StationsEnd()); } SilentStationIterator SilentStationsEnd() { return SilentStationIterator(StationsEnd(), StationsEnd()); } ConstSilentStationIterator SilentStationsBegin() const { return ConstSilentStationIterator(StationsBegin(), StationsEnd()); } ConstSilentStationIterator SilentStationsEnd() const { return ConstSilentStationIterator(StationsEnd(), StationsEnd()); } /// Iterator over rejected stations that match some rejection mask typedef boost::filter_iterator RejectedStationIterator; typedef boost::filter_iterator ConstRejectedStationIterator; // DV: maybe in the future the rejectionMask should be replaced with an expression template RejectedStationIterator RejectedStationsBegin(const int rejectionMask = ~0) { return RejectedStationIterator(RejectedStationFilter(rejectionMask), StationsBegin(), StationsEnd()); } RejectedStationIterator RejectedStationsEnd(const int rejectionMask = ~0) { return RejectedStationIterator(RejectedStationFilter(rejectionMask), StationsEnd(), StationsEnd()); } ConstRejectedStationIterator RejectedStationsBegin(const int rejectionMask = ~0) const { return ConstRejectedStationIterator(RejectedStationFilter(rejectionMask), StationsBegin(), StationsEnd()); } ConstRejectedStationIterator RejectedStationsEnd(const int rejectionMask = ~0) const { return ConstRejectedStationIterator(RejectedStationFilter(rejectionMask), StationsEnd(), StationsEnd()); } /// retrieve station by id throw utl::NonExistentComponentException if n.a. Station& GetStation(const int stationId); const Station& GetStation(const int stationId) const; /// make a station with specifying Id, throw if invalid stationId void MakeStation(const int stationId); /// Check whether station exists bool HasStation(const int stationId) const; /// Get total number of stations in the event int GetNumberOfStations() const { return fStations.size(); } // The following methods map from IoSdEvent // and set and get the actual number of stations // in the T3 /// Get number of error zero stations (mapped over from IoSdEvent) int GetNumberOfErrorZeroStations() const { return fNErrorZeroStations; } /// Set number of error zero stations void SetNumberOfErrorZeroStations(const unsigned int nstations) { fNErrorZeroStations = nstations; } // SD Event SimData /// Get the object with simulated data, throw if n.a. SEventSimData& GetSimData() { return *fSimData; } const SEventSimData& GetSimData() const { return *fSimData; } /// Create the SimData object void MakeSimData(); /// check whether the SimData object exists bool HasSimData() const { return fSimData; } // SD Event Central Trigger Information /// Get the object with central trigger data, throw if n.a. EventTrigger& GetTrigger() { return *fTrigger; } const EventTrigger& GetTrigger() const { return *fTrigger; } /// Create the central trigger object void MakeTrigger(); /// check whether the central trigger object exists bool HasTrigger() const { return fTrigger; } Header& GetHeader() { return *fHeader; } const Header& GetHeader() const { return *fHeader; } /// Sort the list of stations by the criterion specified in an OrderingCriterion object. /** The OrderingCriterion class has to be specified in accordance * with the STL strict weak ordering model * http://www.sgi.com/tech/stl/StrictWeakOrdering.html * * Predifined ordering are available in SortCriteria.h * (see sevt::ByIncreasingSignal) * * Example: * \code * SEvent::SortStations(sevt::ByIncreasingSignal()) * \endcode */ template void SortStations(const OrderingCriterion ord) { std::sort(fStations.begin(), fStations.end(), ord); } bool HasQualityCuts() const { return fQualityCuts; } const SQualityCuts& GetQualityCuts() const { return *fQualityCuts; } void SetQualityCuts(const SQualityCuts& cuts); // new Meteo weather information bool HasMeteo() const { return fMeteo; } void MakeMeteo(); Meteo& GetMeteo() { return *fMeteo; } const Meteo& GetMeteo() const { return *fMeteo; } private: SEvent(); ~SEvent(); /// remove a station from the list /** @note the same caveats of STL removal apply. * The right way to remove stations is * @code * for (StationIterator it = sevent.StationsBegin(); * it != sevent.StationsEnd(); ) * if (condition ...) * it = sevent.RemoveStation(it); * else * ++it; * @endcode * Note that removal of stations from the event is strongly * discouraged! */ StationIterator RemoveStation(const StationIterator it); InternalStationCollection fStations; utl::LameShadowPtr fSimData; utl::LameShadowPtr fTrigger; utl::InitializedLameShadowPtr
fHeader; unsigned int fNErrorZeroStations; utl::LameShadowPtr fQualityCuts; utl::LameShadowPtr fMeteo; friend class evt::Event; friend class utl::LameShadowPtr; }; } #endif // Configure (x)emacs for this file ... // Local Variables: // mode: c++ // compile-command: "make -C .. -k" // End: