SiStripHistoTitle

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118

#ifndef DataFormats_SiStripCommon_SiStripHistoTitle_H
#define DataFormats_SiStripCommon_SiStripHistoTitle_H

#include "DataFormats/SiStripCommon/interface/SiStripConstants.h"
#include <ostream>
#include <sstream>
#include <string>

class SiStripKey;
class SiStripHistoTitle;

/** Debug info for class. */
std::ostream& operator<<(std::ostream&, const SiStripHistoTitle&);

/** 
    @author R.Bainbridge
    @brief Utility class that holds histogram title.
*/
class SiStripHistoTitle {
public:
  // ---------- Constructors, destructors ----------

  /** Constructs histogram title from key object. */
  SiStripHistoTitle(const sistrip::HistoType& histo_type,
                    const sistrip::RunType& run_type,
                    const SiStripKey& key,
                    const std::string& extra_info = "");

  /** Constructs histogram title from various data. */
  SiStripHistoTitle(const sistrip::HistoType& histo_type,
                    const sistrip::RunType& run_type,
                    const sistrip::KeyType& key_type,
                    const uint32_t& key_value,
                    const sistrip::Granularity& gran,
                    const uint16_t& channel,
                    const std::string& extra_info = "");

  /** Extracts individual components from histogram title. */
  SiStripHistoTitle(const std::string& histo_title);

  // ---------- Public interface ----------

  /** Returns the histogram title. */
  inline const std::string& title() const;

  /** Returns the histogram type. */
  inline const sistrip::HistoType& histoType() const;

  /** Returns the run type. */
  inline const sistrip::RunType& runType() const;

  /** Defines key type used to form the histogram title. */
  inline const sistrip::KeyType& keyType() const;

  /** Returns values of the 32-bit key. */
  inline const uint32_t& keyValue() const;

  /** Returns granularity of histogram. */
  inline const sistrip::Granularity& granularity() const;

  /** Returns channel for histogram granularity. */
  inline const uint16_t& channel() const;

  /** Extra information attached to histogram title. */
  inline const std::string& extraInfo() const;

private:
  // ---------- Private methods ----------

  /** Private default constructor. */
  SiStripHistoTitle() { ; }

  /** Constructs histogram title. */
  void setTitle();

  /** Extracts member data values from title. */
  void extractTitle();

  // ---------- Private member data ----------

  /** Histogram title. */
  std::string title_;

  /** Defines histo type. */
  sistrip::HistoType histoType_;

  /** Defines run type. */
  sistrip::RunType runType_;

  /** Defines key type. */
  sistrip::KeyType keyType_;

  /** Key value. */
  uint32_t keyValue_;

  /** Granularity of histogram. */
  sistrip::Granularity granularity_;

  /**Channel number for granularity. */
  uint16_t channel_;

  /** Extra information to be attached to title. */
  std::string extraInfo_;
};

// ---------- inline methods ----------

const std::string& SiStripHistoTitle::title() const { return title_; }
const sistrip::HistoType& SiStripHistoTitle::histoType() const { return histoType_; }
const sistrip::RunType& SiStripHistoTitle::runType() const { return runType_; }
const sistrip::KeyType& SiStripHistoTitle::keyType() const { return keyType_; }
const uint32_t& SiStripHistoTitle::keyValue() const { return keyValue_; }
const sistrip::Granularity& SiStripHistoTitle::granularity() const { return granularity_; }
const uint16_t& SiStripHistoTitle::channel() const { return channel_; }
const std::string& SiStripHistoTitle::extraInfo() const { return extraInfo_; }

#endif  // DataFormats_SiStripCommon_SiStripHistoTitle_H