9#include "FemtoSourceModelNumericalPseudo3d.h"
16 FemtoSourceModelNumericalPseudo3d::FemtoSourceModelNumericalPseudo3d() {
fDensity =
new FemtoSourceDensityNumericalPseudo3d(); }
18 FemtoSourceModelNumericalPseudo3d::FemtoSourceModelNumericalPseudo3d(
const FemtoSourceModelNumericalPseudo3d& other) :
19 FemtoSourceModel3D(other) {
20 if (other.fRawDistribution) this->fRawDistribution = (TH1D*) other.fRawDistribution->Clone();
23 void FemtoSourceModelNumericalPseudo3d::SetRadiusDistribution(
const TH1D& distribution) {
24 if (fRawDistribution)
delete fRawDistribution;
25 fRawDistribution = (TH1D*) distribution.Clone();
26 fRawDistribution->SetDirectory(
nullptr);
28 fRawDistribution->SetBinContent(0, 0);
29 ((FemtoSourceDensityNumericalPseudo3d*) fDensity)->SetRadiusDistribution(*fRawDistribution);
32 void FemtoSourceModelNumericalPseudo3d::GenerateCoordinates(
FemtoPair* Pair) {
33 fRout = fRawDistribution->GetRandom();
34 fRside = fRawDistribution->GetRandom();
35 fRlong = fRawDistribution->GetRandom();
36 int swap = gRandom->Integer(8);
70 FemtoSourceModelNumericalPseudo3d::~FemtoSourceModelNumericalPseudo3d() {
71 if (fRawDistribution)
delete fRawDistribution;
74 Double_t FemtoSourceDensityNumericalPseudo3d::GetProbDensity3d(
const TVector3& r,
const Double_t* params)
const {
75 auto findDens = [&](Double_t v) {
return int((TMath::Abs(v) - fMin) * fDx + 1); };
76 double rho = fRawDistribution->GetBinContent(findDens(r.X()));
77 rho *= fRawDistribution->GetBinContent(findDens(r.Y()));
78 rho *= fRawDistribution->GetBinContent(findDens(r.Z()));
82 void FemtoSourceDensityNumericalPseudo3d::SetRadiusDistribution(
const TH1D& distribution) {
83 if (fRawDistribution)
delete fRawDistribution;
85 fRawDistribution = (TH1D*) distribution.Clone();
86 fRawDistribution->SetDirectory(
nullptr);
87 fRawDistribution->SetBinContent(0, 0);
88 fDx = 1.0 / fRawDistribution->GetBinWidth(1);
89 fMin = fRawDistribution->GetBinLowEdge(1);
90 double integral = fRawDistribution->Integral(
"width");
91 fRawDistribution->Scale(1.0 / integral);
94 FemtoSourceDensityNumericalPseudo3d::FemtoSourceDensityNumericalPseudo3d(
const FemtoSourceDensityNumericalPseudo3d& other) :
95 FemtoSourceDensity(other) {
96 if (other.fRawDistribution) fRawDistribution = (TH1D*) other.fRawDistribution;
101 FemtoSourceDensityNumericalPseudo3d::~FemtoSourceDensityNumericalPseudo3d() {
102 if (fRawDistribution)
delete fRawDistribution;
FemtoSourceDensity * fDensity