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();
78 if (subCaloStr.compare(pos1,len,
"EMB")==0)
80 else if(subCaloStr.compare(pos1,len,
"EMECIW")==0)
82 else if(subCaloStr.compare(pos1,len,
"EMECOW")==0)
84 else if(subCaloStr.compare(pos1,len,
"HEC")==0)
86 else if(subCaloStr.compare(pos1,len,
"FCAL")==0)
89 logStr << MSG::ERROR <<
"Unknown sub-calo name '"<< subCaloStr.substr(pos1,len) <<
"'found. "
90 <<
"Allowed values are EMB, EMECIW, EMECOW, HEC and FCAL" <<
endmsg;
95 while(pos2!=std::string::npos);
98 if (subdefs[1].
size()!=1) {
103 if (subdefs[1][0]==
'A')
105 else if (subdefs[1][0]==
'C')
107 else if (subdefs[1][0]==
'*')
110 logStr << MSG::ERROR <<
"Allowed values for side are: A,C or * (means both), found " << subdefs[1] <<
endmsg;
115 std::string& subdef=subdefs[
i+2];
118 if (subdef.compare(
"*")!=0) {
119 std::size_t pos1=subdef.find(
'-');
120 if (pos1==std::string::npos) {
121 if (isdigit(subdef[0]))
122 lower=
upper=atol(subdef.c_str());
124 logStr << MSG::ERROR <<
"Malformed string [" << subdef <<
"], expected numerical value!" <<
endmsg;
127 std::string lStr=subdef.substr(0,pos1);
128 std::string uStr=subdef.substr(pos1+1);
130 if (isdigit(lStr[0]))
131 lower=atol(lStr.c_str());
133 logStr << MSG::ERROR <<
"Malformed string [" << subdef <<
"], expected numerical value!" <<
endmsg;
136 if (isdigit(uStr[0]))
137 upper=atol(uStr.c_str());
139 logStr << MSG::ERROR <<
"Malformed string [" << subdef <<
"], expected numerical value!" <<
endmsg;
147 const char* ptr1=valuesStr.c_str();
155 ptr1=
const_cast<const char*
>(ptr2+1);
159 logStr << MSG::INFO <<
"Sussefully parsed defintion string" <<
endmsg;