CMS 3D CMS Logo

SiPixelHistogramId.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SiPixelCommon
4 // Class : SiPixelHistogramId
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: chiochia
10 // Created: Wed Feb 22 16:07:58 CET 2006
11 //
12 
13 #include<iostream>
14 #include<sstream>
15 
18 
19 using namespace edm;
20 
23  dataCollection_("defaultData"),
24  separator_("_")
25 {
26 }
29  dataCollection_(dataCollection),
30  separator_("_")
31 {
32 }
33 
36 {
37 }
40 {
41  std::string histoId;
42  std::ostringstream rawIdString;
43  rawIdString<<rawId;
44  histoId = variable + separator_ + dataCollection_ + separator_ + rawIdString.str();
45 
46  return histoId;
47 }
50  return returnIdPart(histoid,2);
51 }
54  uint32_t local_component_id;
55  std::istringstream input(returnIdPart(histoid,3)); input >> local_component_id;
56  return local_component_id;
57 }
60 
61  size_t length1=histoid.find(separator_,0);
62  if(length1==std::string::npos){ // no separator1 found
63  LogWarning("PixelDQM")<<"SiPixelHistogramId::returnIdPart - no regular histoid. Returning 0";
64  return "0";
65  }
66  std::string part1 = histoid.substr(0,length1); // part of 'histoid' up to 'separator1'
67  if(whichpart==1) return part1;
68  std::string remain1 = histoid.substr(length1+separator_.size()); // rest of 'histoid' starting at end of 'separator1'
69  size_t length2=remain1.find(separator_,0);
70  if(length2==std::string::npos){ // no separator2 found
71  LogWarning("PixelDQM")<<"SiPixelHistogramId::returnIdPart - no regular histoid. Returning 0";
72  return "0";
73  }
74  std::string part2 = remain1.substr(0,length2); // part of 'remain1' up to 'separator2'
75  if(whichpart==2) return part2;
76  std::string part3 = remain1.substr(length2+separator_.size()); // rest of remain1 starting at end of 'separator2'
77  if(whichpart==3) return part3;
78  LogWarning("PixelDQM")<<"SiPixelHistogramId::returnIdPart - no such whichpart="<<whichpart<<" returning 0";
79  return "0";
80 }
static std::string const input
Definition: EdmProvDump.cc:44
virtual ~SiPixelHistogramId()
Destructor.
std::string dataCollection_
std::string returnIdPart(std::string histoid, uint32_t whichpart)
get Part
std::string getDataCollection(std::string histogramId)
Get data Collection.
std::string setHistoId(std::string variable, uint32_t &rawId)
Set Histogram Id.
HLT enums.
uint32_t getRawId(std::string histogramId)
Get Detector Raw Id.
SiPixelHistogramId()
Constructor.