35 std::vector<std::string> subdefs(2+
NFIELDS);
36 std::string valuesStr;
38 std::size_t pos1,pos2;
39 pos1=definition.find(
'[');
40 if( pos1==std::string::npos) {
45 std::size_t
i,iField=0;
46 for (
i=1+pos1;
i<definition.size();
i++) {
48 if (isspace(
c))
continue;
53 if (iField >= subdefs.size())
break;
56 subdefs[iField].push_back(
c);
59 if (iField!=subdefs.size()-1 ||
i==definition.size()) {
60 logStr << MSG::ERROR <<
"Definition String [" << definition <<
"] malformed. Expect "
65 valuesStr=definition.substr(
i+1);
69 std::string& subCaloStr=subdefs[0];
73 pos2=subCaloStr.find(
',',pos1);
74 if (pos2==std::string::npos)
75 len=subCaloStr.size();
80 if (subCaloStr.compare(pos1,len,
"EMB")==0)
82 else if(subCaloStr.compare(pos1,len,
"EMECIW")==0)
84 else if(subCaloStr.compare(pos1,len,
"EMECOW")==0)
86 else if(subCaloStr.compare(pos1,len,
"HEC")==0)
88 else if(subCaloStr.compare(pos1,len,
"FCAL")==0)
91 logStr << MSG::ERROR <<
"Unknown sub-calo name '"<< subCaloStr.substr(pos1,len) <<
"'found. "
92 <<
"Allowed values are EMB, EMECIW, EMECOW, HEC and FCAL" <<
endmsg;
96 while(pos2!=std::string::npos);
99 if (subdefs[1].
size()!=1) {
104 if (subdefs[1][0]==
'A')
106 else if (subdefs[1][0]==
'C')
108 else if (subdefs[1][0]==
'*')
111 logStr << MSG::ERROR <<
"Allowed values for side are: A,C or * (means both), found " << subdefs[1] <<
endmsg;
116 std::string& subdef=subdefs[
i+2];
119 if (subdef.compare(
"*")!=0) {
120 std::size_t pos1=subdef.find(
'-');
121 if (pos1==std::string::npos) {
122 if (isdigit(subdef[0]))
123 lower=
upper=atol(subdef.c_str());
125 logStr << MSG::ERROR <<
"Malformed string [" << subdef <<
"], expected numerical value!" <<
endmsg;
128 std::string lStr=subdef.substr(0,pos1);
129 std::string uStr=subdef.substr(pos1+1);
131 if (isdigit(lStr[0]))
132 lower=atol(lStr.c_str());
134 logStr << MSG::ERROR <<
"Malformed string [" << subdef <<
"], expected numerical value!" <<
endmsg;
137 if (isdigit(uStr[0]))
138 upper=atol(uStr.c_str());
140 logStr << MSG::ERROR <<
"Malformed string [" << subdef <<
"], expected numerical value!" <<
endmsg;
148 const char* ptr1=valuesStr.c_str();
156 ptr1=
const_cast<const char*
>(ptr2+1);