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
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, const TrackerTopology *tTopo, 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 &)
 

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 23 of file SiStripHistoId.cc.

24 {
25 }
SiStripHistoId::~SiStripHistoId ( )
virtual

Definition at line 28 of file SiStripHistoId.cc.

29 {
30 }
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 33 of file SiStripHistoId.cc.

References idDealer::description, and AlCaHLTBitMon_QueryRunRegistry::string.

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

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

Definition at line 58 of file SiStripHistoId.cc.

References idDealer::description, LogTrace, cmsHarvester::path, and AlCaHLTBitMon_QueryRunRegistry::string.

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

58  {
59  size_t pos1 = description.find( "__", 0 ); // check if std::string 'description' contains by mistake the 'separator1'
60  size_t pos2 = description.find( "__", 0 ); // check if std::string 'description' contains by mistake the 'separator2'
61  std::string local_histo_id;
62  if ( pos1 == std::string::npos && pos2 == std::string::npos ){ // ok, not found either separator
63  if(id_type=="fed" || id_type=="det" || id_type=="fec" || id_type=="layer" || id_type=="ring"){ // ok! is one of the accepted id_type-s
64  if(flag.size() > 0)
65  local_histo_id = description + "__" + flag + "__" + path;
66  else
67  local_histo_id = description + "__" + path;
68  LogTrace("SiStripHistoId") << "Local_histo_ID " << local_histo_id << std::endl;
69  }else{
70  local_histo_id = description + "___dummy___" + path;
71  edm::LogError("SiStripHistoId") <<" SiStripHistoId::WrongInput "
72  <<" no such type of component accepted: "<<id_type
73  <<" id_type can be: fed, det, fec or layer ";
74  }
75  }else{
76  local_histo_id = description + "_dummy___" + path;
77  edm::LogWarning("SiStripHistoId") <<" SiStripHistoId::WrongInput "
78  <<" histogram description cannot contain: __ or: __"
79  <<" histogram description = "<<description;
80  }
81  return local_histo_id;
82 }
tuple path
else: Piece not in the list, fine.
#define LogTrace(id)
tuple description
Definition: idDealer.py:66
uint32_t SiStripHistoId::getComponentId ( std::string  histoid)

Definition at line 145 of file SiStripHistoId.cc.

References input, and returnIdPart().

Referenced by SiStripCalibLorentzAngle::algoBeginJob().

145  {
146  uint32_t local_component_id;
147  std::istringstream input(returnIdPart(histoid,3)); input >> local_component_id; // use std::istringstream for casting from std::string to uint32_t
148  return local_component_id;
149 }
std::string returnIdPart(std::string histoid, uint32_t whichpart)
static std::string const input
Definition: EdmProvDump.cc:43
std::string SiStripHistoId::getComponentType ( std::string  histoid)

Definition at line 152 of file SiStripHistoId.cc.

References returnIdPart().

152  {
153  return returnIdPart(histoid,2);
154 }
std::string returnIdPart(std::string histoid, uint32_t whichpart)
std::string SiStripHistoId::getSubdetid ( uint32_t  id,
const TrackerTopology tTopo,
bool  flag_ring 
)

Definition at line 85 of file SiStripHistoId.cc.

References AlCaHLTBitMon_QueryRunRegistry::string, DetId::subdetId(), StripSubdetector::TEC, TrackerTopology::tecRing(), TrackerTopology::tecSide(), TrackerTopology::tecWheel(), StripSubdetector::TIB, TrackerTopology::tibLayer(), StripSubdetector::TID, TrackerTopology::tidRing(), TrackerTopology::tidSide(), TrackerTopology::tidWheel(), StripSubdetector::TOB, and TrackerTopology::tobLayer().

Referenced by SiStripRecHitsValid::analyze(), SiStripTrackingRecHitsValid::analyze(), SiStripMonitorTrack::book(), SiStripMonitorDigi::createMEs(), SiStripMonitorCluster::createMEs(), SiStripRecHitsValid::createMEs(), SiStripTrackingRecHitsValid::createMEs(), and SiStripMonitorTrack::findMEs().

85  {
86  const int buf_len = 50;
87  char temp_str[buf_len];
88 
89  StripSubdetector subdet(id);
90  if( subdet.subdetId() == StripSubdetector::TIB){
91  // --------------------------- TIB --------------------------- //
92 
93  snprintf(temp_str, buf_len, "TIB__layer__%i", tTopo->tibLayer(id));
94  }else if( subdet.subdetId() == StripSubdetector::TID){
95  // --------------------------- TID --------------------------- //
96 
97  const char *side = "";
98  if (tTopo->tidSide(id) == 1)
99  side = "MINUS";
100  else if (tTopo->tidSide(id) == 2)
101  side = "PLUS";
102 
103  if (flag_ring)
104  snprintf(temp_str, buf_len, "TID__%s__ring__%i", side, tTopo->tidRing(id) );
105  else
106  snprintf(temp_str, buf_len, "TID__%s__wheel__%i", side, tTopo->tidWheel(id));
107 
108  }else if(subdet.subdetId() == StripSubdetector::TOB){
109  // --------------------------- TOB --------------------------- //
110 
111  snprintf(temp_str, buf_len, "TOB__layer__%i",tTopo->tobLayer(id));
112  }else if(subdet.subdetId() == StripSubdetector::TEC){
113  // --------------------------- TEC --------------------------- //
114 
115  const char *side = "";
116  if (tTopo->tecSide(id) == 1)
117  side = "MINUS";
118  else if (tTopo->tecSide(id) == 2)
119  side = "PLUS";
120 
121  if (flag_ring)
122  snprintf(temp_str, buf_len, "TEC__%s__ring__%i", side, tTopo->tecRing(id) );
123  else {
124  /*
125  if (flag_thickness) {
126  uint32_t ring = tTopo->tecRing(id);
127  if ( ring >= 1 && ring <= 4 )
128  snprintf(temp_str, buf_len, "TEC__%s__wheel__%i__THIN", side.c_str(), tTopo->tecWheel(id));
129  else
130  snprintf(temp_str, buf_len, "TEC__%s__wheel__%i__THICK", side.c_str(), tTopo->tecWheel(id));
131  }
132  else
133 */
134  snprintf(temp_str, buf_len, "TEC__%s__wheel__%i", side, tTopo->tecWheel(id));
135  }
136  }else{
137  // --------------------------- ??? --------------------------- //
138  edm::LogError("SiStripTkDQM|WrongInput")<<"no such subdetector type :"<<subdet.subdetId()<<" no folder set!"<<std::endl;
139  snprintf(temp_str,0,"%s","");
140  }
141 
142  return std::string(temp_str);
143 }
unsigned int tibLayer(const DetId &id) const
unsigned int tidRing(const DetId &id) const
unsigned int tecRing(const DetId &id) const
ring id
unsigned int tidWheel(const DetId &id) const
unsigned int tidSide(const DetId &id) const
unsigned int tecWheel(const DetId &id) const
unsigned int tobLayer(const DetId &id) const
unsigned int tecSide(const DetId &id) const
const SiStripHistoId& SiStripHistoId::operator= ( const SiStripHistoId )
private
std::string SiStripHistoId::returnIdPart ( std::string  histoid,
uint32_t  whichpart 
)
private

Definition at line 157 of file SiStripHistoId.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getComponentId(), and getComponentType().

157  {
158  size_t length1=histoid.find("__",0);
159  if(length1==std::string::npos){ // no separator1 found
160  edm::LogWarning("SiStripTkDQM|UnregularInput")<<"no regular histoid. Returning 0";
161  return "0";
162  }
163  std::string part1 = histoid.substr(0,length1); // part of 'histoid' up to 'separator1'
164  if(whichpart==1) return part1;
165  std::string remain1 = histoid.substr(length1+2); // rest of 'histoid' starting at end of 'separator1'
166  size_t length2=remain1.find("__",0);
167  if(length2==std::string::npos){ // no separator2 found
168  edm::LogWarning("SiStripTkDQM|UnregularInput")<<"no regular histoid. Returning 0";
169  return "0";
170  }
171  std::string part2 = remain1.substr(0,length2); // part of 'remain1' up to 'separator2'
172  if(whichpart==2) return part2;
173  std::string part3 = remain1.substr(length2+2); // rest of remain1 starting at end of 'separator2'
174  if(whichpart==3) return part3;
175  edm::LogWarning("SiStripTkDQM|UnregularInput")<<"no such whichpart="<<whichpart<<" returning 0";
176  return "0";
177 }