CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 SiStripKey &key, const std::string &extra_info="")
 
 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 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::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.

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

17  : title_(""),
18  histoType_(histo_type),
19  runType_(run_type),
24  extraInfo_(extra_info)
25 {
26  if ( &dynamic_cast<const SiStripFedKey&>(key_object) ) {
28  } else if ( &dynamic_cast<const SiStripFecKey&>(key_object) ) {
30  } else {
32  }
33  if ( &key_object ) {
34  keyValue_ = key_object.key();
35  granularity_ = key_object.granularity();
36  channel_ = key_object.channel();
37  }
38  setTitle();
39 }
static const uint32_t invalid32_
Definition: Constants.h:15
sistrip::Granularity granularity_
sistrip::RunType runType_
sistrip::HistoType histoType_
sistrip::KeyType keyType_
static const uint16_t invalid_
Definition: Constants.h:16
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 43 of file SiStripHistoTitle.cc.

References setTitle().

50  : title_(""),
51  histoType_(histo_type),
52  runType_(run_type),
53  keyType_(key_type),
54  keyValue_(key_value),
55  granularity_(gran),
57  extraInfo_(extra_info)
58 {
59  setTitle();
60 }
sistrip::Granularity granularity_
sistrip::RunType runType_
sistrip::HistoType histoType_
sistrip::KeyType keyType_
const uint16_t & channel() const
SiStripHistoTitle::SiStripHistoTitle ( const std::string &  histo_title)

Extracts individual components from histogram title.

Definition at line 64 of file SiStripHistoTitle.cc.

References extractTitle().

65  : title_(histo_title),
72  extraInfo_("")
73 {
74  extractTitle();
75 }
static const uint32_t invalid32_
Definition: Constants.h:15
sistrip::Granularity granularity_
sistrip::RunType runType_
sistrip::HistoType histoType_
sistrip::KeyType keyType_
static const uint16_t invalid_
Definition: Constants.h:16
SiStripHistoTitle::SiStripHistoTitle ( )
inlineprivate

Private default constructor.

Definition at line 75 of file SiStripHistoTitle.h.

75 {;}

Member Function Documentation

const uint16_t & SiStripHistoTitle::channel ( ) const
inline

Returns channel for histogram granularity.

Definition at line 119 of file SiStripHistoTitle.h.

References channel_.

Referenced by operator<<().

119 { return channel_; }
void SiStripHistoTitle::extractTitle ( )
private

Extracts member data values from title.

Definition at line 108 of file SiStripHistoTitle.cc.

References channel_, TauDecayModes::dec, extraInfo_, SiStripEnumsAndStrings::granularity(), granularity_, sistrip::hex_, SiStripEnumsAndStrings::histoType(), histoType_, sistrip::invalid_, relval_steps::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().

108  {
109 
110  std::string::size_type length = title_.length();
112  std::string::size_type pos = 0;
113  std::string::size_type siz = 0;
114 
115  // Extract HistoType
116  siz = title_.find(sistrip::sep_,position) - position;
117  histoType_ = SiStripEnumsAndStrings::histoType( title_.substr(position,siz) );
119  position += title_.substr(position).find( histo_type ) + histo_type.size() + (sizeof(sistrip::sep_) - 1);
120  if ( histoType_ == sistrip::UNKNOWN_HISTO_TYPE ) { position = 0; }
121  else if ( position >= length ) { return; }
122 
123  // Extract RunType
124  siz = title_.find(sistrip::sep_,position) - position;
125  runType_ = SiStripEnumsAndStrings::runType( title_.substr(position,siz) );
127  position += title_.substr(position).find( run_type ) + run_type.size() + (sizeof(sistrip::sep_) - 1);
128  if ( position >= length ) { return; }
129 
130  // Extract KeyType
131  siz = title_.find(sistrip::sep_,position) - position;
132  keyType_ = SiStripEnumsAndStrings::keyType( title_.substr(position,siz) );
134  position += title_.substr(position).find( key_type ) + key_type.size() + (sizeof(sistrip::hex_) - 1);
135  if ( position >= length ) { return; }
136 
137  // Extract KeyValue
138  siz = 8;
139  std::stringstream key;
140  key << title_.substr(position,siz);
141  key >> std::hex >> keyValue_;
142  position += siz + (sizeof(sistrip::sep_) - 1);
143  if ( position >= length ) { return; }
144 
145  // Extract Granularity
146  pos = title_.find(sistrip::sep_,position);
147  if ( pos == std::string::npos || pos < position ) { siz = std::string::npos - position; }
148  else { siz = pos - position; }
149  granularity_ = SiStripEnumsAndStrings::granularity( title_.substr(position,siz) );
151  position += title_.substr(position).find( gran ) + gran.size();
152  if ( position > length ) { return; }
153 
154  // Extract Channel
155  pos = title_.find(sistrip::sep_,position);
156  if ( pos == std::string::npos || pos < position ) { siz = std::string::npos - position; }
157  else { siz = pos - position; }
158  if ( position == length || !siz ) {
161  } else {
162  std::stringstream chan;
163  chan << title_.substr(position,siz);
164  chan >> std::dec >> channel_;
165  }
166  position += siz + (sizeof(sistrip::sep_) - 1);
167  if ( position >= length ) { return; }
168 
169  // Extract ExtraInfo
170  extraInfo_ = title_.substr( position, std::string::npos - position );
171 
172 }
sistrip::Granularity granularity_
sistrip::RunType runType_
static std::string granularity(const sistrip::Granularity &)
uint16_t size_type
static std::string runType(const sistrip::RunType &)
static const char sep_[]
sistrip::HistoType histoType_
static std::string histoType(const sistrip::HistoType &)
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
sistrip::KeyType keyType_
static std::string keyType(const sistrip::KeyType &)
static const uint16_t invalid_
Definition: Constants.h:16
static int position[264][3]
Definition: ReadPGInfo.cc:509
static const char hex_[]
const std::string & SiStripHistoTitle::extraInfo ( ) const
inline

Extra information attached to histogram title.

Definition at line 120 of file SiStripHistoTitle.h.

References extraInfo_.

Referenced by operator<<().

120 { return extraInfo_; }
const sistrip::Granularity & SiStripHistoTitle::granularity ( ) const
inline

Returns granularity of histogram.

Definition at line 118 of file SiStripHistoTitle.h.

References granularity_.

Referenced by operator<<().

118 { return granularity_; }
sistrip::Granularity granularity_
const sistrip::HistoType & SiStripHistoTitle::histoType ( ) const
inline

Returns the histogram type.

Definition at line 114 of file SiStripHistoTitle.h.

References histoType_.

Referenced by operator<<().

114 { return histoType_; }
sistrip::HistoType histoType_
const sistrip::KeyType & SiStripHistoTitle::keyType ( ) const
inline

Defines key type used to form the histogram title.

Definition at line 116 of file SiStripHistoTitle.h.

References keyType_.

Referenced by operator<<().

116 { return keyType_; }
sistrip::KeyType keyType_
const uint32_t & SiStripHistoTitle::keyValue ( ) const
inline

Returns values of the 32-bit key.

Definition at line 117 of file SiStripHistoTitle.h.

References keyValue_.

Referenced by operator<<().

117 { return keyValue_; }
const sistrip::RunType & SiStripHistoTitle::runType ( ) const
inline

Returns the run type.

Definition at line 115 of file SiStripHistoTitle.h.

References runType_.

Referenced by operator<<().

115 { return runType_; }
sistrip::RunType runType_
void SiStripHistoTitle::setTitle ( )
private

Constructs histogram title.

Definition at line 79 of file SiStripHistoTitle.cc.

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 Vispa.Gui.PortWidget.PortWidget::setName(), Vispa.Views.LineDecayView.LineDecayContainer::setPxlObject(), and SiStripHistoTitle().

79  {
80 
81  std::stringstream title;
82 
83  // Append HistoType, RunType, KeyType and KeyValue
85  << sistrip::sep_
87  << sistrip::sep_
89  << sistrip::hex_
90  << std::setfill('0') << std::setw(8) << std::hex << keyValue_ << std::dec
91  << sistrip::sep_;
92 
93  // Append Granularity and channel number
95  if ( channel_ ) { title << channel_; }
96 
97  // Append extra info
98  if ( extraInfo_ != "" ) {
99  title << sistrip::sep_ << extraInfo_;
100  }
101 
102  title_ = title.str();
103 
104 }
const std::string & title() const
sistrip::Granularity granularity_
sistrip::RunType runType_
static std::string granularity(const sistrip::Granularity &)
static std::string runType(const sistrip::RunType &)
static const char sep_[]
sistrip::HistoType histoType_
static std::string histoType(const sistrip::HistoType &)
sistrip::KeyType keyType_
static std::string keyType(const sistrip::KeyType &)
static const char hex_[]
const std::string & SiStripHistoTitle::title ( ) const
inline

Member Data Documentation

uint16_t SiStripHistoTitle::channel_
private

Channel number for granularity.

Definition at line 104 of file SiStripHistoTitle.h.

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

std::string SiStripHistoTitle::extraInfo_
private

Extra information to be attached to title.

Definition at line 107 of file SiStripHistoTitle.h.

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

sistrip::Granularity SiStripHistoTitle::granularity_
private

Granularity of histogram.

Definition at line 101 of file SiStripHistoTitle.h.

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

sistrip::HistoType SiStripHistoTitle::histoType_
private

Defines histo type.

Definition at line 89 of file SiStripHistoTitle.h.

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

sistrip::KeyType SiStripHistoTitle::keyType_
private

Defines key type.

Definition at line 95 of file SiStripHistoTitle.h.

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

uint32_t SiStripHistoTitle::keyValue_
private

Key value.

Definition at line 98 of file SiStripHistoTitle.h.

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

sistrip::RunType SiStripHistoTitle::runType_
private

Defines run type.

Definition at line 92 of file SiStripHistoTitle.h.

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

std::string SiStripHistoTitle::title_
private

Histogram title.

Definition at line 86 of file SiStripHistoTitle.h.

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