41 #include <boost/lexical_cast.hpp>
42 #include <boost/algorithm/string.hpp>
44 #include "spinUtils.hpp"
45 #include "conversionUtils.hpp"
52 using namespace boost;
55 bool particleProperties::_debug =
false;
58 particleProperties::decayMode::decayMode(
const multiset<string>& daughters,
61 : _daughters(daughters),
77 if ((_L != -1) and (rhsDecay.
_L != -1) and (_L != rhsDecay.
_L))
79 if ((_S != -1) and (rhsDecay.
_S != -1) and (_S != rhsDecay.
_S))
88 copy(_daughters.begin(), _daughters.end(), ostream_iterator<string>(out,
" "));
90 out <<
"[L = " << spinQn(_L);
96 out <<
"S = " << spinQn(_S) <<
"]";
161 if (
this != &partProp) {
189 const pair<particleProperties, string>& rhsPropSel)
192 const string& selector = rhsPropSel.second;
193 const bool checkAllQn = (selector.find(
"allQn") != string::npos);
194 return ( ( ((selector.find(
"charge") == string::npos) and not checkAllQn)
196 and ( ((selector.find(
"baryonNmb") == string::npos) and not checkAllQn)
198 and ( ((selector.find(
"I") == string::npos) and not checkAllQn)
200 and ( ((selector.find(
"strangeness") == string::npos) and not checkAllQn)
202 and ( ((selector.find(
"charm") == string::npos) and not checkAllQn)
204 and ( ((selector.find(
"beauty") == string::npos) and not checkAllQn)
206 and ( ((selector.find(
"G") == string::npos) and not checkAllQn)
207 or (lhsProp.
G() == rhsProp.
G()))
208 and ( ((selector.find(
"J") == string::npos) and not checkAllQn)
209 or (lhsProp.
J() == rhsProp.
J()))
210 and ( ((selector.find(
"P") == string::npos) and not checkAllQn)
211 or (lhsProp.
P() == rhsProp.
P()))
212 and ( ((selector.find(
"C") == string::npos) and not checkAllQn)
213 or (lhsProp.
C() == rhsProp.
C())));
242 const bool warnIfNotExistent)
244 string name = partName;
251 if (warnIfNotExistent)
252 printWarn <<
"trying to fill particle properties for '"
253 << partName <<
"' from non-existing table entry" << endl;
258 printDebug <<
"succesfully filled particle properties for '" << partName <<
"': "
296 if (convertDecaysModes)
299 antiPartProp = *
this;
318 if (convertDecaysModes)
320 multiset<string> antiDaughters;
323 for (multiset<string>::const_iterator it = decay.
_daughters.begin();
384 out <<
name() <<
"[" << spinQn(
isospin()) << parityQn(
G())
385 <<
"(" << spinQn(
J()) << parityQn(
P()) << parityQn(
C()) <<
")]";
393 out <<
"particle '" <<
name() <<
"': "
394 <<
"mass = " <<
mass() <<
" GeV/c^2, "
395 <<
"width = " <<
width() <<
" GeV/c^2, "
397 <<
"I" << ((
G() != 0) ?
"^G" :
"") <<
" J";
399 out <<
"^P" << ((
C() != 0) ?
"C" :
"") <<
" = ";
401 out << ((
C() != 0) ?
"^C" :
"") <<
" = ";
404 out <<
"^" << sign(
G());
405 out <<
" " << spinQn(
J());
407 out <<
"^" << sign(
P()) << parityQn(
C());
410 out <<
"^" << sign(
C());
413 <<
"charm = " <<
charm() <<
", "
414 <<
"beauty = " <<
beauty() <<
", "
415 <<
"is meson = " << yesNo(
isMeson()) <<
", ";
417 out <<
"is spin-exotic = " << yesNo(
isSpinExotic()) <<
", ";
418 out <<
"is baryon = " << yesNo(
isBaryon()) <<
", "
419 <<
"is lepton = " << yesNo(
isLepton()) <<
", "
420 <<
"is photon = " << yesNo(
isPhoton()) <<
", "
426 out << endl <<
" decay modes:" << endl;
429 if (
i < nmbDecays - 1)
441 out <<
name () <<
"\t"
463 printDebug <<
"trying to read particle properties from line '" << line.str() <<
"' ... " << flush;
467 int G = 0,
J = 0,
P = 0,
C = 0;
495 cout <<
"success" << endl;
496 printDebug <<
"read "<< *
this << endl;
500 printWarn <<
"problems reading particle data from line '" << line.str() <<
"'" << endl;
511 if (bareName !=
"") {
512 if (abs(charge) > 1) {
515 q = lexical_cast<
char>(abs(charge));
516 }
catch (bad_lexical_cast&) { }
519 name += sign(charge);
543 string strippedName = partName;
544 const char last = partName[partName.length() - 1];
545 if ((last ==
'+') or (last ==
'0') or (last ==
'-')) {
547 strippedName.erase(strippedName.length() - 1);
550 chargeVal = lexical_cast<
int>(partName[partName.length() - 2]);
551 }
catch (bad_lexical_cast&) { }
552 if (chargeVal != 0) {
554 strippedName.erase(strippedName.length() - 1);
572 return ( (
name () == rhsProp.
name ())
582 and (
G () == rhsProp.
G ())
583 and (
J () == rhsProp.
J ())
584 and (
P () == rhsProp.
P ())
585 and (
C () == rhsProp.
C ()));