5 #include "libconfig.h++"
7 #include "libConfigUtils.hpp"
14 using namespace libconfig;
21 bool RelAmplDummy(
int p_J,
int p_P,
int d1_J,
int d1_P,
int d2_J,
int d2_P,
int L,
int S,
const Setting* parent);
28 cout <<
"ReadoutTestKexfile failed" << endl;
37 cout <<
"ReadoutTestKexfile failed" << endl;
43 <<
"This program requires 3 input strings for the mother and "<<endl
44 <<
"the 2 decay particles, each of the form Jp," << endl
45 <<
"where J is the spin of the particle and p = +/- its parity"
48 <<
"options that may follow the three Jp terms:" << endl
49 <<
"-H result output also in header file format" << endl
56 for (
int oi=4; oi<narg; oi++) {
57 int nchar =
sizeof(carg[oi])/
sizeof(
char);
58 if (nchar>1 && carg[oi][1]==
'H') {
59 cout <<
"H option length:" << nchar << endl;
71 sscanf(carg[1],
"%d%c", &jmother, &pmother);
72 cout <<
"Mother particle: " << jmother << pmother << endl;
73 if (pmother==
'+') pm= 1;
76 sscanf(carg[2],
"%1d%c", &jdecay1, &pdecay1);
77 cout <<
"1. decay particle: " << jdecay1 << pdecay1 << endl;
78 if (pdecay1==
'+') p1= 1;
81 sscanf(carg[3],
"%1d%c", &jdecay2, &pdecay2);
82 cout <<
"2. decay particle: " << jdecay2 << pdecay2 << endl;
83 if (pdecay2==
'+') p2= 1;
86 cout << jmother <<
"," << pm <<
","
87 << jdecay1 <<
"," << p1 <<
","
88 << jdecay2 <<
"," << p2 << endl;
90 TJSS jss(jmother, pm, jdecay1, p1, jdecay2, p2, opt);
101 if(not parseLibConfigFile(KeyfileName, key, debug)) {
102 printWarn <<
"problems reading keyfile" << endl;
106 const Setting& rootKey = key.getRoot();
107 const Setting* decayVertKey = findLibConfigGroup(rootKey,
"decayVertex");
108 const Setting* XWaveQn = findLibConfigGroup(*decayVertKey,
"XQuantumNumbers");
109 const Setting* XDecay = findLibConfigGroup(*decayVertKey,
"XDecay");
111 int J_parent = (*XWaveQn)[
"J"];
112 int P_parent = (*XWaveQn)[
"P"];
115 pdt.
readFile(
"../amplitude/particleDataTable.txt");
127 int d1_J = 0, d1_P = 0, d2_J = 0, d2_P = 0, L = 0, S = 0;
132 const Setting* isobar = findLibConfigList(*parent,
"isobars",
false);
134 if (not not isobar) {
135 const Setting* isobar0 = findLibConfigGroup(*isobar,0,
false);
136 if (not not isobar0) {
140 const Setting* isobar1 = findLibConfigGroup(*isobar,1,
false);
141 if (not not isobar1){
147 const char* name = (*parent)[
"name"];
151 }
catch (SettingNotFoundException& NotFound) {
157 const Setting* fsParticles = findLibConfigList(*parent,
"fsParticles",
false);
158 if (not not fsParticles) {
159 const Setting* fsParticles0 = findLibConfigGroup(*fsParticles,0,
false);
160 if (not not fsParticles0) {
161 const char* fsParticle1 = (*fsParticles0)[
"name"];
167 const Setting* fsParticles1 = findLibConfigGroup(*fsParticles,1,
false);
168 if (not not fsParticles1) {
169 const char* fsParticle2 = (*fsParticles1)[
"name"];
174 const char* Particle2 = (*parent)[
"isobars"][0][
"name"];
190 if (not
RelAmplDummy(p_J,p_P,d1_J,d1_P,d2_J,d2_P,L,S,parent))
return false;
194 bool RelAmplDummy (
int p_J,
int p_P,
int d1_J,
int d1_P,
int d2_J,
int d2_P,
int L,
int S,
const Setting* parent) {
199 cout <<
"Parent J: "<< p_J << endl;
200 cout <<
"Parent P: "<< p_P << endl;
201 cout <<
"Daughter 1 J: "<< d1_J << endl;
202 cout <<
"Daughter 1 P: "<< d1_P << endl;
203 cout <<
"Daughter 2 J: "<< d2_J << endl;
204 cout <<
"Daughter 2 P: "<< d2_P << endl;
205 cout <<
"L: " << L << endl;
206 cout <<
"S: " << S << endl;
211 const char*
filename =
"../relampl/test.key";
213 parseLibConfigFile(filename, key,
false);
214 const string path = (*parent).getPath();
217 Setting& parent0 = key.lookup(path);
219 if (parent0.exists(
"Relampl")) {
220 parent0.remove(
"Relampl");
223 parent0.add(
"Relampl", Setting::TypeString) = path;
226 key.writeFile(filename);
237 printErr <<
"canot find particle '" << name <<
"' in particle data table. aborting." << endl;
240 return (partProp.
J()/2);
249 printErr <<
"canot find particle '" << name <<
"' in particle data table. aborting." << endl;