CbmRoot
Loading...
Searching...
No Matches
PStaticData.h
Go to the documentation of this file.
1/* Copyright (C) 2018-2019 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Florian Uhlig [committer] */
4
5// Author: M.A. Kagarlis
6// Written: 31.01.99
7// Revised: (IF)
8// PDataUtil Class Header
9
10#ifndef _PSTATICDATA_H_
11#define _PSTATICDATA_H_
12
13#include "TF1.h"
14#include "TROOT.h"
15
16#include <iostream>
17
18#include "PDataBase.h"
19#include "PMesh.h"
20
21
22#define MAX_DAUGHTERS 7
23
24using namespace std;
25
26class PStaticData;
29
30
31void listParticle(int = -1);
32void listParticle(const char* id);
33void listModes(int id = -1);
34void listModes(const char* id);
35
36
37class PStaticData : public TObject {
38
39public:
41
42 //Freeze out -> Important to check this
43 void SetFreezeOut(void) { freeze = kTRUE; };
44
45 void clearFreezeOut(void)
46 {
47 //re-loop PStdModels
48 freeze = kFALSE;
49 };
50
51 bool GetFreezeOut(void) { return freeze; }
52
53 //Common stuff
54 int AddAlias(const char* old_name,
55 const char* new_name); //adds an alias, ret value is alias key
56 int GetAliasParent(const char* alias_name);
57 int GetAliasParent(int key);
58
59 int MakeDirectoryEntry(const char* name, const char* n, const char* l,
60 const char* ename); //adds a directory, ret value is key
61 Double_t* GetBatchValue(const char* name, Int_t make_val = 1);
62 int GetSecondaryKey(int key,
63 int defkey); //Loops over the alias entries and look for matching defkey
64
65 //Particle get methods
66 int GetParticleID(const char* id, int warn = 1); // pid by name
67 int GetParticleIDByKey(int key); // pid by key
68 const char* GetParticleName(const int& id); // name by pid
69 int GetParticleKey(const int& id); // data base key by pid
70 int GetParticleKey(const char* id) { return GetParticleKey(GetParticleID(id)); };
71 int IsParticle(const int& id,
72 const char* name); // does pid correspond to given name?
73 int IsParticleValid(const int& id); // check id range by id
74 int IsParticleValid(const char* n); // check id range by name
75
76 int AddParticle(int pid, const char* name, double mass);
77 void PrintParticle(int pid);
78 void PrintParticleByKey(int pid);
79 void PrintParticle(const char* id) { PrintParticle(GetParticleID(id)); };
80
81 int GetParticleKF(const int Id); // return Pythia6 kf code
82 int GetParticleIDbyKF(const int kf); // return Id corresponding to Pythia6 kf code
83
84 int IsParticleMeson(const int& id); // is meson?, by pid
85 void SetParticleMeson(const char* id, Int_t num = 1); // set meson number
86
87 int IsParticleHadron(const int& id); // is hadron?, by pid
88 int GetParticleBaryon(const int& id); // baryon number by pid
89 void SetParticleBaryon(const char* id,
90 Int_t num = 1); // baryon number by name
91
92 int GetParticleLepton(const int& id); // lepton number by pid
93 void SetParticleLepton(const char* id, Int_t num = 1);
94
95 int GetParticleCharge(const int& id); // charge by pid
96 int GetParticleCharge(const char* id); // charge by name
97 void SetParticleCharge(const char* id, Int_t charge);
98
99 int GetParticleSpin(const int& id); // 2 x J by pid
100 int GetParticleSpin(const char* id); // 2 x J by name
101 void SetParticleSpin(const char* id, Int_t spin);
102
103 int GetParticleIsospin(const int& id); // 2 x I by pid
104 int GetParticleIsospin(const char* id); // 2 x I by name
105 void SetParticleIsospin(const char* id, Int_t isospin);
106
107 int GetParticleParity(const int& id); // parity (0 if irrelevant)
108 int GetParticleParity(const char* id); // parity (0 if irrelevant)
109 void SetParticleParity(const char* id, Int_t parity);
110
111 double GetParticleMass(const int& id); // mass by id
112 double GetParticleMass(const char* id); // mass by name
113 double GetParticleMassByKey(const int& id);
114 void SetParticleMass(Int_t id, Float_t mass); //reset mass
115 void SetParticleMass(const char* id, Float_t mass); //reset mass
116
117 int GetParticleNChannels(const int& id); // number of decay channels by pid
118 int GetParticleNChannels(const char* id); // number of decay channels by name
119 int GetParticleNChannelsByKey(int id);
120
121 void SetParticleTotalWidth(Int_t id, Float_t wid);
122 void SetParticleTotalWidth(const char* id, Float_t wid);
123 double GetParticleTotalWidth(const int& id); // -->PWidth[id]
124 double GetParticleTotalWidth(const char* id) { return GetParticleTotalWidth(GetParticleID(id)); };
125 double GetParticleTotalWidthByKey(const int& id);
126
127 double GetParticleEmin(const int& id); // Returns the energy threshold for the particle
128 void SetParticleEmin(const int& id, const double v);
129
130 //Change particle range:
131 double GetParticleLMass(const int& id); // Returns lower mass (used in all samplings)
132 double GetParticleLMass(const char* id) { return GetParticleLMass(GetParticleID(id)); };
133 double GetParticleUMass(const int& id); // Returns upper mass (used in all samplings)
134 double GetParticleUMass(const char* id) { return GetParticleUMass(GetParticleID(id)); };
135 void SetParticleLMass(const int& id, const double v)
136 { // Set lower mass (used in all samplings)
138 };
139 void SetParticleLMass(const char* id,
140 const double v); // Set lower mass (used in all samplings)
141
142 void SetParticleUMass(const int& id, const double v)
143 { // Set upper mass (used in all samplings)
145 };
146 void SetParticleUMass(const char* id,
147 const double v); // Set upper mass (used in all samplings)
148
149
150 bool NormParticleBR(Int_t id); // normalize branching ratios for particle id
151 bool NormParticleBRbyKey(Int_t key);
152 void SetTotalNormalization(char* p, int flag = 1);
153
154 //Decay methods
155 void FreezeDecayBR(Int_t id,
156 Int_t brn); // Set BR (BUGBUG->brn nomally unknown)
157 bool SetDecayBR(int didx, double br, int mode);
158 bool SetDecayBR(const char* parent, const char* daughters, double br, int mode);
159 bool SetDecayBRByKey(int key, double br, int mode);
160
161 Double_t GetDecayBR(Int_t id);
162 Double_t GetDecayPartialWidth(Int_t id);
163 Double_t GetDecayPartialWidthByKey(Int_t id);
164 const char* GetDecayName(Int_t id);
165 const char* GetDecayNameByKey(Int_t key);
166
167 Int_t IsDecayHadronic(Int_t didx);
168
169
181 void PrintDecayByKey(int key);
182
183 int GetDecayNProducts(const int&); // retrieve number of products by mode index
184 int GetDecayNProducts(const char*); // number of products by name
185 int GetDecayNProductsByKey(const int& key);
186
187 int GetDecayParent(const int&); // parent pid from decay mode index
188 int GetDecayParentByKey(const int&);
189 void GetDecayMode(const int,
190 int* n); // retrieve product number, pids, by mode index
191 void GetDecayModeByKey(const int, int* n);
192
193 int GetDecayIdx(int* pid,
194 int n); // decay-mode index from parent and product ids; ->getChannel
195 int GetDecayKey(int* pid, int n);
196 int GetDecayKey(const int& id);
197 int GetDecayIdxByKey(int key);
198
199 int GetDecayBRFlag(int didx);
200 void SetDecayBRFlag(int didx, int flag);
201
202
203 double GetDecayEmin(const int& idx); // Returns the energy threshold for the decay mode with index=idx
204 void SetDecayEmin(const int& idx, const double v);
205
206 //for dynamic stuff
207 int GetTWidx(const int&); // total width flag from index
208 int GetPWidx(const int&); // partial width flag from index
209 void SetTWidx(const int&, const int&); // total width flag from index
210 void SetPWidx(const int&, const int&); // partial width flag from index
211
212 int GetTDepth(const int&);
213 void SetTDepth(const int&, const int&);
214 int GetHDepth(const int&);
215 void SetHDepth(const int&, const int&);
216
217 void SetTWidthMesh(const int&, PMesh* mesh);
218 PMesh* GetTWidthMesh(const int&);
219
220 void SetPWidthMesh(const int&, PMesh* mesh);
221 PMesh* GetPWidthMesh(const int&);
222
223 void SetTF1(const int&, TF1* mesh);
224 TF1* GetTF1(const int&);
225
226 static Bool_t Tokenize(const char* options, const char* delimiter, char** array, int* size);
227 static void remove_spaces(char** partc);
228
229 static void dsort(Double_t*, int);
230 static void isort(int* i, int n)
231 {
232 // Sort in ascending order the first (int) entries of the array (int *).
233
234 //BUGBUG: Quickersort is unstable
235 //see example:
236 //Int_t a[3]={8,9,9};
237 //PUtils::isort(a,3);
238
239 //workaround: add very small number
240
241 Double_t x[n];
242
243 for (int j = 0; j < n; ++j)
244 x[j] = ((Double_t) i[j]) + ((Double_t) j) * 0.00001;
245 dsort(x, n);
246 for (int j = 0; j < n; ++j)
247 i[j] = (int) x[j];
248 }
249
250 // global friend functions
251 //Keeping for backward compatibility
252
253 friend void listParticle(int id);
254 // list particles in data base and their properties, by particle pid
255
256 friend void listParticle(const char* id) { listParticle(makeStaticData()->GetParticleID(id)); };
257 // list particles in data base and their properties, by particle code name
258
259 friend void listModes(int id);
260 // list decay modes in data base, by particle pid
261
262 friend void listModes(const char* id) { listModes(makeStaticData()->GetParticleID(id)); };
263 // list decay modes in data base, by particle name
264
265
266private:
267 Int_t* i_result;
268 const char* c_result;
269 Double_t* d_result;
270 TObject* t_result;
283
284 Bool_t freeze;
285
287
288 ClassDef(PStaticData, 0); //Pluto Static Data Wrapper
289};
290
291#endif // _PDATAUTIL_H_
static constexpr size_t size()
Definition KfSimdPseudo.h:2
fscal v[fmask::Size]
Definition KfSimdPseudo.h:4
void listParticle(int=-1)
PStaticData * makeStaticData()
PStaticData & fStaticData()
void listModes(int id=-1)
Definition PMesh.h:13
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)
double GetParticleTotalWidth(const char *id)
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_t name_param
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)
Int_t mesh_param
Int_t tdepth_param
double GetParticleMass(const int &id)
bool SetDecayBR(int didx, double br, int mode)
ClassDef(PStaticData, 0)
static Bool_t Tokenize(const char *options, const char *delimiter, char **array, int *size)
Int_t nalias_param
void SetParticleMass(Int_t id, Float_t mass)
int GetDecayIdxByKey(int key)
double GetParticleLMass(const char *id)
Int_t widx_param
Int_t umass_param
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_t * d_result
double GetParticleTotalWidth(const int &id)
Int_t ispin_param
int IsParticleMeson(const int &id)
double GetParticleUMass(const char *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_t tf1_param
int GetSecondaryKey(int key, int defkey)
Int_t pnmodes_param
PMesh * GetTWidthMesh(const int &)
static void dsort(Double_t *, int)
int GetDecayParentByKey(const int &)
Int_t lepton_param
void FreezeDecayBR(Int_t id, Int_t brn)
int GetParticleLepton(const int &id)
Int_t charge_param
Int_t didx_param
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)
friend void listParticle(int id)
void SetTF1(const int &, TF1 *mesh)
double GetParticleEmin(const int &id)
Int_t lmass_param
int IsParticleValid(const int &id)
Int_t brorig_param
int GetParticleKey(const char *id)
Definition PStaticData.h:70
Bool_t freeze
Int_t parity_param
Double_t * GetBatchValue(const char *name, Int_t make_val=1)
void clearFreezeOut(void)
Definition PStaticData.h:45
void SetParticleBaryon(const char *id, Int_t num=1)
void SetParticleEmin(const int &id, const double v)
bool GetFreezeOut(void)
Definition PStaticData.h:51
Int_t width_param
const char * c_result
Int_t count_param
int GetParticleBaryon(const int &id)
Int_t baryon_param
Int_t lalias_param
friend void listModes(const char *id)
int GetTDepth(const int &)
void SetPWidx(const int &, const int &)
friend void listParticle(const char *id)
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)
Int_t ppid_param
Double_t * system_alloc_verbosity
Int_t * i_result
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_t pkf_param
int GetParticleNChannelsByKey(int id)
int GetParticleSpin(const int &id)
Int_t mass_param
void SetParticleParity(const char *id, Int_t parity)
int AddParticle(int pid, const char *name, double mass)
Int_t meson_param
bool NormParticleBR(Int_t id)
Int_t defkey_param
Int_t hdepth_param
Int_t brflag_param
void SetHDepth(const int &, const int &)
void PrintParticleByKey(int pid)
int GetParticleParity(const int &id)
TObject * t_result
Int_t spin_param
int GetDecayKey(int *pid, int n)
void SetParticleUMass(const int &id, const double v)
Int_t ethreshold_param
TF1 * GetTF1(const int &)
int AddAlias(const char *old_name, const char *new_name)
Int_t pid_param
void PrintDecayByKey(int key)
int IsParticleHadron(const int &id)
void SetFreezeOut(void)
Definition PStaticData.h:43
void PrintParticle(const char *id)
Definition PStaticData.h:79
Double_t GetDecayPartialWidthByKey(Int_t id)
friend void listModes(int id)
Hash for CbmL1LinkKey.