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 
22 SiPixelHistogramId::SiPixelHistogramId() : dataCollection_("defaultData"), separator_("_") {}
25 
30  std::string histoId;
31  std::ostringstream rawIdString;
32  rawIdString << rawId;
33  histoId = variable + separator_ + dataCollection_ + separator_ + rawIdString.str();
34 
35  return histoId;
36 }
41  uint32_t local_component_id;
42  std::istringstream input(returnIdPart(histoid, 3));
43  input >> local_component_id;
44  return local_component_id;
45 }
48  size_t length1 = histoid.find(separator_, 0);
49  if (length1 == std::string::npos) { // no separator1 found
50  LogWarning("PixelDQM") << "SiPixelHistogramId::returnIdPart - no regular histoid. Returning 0";
51  return "0";
52  }
53  std::string part1 = histoid.substr(0, length1); // part of 'histoid' up to 'separator1'
54  if (whichpart == 1)
55  return part1;
56  std::string remain1 =
57  histoid.substr(length1 + separator_.size()); // rest of 'histoid' starting at end of 'separator1'
58  size_t length2 = remain1.find(separator_, 0);
59  if (length2 == std::string::npos) { // no separator2 found
60  LogWarning("PixelDQM") << "SiPixelHistogramId::returnIdPart - no regular histoid. Returning 0";
61  return "0";
62  }
63  std::string part2 = remain1.substr(0, length2); // part of 'remain1' up to 'separator2'
64  if (whichpart == 2)
65  return part2;
66  std::string part3 = remain1.substr(length2 + separator_.size()); // rest of remain1 starting at end of 'separator2'
67  if (whichpart == 3)
68  return part3;
69  LogWarning("PixelDQM") << "SiPixelHistogramId::returnIdPart - no such whichpart=" << whichpart << " returning 0";
70  return "0";
71 }
static std::string const input
Definition: EdmProvDump.cc:48
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.