/** \file REvent top of radio event hierarchy \author J. Rautenberg \date \version $Id$ */ #ifndef _revt_REvent_h_ #define _revt_REvent_h_ #include #include #include #include #include #include #include #include #include static const char CvsId_revt_REvent[] = "$Id$"; namespace evt { class Event; } namespace revt { class EventTrigger; class Header; /** \class REvent REvent.h revt/REvent.h \brief Interface class to access to the Radio part of an event \author S. Fliescher \date 2008/10/31 \version $Id$ \ingroup revt */ class REvent { private: typedef std::map InternalStationCollection; //Stefan: changed form std::vector to std::map typedef InternalStationCollection::iterator InternalStationIterator; typedef InternalStationCollection::const_iterator InternalConstStationIterator; /*struct ConstInternalStationFunctor { //should not be needed const revt::Station& operator()(const InternalStationCollection::value_type& pair) const { return *pair.second; } };*/ struct InternalStationFunctor { revt::Station& operator()(const InternalStationCollection::value_type& pair) const { return *pair.second; } }; public: enum RejectionStatus { eEventNoRejection = 0, eEventManuallyRejected = (1 << 0), // Set by Offline Modules e2DLDFsigmaatlimit = (1 << 1), //2DLDFFit -> Varying the measured values and refitting the 2LDF 1000 times, shape of distribution used as quality criteria e2DLDFvariationfails = (1 << 2), //2DLDFFitter not enough successful reconstructions varying the measruments e2DLDFmeanAdistoutside = (1 << 3), //difference between mean of A-distribution and A too big e2DLDFmeanSigmadistoutside = (1 << 4), //difference between mean of Sigma-distribution and Sigma too big e2DLDFasymmetryAdist = (1 << 5), //A-distribution too asymmetric e2DLDFasymmetrySigmadist = (1 << 6), //Sigma-distribution too asymmetric e2DLDFFitfailed = (1 << 7), //no successful 2DLDF fit eNumStationRejectionStatusBits = 7 }; REvent(const REvent& rEvent); REvent& operator=(const REvent& rEvent); /// ConstStationIterator returns a const pointer to a station for read typedef boost::transform_iterator ConstStationIterator; /// StationIterator returns a pointer to a station for read/write typedef boost::transform_iterator StationIterator; /// Beginning of stations for read ConstStationIterator StationsBegin() const { return ConstStationIterator(fStations.begin()); } /// End of stations for read ConstStationIterator StationsEnd() const { return ConstStationIterator(fStations.end()); } /// Beginning of the stations for read/write StationIterator StationsBegin() { return StationIterator(fStations.begin()); } /// End of the stations for read/write StationIterator StationsEnd() { return StationIterator(fStations.end()); } /// Iterator over signal stations typedef boost::filter_iterator SignalStationIterator; typedef boost::filter_iterator ConstSignalStationIterator; SignalStationIterator SignalStationsBegin() { return SignalStationIterator(StationsBegin(), StationsEnd()); } SignalStationIterator SignalStationsEnd() { return SignalStationIterator(StationsEnd(), StationsEnd()); } ConstSignalStationIterator SignalStationsBegin() const { return ConstSignalStationIterator(StationsBegin(), StationsEnd()); } ConstSignalStationIterator SignalStationsEnd() const { return ConstSignalStationIterator(StationsEnd(), StationsEnd()); } /// 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) throw(utl::NonExistentComponentException); const Station& GetStation(const int stationId) const throw(utl::NonExistentComponentException); /// retrieve station by name, throw utl::NonExistentComponentException if n.a. Station& GetStationByName(const std::string name) throw(utl::NonExistentComponentException); const Station& GetStationByName(const std::string name) const throw(utl::NonExistentComponentException); /// make a station with specifying Id, throw if invalid stationId void MakeStation(const int stationId); void MakeStation(const std::string stationName) throw(utl::NonExistentComponentException); /// Check whether station exists bool HasStation(const int stationId) const; bool HasStation(const std::string name) const throw(utl::NonExistentComponentException); /// Get total number of stations in the event int GetNumberOfStations() const { return fStations.size(); } /// 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 = revent.StationsBegin(); * it != revent.StationsEnd(); ) * if (condition ...) * it = revent.RemoveStation(it); * else * ++it; * @endcode */ StationIterator RemoveStation(const StationIterator it); // RD 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; } /// access to REvent Header Header& GetHeader() { return *fHeader; } const Header& GetHeader() const { return *fHeader; } bool IsRejected() { return fRejectionStatus == eEventNoRejection; } void SetRejected(const unsigned long long int reason) { fRejectionStatus |= reason; } unsigned long long int GetRejectionStatus() const { return fRejectionStatus; } void ClearRejectionStatus() { fRejectionStatus = eEventNoRejection; } /// 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 * REvent::SortStations(revt::ByIncreasingSignal()) * \endcode */ template void SortStations(const OrderingCriterion ord) { std::sort(fStations.begin(), fStations.end(), ord); } /// access to AERARootIO source file name const std::string& GetAERARootIoSourceFileName() const { return fAERARootIoSourceFileName; } void SetAERARootIoSourceFileName(std::string parFileName) { fAERARootIoSourceFileName = parFileName; } /// access to AERARootIO event id double GetAERARootIoEventId() const { return fAERARootIoEventId; } void SetAERARootIoEventId(double parEventId) { fAERARootIoEventId = parEventId; } /// access to fChannelResponseApplied flag bool GetChannelResponseApplied() const { return fChannelResponseApplied; } void SetChannelResponseApplied(bool parFlag) { fChannelResponseApplied = parFlag; } private: REvent(); ~REvent(); InternalStationCollection fStations; utl::LameShadowPtr fTrigger; utl::InitializedLameShadowPtr
fHeader; // metadata for events read in from AERARootIo files to enable event extraction, this is a quick'n'dirty solution, should rather use static member in RadioFileAERARoot std::string fAERARootIoSourceFileName; long fAERARootIoEventId; // flag for RdChannelResponseIncorporator to keep track if it has already been called bool fChannelResponseApplied; unsigned long long int fRejectionStatus; 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: