/*! \file Station data \version $Id$ */ #ifndef _revt_Station_h_ #define _revt_Station_h_ #include #include #include #include #include #include #include #include #include static const char CvsId_revt_Station[] = "$Id$"; namespace revt { class REvent; class Channel; class StationSimData; class StationRecData; class StationTriggerData; class StationGPSData; class StationHeader; /** \class Station Station.h "revt/Station.h" \brief class to hold data at the radio Station level. \ingroup revt */ typedef utl::TraceV3D StationTimeSeries; typedef utl::TraceV3C StationFrequencySpectrum; typedef utl::FFTDataContainer StationFFTDataContainer; class Station { private: typedef std::vector::iterator InternalChannelIterator; typedef std::vector::const_iterator InternalConstChannelIterator; public: Station(const Station& station); Station& operator=(const Station& station); /// Iterator over station for read/write typedef boost::indirect_iterator ChannelIterator; /// Iterator over station for read typedef boost::indirect_iterator ConstChannelIterator; /// Get the station Id int GetId() const { return fId; } /// Check if a particular Channel object exists bool HasChannel(const int pmtId) const; /// Retrieve a Channel by Id Channel& GetChannel(const int pmtId); const Channel& GetChannel(const int pmtId) const; /// begin Channel iterator for read/write ChannelIterator ChannelsBegin() { return ChannelIterator(fChannels.begin()); } /// end Channel iterator for read/write ChannelIterator ChannelsEnd() { return ChannelIterator(fChannels.end()); } /// begin Channel iterator for read ConstChannelIterator ChannelsBegin() const { return ConstChannelIterator(fChannels.begin()); } /// end Channel iterator for read ConstChannelIterator ChannelsEnd() const { return ConstChannelIterator(fChannels.end()); } /// Retrieve number of Channels in this Station unsigned int ChannelsSize() const { return fChannels.size(); } /// Get simulated data at station level StationSimData& GetSimData(); const StationSimData& GetSimData() const; /// Make station simulated data object void MakeSimData(); /// Check whether station simulated data exists bool HasSimData() const { return fSimData; } /// Get station level reconstructed data StationRecData& GetRecData(); const StationRecData& GetRecData() const; /// Make station reconstructed data object void MakeRecData(); /// Check whether station reconstructed data exists bool HasRecData() const { return fRecData; } /// Get Trigger data for the station StationTriggerData& GetTriggerData(); const StationTriggerData& GetTriggerData() const; /// Make trigger data object void MakeTriggerData(); /// Check whether trigger data object exists bool HasTriggerData() const { return fTriggerData; } /// Get GPS data for the station StationGPSData& GetGPSData(); const StationGPSData& GetGPSData() const; /// Make GPS data object void MakeGPSData(); /// Check whether GPS data object exists bool HasGPSData() const { return fGPSData; } /// Get the Station Header StationHeader& GetStationHeader(); const StationHeader& GetStationHeader() const; ///Make Station Header object void MakeStationHeader(); ///Check whether StationHeader exists bool HasStationHeader() const {return fStationHeader;} /// Get absolute start time of the station-level trace as originally provided in raw data, for reconstructions use eTraceStartTime in StationRecData! utl::TimeStamp GetRawTraceStartTime() const { return fRawTraceStartTime; } /// Set absolute start time of the station-level trace as originally provided in raw data, for reconstructions use eTraceStartTime in StationRecData! /*! For MC this should be set by the local trigger simulation */ void SetRawTraceStartTime(const utl::TimeStamp& Time) { if (!fRawTraceStartTimeLocked) fRawTraceStartTime = Time; else { const std::string err = "fRawTraceStartTime has already been locked in RdEventInitializer! Change is no longer allowed."; ERROR(err); throw utl::InitSequenceException(err); } } /// Lock fRawTraceStartTime paramater (done in RdEventInitializer) so that it cannot be changed any more after it has been copied over to eTraceStartTime. void LockRawTraceStartTime() { fRawTraceStartTimeLocked = true; } /// Get the Nyquist zone unsigned int GetNyquistZone() const { return fStationRadioData->GetNyquistZone(); } /// Set the Nyquist zone void SetNyquistZone(const unsigned int zone) { fStationRadioData->SetNyquistZone(zone); } /// Get the frequency corresponding to a bin of the frequency spectrum double GetFrequencyOfBin(const StationFrequencySpectrum::SizeType bin) const { return fStationRadioData->GetFrequencyOfBin(bin); } /// Get the mimimum frequency of the spectrum frequency spectrum double GetMinimumFrequency() const { return (GetFrequencyOfBin(0) < GetFrequencyOfBin(fStationRadioData->GetConstFrequencySpectrum().GetSize()-1)) ? GetFrequencyOfBin(0) : GetFrequencyOfBin(fStationRadioData->GetConstFrequencySpectrum().GetSize()-1); } /// Get the maximum frequency of the spectrum frequency spectrum double GetMaximumFrequency() const { return (GetFrequencyOfBin(0) > GetFrequencyOfBin(fStationRadioData->GetConstFrequencySpectrum().GetSize()-1)) ? GetFrequencyOfBin(0) : GetFrequencyOfBin(fStationRadioData->GetConstFrequencySpectrum().GetSize()-1); } /// retrieve Station Time Series (write access, only use this if you intend to change the data) StationTimeSeries& GetStationTimeSeries() { return fStationRadioData->GetTimeSeries(); } /// retrieve Station Time Series (read access) const StationTimeSeries& GetConstStationTimeSeries() const { return fStationRadioData->GetConstTimeSeries(); } /// retrieve Station Frequency Spectrum (write access, only use this if you intend to change the data) StationFrequencySpectrum& GetStationFrequencySpectrum() { return fStationRadioData->GetFrequencySpectrum(); } /// retrieve Station Frequency Spectrum (read access) const StationFrequencySpectrum& GetConstStationFrequencySpectrum() const { return fStationRadioData->GetConstFrequencySpectrum(); } /// retrieve Station FFTDataContainer (read access) const StationFFTDataContainer& GetFFTDataContainer() const { return *fStationRadioData; } /// retrieve Station FFTDataContainer (write access) StationFFTDataContainer& GetFFTDataContainer() { return *fStationRadioData; } bool IsSilent() const { return fReconstructionStatus == eSilent; } bool IsAccidental() const { return fReconstructionStatus == eRejected; } /// Check if the station is a candidate (a signal station is still a candidate station) bool IsCandidate() const { return fReconstructionStatus == eCandidate || fReconstructionStatus == eHasSignal; } bool HasSignal() const { return fReconstructionStatus == eHasSignal; } bool HasRejectionStatus(const unsigned long long int reason) const { return fRejectionStatus & reason; } void SetSilent() { fReconstructionStatus = eSilent; } //void SetRejected() { fReconstructionStatus = eRejected; } void SetRejected(const unsigned long long int reason) { fReconstructionStatus = eRejected; fRejectionStatus |= reason; } void SetCandidate() { fReconstructionStatus = eCandidate; } void SetSignal() { fReconstructionStatus = eHasSignal; } unsigned long long int GetRejectionStatus() const { return fRejectionStatus; } void ClearRejectionStatus() { fRejectionStatus = eNoRejection; } void SetHWTemperature(const double temp) { fHWTemperature = temp; } double GetHWTemperature() const { return fHWTemperature; } void SetHWTemperatureInt(const double temp) { fHWTemperatureInt = temp; } double GetHWTemperatureInt() const { return fHWTemperatureInt; } void SetHWTemperatureExt(const double temp) { fHWTemperatureExt = temp; } double GetHWTemperatureExt()const { return fHWTemperatureExt; } /// Check if the station is saturated void SetSaturated() { fIsSaturated = true; } void SetNotSaturated(){ fIsSaturated = false; } bool IsSaturated() const { return fIsSaturated; } /* /// Check if the station is saturated bool IsNoSaturation() const { return fSatStatus == eNoSaturation; } bool IsLowGainSaturation() const { return fSatStatus == eLowGainSat; } bool IsHighGainSaturation() const { return fSatStatus == eHighGainSat; } void SetNoSaturation() { fSatStatus = eNoSaturation; } void SetLowGainSaturation() { fSatStatus = eLowGainSat; } void SetHighGainSaturation() { fSatStatus = eHighGainSat; } */ private: Station(const int stationId); ~Station(); /* enum SaturationStatus { eNoSaturation = 0, eLowGainSat, eHighGainSat }; */ int fId; std::vector fChannels; utl::ShadowPtr fSimData; utl::ShadowPtr fRecData; utl::ShadowPtr fTriggerData; utl::ShadowPtr fGPSData; utl::ShadowPtr fStationHeader; utl::TimeStamp fRawTraceStartTime; bool fRawTraceStartTimeLocked; /// container for the radio time and frequency data utl::InitializedShadowPtr fStationRadioData; //Status fRecStatus; ReconstructionStatus fReconstructionStatus; bool fIsSaturated; //SaturationStatus fSatStatus; unsigned long long int fRejectionStatus; double fHWTemperature; double fHWTemperatureInt; double fHWTemperatureExt; friend class revt::REvent; }; struct SignalStationFilter { bool operator()(const Station& station) const { return station.HasSignal(); } }; struct CandidateStationFilter { bool operator()(const Station& station) const { return station.IsCandidate(); } }; struct SilentStationFilter { bool operator()(const Station& station) const { return station.IsSilent(); } }; class RejectedStationFilter { public: RejectedStationFilter(const int statusMask) : fStatusMask(statusMask) { } bool operator()(const Station& station) const { return station.GetRejectionStatus() & fStatusMask; } private: int fStatusMask; }; } #endif // Configure (x)emacs for this file ... // Local Variables: // mode: c++ // compile-command: "make -C .. REvent/Station.o -k" // End: