Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:51:21

0001 
0002 #ifndef DataFormats_SiStripCommon_SiStripHistoTitle_H
0003 #define DataFormats_SiStripCommon_SiStripHistoTitle_H
0004 
0005 #include "DataFormats/SiStripCommon/interface/SiStripConstants.h"
0006 #include <ostream>
0007 #include <sstream>
0008 #include <string>
0009 
0010 class SiStripKey;
0011 class SiStripHistoTitle;
0012 
0013 /** Debug info for class. */
0014 std::ostream& operator<<(std::ostream&, const SiStripHistoTitle&);
0015 
0016 /** 
0017     @author R.Bainbridge
0018     @brief Utility class that holds histogram title.
0019 */
0020 class SiStripHistoTitle {
0021 public:
0022   // ---------- Constructors, destructors ----------
0023 
0024   /** Constructs histogram title from key object. */
0025   SiStripHistoTitle(const sistrip::HistoType& histo_type,
0026                     const sistrip::RunType& run_type,
0027                     const SiStripKey& key,
0028                     const std::string& extra_info = "");
0029 
0030   /** Constructs histogram title from various data. */
0031   SiStripHistoTitle(const sistrip::HistoType& histo_type,
0032                     const sistrip::RunType& run_type,
0033                     const sistrip::KeyType& key_type,
0034                     const uint32_t& key_value,
0035                     const sistrip::Granularity& gran,
0036                     const uint16_t& channel,
0037                     const std::string& extra_info = "");
0038 
0039   /** Extracts individual components from histogram title. */
0040   SiStripHistoTitle(const std::string& histo_title);
0041 
0042   // ---------- Public interface ----------
0043 
0044   /** Returns the histogram title. */
0045   inline const std::string& title() const;
0046 
0047   /** Returns the histogram type. */
0048   inline const sistrip::HistoType& histoType() const;
0049 
0050   /** Returns the run type. */
0051   inline const sistrip::RunType& runType() const;
0052 
0053   /** Defines key type used to form the histogram title. */
0054   inline const sistrip::KeyType& keyType() const;
0055 
0056   /** Returns values of the 32-bit key. */
0057   inline const uint32_t& keyValue() const;
0058 
0059   /** Returns granularity of histogram. */
0060   inline const sistrip::Granularity& granularity() const;
0061 
0062   /** Returns channel for histogram granularity. */
0063   inline const uint16_t& channel() const;
0064 
0065   /** Extra information attached to histogram title. */
0066   inline const std::string& extraInfo() const;
0067 
0068 private:
0069   // ---------- Private methods ----------
0070 
0071   /** Private default constructor. */
0072   SiStripHistoTitle() { ; }
0073 
0074   /** Constructs histogram title. */
0075   void setTitle();
0076 
0077   /** Extracts member data values from title. */
0078   void extractTitle();
0079 
0080   // ---------- Private member data ----------
0081 
0082   /** Histogram title. */
0083   std::string title_;
0084 
0085   /** Defines histo type. */
0086   sistrip::HistoType histoType_;
0087 
0088   /** Defines run type. */
0089   sistrip::RunType runType_;
0090 
0091   /** Defines key type. */
0092   sistrip::KeyType keyType_;
0093 
0094   /** Key value. */
0095   uint32_t keyValue_;
0096 
0097   /** Granularity of histogram. */
0098   sistrip::Granularity granularity_;
0099 
0100   /**Channel number for granularity. */
0101   uint16_t channel_;
0102 
0103   /** Extra information to be attached to title. */
0104   std::string extraInfo_;
0105 };
0106 
0107 // ---------- inline methods ----------
0108 
0109 const std::string& SiStripHistoTitle::title() const { return title_; }
0110 const sistrip::HistoType& SiStripHistoTitle::histoType() const { return histoType_; }
0111 const sistrip::RunType& SiStripHistoTitle::runType() const { return runType_; }
0112 const sistrip::KeyType& SiStripHistoTitle::keyType() const { return keyType_; }
0113 const uint32_t& SiStripHistoTitle::keyValue() const { return keyValue_; }
0114 const sistrip::Granularity& SiStripHistoTitle::granularity() const { return granularity_; }
0115 const uint16_t& SiStripHistoTitle::channel() const { return channel_; }
0116 const std::string& SiStripHistoTitle::extraInfo() const { return extraInfo_; }
0117 
0118 #endif  // DataFormats_SiStripCommon_SiStripHistoTitle_H