23#include "TObjString.h"
41 Error(
"PStaticData",
"Data base could not be filled");
95 if (key < 0) Warning(
"PStaticData",
"std_set not found");
97 while (
makeDataBase()->MakeListIterator(key,
"snpart",
"slink", &listkey)) {
124 AddAlias(
"DP33++",
"Delta(1600)++");
129 AddAlias(
"DS31++",
"Delta(1620)++");
145 (*system_alloc_verbosity) = 1.;
183 if (skey < 0)
return -1;
187 if (skey < 0)
return -1;
204 if (batch_value_param < 0)
207 if (!
makeDataBase()->GetParamDouble(key_a, batch_value_param, &val)) {
209 Double_t* delme =
new Double_t(0.);
227 if (warn) { Warning(
"GetParticleID",
"%s not found",
id); }
240 Warning(
"GetParticleName",
"id %i not found",
id);
267 if ((key =
makeDataBase()->GetEntryInt(
didx_param,
id)) < 0) { Warning(
"GetDecayKey",
"id %i not found",
id); }
289 if ((
id > 500) && (
id < 1000))
return id;
300 if (pid < 0)
return 0;
311 if ((pkey = base->
AddListEntry(old_name,
"nalias",
"lalias", new_name)) < 0) {
312 Warning(
"AddAlias",
"Name %s not found", old_name);
321 Int_t listkey = -1, *dummy;
323 if (key < 0)
return -1;
335 Int_t listkey = -1, *dummy;
336 if (key < 0)
return -1;
358 if (key < 0)
return -1;
367 if (*dummy == defkey)
return listkey;
383 Warning(
"AddParticle",
"pid %i already used in data base", pid);
388 Warning(
"AddParticle",
"Name %s already used in data base", name);
400 if ((pkey = base->
AddListEntry(
"std_set",
"snpart",
"slink", name)) < 0) {
401 Warning(
"AddParticle",
"particle header not found");
405 Int_t* ii =
new int(pid);
410 Double_t* dd =
new double(0.);
415 dd =
new Double_t(mass);
420 dd =
new Double_t(mass);
426 if (!base->
SetParamInt(pkey,
"meson", ii))
return -1;
428 if (!base->
SetParamInt(pkey,
"baryon", ii))
return -1;
430 if (!base->
SetParamInt(pkey,
"lepton", ii))
return -1;
432 if (!base->
SetParamInt(pkey,
"charge", ii))
return -1;
434 if (!base->
SetParamInt(pkey,
"spin", ii))
return -1;
436 if (!base->
SetParamInt(pkey,
"parity", ii))
return -1;
438 if (!base->
SetParamInt(pkey,
"ispin", ii))
return -1;
440 if (!base->
SetParamInt(pkey,
"pythiakf", ii))
return -1;
442 if (!base->
SetParamInt(pkey,
"widx", ii))
return -1;
444 if (!base->
SetParamInt(pkey,
"tdepth", ii))
return -1;
446 if (!base->
SetParamInt(pkey,
"hdepth", ii))
return -1;
458 Int_t listkey = -1, alias_printed = 0;
461 while (
makeDataBase()->MakeListIterator(key,
"nalias",
"lalias", &listkey)) {
467 if (alias_printed) cout << endl;
470 cout <<
"This particle is stable" << endl;
474 cout <<
"This particle decays via the following modes:" << endl;
479 while (
makeDataBase()->MakeListIterator(key,
"pnmodes",
"link", &listkey)) {
489 Warning(
"GetParticleKF",
"id %i not found",
id);
503 Warning(
"GetParticleIDbyKF",
"invalid kf code %i", *
id);
618 cout <<
"PStaticData::Charge: " <<
id <<
" not found" << endl;
628 cout <<
"PStaticData::Charge: " <<
id <<
" not found" << endl;
638 cout <<
"PStaticData::GetParticleSpin: " <<
id <<
" not found" << endl;
648 cout <<
"PStaticData::GetParticleSpin: " <<
id <<
" not found" << endl;
658 cout <<
"PStaticData::GetParticleIsospin: " <<
id <<
" not found" << endl;
668 cout <<
"PStaticData::GetParticleIsospin: " <<
id <<
" not found" << endl;
678 cout <<
"PStaticData::GetParticleParity: " <<
id <<
" not found" << endl;
688 cout <<
"PStaticData::GetParticleParity: " <<
id <<
" not found" << endl;
699 cout <<
"PStaticData::GetParticleMass: " <<
id <<
" not found" << endl;
709 cout <<
"PStaticData::GetParticleMass: " <<
id <<
" not found" << endl;
719 cout <<
"PStaticData::GetParticleMassByKey: " <<
id <<
" not found" << endl;
729 cout <<
"PStaticData::SetParticleMass: " <<
id <<
" not found" << endl;
738 cout <<
"PStaticData::SetParticleMass: " <<
id <<
" not found" << endl;
759 cout <<
"PStaticData::SetTWidth: " <<
id <<
" not found" << endl;
775 cout <<
"PStaticData::SetTWidth: " <<
id <<
" not found" << endl;
782 printf(
"\n*** Warning: Use only at start of macro! ***\n\n");
793 cout <<
"PStaticData::GetTWidx: " <<
id <<
" not found" << endl;
807 cout <<
"PStaticData::GetPWidx: " <<
id <<
" not found" << endl;
820 cout <<
"PStaticData::SetTWidx: " <<
id <<
" not found" << endl;
832 cout <<
"PStaticData::GetPWidx: " <<
id <<
" not found" << endl;
842 cout <<
"PStaticData::SetTWidx: " <<
id <<
" not possible" << endl;
850 cout <<
"PStaticData::GetTWidthMesh: " <<
id <<
" not found" << endl;
860 cout <<
"PStaticData::SetPWidthMesh: " <<
id <<
" not possible" << endl;
868 cout <<
"PStaticData::GetPWidthMesh: " <<
id <<
" not found" << endl;
879 cout <<
"PStaticData::SetTF1: " <<
id <<
" not possible" << endl;
897 cout <<
"PStaticData::GetDecayEmin: " <<
id <<
" not found" << endl;
914 Int_t* ii =
new Int_t(flag);
932 Warning(
"SetTotalNormalization",
"Invalid particle");
936 while (
makeDataBase()->MakeListIterator(key,
"pnmodes",
"link", &listkey)) {
938 Int_t* ii =
new Int_t(flag);
939 if (!
makeDataBase()->SetParamInt(listkey,
"brflag", ii)) {
953 cout <<
"PStaticData::SetDecayEmin: " <<
id <<
" not found" << endl;
961 cout <<
"PStaticData::GetParticleEmin: " <<
id <<
" not found" << endl;
970 cout <<
"PStaticData::SetParticleEmin: " <<
id <<
" not found" << endl;
978 Warning(
"GetParticleLMass",
"id %i not found",
id);
997 Warning(
"GetParticleUMass",
"id %i not found",
id);
1016 cout <<
"PStaticData::GetTDepth: " <<
id <<
" not found" << endl;
1025 cout <<
"PStaticData::GetTDepth: " <<
id <<
" not found" << endl;
1033 cout <<
"PStaticData::GetHDepth: " <<
id <<
" not found" << endl;
1042 cout <<
"PStaticData::GetHDepth: " <<
id <<
" not found" << endl;
1050 cout <<
"PStaticData::GetDecayBR: " <<
id <<
" not found" << endl;
1075 if (!
makeDataBase()->GetParamDouble(key,
"brorig", &brorig))
return kFALSE;
1079 br = (other * br) / (1. - br);
1092 if (!
makeDataBase()->GetParamDouble(key,
"brorig", &brorig))
return kFALSE;
1096 br = (other * br) / (1. - br);
1123 if (parent_key < 0) {
1124 cout <<
"PStaticData::SetDecayBR: parent " << parent <<
" not found in data base" << endl;
1129 if (pid < 0) {
return kFALSE; }
1136 Tokenize(daughters,
",", arr1, &arr1_s);
1140 for (
int pat = 0; pat < arr1_s; pat++) {
1147 if (decay_key < 0) {
1148 Warning(
"SetDecayBR",
"Decay %s -> %s not defined", parent, daughters);
1184 Double_t *br, *brorig, *width;
1189 while (
makeDataBase()->MakeListIterator(key,
"pnmodes",
"link", &listkey)) {
1190 if (!
makeDataBase()->GetParamDouble(listkey,
"brorig", &brorig))
return kFALSE;
1196 while (
makeDataBase()->MakeListIterator(key,
"pnmodes",
"link", &listkey)) {
1197 if (!
makeDataBase()->GetParamDouble(listkey,
"brorig", &brorig))
return kFALSE;
1198 if (!
makeDataBase()->GetParamDouble(listkey,
"br", &br))
return kFALSE;
1199 *br = *brorig / sum;
1200 if (
makeDataBase()->GetParamDouble(listkey,
"width", &width)) { *width = *br * twidth; }
1208 Fatal(
"FreezeDecayBR",
"not implemented");
1250 for (
int i = 1; i < tid[0]; i++) {
1420 if (products == 5)
makeDataBase()->
ListEntries(key, 0,
"name,didx,br,d1:name,d2:name,d3:name,d4:name,d5:name");
1422 makeDataBase()->
ListEntries(key, 0,
"name,didx,br,d1:name,d2:name,d3:name,d4:name,d5:name,d6:name");
1424 makeDataBase()->
ListEntries(key, 0,
"name,didx,br,d1:name,d2:name,d3:name,d4:name,d5:name,d6:name,d7:name");
1501 if (n < 2 || !pid)
return -1;
1502 for (i = 0; i <= n; ++i) {
1504 cout <<
"PStaticData:: GetDecayIdx: id not found:" << pid[i] << endl;
1508 nid[i - 1] = pid[i];
1512 int id = pid[0], *nm;
1522 while (
makeDataBase()->MakeListIterator(key,
"pnmodes",
"link", &listkey)) {
1528 for (i = 0; i < n; ++i)
1529 count += (tid[i + 1] == nid[i]);
1547 if (n < 1 || !pid)
return -1;
1548 for (i = 0; i <= n; ++i) {
1550 Warning(
"GetDecayKey",
"id %i not found", pid[i]);
1554 nid[i - 1] = pid[i];
1560 int id = pid[0], *nm;
1569 while (
makeDataBase()->MakeListIterator(key,
"pnmodes",
"link", &listkey)) {
1575 for (i = 0; i < n; ++i)
1576 count += (tid[i + 1] == nid[i]);
1602 Int_t *d1_key, *d2_key, *d3_key, *d4_key, *d5_key, *d6_key, *d7_key, found = 0;
1613 cout <<
"PStaticData:: size too low" << endl;
1619 Int_t *d1_p =
nullptr, *d2_p =
nullptr, *d3_p =
nullptr, *d4_p =
nullptr, *d5_p =
nullptr, *d6_p =
nullptr,
1622 cout <<
"PStaticData:: Mode: unable to unpack key1 " << *d1_key << endl;
1626 cout <<
"PStaticData:: Mode: unable to unpack key2 " << *d2_key << endl;
1630 cout <<
"PStaticData:: Mode: unable to unpack key3 " << *d3_key << endl;
1634 cout <<
"PStaticData:: Mode: unable to unpack key4 " << *d4_key << endl;
1638 cout <<
"PStaticData:: Mode: unable to unpack key5 " << *d5_key << endl;
1642 cout <<
"PStaticData:: Mode: unable to unpack key6 " << *d6_key << endl;
1646 cout <<
"PStaticData:: Mode: unable to unpack key7 " << *d7_key << endl;
1649 if (d1_p)
id[1] = *d1_p;
1650 if (d2_p)
id[2] = *d2_p;
1651 if (d3_p)
id[3] = *d3_p;
1652 if (d4_p)
id[4] = *d4_p;
1653 if (d5_p)
id[5] = *d5_p;
1654 if (d6_p)
id[6] = *d6_p;
1655 if (d7_p)
id[7] = *d7_p;
1662 Int_t *d1_key, *d2_key, *d3_key, *d4_key, *d5_key, *d6_key, *d7_key, found = 0;
1672 cout <<
"PStaticData:: size too low" << endl;
1679 Int_t *d1_p =
nullptr, *d2_p =
nullptr, *d3_p =
nullptr, *d4_p =
nullptr, *d5_p =
nullptr, *d6_p =
nullptr,
1682 cout <<
"PStaticData:: ModeByKey: unable to unpack key1 " << *d1_key << endl;
1686 cout <<
"PStaticData:: ModeByKey: unable to unpack key2 " << *d2_key << endl;
1690 cout <<
"PStaticData:: ModeByKey: unable to unpack key3 " << *d3_key << endl;
1694 cout <<
"PStaticData:: ModeByKey: unable to unpack key4 " << *d4_key << endl;
1698 cout <<
"PStaticData:: ModeByKey: unable to unpack key5 " << *d5_key << endl;
1702 cout <<
"PStaticData:: ModeByKey: unable to unpack key6 " << *d6_key << endl;
1706 cout <<
"PStaticData:: ModeByKey: unable to unpack key7 " << *d7_key << endl;
1709 if (d1_p)
id[1] = *d1_p;
1710 if (d2_p)
id[2] = *d2_p;
1711 if (d3_p)
id[3] = *d3_p;
1712 if (d4_p)
id[4] = *d4_p;
1713 if (d5_p)
id[5] = *d5_p;
1714 if (d6_p)
id[6] = *d6_p;
1715 if (d7_p)
id[7] = *d7_p;
1723 cout <<
"PStaticData::GetParticleTotalWidth: " <<
id <<
" not found" << endl;
1733 cout <<
"PStaticData::GetParticleTotalWidthByKey: " << key <<
" not found" << endl;
1756 for (
int i = 0; i < *
size; i++)
1759 char* mystack =
new char[strlen(options) + 1];
1760 strcpy(mystack, options);
1765 while (strstr(mystack, delimiter)) {
1767 cout <<
"Tokenize: size " << *
size <<
" is too small for " << options <<
" ,delim:" << delimiter << endl;
1769 char*
pos = strstr(mystack, delimiter);
1771 mystack =
pos + strlen(delimiter);
1772 array[pat] = mystack;
1779 for (
int i = 0; i < *
size; i++) {
1791 while (**partc ==
' ')
1793 if (strlen(*partc)) {
1794 int partend = strlen(*partc) - 1;
1796 while ((*partc)[partend] ==
' ' && partend >= 0) {
1797 (*partc)[partend] =
'\0';
1806 int i, j, l, m, r, rt[20], lt[20], level = 1;
1816 if (level > 0)
goto a;
1826 while (*(a + i - 1) <
x)
1828 while (*(a + j - 1) >
x)
1832 *(a + i - 1) = *(a + j - 1);
1839 if (r - i >= j - l) {
ClassImp(CbmConverterManager)
static constexpr size_t size()
PDataBase * makeDataBase()
void listParticle(int id)
PStaticData * makeStaticData()
PStaticData & fStaticData()
Int_t MakeParamDouble(const char *paramname, const char *descr)
Bool_t AddEntry(Int_t key, const char *name)
Int_t GetParamDouble(const char *paramname)
Int_t GetParamString(const char *paramname)
Int_t GetParamTObj(const char *paramname)
Int_t MakeParamInt(const char *paramname, const char *descr)
Bool_t SetParamDouble(Int_t key, const char *paramname, Double_t *result)
Bool_t ListEntries(Int_t key=-1, Int_t option=0, const char *pattern=nullptr)
Int_t GetEntry(const char *name)
Int_t AddListEntry(const char *name, const char *count, const char *link, const char *newname)
const char * GetName(Int_t key)
Int_t GetEntryInt(const char *paramname, Int_t value)
Int_t GetParamInt(const char *paramname, Int_t length=-1)
Bool_t SetParamInt(Int_t key, const char *paramname, Int_t *result)
static void remove_spaces(char **partc)
int GetParticleCharge(const int &id)
double GetParticleLMass(const int &id)
void SetParticleIsospin(const char *id, Int_t isospin)
double GetParticleTotalWidthByKey(const int &id)
void SetParticleSpin(const char *id, Int_t spin)
int GetDecayBRFlag(int didx)
const char * GetParticleName(const int &id)
int GetDecayNProducts(const int &)
bool SetDecayBRByKey(int key, double br, int mode)
int GetDecayNProductsByKey(const int &key)
int IsParticle(const int &id, const char *name)
void SetTDepth(const int &, const int &)
int GetParticleIDByKey(int key)
void SetTWidx(const int &, const int &)
Double_t GetDecayPartialWidth(Int_t id)
void SetPWidthMesh(const int &, PMesh *mesh)
int MakeDirectoryEntry(const char *name, const char *n, const char *l, const char *ename)
double GetParticleMass(const int &id)
bool SetDecayBR(int didx, double br, int mode)
static Bool_t Tokenize(const char *options, const char *delimiter, char **array, int *size)
void SetParticleMass(Int_t id, Float_t mass)
int GetDecayIdxByKey(int key)
bool NormParticleBRbyKey(Int_t key)
int GetDecayIdx(int *pid, int n)
void SetDecayBRFlag(int didx, int flag)
int GetParticleID(const char *id, int warn=1)
double GetParticleTotalWidth(const int &id)
int IsParticleMeson(const int &id)
void SetTWidthMesh(const int &, PMesh *mesh)
void SetTotalNormalization(char *p, int flag=1)
int GetParticleIsospin(const int &id)
void SetParticleLMass(const int &id, const double v)
void SetParticleLepton(const char *id, Int_t num=1)
void SetParticleMeson(const char *id, Int_t num=1)
static void isort(int *i, int n)
int GetSecondaryKey(int key, int defkey)
PMesh * GetTWidthMesh(const int &)
static void dsort(Double_t *, int)
int GetDecayParentByKey(const int &)
void FreezeDecayBR(Int_t id, Int_t brn)
int GetParticleLepton(const int &id)
int GetHDepth(const int &)
void SetParticleTotalWidth(Int_t id, Float_t wid)
void SetParticleCharge(const char *id, Int_t charge)
int GetPWidx(const int &)
const char * GetDecayNameByKey(Int_t key)
int GetParticleNChannels(const int &id)
PMesh * GetPWidthMesh(const int &)
int GetAliasParent(const char *alias_name)
Int_t IsDecayHadronic(Int_t didx)
void PrintParticle(int pid)
int GetTWidx(const int &)
int GetParticleKey(const int &id)
int GetDecayParent(const int &)
double GetParticleMassByKey(const int &id)
void SetTF1(const int &, TF1 *mesh)
double GetParticleEmin(const int &id)
int IsParticleValid(const int &id)
Double_t * GetBatchValue(const char *name, Int_t make_val=1)
void clearFreezeOut(void)
void SetParticleBaryon(const char *id, Int_t num=1)
void SetParticleEmin(const int &id, const double v)
int GetParticleBaryon(const int &id)
int GetTDepth(const int &)
void SetPWidx(const int &, const int &)
Double_t GetDecayBR(Int_t id)
int GetParticleKF(const int Id)
double GetDecayEmin(const int &idx)
double GetParticleUMass(const int &id)
void GetDecayModeByKey(const int, int *n)
Double_t * system_alloc_verbosity
int GetParticleIDbyKF(const int kf)
void GetDecayMode(const int, int *n)
const char * GetDecayName(Int_t id)
void SetDecayEmin(const int &idx, const double v)
int GetParticleNChannelsByKey(int id)
int GetParticleSpin(const int &id)
void SetParticleParity(const char *id, Int_t parity)
int AddParticle(int pid, const char *name, double mass)
bool NormParticleBR(Int_t id)
void SetHDepth(const int &, const int &)
void PrintParticleByKey(int pid)
int GetParticleParity(const int &id)
int GetDecayKey(int *pid, int n)
void SetParticleUMass(const int &id, const double v)
TF1 * GetTF1(const int &)
int AddAlias(const char *old_name, const char *new_name)
void PrintDecayByKey(int key)
int IsParticleHadron(const int &id)
Double_t GetDecayPartialWidthByKey(Int_t id)