37 size_t pos1 = description.find(
"__", 0 );
38 size_t pos2 = description.find(
"__", 0 );
39 std::string local_histo_id;
40 std::ostringstream compid;
43 if ( pos1 == std::string::npos && pos2 == std::string::npos ){
44 if(id_type==
"fed" || id_type==
"det" || id_type==
"fec"){
45 local_histo_id = description +
"__" + id_type +
"__" + compid.str();
47 local_histo_id = description +
"__dummy__" + compid.str();
48 edm::LogError(
"SiStripHistoId") <<
" SiStripHistoId::WrongInput "
49 <<
" no such type of component accepted: "<<id_type
50 <<
" id_type can be: fed, det, or fec.";
53 local_histo_id = description +
"_dummy___" + id_type +
"__" + compid.str();
54 edm::LogError(
"SiStripHistoId") <<
" SiStripHistoId::WrongInput "
55 <<
" histogram description cannot contain: __ or: __"
58 return local_histo_id;
62 size_t pos1 = description.find(
"__", 0 );
63 size_t pos2 = description.find(
"__", 0 );
64 std::string local_histo_id;
65 if ( pos1 == std::string::npos && pos2 == std::string::npos ){
66 if(id_type==
"fed" || id_type==
"det" || id_type==
"fec" || id_type==
"layer"){
68 local_histo_id = description +
"__" + flag +
"__" + path;
70 local_histo_id = description +
"__" +
path;
71 LogTrace(
"SiStripHistoId") <<
"Local_histo_ID " << local_histo_id << std::endl;
73 local_histo_id = description +
"___dummy___" +
path;
74 edm::LogError(
"SiStripHistoId") <<
" SiStripHistoId::WrongInput "
75 <<
" no such type of component accepted: "<<id_type
76 <<
" id_type can be: fed, det, fec or layer ";
79 local_histo_id = description +
"_dummy___" +
path;
81 <<
" histogram description cannot contain: __ or: __"
84 return local_histo_id;
89 const int buf_len = 50;
90 char temp_str[buf_len];
96 snprintf(temp_str, buf_len,
"TIB__layer__%i", tib1.
layer());
100 if (flag_ring) snprintf(temp_str, buf_len,
"TID__side__%i__ring__%i", tid1.
side(), tid1.
ring());
101 else snprintf(temp_str, buf_len,
"TID__side__%i__wheel__%i", tid1.
side(), tid1.
wheel());
105 snprintf(temp_str, buf_len,
"TOB__layer__%i",tob1.
layer());
109 if (flag_ring) snprintf(temp_str, buf_len,
"TEC__side__%i__ring__%i", tec1.
side(), tec1.
ring());
110 else snprintf(temp_str, buf_len,
"TEC__side__%i__wheel__%i", tec1.
side(), tec1.
wheel());
113 edm::LogError(
"SiStripTkDQM|WrongInput")<<
"no such subdetector type :"<<subdet.
subdetId()<<
" no folder set!"<<std::endl;
114 snprintf(temp_str,0,
"%s",
"");
117 return std::string(temp_str);
121 uint32_t local_component_id;
123 return local_component_id;
133 size_t length1=histoid.find(
"__",0);
134 if(length1==std::string::npos){
135 edm::LogWarning(
"SiStripTkDQM|UnregularInput")<<
"no regular histoid. Returning 0";
138 std::string part1 = histoid.substr(0,length1);
139 if(whichpart==1)
return part1;
140 std::string remain1 = histoid.substr(length1+2);
141 size_t length2=remain1.find(
"__",0);
142 if(length2==std::string::npos){
143 edm::LogWarning(
"SiStripTkDQM|UnregularInput")<<
"no regular histoid. Returning 0";
146 std::string part2 = remain1.substr(0,length2);
147 if(whichpart==2)
return part2;
148 std::string part3 = remain1.substr(length2+2);
149 if(whichpart==3)
return part3;
150 edm::LogWarning(
"SiStripTkDQM|UnregularInput")<<
"no such whichpart="<<whichpart<<
" returning 0";
std::string getComponentType(std::string histoid)
unsigned int layer() const
layer id
std::string returnIdPart(std::string histoid, uint32_t whichpart)
unsigned int side() const
positive or negative id
uint32_t getComponentId(std::string histoid)
std::string getSubdetid(uint32_t id, bool flag_ring)
unsigned int ring() const
ring id
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
std::string createHistoId(std::string description, std::string id_type, uint32_t component_id)
unsigned int side() const
positive or negative id
unsigned int wheel() const
wheel id
unsigned int layer() const
layer id
unsigned int ring() const
ring id
std::string createHistoLayer(std::string description, std::string id_type, std::string path, std::string flag)
virtual ~SiStripHistoId()
unsigned int wheel() const
wheel id