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 21 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 14 of file SiStripHistoTitle.cc.

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

18  : title_(""),
19  histoType_(histo_type),
20  runType_(run_type),
25  extraInfo_(extra_info)
26 {
27  SiStripKey& temp = const_cast<SiStripKey&>(key_object);
28  if ( &dynamic_cast<SiStripFedKey&>(temp) ) {
30  } else if ( &dynamic_cast<SiStripFecKey&>(temp) ) {
32  } else {
34  }
35  if ( &key_object ) {
36  keyValue_ = key_object.key();
37  granularity_ = key_object.granularity();
38  channel_ = key_object.channel();
39  }
40  setTitle();
41 }
static const uint32_t invalid32_
Definition: Constants.h:16
sistrip::Granularity granularity_
sistrip::RunType runType_
sistrip::HistoType histoType_
Base utility class that identifies a position within a logical structure of the strip tracker...
Definition: SiStripKey.h:24
sistrip::KeyType keyType_
static const uint16_t invalid_
Definition: Constants.h:17
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 45 of file SiStripHistoTitle.cc.

References setTitle().

52  : title_(""),
53  histoType_(histo_type),
54  runType_(run_type),
55  keyType_(key_type),
56  keyValue_(key_value),
57  granularity_(gran),
59  extraInfo_(extra_info)
60 {
61  setTitle();
62 }
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 66 of file SiStripHistoTitle.cc.

References extractTitle().

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

Private default constructor.

Definition at line 76 of file SiStripHistoTitle.h.

76 {;}

Member Function Documentation

const uint16_t & SiStripHistoTitle::channel ( ) const
inline

Returns channel for histogram granularity.

Definition at line 120 of file SiStripHistoTitle.h.

References channel_.

Referenced by operator<<().

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

Extracts member data values from title.

Definition at line 110 of file SiStripHistoTitle.cc.

References channel_, extraInfo_, SiStripEnumsAndStrings::granularity(), granularity_, sistrip::hex_, SiStripEnumsAndStrings::histoType(), histoType_, sistrip::invalid_, combine::key, SiStripEnumsAndStrings::keyType(), keyType_, keyValue_, pos, position, SiStripEnumsAndStrings::runType(), runType_, sistrip::sep_, title_, sistrip::UNDEFINED_GRAN, sistrip::UNKNOWN_GRAN, and sistrip::UNKNOWN_HISTO_TYPE.

Referenced by SiStripHistoTitle().

110  {
111 
112  std::string::size_type length = title_.length();
115  std::string::size_type siz = 0;
116 
117  // Extract HistoType
118  siz = title_.find(sistrip::sep_,position) - position;
119  histoType_ = SiStripEnumsAndStrings::histoType( title_.substr(position,siz) );
120  std::string histo_type = SiStripEnumsAndStrings::histoType( histoType_ );
121  position += title_.substr(position).find( histo_type ) + histo_type.size() + (sizeof(sistrip::sep_) - 1);
122  if ( histoType_ == sistrip::UNKNOWN_HISTO_TYPE ) { position = 0; }
123  else if ( position >= length ) { return; }
124 
125  // Extract RunType
126  siz = title_.find(sistrip::sep_,position) - position;
127  runType_ = SiStripEnumsAndStrings::runType( title_.substr(position,siz) );
128  std::string run_type = SiStripEnumsAndStrings::runType( runType_ );
129  position += title_.substr(position).find( run_type ) + run_type.size() + (sizeof(sistrip::sep_) - 1);
130  if ( position >= length ) { return; }
131 
132  // Extract KeyType
133  siz = title_.find(sistrip::sep_,position) - position;
134  keyType_ = SiStripEnumsAndStrings::keyType( title_.substr(position,siz) );
135  std::string key_type = SiStripEnumsAndStrings::keyType( keyType_ );
136  position += title_.substr(position).find( key_type ) + key_type.size() + (sizeof(sistrip::hex_) - 1);
137  if ( position >= length ) { return; }
138 
139  // Extract KeyValue
140  siz = 8;
141  std::stringstream key;
142  key << title_.substr(position,siz);
143  key >> std::hex >> keyValue_;
144  position += siz + (sizeof(sistrip::sep_) - 1);
145  if ( position >= length ) { return; }
146 
147  // Extract Granularity
148  pos = title_.find(sistrip::sep_,position);
149  if ( pos == std::string::npos || pos < position ) { siz = std::string::npos - position; }
150  else { siz = pos - position; }
151  granularity_ = SiStripEnumsAndStrings::granularity( title_.substr(position,siz) );
153  position += title_.substr(position).find( gran ) + gran.size();
154  if ( position > length ) { return; }
155 
156  // Extract Channel
157  pos = title_.find(sistrip::sep_,position);
158  if ( pos == std::string::npos || pos < position ) { siz = std::string::npos - position; }
159  else { siz = pos - position; }
160  if ( position == length || !siz ) {
163  } else {
164  std::stringstream chan;
165  chan << title_.substr(position,siz);
166  chan >> std::dec >> channel_;
167  }
168  position += siz + (sizeof(sistrip::sep_) - 1);
169  if ( position >= length ) { return; }
170 
171  // Extract ExtraInfo
172  extraInfo_ = title_.substr( position, std::string::npos - position );
173 
174 }
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 &)
sistrip::KeyType keyType_
static std::string keyType(const sistrip::KeyType &)
static const uint16_t invalid_
Definition: Constants.h:17
list key
Definition: combine.py:13
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 121 of file SiStripHistoTitle.h.

References extraInfo_.

Referenced by operator<<().

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

Returns granularity of histogram.

Definition at line 119 of file SiStripHistoTitle.h.

References granularity_.

Referenced by operator<<().

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

Returns the histogram type.

Definition at line 115 of file SiStripHistoTitle.h.

References histoType_.

Referenced by operator<<().

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

Defines key type used to form the histogram title.

Definition at line 117 of file SiStripHistoTitle.h.

References keyType_.

Referenced by operator<<().

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

Returns values of the 32-bit key.

Definition at line 118 of file SiStripHistoTitle.h.

References keyValue_.

Referenced by operator<<().

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

Returns the run type.

Definition at line 116 of file SiStripHistoTitle.h.

References runType_.

Referenced by operator<<().

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

Constructs histogram title.

Definition at line 81 of file SiStripHistoTitle.cc.

References channel_, 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().

81  {
82 
83  std::stringstream title;
84 
85  // Append HistoType, RunType, KeyType and KeyValue
87  << sistrip::sep_
89  << sistrip::sep_
91  << sistrip::hex_
92  << std::setfill('0') << std::setw(8) << std::hex << keyValue_ << std::dec
93  << sistrip::sep_;
94 
95  // Append Granularity and channel number
97  if ( channel_ ) { title << channel_; }
98 
99  // Append extra info
100  if ( extraInfo_ != "" ) {
101  title << sistrip::sep_ << extraInfo_;
102  }
103 
104  title_ = title.str();
105 
106 }
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 105 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 108 of file SiStripHistoTitle.h.

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

sistrip::Granularity SiStripHistoTitle::granularity_
private

Granularity of histogram.

Definition at line 102 of file SiStripHistoTitle.h.

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

sistrip::HistoType SiStripHistoTitle::histoType_
private

Defines histo type.

Definition at line 90 of file SiStripHistoTitle.h.

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

sistrip::KeyType SiStripHistoTitle::keyType_
private

Defines key type.

Definition at line 96 of file SiStripHistoTitle.h.

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

uint32_t SiStripHistoTitle::keyValue_
private

Key value.

Definition at line 99 of file SiStripHistoTitle.h.

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

sistrip::RunType SiStripHistoTitle::runType_
private

Defines run type.

Definition at line 93 of file SiStripHistoTitle.h.

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

std::string SiStripHistoTitle::title_
private

Histogram title.

Definition at line 87 of file SiStripHistoTitle.h.

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