CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 // $Id: SiPixelHistogramId.cc,v 1.4 2010/11/29 20:41:58 wmtan Exp $
12 //
13 
14 #include<iostream>
15 #include<sstream>
16 
19 
20 using namespace edm;
21 
24  dataCollection_("defaultData"),
25  separator_("_")
26 {
27 }
30  dataCollection_(dataCollection),
31  separator_("_")
32 {
33 }
34 
37 {
38 }
41 {
42  std::string histoId;
43  std::ostringstream rawIdString;
44  rawIdString<<rawId;
45  histoId = variable + separator_ + dataCollection_ + separator_ + rawIdString.str();
46 
47  return histoId;
48 }
51  return returnIdPart(histoid,2);
52 }
55  uint32_t local_component_id;
56  std::istringstream input(returnIdPart(histoid,3)); input >> local_component_id;
57  return local_component_id;
58 }
61 
62  size_t length1=histoid.find(separator_,0);
63  if(length1==std::string::npos){ // no separator1 found
64  LogWarning("PixelDQM")<<"SiPixelHistogramId::returnIdPart - no regular histoid. Returning 0";
65  return "0";
66  }
67  std::string part1 = histoid.substr(0,length1); // part of 'histoid' up to 'separator1'
68  if(whichpart==1) return part1;
69  std::string remain1 = histoid.substr(length1+separator_.size()); // rest of 'histoid' starting at end of 'separator1'
70  size_t length2=remain1.find(separator_,0);
71  if(length2==std::string::npos){ // no separator2 found
72  LogWarning("PixelDQM")<<"SiPixelHistogramId::returnIdPart - no regular histoid. Returning 0";
73  return "0";
74  }
75  std::string part2 = remain1.substr(0,length2); // part of 'remain1' up to 'separator2'
76  if(whichpart==2) return part2;
77  std::string part3 = remain1.substr(length2+separator_.size()); // rest of remain1 starting at end of 'separator2'
78  if(whichpart==3) return part3;
79  LogWarning("PixelDQM")<<"SiPixelHistogramId::returnIdPart - no such whichpart="<<whichpart<<" returning 0";
80  return "0";
81 }
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.
uint32_t getRawId(std::string histogramId)
Get Detector Raw Id.
SiPixelHistogramId()
Constructor.