//////////////////////////////////////////////////////////////////// /// \class RAT::DU::ChanSWStatus /// /// \brief Functions to test whether a channel passes CSS selection. /// /// \author Billy Liggins (billy.liggins@qmul.ac.uk) /// /// REVISION HISTORY:\n /// 13th Oct 2017 : Initial file. /// 27th Mar 2019 : Update for Charge Cuts - LN /// /// //////////////////////////////////////////////////////////////////// #ifndef __RAT_DU_ChanSWStatus__ #define __RAT_DU_ChanSWStatus__ #include #include #include #include namespace RAT { namespace DU { class ChanSWStatus : public TObject { public: /// Construct set constant threshold usage to false ChanSWStatus() : TObject(), fResultExist(false) { } enum Bit { RunLength = 1, HighOcc=2, LowOcc=3, QHS=4, QHL=5, QLX=6, TAC=7, ECA=8, PCA=9, CHS=10, CHS_STANDARD=11}; /// Initialize with current DB values at the start of a new run. void BeginOfRun(); /// Check if the channel is deemed CSS good. /// /// @return true if pass. bool IsTubeStable( const unsigned int lcn ) const; //-------Combined ChanSWStatusBits-------- /// Get the name of the data quality bit at index /// /// @param[in] index of the bit /// @return name of the bit /// @throws out_of_range if index is not valid std::string GetBitName( const size_t index ) const; /// Get the bit index from the name /// /// @param[in] name of the bit /// @return index of the bit /// @throws out_of_range if index is not valid size_t GetBitIndex( const std::string& name ) const; /// Outputs a list of the names and bit indices to the screen void DumpNames(); /// Returns a vector of the bit names std::vector GetBitNames() const; /// Returns fBitMap. const std::map& GetBitMap() const; /// Returns fInverseBitMap. const std::map& GetInverseBitMap() const; // This ROOT macro adds dictionary methods to this class. // The number is 0 as this class is never, and should never be written to disc. // It assumes this class has no virtual methods, use ClassDef if change this. ClassDefNV( ChanSWStatus, 0 ); private: std::vector channelMask; int fdefaultCSS; bool fResultExist; // True if the CSS_RESULT table is available. std::map fBitMap; ///< Mapping between bit name and bit position std::map fInverseBitMap; ///< Opposite mapping, bit position to bit name }; // class ChanSWStatus } // ::DU } // namespace RAT #endif // __RAT_DU_ChanSWStatus__