#include <EvtMultiChannelParser.hh>
Public Member Functions | |
std::vector< std::string > | amp (int i) const |
EvtComplex | ampCoef (int i) const |
std::vector< std::string > | ampConj (int i) const |
EvtComplex | ampConjCoef (int i) const |
int | coefConjFormat (int i) const |
int | coefFormat (int i) const |
double | dm () const |
EvtMultiChannelParser () | |
int | getNAmp () const |
int | getNAmpConj () const |
int | nScan () const |
void | parse (const std::vector< std::string > &v) |
void | parse (const char *file, const char *model) |
double | pdfMax () const |
~EvtMultiChannelParser () | |
Static Public Member Functions | |
EvtDecayMode | getDecayMode (const char *file) |
bool | isKeyword (const std::string &s) |
void | parseComplexCoef (int &i, const std::vector< std::string > &v, EvtComplex &c, int &format) |
double | parseRealCoef (int &i, const std::vector< std::string > &v) |
Private Attributes | |
std::vector< std::vector< std::string > > | _amp |
std::vector< EvtComplex > | _ampCoef |
std::vector< std::vector< std::string > > | _ampConj |
std::vector< EvtComplex > | _ampConjCoef |
std::vector< int > | _coefConjFormat |
std::vector< int > | _coefFormat |
double | _dm |
int | _nScan |
double | _pdfMax |
|
|
|
00036 {}
|
|
00052 { return _amp[i]; }
|
|
00054 { return _ampCoef[i]; }
|
|
00053 { return _ampConj[i]; }
|
|
00055 { return _ampConjCoef[i]; }
|
|
00058 { return _coefConjFormat[i]; }
|
|
00057 { return _coefFormat[i]; }
|
|
00050 { return _dm; }
|
|
00033 { 00034 // Open file, read tokens 00035 00036 EvtParser parser; 00037 parser.Read(file); 00038 00039 // Seek Decay 00040 00041 int i = 0; 00042 int N = parser.getNToken(); 00043 while(i<N) { 00044 00045 std::string tok = parser.getToken(i++); 00046 if(tok == std::string("Decay")) break; 00047 } 00048 00049 // Get mother 00050 00051 string mother = string(parser.getToken(i++).c_str()); 00052 std::string bf = parser.getToken(i++); 00053 00054 vector<string> dauV; 00055 // Get daughters 00056 00057 while(1) { 00058 00059 std::string d = parser.getToken(i++); 00060 00061 if(EvtPDL::getStdHep(EvtPDL::getId(d.c_str())) == 0) break; 00062 00063 dauV.push_back(string(d.c_str())); 00064 } 00065 00066 EvtDecayMode mode(mother,dauV); 00067 printf("Decay File defines mode %s\n",mode.mode()); 00068 00069 return mode; 00070 }
|
|
00060 { return _amp.size(); }
|
|
00061 { return _ampConj.size(); }
|
|
00268 { 00269 if(s == std::string("AMPLITUDE")) return true; 00270 if(s == std::string("CONJUGATE")) return true; 00271 if(s == std::string("COEFFICIENT")) return true; 00272 return false; 00273 }
|
|
00049 { return _nScan; }
|
|
00122 { 00123 // place holder for strtod 00124 char** tc = 0; 00125 00126 00127 // Get PDF maximum or number of points to 00128 // use in the scan. 00129 00130 if(v[0] == std::string("MAXPDF")) { 00131 00132 _pdfMax = strtod(v[1].c_str(),tc); 00133 if(_pdfMax <= 0) { printf("Bad pdfMax=%f\n",_pdfMax); assert(0); } 00134 } 00135 else 00136 if(v[0] == std::string("SCANPDF")) { 00137 00138 _nScan = atoi(v[1].c_str()); 00139 } 00140 else { 00141 00142 printf("Error parsing decay file\n"); 00143 assert(0); 00144 } 00145 00146 00147 // Now parse the rest of file for amplitude specifications. 00148 00149 bool conjugate = false; 00150 int i = 2; 00151 assert(isKeyword(v[2])); 00152 00153 while(i < v.size()) { 00154 00155 int i0 = i; 00156 00157 // Switch to conjugate amplitudes after keyword 00158 if(v[i] == std::string("CONJUGATE")) { 00159 00160 assert(conjugate == false); 00161 conjugate = true; 00162 assert(!isKeyword(v[++i])); 00163 _dm = strtod(v[i].c_str(),tc); 00164 i++; 00165 } 00166 00167 std::vector<std::string> params; 00168 EvtComplex c; 00169 int format; 00170 00171 if(!conjugate && v[i] == std::string("AMPLITUDE")) { 00172 00173 while(!isKeyword(v[++i])) params.push_back(v[i]); 00174 _amp.push_back(params); 00175 00176 parseComplexCoef(i,v,c,format); 00177 _ampCoef.push_back(c); 00178 _coefFormat.push_back(format); 00179 continue; 00180 } 00181 else 00182 if(conjugate && v[i] == std::string("AMPLITUDE")) { 00183 00184 while(!isKeyword(v[++i])) params.push_back(v[i]); 00185 _ampConj.push_back(params); 00186 parseComplexCoef(i,v,c,format); 00187 _ampConjCoef.push_back(c); 00188 _coefConjFormat.push_back(format); 00189 continue; 00190 } 00191 else { 00192 00193 printf("Expect keyword, found parameter %s\n",v[i].c_str()); 00194 assert(0); 00195 } 00196 00197 00198 assert(i > i0); 00199 } 00200 00201 printf("PARSING SUCCESSFUL\n"); 00202 printf("%d amplitude terms\n",_amp.size()); 00203 printf("%d conj amplitude terms\n",_ampConj.size()); 00204 }
|
|
00075 { 00076 // Open file, read tokens 00077 00078 EvtParser parser; 00079 parser.Read(file); 00080 00081 00082 // Get parameters (tokens between the model name and ;) 00083 00084 int i = 0; 00085 int N = parser.getNToken(); 00086 00087 // Seek the model name 00088 00089 while(i<N) { 00090 00091 std::string tok = parser.getToken(i++); 00092 if(tok == std::string(model)) break; 00093 } 00094 if(i == N) { 00095 00096 printf("No model %s found in decay file %s",model,file); 00097 exit(0); 00098 } 00099 00100 00101 // Add all tokens up to a semicolon to vector 00102 00103 std::vector<std::string> v; 00104 while(i<N) { 00105 00106 std::string tok = parser.getToken(i++); 00107 if(tok == std::string(";")) break; 00108 else v.push_back(tok); 00109 } 00110 00111 if(i == N) { 00112 00113 printf("No terminating ; found in decay file %s",file); 00114 assert(0); 00115 } 00116 00117 parse(v); 00118 }
|
|
00210 { 00211 // place holder for strtod 00212 char** tc = 0; 00213 00214 assert(v[i++] == std::string("COEFFICIENT")); 00215 00216 if(v[i] == std::string("POLAR_DEG")) { 00217 00218 double mag = strtod(v[i+1].c_str(),tc); 00219 double phaseRad = strtod(v[i+2].c_str(),tc)*EvtConst::pi/180.0; 00220 i += 3; 00221 c = EvtComplex(mag*cos(phaseRad),mag*sin(phaseRad)); 00222 format = POLAR_DEG; 00223 } 00224 else if(v[i] == std::string("POLAR_RAD")) { 00225 00226 double mag = strtod(v[i+1].c_str(),tc); 00227 double phaseRad = strtod(v[i+2].c_str(),tc); 00228 i += 3; 00229 c = EvtComplex(mag*cos(phaseRad),mag*sin(phaseRad)); 00230 format = POLAR_RAD; 00231 } 00232 else if(v[i] == std::string("CARTESIAN")) { 00233 00234 double re = strtod(v[i+1].c_str(),tc); 00235 double im = strtod(v[i+2].c_str(),tc); 00236 i += 3; 00237 c = EvtComplex(re,im); 00238 format = CARTESIAN; 00239 } 00240 else { 00241 00242 printf("Invalid format %s for complex coefficient\n",v[i].c_str()); 00243 exit(0); 00244 } 00245 }
|
|
00249 { 00250 // place holder for strtod 00251 char** tc = 0; 00252 double value = 0; 00253 00254 if(v[i] == std::string("COEFFICIENT")) { 00255 00256 value = strtod(v[i+1].c_str(),tc); 00257 } 00258 else assert(0); 00259 00260 i += 2; 00261 00262 assert(value > 0.); 00263 return value; 00264 }
|
|
00048 { return _pdfMax; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|