//////////////////////////////////////////////////////////////////// /// \class RAT::DS::Run /// /// \brief Instances of this class represent a run /// /// \author Stan Seibert \n /// P G Jones /// /// REVISION HISTORY:\n /// 29 Mar 2010 : Gabriel Orebi Gann - add additional members /// to hold the full detector data\n /// 09 Apr 2010 : Gabriel Orebi Gann - add AV and Manip status /// branches, and a few extra members\n /// 31 May 2011 : Phil G Jones - refactor file, correct memory /// leaks, introduce FastPath class.\n /// 30 Jan 2013 : P G Jones - Add SOC information.\n /// 01 Aug 2013 : Richie Bonventre - Added data cleaning info\n /// 2014-03-26 : P G Jones - New DS refactor. /// 2016-06-07 : F. Descamps - Add valid GTID /// 2017-08-24 : T. Kaptanoglu - Change date and time to UInt_t /// 2017-09-17 : Anthony LaTorre - add run type and first gtid to class. /// /// \details This class contains all the information about the run. /// It also contains the SOC data within RAT, the SOC data is written /// out to a different tree to the run data. /// //////////////////////////////////////////////////////////////////// #ifndef __RAT_DS_Run__ #define __RAT_DS_Run__ #include #include #include #include #include #include #include namespace RAT { namespace DS { class Run: public TObject { public: Run() : TObject(), runID(0), subRunID(0), date(0), startTime(0), runType(0), firstGTID(0), validGTID(0), nMCEvents(0), mcFlag(false) { } virtual ~Run() {} /// Set the ID of the run /// /// @param[in] id the run ID void SetRunID( const UInt_t id ) { runID = id; } /// Get the ID of the run /// /// @return the run ID UInt_t GetRunID() const { return runID; } /// Set the ID of the sub run /// /// @param[in] id the sub run ID void SetSubRunID( const UInt_t id ) { subRunID = id; } /// Get the ID of the sub run /// /// @return the sub run ID UInt_t GetSubRunID() const { return subRunID; } /// Set the run start date, parsed in BeginOfRun in ReconstructClocks proc /// /// @param[in] date_ to set void SetDate( const UInt_t date_ ) { date = date_; } /// Get the run start date /// /// @return the date UInt_t GetDate() const { return date; } /// Set the run start time, parsed in BeginOfRun in ReconstructClocks proc /// /// @param[in] time to set void SetTime(const UInt_t time) { startTime = time; } /// Get the run start time /// /// @return the start time UInt_t GetTime() const { return startTime; } /// Set the run type /// /// @param[in] run type to set void SetRunType(const UInt_t type) { runType = type; } /// Get the run type /// /// @return the run type UInt_t GetRunType() const { return runType; } /// Set the first gtid /// /// @param[in] first gtid to set void SetFirstGTID(const UInt_t gtid) { firstGTID = gtid; } /// Get the GTID of the first event /// /// @return the first GTID UInt_t GetFirstGTID() const { return firstGTID; } /// Set the valid gtid /// /// @param[in] valid gtid to set void SetValidGTID(const UInt_t gtid) { validGTID = gtid; } /// Get the GTID of the first valid event /// /// @return the valid GTID UInt_t GetValidGTID() const { return validGTID; } /// Set the builder version /// /// @param[in] version the builder version void SetBuilderVersion( const std::string& version ) { builderVersion = version; } /// Get the builder version /// /// @return the builder version std::string GetBuilderVersion() const { return builderVersion; } /// Get the data quality flags /// /// @return reference to the flags DataQCFlags& GetDataQualityFlags() { return dataQualityFlags; } /// @copydoc GetDataQualityFlags() const DataQCFlags& GetDataQualityFlags() const { return dataQualityFlags; } /// Increase the number of events simulated by 1 void IncrementNMCEvents() { nMCEvents++; }; /// Get the count of MC events /// /// @return the number of MC events UInt_t GetNMCEvents() const { return nMCEvents; } /// Set the flag identifying this run as mc data /// /// @param[in] flag value, defaults to true void SetMCFlag( const Bool_t flag=true ) { mcFlag = flag; } /// Get transient run length for transferring between processors /// /// @return transient run length virtual double GetRunLength() const { return runLength; }; /// Set transient run length for transferring between processors /// /// @param[in] _runLength transient run length virtual void SetRunLength(double _runLength) { runLength = _runLength; }; /// Get the flag identifying this run as mc data /// /// @return true if MC data Bool_t GetMCFlag() const { return mcFlag; }; /// Set all the trigger sum values, overwrites existing /// /// @param[in] value of all the trigger sums void SetDigitiserTrigSums( const std::vector value ) { digitiserTrigSums = value; } /// Set a trigger sum value /// /// @param[in] id of the trigger /// @param[in] value of the trigger sum inline void SetDigitiserTrigSum( const size_t id, const Int_t value ); /// Get all the trigger sums /// /// @return the vector of trigger sums std::vector GetDigitiserTrigSums() const { return digitiserTrigSums; } /// Get the trigger sum for trigger id /// /// @param[in] id of the trigger /// @return the trigger sum /// @throws out_of_range if no sum exists Int_t GetDigitiserTrigSum( const size_t id ) const { return digitiserTrigSums.at( id ); } /// Prune the digitiser trigger sum information void PruneDigitiserTrigSums() { clear_vector( digitiserTrigSums ); } /// Check if SOC data exists for a source /// /// @param[in] id of the source to check /// @return true if the data exists bool SOCDataExists( const std::string& id ) const { return socs.count( id ) == 1; } /// Set the SOC data for a source /// /// @param[in] id of the source /// @param[in] data in the SOC format void SetSOCData( const std::string& id, const SOC& data ) { socs[id] = data; } /// Get the SOC data for a source /// /// @param[in] id of the source /// @return the SOC data /// @throws out_of_range if no data exists for the source SOC& GetSOCData( const std::string& id ) { return socs.at( id ); } /// @copydoc GetSOCData(std::string) const SOC& GetSOCData( const std::string& id ) const { return socs.at( id ); } /// Get the soc source ids /// /// @return vector of soc source id strings std::vector GetSOCSourceIDs() const { return keys_in_map( socs ); } /// Check if Channel Software Status bits exist for a channel /// /// @param[in] lcn (logical channel number) to study /// @return true if the bits exist Bool_t CSSBitsExist( const UInt_t lcn ) const { return chanSWStatus.count( lcn ) == 1; } /// Set the Channel Software Status bits /// /// @param[in] lcn (logical channel number) to study void SetCSSBits( const UInt_t lcn, const BitMask& cssBit ) { chanSWStatus[lcn] = cssBit; } /// Get the Channel Software Status bits for a channel /// /// @param[in] lcn (logical channel number) to study /// @return Channel Software Status bit information /// @throws out_of_range if there is no information for the channel BitMask& GetCSSBits( const UInt_t lcn ) { return chanSWStatus.at( lcn ); } /// @copydoc GetCSSBits(std::string) const BitMask& GetCSSBits( const UInt_t lcn ) const { return chanSWStatus.at( lcn ); } // This ROOT macro adds dictionary methods to this class. // The number should be incremented whenever this class's members are changed. ClassDef( Run, 15 ); private: std::map socs; //! This is NOT SAVED to disk, Summary Optical Calibration data indexed by calibration source std::vector digitiserTrigSums; ///< The digitiser trigger sums std::string builderVersion; ///< The builder version std::map chanSWStatus; ///< The channel software status bits indexed by LCN DataQCFlags dataQualityFlags; ///< The data quality flags UInt_t runID; ///< The run ID UInt_t subRunID; ///< The sub run ID UInt_t date; ///< The run start date, parsed in BeginOfRun in ReconstructClocks proc UInt_t startTime; ///< The run start time, parsed in BeginOfRun in ReconstructClocks proc UInt_t runType; ///< The run type word UInt_t firstGTID; ///< Event ID (Global Trigger ID, GTID) of first event UInt_t validGTID; ///< Event ID (Global Trigger ID, GTID) of first valid event UInt_t nMCEvents; ///< Total number of simulated MC events Bool_t mcFlag; ///< false: data; true:MC double runLength; //! This is NOT SAVED to disk, transient run length for transferring between processors }; inline void Run::SetDigitiserTrigSum( const size_t id, const Int_t value ) { if( digitiserTrigSums.size() <= id ) digitiserTrigSums.resize( id + 1, 0 ); digitiserTrigSums[id] = value; } } // namespace DS } // namespace RAT #endif