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_("_") {}
24 SiPixelHistogramId::SiPixelHistogramId(std::string dataCollection) : dataCollection_(dataCollection), 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 }
input
static const std::string input
Definition: EdmProvDump.cc:48
MessageLogger.h
edm
HLT enums.
Definition: AlignableModifier.h:19
SiPixelHistogramId::SiPixelHistogramId
SiPixelHistogramId()
Constructor.
Definition: SiPixelHistogramId.cc:22
SiPixelHistogramId.h
SiPixelHistogramId::dataCollection_
std::string dataCollection_
Definition: SiPixelHistogramId.h:42
SiPixelHistogramId::returnIdPart
std::string returnIdPart(std::string histoid, uint32_t whichpart)
get Part
Definition: SiPixelHistogramId.cc:47
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
SiPixelHistogramId::setHistoId
std::string setHistoId(std::string variable, uint32_t &rawId)
Set Histogram Id.
Definition: SiPixelHistogramId.cc:29
SiPixelHistogramId::getDataCollection
std::string getDataCollection(std::string histogramId)
Get data Collection.
Definition: SiPixelHistogramId.cc:38
SiPixelHistogramId::~SiPixelHistogramId
virtual ~SiPixelHistogramId()
Destructor.
Definition: SiPixelHistogramId.cc:27
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiPixelHistogramId::getRawId
uint32_t getRawId(std::string histogramId)
Get Detector Raw Id.
Definition: SiPixelHistogramId.cc:40
taus_updatedMVAIds_cff.variable
variable
Definition: taus_updatedMVAIds_cff.py:33
SiPixelHistogramId::separator_
std::string separator_
Definition: SiPixelHistogramId.h:43