BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtMultiChannelParser Class Reference

#include <EvtMultiChannelParser.hh>

Public Member Functions

 EvtMultiChannelParser ()
 
 ~EvtMultiChannelParser ()
 
void parse (const char *file, const char *model)
 
void parse (const std::vector< std::string > &v)
 
double pdfMax () const
 
int nScan () const
 
double dm () const
 
std::vector< std::string > amp (int i) const
 
std::vector< std::string > ampConj (int i) const
 
EvtComplex ampCoef (int i) const
 
EvtComplex ampConjCoef (int i) const
 
int coefFormat (int i) const
 
int coefConjFormat (int i) const
 
int getNAmp () const
 
int getNAmpConj () const
 
 EvtMultiChannelParser ()
 
 ~EvtMultiChannelParser ()
 
void parse (const char *file, const char *model)
 
void parse (const std::vector< std::string > &v)
 
double pdfMax () const
 
int nScan () const
 
double dm () const
 
std::vector< std::string > amp (int i) const
 
std::vector< std::string > ampConj (int i) const
 
EvtComplex ampCoef (int i) const
 
EvtComplex ampConjCoef (int i) const
 
int coefFormat (int i) const
 
int coefConjFormat (int i) const
 
int getNAmp () const
 
int getNAmpConj () const
 

Static Public Member Functions

static EvtDecayMode getDecayMode (const char *file)
 
static void parseComplexCoef (int &i, const std::vector< std::string > &v, EvtComplex &c, int &format)
 
static double parseRealCoef (int &i, const std::vector< std::string > &v)
 
static bool isKeyword (const std::string &s)
 
static EvtDecayMode getDecayMode (const char *file)
 
static void parseComplexCoef (int &i, const std::vector< std::string > &v, EvtComplex &c, int &format)
 
static double parseRealCoef (int &i, const std::vector< std::string > &v)
 
static bool isKeyword (const std::string &s)
 

Detailed Description

Constructor & Destructor Documentation

◆ EvtMultiChannelParser() [1/2]

EvtMultiChannelParser::EvtMultiChannelParser ( )
inline

Definition at line 35 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtMultiChannelParser.hh.

35: _pdfMax(-1.), _nScan(0), _dm(0.) {}

◆ ~EvtMultiChannelParser() [1/2]

EvtMultiChannelParser::~EvtMultiChannelParser ( )
inline

◆ EvtMultiChannelParser() [2/2]

EvtMultiChannelParser::EvtMultiChannelParser ( )
inline

Definition at line 35 of file BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtMultiChannelParser.hh.

35: _pdfMax(-1.), _nScan(0), _dm(0.) {}

◆ ~EvtMultiChannelParser() [2/2]

EvtMultiChannelParser::~EvtMultiChannelParser ( )
inline

Member Function Documentation

◆ amp() [1/2]

std::vector< std::string > EvtMultiChannelParser::amp ( int  i) const
inline

Definition at line 52 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtMultiChannelParser.hh.

52{ return _amp[i]; }

Referenced by EvtAmpFactory< T >::build().

◆ amp() [2/2]

std::vector< std::string > EvtMultiChannelParser::amp ( int  i) const
inline

Definition at line 52 of file BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtMultiChannelParser.hh.

52{ return _amp[i]; }

◆ ampCoef() [1/2]

EvtComplex EvtMultiChannelParser::ampCoef ( int  i) const
inline

Definition at line 54 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtMultiChannelParser.hh.

54{ return _ampCoef[i]; }

Referenced by EvtAmpFactory< T >::build().

◆ ampCoef() [2/2]

EvtComplex EvtMultiChannelParser::ampCoef ( int  i) const
inline

Definition at line 54 of file BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtMultiChannelParser.hh.

54{ return _ampCoef[i]; }

◆ ampConj() [1/2]

std::vector< std::string > EvtMultiChannelParser::ampConj ( int  i) const
inline

Definition at line 53 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtMultiChannelParser.hh.

53{ return _ampConj[i]; }

Referenced by EvtAmpFactory< T >::build().

◆ ampConj() [2/2]

std::vector< std::string > EvtMultiChannelParser::ampConj ( int  i) const
inline

Definition at line 53 of file BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtMultiChannelParser.hh.

53{ return _ampConj[i]; }

◆ ampConjCoef() [1/2]

EvtComplex EvtMultiChannelParser::ampConjCoef ( int  i) const
inline

Definition at line 55 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtMultiChannelParser.hh.

55{ return _ampConjCoef[i]; }

Referenced by EvtAmpFactory< T >::build().

◆ ampConjCoef() [2/2]

EvtComplex EvtMultiChannelParser::ampConjCoef ( int  i) const
inline

Definition at line 55 of file BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtMultiChannelParser.hh.

55{ return _ampConjCoef[i]; }

◆ coefConjFormat() [1/2]

int EvtMultiChannelParser::coefConjFormat ( int  i) const
inline

Definition at line 58 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtMultiChannelParser.hh.

58{ return _coefConjFormat[i]; }

◆ coefConjFormat() [2/2]

int EvtMultiChannelParser::coefConjFormat ( int  i) const
inline

Definition at line 58 of file BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtMultiChannelParser.hh.

58{ return _coefConjFormat[i]; }

◆ coefFormat() [1/2]

int EvtMultiChannelParser::coefFormat ( int  i) const
inline

Definition at line 57 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtMultiChannelParser.hh.

57{ return _coefFormat[i]; }

◆ coefFormat() [2/2]

int EvtMultiChannelParser::coefFormat ( int  i) const
inline

Definition at line 57 of file BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtMultiChannelParser.hh.

57{ return _coefFormat[i]; }

◆ dm() [1/2]

double EvtMultiChannelParser::dm ( ) const
inline

Definition at line 50 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtMultiChannelParser.hh.

50{ return _dm; }

◆ dm() [2/2]

double EvtMultiChannelParser::dm ( ) const
inline

Definition at line 50 of file BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtMultiChannelParser.hh.

50{ return _dm; }

◆ getDecayMode() [1/2]

EvtDecayMode EvtMultiChannelParser::getDecayMode ( const char *  file)
static

Definition at line 32 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtMultiChannelParser.cc.

33{
34 // Open file, read tokens
35
36 EvtParser parser;
37 parser.Read(file);
38
39 // Seek Decay
40
41 int i = 0;
42 int N = parser.getNToken();
43 while(i<N) {
44
45 std::string tok = parser.getToken(i++);
46 if(tok == std::string("Decay")) break;
47 }
48
49 // Get mother
50
51 string mother = string(parser.getToken(i++).c_str());
52 std::string bf = parser.getToken(i++);
53
54 vector<string> dauV;
55 // Get daughters
56
57 while(1) {
58
59 std::string d = parser.getToken(i++);
60
61 if(EvtPDL::getStdHep(EvtPDL::getId(d.c_str())) == 0) break;
62
63 dauV.push_back(string(d.c_str()));
64 }
65
66 EvtDecayMode mode(mother,dauV);
67 printf("Decay File defines mode %s\n",mode.mode());
68
69 return mode;
70}
char * file
Definition: DQA_TO_DB.cxx:15
static EvtId getId(const std::string &name)

◆ getDecayMode() [2/2]

static EvtDecayMode EvtMultiChannelParser::getDecayMode ( const char *  file)
static

◆ getNAmp() [1/2]

int EvtMultiChannelParser::getNAmp ( ) const
inline

Definition at line 60 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtMultiChannelParser.hh.

60{ return _amp.size(); }

Referenced by EvtAmpFactory< T >::build().

◆ getNAmp() [2/2]

int EvtMultiChannelParser::getNAmp ( ) const
inline

Definition at line 60 of file BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtMultiChannelParser.hh.

60{ return _amp.size(); }

◆ getNAmpConj() [1/2]

int EvtMultiChannelParser::getNAmpConj ( ) const
inline

Definition at line 61 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtMultiChannelParser.hh.

61{ return _ampConj.size(); }

Referenced by EvtAmpFactory< T >::build().

◆ getNAmpConj() [2/2]

int EvtMultiChannelParser::getNAmpConj ( ) const
inline

Definition at line 61 of file BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtMultiChannelParser.hh.

61{ return _ampConj.size(); }

◆ isKeyword() [1/2]

bool EvtMultiChannelParser::isKeyword ( const std::string &  s)
static

Definition at line 267 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtMultiChannelParser.cc.

268{
269 if(s == std::string("AMPLITUDE")) return true;
270 if(s == std::string("CONJUGATE")) return true;
271 if(s == std::string("COEFFICIENT")) return true;
272 return false;
273}
XmlRpcServer s
Definition: HelloServer.cpp:11

Referenced by parse().

◆ isKeyword() [2/2]

static bool EvtMultiChannelParser::isKeyword ( const std::string &  s)
static

◆ nScan() [1/2]

int EvtMultiChannelParser::nScan ( ) const
inline

◆ nScan() [2/2]

int EvtMultiChannelParser::nScan ( ) const
inline

Definition at line 49 of file BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtMultiChannelParser.hh.

49{ return _nScan; }

◆ parse() [1/4]

void EvtMultiChannelParser::parse ( const char *  file,
const char *  model 
)

Definition at line 74 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtMultiChannelParser.cc.

75{
76 // Open file, read tokens
77
78 EvtParser parser;
79 parser.Read(file);
80
81
82 // Get parameters (tokens between the model name and ;)
83
84 int i = 0;
85 int N = parser.getNToken();
86
87 // Seek the model name
88
89 while(i<N) {
90
91 std::string tok = parser.getToken(i++);
92 if(tok == std::string(model)) break;
93 }
94 if(i == N) {
95
96 printf("No model %s found in decay file %s",model,file);
97 exit(0);
98 }
99
100
101 // Add all tokens up to a semicolon to vector
102
103 std::vector<std::string> v;
104 while(i<N) {
105
106 std::string tok = parser.getToken(i++);
107 if(tok == std::string(";")) break;
108 else v.push_back(tok);
109 }
110
111 if(i == N) {
112
113 printf("No terminating ; found in decay file %s",file);
114 assert(0);
115 }
116
117 parse(v);
118}
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
Definition: KarLud.h:35

Referenced by EvtIntervalDecayAmp< T >::init(), and parse().

◆ parse() [2/4]

void EvtMultiChannelParser::parse ( const char *  file,
const char *  model 
)

◆ parse() [3/4]

void EvtMultiChannelParser::parse ( const std::vector< std::string > &  v)

Definition at line 121 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtMultiChannelParser.cc.

122{
123 // place holder for strtod
124 char** tc = 0;
125
126
127 // Get PDF maximum or number of points to
128 // use in the scan.
129
130 if(v[0] == std::string("MAXPDF")) {
131
132 _pdfMax = strtod(v[1].c_str(),tc);
133 if(_pdfMax <= 0) { printf("Bad pdfMax=%f\n",_pdfMax); assert(0); }
134 }
135 else
136 if(v[0] == std::string("SCANPDF")) {
137
138 _nScan = atoi(v[1].c_str());
139 }
140 else {
141
142 printf("Error parsing decay file\n");
143 assert(0);
144 }
145
146
147 // Now parse the rest of file for amplitude specifications.
148
149 bool conjugate = false;
150 int i = 2;
151 assert(isKeyword(v[2]));
152
153 while(i < v.size()) {
154
155 int i0 = i;
156
157 // Switch to conjugate amplitudes after keyword
158 if(v[i] == std::string("CONJUGATE")) {
159
160 assert(conjugate == false);
161 conjugate = true;
162 assert(!isKeyword(v[++i]));
163 _dm = strtod(v[i].c_str(),tc);
164 i++;
165 }
166
167 std::vector<std::string> params;
168 EvtComplex c;
169 int format;
170
171 if(!conjugate && v[i] == std::string("AMPLITUDE")) {
172
173 while(!isKeyword(v[++i])) params.push_back(v[i]);
174 _amp.push_back(params);
175
176 parseComplexCoef(i,v,c,format);
177 _ampCoef.push_back(c);
178 _coefFormat.push_back(format);
179 continue;
180 }
181 else
182 if(conjugate && v[i] == std::string("AMPLITUDE")) {
183
184 while(!isKeyword(v[++i])) params.push_back(v[i]);
185 _ampConj.push_back(params);
186 parseComplexCoef(i,v,c,format);
187 _ampConjCoef.push_back(c);
188 _coefConjFormat.push_back(format);
189 continue;
190 }
191 else {
192
193 printf("Expect keyword, found parameter %s\n",v[i].c_str());
194 assert(0);
195 }
196
197
198 assert(i > i0);
199 }
200
201 printf("PARSING SUCCESSFUL\n");
202 printf("%d amplitude terms\n",_amp.size());
203 printf("%d conj amplitude terms\n",_ampConj.size());
204}
static void parseComplexCoef(int &i, const std::vector< std::string > &v, EvtComplex &c, int &format)

◆ parse() [4/4]

void EvtMultiChannelParser::parse ( const std::vector< std::string > &  v)

◆ parseComplexCoef() [1/2]

void EvtMultiChannelParser::parseComplexCoef ( int &  i,
const std::vector< std::string > &  v,
EvtComplex c,
int &  format 
)
static

Definition at line 208 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtMultiChannelParser.cc.

210{
211 // place holder for strtod
212 char** tc = 0;
213
214 assert(v[i++] == std::string("COEFFICIENT"));
215
216 if(v[i] == std::string("POLAR_DEG")) {
217
218 double mag = strtod(v[i+1].c_str(),tc);
219 double phaseRad = strtod(v[i+2].c_str(),tc)*EvtConst::pi/180.0;
220 i += 3;
221 c = EvtComplex(mag*cos(phaseRad),mag*sin(phaseRad));
222 format = POLAR_DEG;
223 }
224 else if(v[i] == std::string("POLAR_RAD")) {
225
226 double mag = strtod(v[i+1].c_str(),tc);
227 double phaseRad = strtod(v[i+2].c_str(),tc);
228 i += 3;
229 c = EvtComplex(mag*cos(phaseRad),mag*sin(phaseRad));
230 format = POLAR_RAD;
231 }
232 else if(v[i] == std::string("CARTESIAN")) {
233
234 double re = strtod(v[i+1].c_str(),tc);
235 double im = strtod(v[i+2].c_str(),tc);
236 i += 3;
237 c = EvtComplex(re,im);
238 format = CARTESIAN;
239 }
240 else {
241
242 printf("Invalid format %s for complex coefficient\n",v[i].c_str());
243 exit(0);
244 }
245}
double sin(const BesAngle a)
Definition: BesAngle.h:210
double cos(const BesAngle a)
Definition: BesAngle.h:213

Referenced by parse().

◆ parseComplexCoef() [2/2]

static void EvtMultiChannelParser::parseComplexCoef ( int &  i,
const std::vector< std::string > &  v,
EvtComplex c,
int &  format 
)
static

◆ parseRealCoef() [1/2]

double EvtMultiChannelParser::parseRealCoef ( int &  i,
const std::vector< std::string > &  v 
)
static

Definition at line 248 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtMultiChannelParser.cc.

249{
250 // place holder for strtod
251 char** tc = 0;
252 double value = 0;
253
254 if(v[i] == std::string("COEFFICIENT")) {
255
256 value = strtod(v[i+1].c_str(),tc);
257 }
258 else assert(0);
259
260 i += 2;
261
262 assert(value > 0.);
263 return value;
264}

◆ parseRealCoef() [2/2]

static double EvtMultiChannelParser::parseRealCoef ( int &  i,
const std::vector< std::string > &  v 
)
static

◆ pdfMax() [1/2]

double EvtMultiChannelParser::pdfMax ( ) const
inline

Definition at line 48 of file bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtMultiChannelParser.hh.

48{ return _pdfMax; }

Referenced by EvtIntervalDecayAmp< T >::init().

◆ pdfMax() [2/2]

double EvtMultiChannelParser::pdfMax ( ) const
inline

Definition at line 48 of file BesEvtGen-00-04-08/src/EvtGen/EvtGenBase/EvtMultiChannelParser.hh.

48{ return _pdfMax; }

The documentation for this class was generated from the following files: