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
SiStripHistoId Class Reference

#include <DQM/SiStripCommon/interface/SiStripHistoId.h>

Public Member Functions

std::string createHistoId (std::string description, std::string id_type, uint32_t component_id)
 
std::string createHistoLayer (std::string description, std::string id_type, std::string path, std::string flag)
 
uint32_t getComponentId (std::string histoid)
 
std::string getComponentType (std::string histoid)
 
std::string getSubdetid (uint32_t id, bool flag_ring)
 
 SiStripHistoId ()
 
virtual ~SiStripHistoId ()
 

Private Member Functions

const SiStripHistoIdoperator= (const SiStripHistoId &)
 
std::string returnIdPart (std::string histoid, uint32_t whichpart)
 
 SiStripHistoId (const SiStripHistoId &)
 

Private Attributes

std::string separator1
 
std::string separator2
 

Detailed Description

Description: <one line="" class="" summary>="">

Usage: <usage>

Definition at line 26 of file SiStripHistoId.h.

Constructor & Destructor Documentation

SiStripHistoId::SiStripHistoId ( )

Definition at line 26 of file SiStripHistoId.cc.

References separator1, and separator2.

27 {
28  separator1="__";
29  separator2="__";
30 }
std::string separator2
std::string separator1
SiStripHistoId::~SiStripHistoId ( )
virtual

Definition at line 33 of file SiStripHistoId.cc.

34 {
35 }
SiStripHistoId::SiStripHistoId ( const SiStripHistoId )
private

Member Function Documentation

std::string SiStripHistoId::createHistoId ( std::string  description,
std::string  id_type,
uint32_t  component_id 
)

Definition at line 38 of file SiStripHistoId.cc.

References idDealer::description, separator1, and separator2.

Referenced by SiStripLAProfileBooker::beginRun(), SiStripBaseCondObjDQM::bookCumulMEs(), SiStripMonitorTrack::bookModMEs(), SiStripBaseCondObjDQM::bookProfileMEs(), SiStripMonitorTrack::clusterInfos(), SiStripMonitorPedestals::createMEs(), SiStripMonitorCluster::createModuleMEs(), SiStripMonitorDigi::createModuleMEs(), and SiStripMonitorQuality::getQualityME().

38  {
39  size_t pos1 = description.find( separator1, 0 ); // check if std::string 'description' contains by mistake the 'separator1'
40  size_t pos2 = description.find( separator2, 0 ); // check if std::string 'description' contains by mistake the 'separator2'
41  std::string local_histo_id;
42  std::ostringstream compid;
43  compid<<component_id; // use std::ostringstream for casting integer to std::string
44 
45  if ( pos1 == std::string::npos && pos2 == std::string::npos ){ // ok, not found either separator
46  if(id_type=="fed" || id_type=="det" || id_type=="fec"){ // ok! is one of the accepted id_type-s
47  local_histo_id = description + separator1 + id_type + separator2 + compid.str();
48  }else{
49  local_histo_id = description + separator1 + "dummy" + separator2 + compid.str();
50  edm::LogError("SiStripHistoId") <<" SiStripHistoId::WrongInput "
51  <<" no such type of component accepted: "<<id_type
52  <<" id_type can be: fed, det, or fec.";
53  }
54  }else{
55  local_histo_id = description + "_dummy_" + separator1 + id_type + separator2 + compid.str();
56  edm::LogError("SiStripHistoId") <<" SiStripHistoId::WrongInput "
57  <<" histogram description cannot contain: "<<separator1<<" or: "<<separator2
58  <<" histogram description = "<<description;
59  }
60  return local_histo_id;
61 }
std::string separator2
tuple description
Definition: idDealer.py:66
std::string separator1
std::string SiStripHistoId::createHistoLayer ( std::string  description,
std::string  id_type,
std::string  path,
std::string  flag 
)

Definition at line 63 of file SiStripHistoId.cc.

References idDealer::description, LogTrace, path(), separator1, and separator2.

Referenced by SiStripMonitorTrack::bookLayerMEs(), SiStripBaseCondObjDQM::bookSummaryCumulMEs(), SiStripBaseCondObjDQM::bookSummaryMEs(), SiStripBaseCondObjDQM::bookSummaryProfileMEs(), SiStripMonitorCluster::createLayerMEs(), SiStripMonitorDigi::createLayerMEs(), SiStripNoisesDQM::fillMEsForLayer(), SiStripLorentzAngleDQM::fillMEsForLayer(), SiStripPedestalsDQM::fillMEsForLayer(), SiStripThresholdDQM::fillMEsForLayer(), SiStripApvGainsDQM::fillMEsForLayer(), and SiStripQualityDQM::fillMEsForLayer().

63  {
64  size_t pos1 = description.find( separator1, 0 ); // check if std::string 'description' contains by mistake the 'separator1'
65  size_t pos2 = description.find( separator2, 0 ); // check if std::string 'description' contains by mistake the 'separator2'
66  std::string local_histo_id;
67  if ( pos1 == std::string::npos && pos2 == std::string::npos ){ // ok, not found either separator
68  if(id_type=="fed" || id_type=="det" || id_type=="fec" || id_type=="layer"){ // ok! is one of the accepted id_type-s
69  if(flag.size() > 0)
70  local_histo_id = description + separator1 + flag + separator2 + path;
71  else
72  local_histo_id = description + separator2 + path;
73  LogTrace("SiStripHistoId") << "Local_histo_ID " << local_histo_id << std::endl;
74  }else{
75  local_histo_id = description + separator2 + "_dummy_" + path;
76  edm::LogError("SiStripHistoId") <<" SiStripHistoId::WrongInput "
77  <<" no such type of component accepted: "<<id_type
78  <<" id_type can be: fed, det, fec or layer ";
79  }
80  }else{
81  local_histo_id = description + "_dummy_" + separator2 + path;
82  edm::LogWarning("SiStripHistoId") <<" SiStripHistoId::WrongInput "
83  <<" histogram description cannot contain: "<<separator1<<" or: "<<separator2
84  <<" histogram description = "<<description;
85  }
86  return local_histo_id;
87 }
long int flag
Definition: mlp_lapack.h:47
std::string separator2
int path() const
Definition: HLTadd.h:3
#define LogTrace(id)
tuple description
Definition: idDealer.py:66
std::string separator1
uint32_t SiStripHistoId::getComponentId ( std::string  histoid)

Definition at line 122 of file SiStripHistoId.cc.

References collect_tpl::input, and returnIdPart().

Referenced by SiStripCalibLorentzAngle::algoBeginJob().

122  {
123  uint32_t local_component_id;
124  std::istringstream input(returnIdPart(histoid,3)); input >> local_component_id; // use std::istringstream for casting from std::string to uint32_t
125  return local_component_id;
126 }
std::string returnIdPart(std::string histoid, uint32_t whichpart)
tuple input
Definition: collect_tpl.py:10
std::string SiStripHistoId::getComponentType ( std::string  histoid)

Definition at line 129 of file SiStripHistoId.cc.

References returnIdPart().

129  {
130  return returnIdPart(histoid,2);
131 }
std::string returnIdPart(std::string histoid, uint32_t whichpart)
std::string SiStripHistoId::getSubdetid ( uint32_t  id,
bool  flag_ring 
)

Definition at line 89 of file SiStripHistoId.cc.

References TOBDetId::layer(), TIBDetId::layer(), TIDDetId::ring(), TECDetId::ring(), TIDDetId::side(), TECDetId::side(), DetId::subdetId(), StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, StripSubdetector::TOB, TIDDetId::wheel(), and TECDetId::wheel().

Referenced by SiStripMonitorTrack::book(), SiStripMonitorDigi::createMEs(), SiStripMonitorCluster::createMEs(), and SiStripMonitorTrack::fillMEs().

89  { std::string rest1;
90 
91  const int buf_len = 50;
92  char temp_str[buf_len];
93 
94  StripSubdetector subdet(id);
95  if( subdet.subdetId() == StripSubdetector::TIB){
96  // --------------------------- TIB --------------------------- //
97  TIBDetId tib1 = TIBDetId(id);
98  snprintf(temp_str, buf_len, "TIB__layer__%i", tib1.layer());
99  }else if( subdet.subdetId() == StripSubdetector::TID){
100  // --------------------------- TID --------------------------- //
101  TIDDetId tid1 = TIDDetId(id);
102  if (flag_ring) snprintf(temp_str, buf_len, "TID__side__%i__ring__%i", tid1.side(), tid1.ring());
103  else snprintf(temp_str, buf_len, "TID__side__%i__wheel__%i", tid1.side(), tid1.wheel());
104  }else if(subdet.subdetId() == StripSubdetector::TOB){
105  // --------------------------- TOB --------------------------- //
106  TOBDetId tob1 = TOBDetId(id);
107  snprintf(temp_str, buf_len, "TOB__layer__%i",tob1.layer());
108  }else if(subdet.subdetId() == StripSubdetector::TEC){
109  // --------------------------- TEC --------------------------- //
110  TECDetId tec1 = TECDetId(id);
111  if (flag_ring) snprintf(temp_str, buf_len, "TEC__side__%i__ring__%i", tec1.side(), tec1.ring());
112  else snprintf(temp_str, buf_len, "TEC__side__%i__wheel__%i", tec1.side(), tec1.wheel());
113  }else{
114  // --------------------------- ??? --------------------------- //
115  edm::LogError("SiStripTkDQM|WrongInput")<<"no such subdetector type :"<<subdet.subdetId()<<" no folder set!"<<std::endl;
116  snprintf(temp_str,0,"%s","");
117  }
118 
119  return std::string(temp_str);
120 }
unsigned int layer() const
layer id
Definition: TOBDetId.h:39
unsigned int side() const
positive or negative id
Definition: TECDetId.h:47
unsigned int ring() const
ring id
Definition: TIDDetId.h:55
unsigned int side() const
positive or negative id
Definition: TIDDetId.h:45
unsigned int wheel() const
wheel id
Definition: TECDetId.h:52
unsigned int layer() const
layer id
Definition: TIBDetId.h:41
unsigned int ring() const
ring id
Definition: TECDetId.h:71
unsigned int wheel() const
wheel id
Definition: TIDDetId.h:50
const SiStripHistoId& SiStripHistoId::operator= ( const SiStripHistoId )
private
std::string SiStripHistoId::returnIdPart ( std::string  histoid,
uint32_t  whichpart 
)
private

Definition at line 134 of file SiStripHistoId.cc.

References separator1, and separator2.

Referenced by getComponentId(), and getComponentType().

134  {
135  size_t length1=histoid.find(separator1,0);
136  if(length1==std::string::npos){ // no separator1 found
137  edm::LogWarning("SiStripTkDQM|UnregularInput")<<"no regular histoid. Returning 0";
138  return "0";
139  }
140  std::string part1 = histoid.substr(0,length1); // part of 'histoid' up to 'separator1'
141  if(whichpart==1) return part1;
142  std::string remain1 = histoid.substr(length1+separator1.size()); // rest of 'histoid' starting at end of 'separator1'
143  size_t length2=remain1.find(separator2,0);
144  if(length2==std::string::npos){ // no separator2 found
145  edm::LogWarning("SiStripTkDQM|UnregularInput")<<"no regular histoid. Returning 0";
146  return "0";
147  }
148  std::string part2 = remain1.substr(0,length2); // part of 'remain1' up to 'separator2'
149  if(whichpart==2) return part2;
150  std::string part3 = remain1.substr(length2+separator2.size()); // rest of remain1 starting at end of 'separator2'
151  if(whichpart==3) return part3;
152  edm::LogWarning("SiStripTkDQM|UnregularInput")<<"no such whichpart="<<whichpart<<" returning 0";
153  return "0";
154 }
std::string separator2
std::string separator1

Member Data Documentation

std::string SiStripHistoId::separator1
private

Definition at line 43 of file SiStripHistoId.h.

Referenced by createHistoId(), createHistoLayer(), returnIdPart(), and SiStripHistoId().

std::string SiStripHistoId::separator2
private

Definition at line 44 of file SiStripHistoId.h.

Referenced by createHistoId(), createHistoLayer(), returnIdPart(), and SiStripHistoId().