14 bool IsSign(
char character,
int& result){
16 if (character ==
'-' || character ==
'+'){
17 if (character ==
'-') result = -1;
else result = +1;
26 bool IsNumber(
string text,
int& result,
unsigned int& pos){
30 for (posend = pos; posend < text.size(); posend++){
31 if (!isdigit(text[posend]))
break;
33 if (posend == pos)
return false;
34 result =
atoi(text.substr(pos,posend-pos).c_str());
41 if (extension !=
"" && filename.find(extension.c_str())!=string::npos){
42 int pos_ext = filename.find(extension.c_str());
43 filename.erase(pos_ext, filename.size()-pos_ext);
46 int slashpos = filename.rfind(
'/');
47 if (slashpos != (
int) string::npos){
48 filename.erase(0, slashpos+1);
53 void GetJPCMreflISO1lsISO2(
string wavename,
int& J,
int& P,
int& C,
int&
M,
int& refl,
string& iso1,
string& iso2,
int& l,
int& s){
70 unsigned int charposlow(0);
71 unsigned int charposhigh(0);
73 unsigned int stringsize = key.size();
77 cout <<
" error decoding wavename " << key <<
", parity expected at position " << charposlow << endl;
83 if (!
IsSign(key[charposlow],G)){
84 cout <<
" error decoding wavename " << key <<
", G parity not found " << endl;
92 cout <<
" error decoding wavename " << key <<
", J not found " << endl;
96 if (!
IsSign(key[charposlow],P)){
97 cout <<
" error decoding wavename " << key <<
", parity not found " << endl;
103 if (!
IsSign(key[charposlow],C)){
104 cout <<
" error decoding wavename " << key <<
", C parity found " << endl;
111 cout <<
" error decoding wavename " << key <<
", M not found " << endl;
116 if (!
IsSign(key[charposlow],refl)){
117 cout <<
" error decoding wavename " << key <<
", reflectivity not found " << endl;
122 charposhigh = charposlow;
124 while(charposhigh < stringsize && key[charposhigh] !=
'_'){
127 iso1 = key.substr(charposlow, charposhigh-charposlow);
130 charposlow=charposhigh;
133 if (!isdigit(key[charposlow])){
134 cout <<
" error decoding wavename " << key <<
", l expected at position " << charposlow << endl;
137 char _l[] = {key[charposlow],
'\0'};
141 if (!isdigit(key[charposlow])){
142 cout <<
" error decoding wavename " << key <<
", s expected at position " << charposlow << endl;
145 char _s[] = {key[charposlow],
'\0'};
149 if (key[charposlow] !=
'_'){
150 cout <<
" error decoding wavename " << key <<
", _ expected at position " << charposlow << endl;
155 iso2 = key.substr(charposlow, stringsize-charposlow);
163 ifstream wavelistfile(wavelistname.c_str());
165 cout <<
" could not open wavelist " << wavelistname << endl;
168 ofstream latexfile(latexfilename.c_str());
170 cout <<
" could not open latexfile " << latexfilename << endl;
173 map<string,string> isobars;
177 latexfile <<
"\\begin{table}" << endl;
178 latexfile <<
" \\myfloatalign " << endl;
179 latexfile <<
" \\begin{tabularx}{\\textwidth}{ccrcl} \\toprule " << endl;
180 latexfile <<
" \\tableheadline{$J^{PC}$} &";
181 latexfile <<
" \\tableheadline{$M\\epsilon$} &";
182 latexfile <<
" \\tableheadline{$iso1$} &";
183 latexfile <<
" \\tableheadline{$\\left[ ^l _s \\right]$} &";
184 latexfile <<
" \\tableheadline{$iso2$} \\\\ \\midrule" << endl;
187 wavelistfile.getline(oneline, 1024);
188 if (!wavelistfile.good())
break;
190 if (oneline[0] ==
'#')
continue;
191 int J,P,C,
M,refl,l,s;
192 string iso1, iso2, signP, signC, signrefl;
193 string wavename = oneline;
196 map<string,string>::iterator it = isobars.find(iso1);
197 if (it != isobars.end()){
202 int counter[] = {65,65,65};
205 if (counter[0] == 91){
209 if (counter[1] == 91){
215 iso <<
"\\isobar" << (char) counter[2] << (
char) counter[1] << (char) counter[0];
216 isobars[iso1]=iso.str();
219 it = isobars.find(iso2);
220 if (it != isobars.end()){
225 int counter[] = {65,65,65};
228 if (counter[0] == 91){
232 if (counter[1] == 91){
238 iso <<
"\\isobar" << (char) counter[2] << (
char) counter[1] << (char) counter[0];
239 isobars[iso2]=iso.str();
243 iso1 = isobars[iso1];
244 iso2 = isobars[iso2];
245 signP = P < 0 ?
"-" :
"+";
246 signC = C < 0 ?
"-" :
"+";
247 signrefl = refl < 0 ?
"-" :
"+";
248 latexfile <<
" $" << J <<
"^{" << signP << signC <<
"}$ & $";
249 latexfile << M << signrefl <<
"$ & $";
250 latexfile <<
" " << iso1 <<
"$ & $";
251 latexfile <<
" \\left[ ^" << l <<
" _" << s <<
" \\right]" <<
"$ & $";
252 latexfile <<
" " << iso2 <<
" $ \\\\ " << endl;
255 latexfile <<
" \\bottomrule " << endl;
256 latexfile <<
" \\end{tabularx}" << endl;
257 latexfile <<
" \\caption[final partial wave set]{The final partial wave set used for fitting.}" << endl;
258 latexfile <<
" \\label{tab:pwset}" << endl;
259 latexfile <<
"\\end{table}" << endl;
262 latexfile <<
" % specification of latex commands to be filled by the user and put to proper place " << endl;
264 for (map<string,string>::iterator it = isobars.begin(); it != isobars.end(); it++){
265 latexfile <<
"\\newcommand{";
266 latexfile << it->second <<
"}{"<< it->first <<
"}" << endl;
269 cout <<
" converted " << nlines <<
" waves " << endl;
271 wavelistfile.close();