50 std::string tok = parser.
getToken( i++ );
51 if ( tok == std::string(
"Decay" ) )
57 string mother = string( parser.
getToken( i++ ).c_str() );
58 std::string bf = parser.
getToken( i++ );
64 std::string d = parser.
getToken( i++ );
69 dauV.push_back(
string( d.c_str() ) );
73 printf(
"Decay File defines mode %s\n", mode.
mode().c_str() );
93 std::string tok = parser.
getToken( i++ );
94 if ( tok == std::string( model ) )
98 printf(
"No model %s found in decay file %s", model, file );
104 std::vector<std::string> v;
106 std::string tok = parser.
getToken( i++ );
107 if ( tok == std::string(
";" ) )
114 printf(
"No terminating ; found in decay file %s", file );
129 if ( v[0] == std::string(
"MAXPDF" ) ) {
132 printf(
"Bad pdfMax=%f\n",
_pdfMax );
135 }
else if ( v[0] == std::string(
"SCANPDF" ) ) {
138 printf(
"Error parsing decay file\n" );
144 bool conjugate =
false;
148 while ( i < v.size() ) {
152 if ( v[i] == std::string(
"CONJUGATE" ) ) {
153 assert( conjugate ==
false );
163 std::vector<std::string> params;
167 if ( !conjugate && v[i] == std::string(
"AMPLITUDE" ) ) {
169 params.push_back( v[i] );
170 _amp.push_back( params );
176 }
else if ( conjugate && v[i] == std::string(
"AMPLITUDE" ) ) {
178 params.push_back( v[i] );
185 printf(
"Expect keyword, found parameter %s\n", v[i].
c_str() );
193 printf(
"PARSING SUCCESSFUL\n" );
194 printf(
"%d amplitude terms\n", (
int)
_amp.size() );
195 printf(
"%d conj amplitude terms\n", (
int)
_ampConj.size() );
199 const std::vector<std::string>& v,
205 std::string coefString = v[i++];
206 assert( coefString == std::string(
"COEFFICIENT" ) );
208 if ( v[i] == std::string(
"POLAR_DEG" ) ) {
209 double mag = strtod( v[i + 1].
c_str(), tc );
212 c =
EvtComplex( mag * cos( phaseRad ), mag * sin( phaseRad ) );
214 }
else if ( v[i] == std::string(
"POLAR_RAD" ) ) {
215 double mag = strtod( v[i + 1].
c_str(), tc );
216 double phaseRad = strtod( v[i + 2].
c_str(), tc );
218 c =
EvtComplex( mag * cos( phaseRad ), mag * sin( phaseRad ) );
220 }
else if ( v[i] == std::string(
"CARTESIAN" ) ) {
221 double re = strtod( v[i + 1].
c_str(), tc );
222 double im = strtod( v[i + 2].
c_str(), tc );
227 printf(
"Invalid format %s for complex coefficient\n", v[i].
c_str() );
233 const std::vector<std::string>& v )
239 if ( v[i] == std::string(
"COEFFICIENT" ) ) {
240 value = strtod( v[i + 1].
c_str(), tc );
246 assert( value > 0. );
252 if ( s == std::string(
"AMPLITUDE" ) )
254 if ( s == std::string(
"CONJUGATE" ) )
256 if ( s == std::string(
"COEFFICIENT" ) )
std::vector< int > _coefFormat
static void parseComplexCoef(size_t &i, const std::vector< std::string > &v, EvtComplex &c, int &format)
const char * c_str(Index i)
static EvtDecayMode getDecayMode(const char *file)
static bool isKeyword(const std::string &s)
void parse(const char *file, const char *model)
int read(const std::string filename)
std::vector< std::vector< std::string > > _amp
std::vector< EvtComplex > _ampConjCoef
static double parseRealCoef(int &i, const std::vector< std::string > &v)
std::vector< std::vector< std::string > > _ampConj
static EvtId getId(const std::string &name)
std::vector< int > _coefConjFormat
static int getStdHep(EvtId id)
std::vector< EvtComplex > _ampCoef
const std::string & getToken(int i)