17#include <TDatabasePDG.h>
19#include <TParticlePDG.h>
47 LOG(info) <<
"Instantiating STS Physics... ";
69 if (z < 0. && z > -0.00001) z = 0.;
70 if (z > d && z < d + 0.00001) z = d;
71 if (z < 0. || z > d) {
72 LOG(error) <<
"StsPhysics: z coordinate " << z <<
" not inside sensor (d = " << d <<
")";
75 if (temperature < 0.) {
76 LOG(error) <<
"StsPhysics: illegal temperature value " << temperature;
82 Double_t diffConst = 8.61733e-5 * temperature;
87 if (chargeType == 0) {
88 tau = 0.5 * d * d / vFd *
log((vBias + (1. - 2. * z / d) * vFd) / (vBias - vFd));
90 else if (chargeType == 1) {
91 tau = -0.5 * d * d / vFd *
log(1. - 2. * vFd * z / d / (vBias + vFd));
94 LOG(error) <<
"StsPhysics: Illegal charge type " << chargeType;
98 return sqrt(2. * diffConst * tau);
106 return (vBias + vFd * (2. * z / dZ - 1.)) / dZ;
116 Double_t gamma = (eKin + mass) / mass;
117 Double_t beta2 = 1. - 1. / (gamma * gamma);
120 Double_t xAux = 2. * mass * beta2 * gamma * gamma;
132 Int_t n1 = gRandom->Poisson(sigma1 * dz);
133 Int_t n2 = gRandom->Poisson(sigma2 * dz);
134 Int_t n3 = gRandom->Poisson(sigma3 * dz);
137 Double_t eLossIon = 0.;
138 for (Int_t j = 1; j <= n3; j++) {
139 Double_t uni = gRandom->Uniform(1.);
162 std::map<Double_t, Double_t>::iterator it = table.lower_bound(eEquiv);
166 if (it == table.begin())
return it->second;
169 if (it == table.end())
return (--it)->second;
172 Double_t e2 = it->first;
173 Double_t v2 = it->second;
175 Double_t e1 = it->first;
176 Double_t v1 = it->second;
177 return (v1 + (eEquiv - e1) * (v2 - v1) / (e2 - e1));
193 std::vector<double> landauTableFlat;
197 landauTableFlat.push_back(landauEntry->second);
199 auto prevLandauEntry = landauEntry;
202 double stepSize = landauEntry->first - prevLandauEntry->first;
204 for (; landauEntry !=
fLandauWidth.end(); landauEntry++) {
205 LOG_IF(fatal, stepSize != landauEntry->first - prevLandauEntry->first)
206 <<
"StsLandau table doesn't have fixed step size.";
208 landauTableFlat.push_back(landauEntry->second);
209 prevLandauEntry = landauEntry;
212 return std::make_pair(std::move(landauTableFlat), stepSize);
220 Double_t charge = 0.;
224 TParticlePDG* particle = TDatabasePDG::Instance()->GetParticle(pid);
225 if (particle) charge = particle->Charge() / 3.;
228 else if (pid > 1000000000 && pid < 1010000000) {
229 Int_t myPid = pid / 10000;
230 charge = Double_t(myPid - (myPid / 1000) * 1000);
245 TParticlePDG* particle = TDatabasePDG::Instance()->GetParticle(pid);
246 if (particle) mass = particle->Mass();
249 else if (pid > 1000000000 && pid < 1010000000) {
250 Int_t myPid = pid - 1e9;
251 myPid -= (myPid / 10000) * 10000;
252 mass = Double_t(myPid / 10);
267 TString dir = gSystem->Getenv(
"VMCWORKDIR");
268 TString errFileName = dir +
"/parameters/sts/LandauWidthTable.txt";
274 inFile.open(errFileName);
275 if (inFile.is_open()) {
279 if (inFile.eof())
break;
283 LOG(info) <<
"StsPhysics: " << setw(5) << right <<
fLandauWidth.size() <<
" values read from " << errFileName;
286 LOG(fatal) <<
"StsPhysics: Could not read from " << errFileName;
302 TString dir = gSystem->Getenv(
"VMCWORKDIR");
303 TString eFileName = dir +
"/parameters/sts/dEdx_Si_e.txt";
304 TString pFileName = dir +
"/parameters/sts/dEdx_Si_p.txt";
310 inFile.open(eFileName);
311 if (inFile.is_open()) {
315 if (inFile.eof())
break;
321 LOG(info) <<
"StsPhysics: " << setw(5) << right <<
fStoppingElectron.size() <<
" values read from " << eFileName;
324 LOG(fatal) <<
"StsPhysics: Could not read from " << eFileName;
327 inFile.open(pFileName);
328 if (inFile.is_open()) {
332 if (inFile.eof())
break;
338 LOG(info) <<
"StsPhysics: " << setw(5) << right <<
fStoppingProton.size() <<
" values read from " << pFileName;
341 LOG(fatal) <<
"StsPhysics: Could not read from " << pFileName;
351 fUrbanI = 1.6e-8 * TMath::Power(z, 0.9);
373 LOG(info) <<
"StsPhysics: Urban parameters for z = " << z <<
" :";
386 if (mass < 0.)
return 0.;
388 Bool_t isElectron = (pid == 11 || pid == -11);
400 Double_t stopPower = -1.;
411 if (!isElectron) stopPower *= (charge * charge);
ClassImp(CbmConverterManager)
friend fvec sqrt(const fvec &a)
friend fvec log(const fvec &a)
Auxiliary class for physics processes in Silicon.
void ReadDataTablesLandauWidth()
Read Landau width data table from file.
static Double_t ElectricField(Double_t vBias, Double_t vFd, Double_t dZ, Double_t z)
Electric field magnitude in a silicon sensor as function of z.
static Double_t ParticleCharge(Int_t pid)
Particle charge from PDG particle ID.
std::pair< std::vector< double >, double > GetLandauWidthTable() const
Raw values of landau width interpolation table.
Double_t fUrbanR
Urban model: weight parameter excitation/ionisation.
static Double_t ParticleMass(Int_t pid)
Particle mass from PDG particle ID.
Double_t InterpolateDataTable(Double_t eKin, std::map< Double_t, Double_t > &table)
Interpolate a value from the data tables.
static CbmStsPhysics * Instance()
Accessor to singleton instance.
static Double_t DiffusionWidth(Double_t z, Double_t d, Double_t vBias, Double_t vFd, Double_t temperature, Int_t chargeType)
Double_t StoppingPower(Double_t eKin, Int_t pid)
Stopping power (average specific energy loss) in Silicon.
Double_t LandauWidth(Double_t mostProbableCharge)
Half width at half max of Landau distribution in ultra-relativistic case.
static CbmStsPhysics * fgInstance
Singleton instance.
Double_t fUrbanE1
Urban model: first atomic energy level.
Double_t EnergyLoss(Double_t dz, Double_t mass, Double_t eKin, Double_t dedx) const
Energy loss in a Silicon layer.
std::map< Double_t, Double_t > fStoppingElectron
E [GeV] -> <-dE/dx> [GeV*g/cm^2].
void ReadDataTablesStoppingPower()
Read stopping power data table from file.
Double_t fUrbanE2
Urban model: second atomic energy level.
Double_t fUrbanI
Urban model: mean ionisation potential of Silicon.
CbmStsPhysics()
Constructor.
Double_t fUrbanF2
Urban model: oscillator strength second level.
std::map< Double_t, Double_t > fStoppingProton
E [GeV] -> <-dE/dx> [GeV*g/cm^2].
void SetUrbanParameters(Double_t z)
Calculate the parameters for the Urban model.
Double_t fUrbanF1
Urban model: oscillator strength first level.
std::map< Double_t, Double_t > fLandauWidth
q [e] -> width [e]
Double_t fUrbanEmax
Urban model: cut-off energy (delta-e threshold)
const Double_t kSiCharge
Silicon charge [e].
const Double_t kSiDensity
Silicon density [g/cm^3].
const Double_t kProtonMass
Proton mass [GeV].