CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
SiStripHistoTitle Class Reference

Utility class that holds histogram title. More...

#include <SiStripHistoTitle.h>

Public Member Functions

const uint16_t & channel () const
 
const std::string & extraInfo () const
 
const sistrip::Granularitygranularity () const
 
const sistrip::HistoTypehistoType () const
 
const sistrip::KeyTypekeyType () const
 
const uint32_t & keyValue () const
 
const sistrip::RunTyperunType () const
 
 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="")
 
 SiStripHistoTitle (const sistrip::HistoType &histo_type, const sistrip::RunType &run_type, const SiStripKey &key, const std::string &extra_info="")
 
 SiStripHistoTitle (const std::string &histo_title)
 
const std::string & title () const
 

Private Member Functions

void extractTitle ()
 
void setTitle ()
 
 SiStripHistoTitle ()
 

Private Attributes

uint16_t channel_
 
std::string extraInfo_
 
sistrip::Granularity granularity_
 
sistrip::HistoType histoType_
 
sistrip::KeyType keyType_
 
uint32_t keyValue_
 
sistrip::RunType runType_
 
std::string title_
 

Detailed Description

Utility class that holds histogram title.

Author
R.Bainbridge

Definition at line 20 of file SiStripHistoTitle.h.

Constructor & Destructor Documentation

◆ SiStripHistoTitle() [1/4]

SiStripHistoTitle::SiStripHistoTitle ( const sistrip::HistoType histo_type,
const sistrip::RunType run_type,
const SiStripKey key,
const std::string &  extra_info = "" 
)

Constructs histogram title from key object.

Definition at line 13 of file SiStripHistoTitle.cc.

17  : title_(""),
18  histoType_(histo_type),
19  runType_(run_type),
24  extraInfo_(extra_info) {
25  if (&dynamic_cast<const SiStripFedKey&>(key_object)) {
27  } else if (&dynamic_cast<const SiStripFecKey&>(key_object)) {
29  } else {
31  }
32  keyValue_ = key_object.key();
33  granularity_ = key_object.granularity();
34  channel_ = key_object.channel();
35  setTitle();
36 }

References SiStripKey::channel(), channel_, sistrip::FEC_KEY, sistrip::FED_KEY, SiStripKey::granularity(), granularity_, SiStripKey::key(), keyType_, keyValue_, setTitle(), and sistrip::UNKNOWN_KEY.

◆ SiStripHistoTitle() [2/4]

SiStripHistoTitle::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 = "" 
)

Constructs histogram title from various data.

Definition at line 40 of file SiStripHistoTitle.cc.

47  : title_(""),
48  histoType_(histo_type),
49  runType_(run_type),
50  keyType_(key_type),
51  keyValue_(key_value),
52  granularity_(gran),
54  extraInfo_(extra_info) {
55  setTitle();
56 }

References setTitle().

◆ SiStripHistoTitle() [3/4]

SiStripHistoTitle::SiStripHistoTitle ( const std::string &  histo_title)

Extracts individual components from histogram title.

Definition at line 60 of file SiStripHistoTitle.cc.

References extractTitle().

◆ SiStripHistoTitle() [4/4]

SiStripHistoTitle::SiStripHistoTitle ( )
inlineprivate

Private default constructor.

Definition at line 72 of file SiStripHistoTitle.h.

72 { ; }

Member Function Documentation

◆ channel()

const uint16_t & SiStripHistoTitle::channel ( ) const
inline

Returns channel for histogram granularity.

Definition at line 115 of file SiStripHistoTitle.h.

115 { return channel_; }

References channel_.

◆ extractTitle()

void SiStripHistoTitle::extractTitle ( )
private

Extracts member data values from title.

Definition at line 98 of file SiStripHistoTitle.cc.

98  {
99  std::string::size_type length = title_.length();
102  std::string::size_type siz = 0;
103 
104  // Extract HistoType
105  siz = title_.find(sistrip::sep_, position) - position;
108  position += title_.substr(position).find(histo_type) + histo_type.size() + (sizeof(sistrip::sep_) - 1);
110  position = 0;
111  } else if (position >= length) {
112  return;
113  }
114 
115  // Extract RunType
116  siz = title_.find(sistrip::sep_, position) - position;
119  position += title_.substr(position).find(run_type) + run_type.size() + (sizeof(sistrip::sep_) - 1);
120  if (position >= length) {
121  return;
122  }
123 
124  // Extract KeyType
125  siz = title_.find(sistrip::sep_, position) - position;
128  position += title_.substr(position).find(key_type) + key_type.size() + (sizeof(sistrip::hex_) - 1);
129  if (position >= length) {
130  return;
131  }
132 
133  // Extract KeyValue
134  siz = 8;
135  std::stringstream key;
136  key << title_.substr(position, siz);
137  key >> std::hex >> keyValue_;
138  position += siz + (sizeof(sistrip::sep_) - 1);
139  if (position >= length) {
140  return;
141  }
142 
143  // Extract Granularity
144  pos = title_.find(sistrip::sep_, position);
145  if (pos == std::string::npos || pos < position) {
146  siz = std::string::npos - position;
147  } else {
148  siz = pos - position;
149  }
152  position += title_.substr(position).find(gran) + gran.size();
153  if (position > length) {
154  return;
155  }
156 
157  // Extract Channel
158  pos = title_.find(sistrip::sep_, position);
159  if (pos == std::string::npos || pos < position) {
160  siz = std::string::npos - position;
161  } else {
162  siz = pos - position;
163  }
164  if (position == length || !siz) {
166  channel_ = 0;
167  } else if (granularity_ == sistrip::UNKNOWN_GRAN) {
169  }
170  } else {
171  std::stringstream chan;
172  chan << title_.substr(position, siz);
173  chan >> std::dec >> channel_;
174  }
175  position += siz + (sizeof(sistrip::sep_) - 1);
176  if (position >= length) {
177  return;
178  }
179 
180  // Extract ExtraInfo
181  extraInfo_ = title_.substr(position, std::string::npos - position);
182 }

References officialStyle::chan, channel_, TauDecayModes::dec, extraInfo_, SiStripEnumsAndStrings::granularity(), granularity_, sistrip::hex_, SiStripEnumsAndStrings::histoType(), histoType_, sistrip::invalid_, crabWrapper::key, SiStripEnumsAndStrings::keyType(), keyType_, keyValue_, position, SiStripEnumsAndStrings::runType(), runType_, sistrip::sep_, AlCaHLTBitMon_QueryRunRegistry::string, title_, sistrip::UNDEFINED_GRAN, sistrip::UNKNOWN_GRAN, and sistrip::UNKNOWN_HISTO_TYPE.

Referenced by SiStripHistoTitle().

◆ extraInfo()

const std::string & SiStripHistoTitle::extraInfo ( ) const
inline

Extra information attached to histogram title.

Definition at line 116 of file SiStripHistoTitle.h.

116 { return extraInfo_; }

References extraInfo_.

◆ granularity()

const sistrip::Granularity & SiStripHistoTitle::granularity ( ) const
inline

Returns granularity of histogram.

Definition at line 114 of file SiStripHistoTitle.h.

114 { return granularity_; }

References granularity_.

◆ histoType()

const sistrip::HistoType & SiStripHistoTitle::histoType ( ) const
inline

Returns the histogram type.

Definition at line 110 of file SiStripHistoTitle.h.

110 { return histoType_; }

References histoType_.

◆ keyType()

const sistrip::KeyType & SiStripHistoTitle::keyType ( ) const
inline

Defines key type used to form the histogram title.

Definition at line 112 of file SiStripHistoTitle.h.

112 { return keyType_; }

References keyType_.

◆ keyValue()

const uint32_t & SiStripHistoTitle::keyValue ( ) const
inline

Returns values of the 32-bit key.

Definition at line 113 of file SiStripHistoTitle.h.

113 { return keyValue_; }

References keyValue_.

◆ runType()

const sistrip::RunType & SiStripHistoTitle::runType ( ) const
inline

Returns the run type.

Definition at line 111 of file SiStripHistoTitle.h.

111 { return runType_; }

References runType_.

◆ setTitle()

void SiStripHistoTitle::setTitle ( )
private

Constructs histogram title.

Definition at line 74 of file SiStripHistoTitle.cc.

74  {
75  std::stringstream title;
76 
77  // Append HistoType, RunType, KeyType and KeyValue
80  << std::setw(8) << std::hex << keyValue_ << std::dec << sistrip::sep_;
81 
82  // Append Granularity and channel number
84  if (channel_) {
85  title << channel_;
86  }
87 
88  // Append extra info
89  if (!extraInfo_.empty()) {
91  }
92 
93  title_ = title.str();
94 }

References channel_, TauDecayModes::dec, extraInfo_, SiStripEnumsAndStrings::granularity(), granularity_, sistrip::hex_, SiStripEnumsAndStrings::histoType(), histoType_, SiStripEnumsAndStrings::keyType(), keyType_, keyValue_, SiStripEnumsAndStrings::runType(), runType_, sistrip::sep_, title(), and title_.

Referenced by SiStripHistoTitle().

◆ title()

const std::string & SiStripHistoTitle::title ( ) const
inline

Member Data Documentation

◆ channel_

uint16_t SiStripHistoTitle::channel_
private

Channel number for granularity.

Definition at line 101 of file SiStripHistoTitle.h.

Referenced by channel(), extractTitle(), setTitle(), and SiStripHistoTitle().

◆ extraInfo_

std::string SiStripHistoTitle::extraInfo_
private

Extra information to be attached to title.

Definition at line 104 of file SiStripHistoTitle.h.

Referenced by extractTitle(), extraInfo(), and setTitle().

◆ granularity_

sistrip::Granularity SiStripHistoTitle::granularity_
private

Granularity of histogram.

Definition at line 98 of file SiStripHistoTitle.h.

Referenced by extractTitle(), granularity(), setTitle(), and SiStripHistoTitle().

◆ histoType_

sistrip::HistoType SiStripHistoTitle::histoType_
private

Defines histo type.

Definition at line 86 of file SiStripHistoTitle.h.

Referenced by extractTitle(), histoType(), and setTitle().

◆ keyType_

sistrip::KeyType SiStripHistoTitle::keyType_
private

Defines key type.

Definition at line 92 of file SiStripHistoTitle.h.

Referenced by extractTitle(), keyType(), setTitle(), and SiStripHistoTitle().

◆ keyValue_

uint32_t SiStripHistoTitle::keyValue_
private

Key value.

Definition at line 95 of file SiStripHistoTitle.h.

Referenced by extractTitle(), keyValue(), setTitle(), and SiStripHistoTitle().

◆ runType_

sistrip::RunType SiStripHistoTitle::runType_
private

Defines run type.

Definition at line 89 of file SiStripHistoTitle.h.

Referenced by extractTitle(), runType(), and setTitle().

◆ title_

std::string SiStripHistoTitle::title_
private

Histogram title.

Definition at line 83 of file SiStripHistoTitle.h.

Referenced by extractTitle(), setTitle(), and title().

SiStripEnumsAndStrings::runType
static std::string runType(const sistrip::RunType &)
Definition: SiStripEnumsAndStrings.cc:39
SiStripHistoTitle::channel_
uint16_t channel_
Definition: SiStripHistoTitle.h:101
sistrip::invalid32_
static const uint32_t invalid32_
Definition: Constants.h:15
SiStripHistoTitle::setTitle
void setTitle()
Definition: SiStripHistoTitle.cc:74
SiStripEnumsAndStrings::histoType
static std::string histoType(const sistrip::HistoType &)
Definition: SiStripEnumsAndStrings.cc:517
pos
Definition: PixelAliasList.h:18
SiStripHistoTitle::keyValue_
uint32_t keyValue_
Definition: SiStripHistoTitle.h:95
SiStripHistoTitle::histoType_
sistrip::HistoType histoType_
Definition: SiStripHistoTitle.h:86
sistrip::UNKNOWN_GRAN
Definition: ConstantsForGranularity.h:62
SiStripHistoTitle::granularity_
sistrip::Granularity granularity_
Definition: SiStripHistoTitle.h:98
sistrip::sep_
static const char sep_[]
Definition: ConstantsForDqm.h:18
SiStripHistoTitle::runType_
sistrip::RunType runType_
Definition: SiStripHistoTitle.h:89
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
sistrip::UNKNOWN_KEY
Definition: ConstantsForKeyType.h:28
sistrip::UNDEFINED_HISTO_TYPE
Definition: ConstantsForHistoType.h:28
SiStripHistoTitle::extraInfo_
std::string extraInfo_
Definition: SiStripHistoTitle.h:104
SiStripEnumsAndStrings::granularity
static std::string granularity(const sistrip::Granularity &)
Definition: SiStripEnumsAndStrings.cc:265
sistrip::UNKNOWN_HISTO_TYPE
Definition: ConstantsForHistoType.h:27
sistrip::UNDEFINED_KEY
Definition: ConstantsForKeyType.h:29
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
SiStripHistoTitle::keyType_
sistrip::KeyType keyType_
Definition: SiStripHistoTitle.h:92
SiStripHistoTitle::extractTitle
void extractTitle()
Definition: SiStripHistoTitle.cc:98
sistrip::FEC_KEY
Definition: ConstantsForKeyType.h:31
sistrip::invalid_
static const uint16_t invalid_
Definition: Constants.h:16
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiStripHistoTitle::channel
const uint16_t & channel() const
Definition: SiStripHistoTitle.h:115
SiStripHistoTitle::title_
std::string title_
Definition: SiStripHistoTitle.h:83
officialStyle.chan
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi....
Definition: officialStyle.py:106
sistrip::UNDEFINED_RUN_TYPE
Definition: ConstantsForRunType.h:95
SiStripHistoTitle::title
const std::string & title() const
Definition: SiStripHistoTitle.h:109
sistrip::hex_
static const char hex_[]
Definition: ConstantsForDqm.h:21
sistrip::FED_KEY
Definition: ConstantsForKeyType.h:30
sistrip::UNDEFINED_GRAN
Definition: ConstantsForGranularity.h:61
crabWrapper.key
key
Definition: crabWrapper.py:19
TauDecayModes.dec
dec
Definition: TauDecayModes.py:142
SiStripEnumsAndStrings::keyType
static std::string keyType(const sistrip::KeyType &)
Definition: SiStripEnumsAndStrings.cc:231