Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
FemtoSourceModel.cxx
1/*
2 * FemtoSourceModel.cxx
3 *
4 * Created on: 26-11-2013
5 * Author: Daniel Wielanek
6 * E-mail: daniel.wielanek@gmail.com
7 * Warsaw University of Technology, Faculty of Physics
8 */
9
10#include "FemtoSourceModel.h"
11
12#include "Cout.h"
13#include "FemtoSourceDensity.h"
14#include "Package.h"
15#include "Parameter.h"
16
17#include <TRandom2.h>
18#include <iostream>
19
20
21// FemtoSourceModel
22/*
23 FemtoSourceModel::FemtoSourceModel() :fRandom( new TRandom2()) ,
24 fRout(0),fRside(0),fRlong(0),fModelName("unknown"),
25 fParametersNo(0),
26 fParameterNames(NULL)
27
28 {
29 }
30
31 */
32namespace Hal {
34 fParametersNo(TMath::Max(1, params_no)), fRandom(new TRandom2()), fRout(0), fRside(0), fRlong(0), fModelName("unknown") {
35 fParameterNames = new TString[fParametersNo];
36 fParams = new Double_t[fParametersNo];
37 }
38
40 TObject(model),
41 fParametersNo(model.fParametersNo),
42 fRandom(new TRandom2()),
43 fRout(model.fRout),
44 fRside(model.fRside),
45 fRlong(model.fRlong),
46 fModelName(model.fModelName) {
47 fParameterNames = new TString[fParametersNo];
48 fParams = new Double_t[fParametersNo];
49 for (int i = 0; i < fParametersNo; i++) {
50 fParameterNames[i] = model.fParameterNames[i];
51 fParams[i] = model.fParams[i];
52 }
53 if (model.fDensity) { fDensity = (FemtoSourceDensity*) model.fDensity->Clone(); }
54 }
55
57 Package* pack = new Package(this);
58 pack->AddObject(new ParameterString("Model_name", fModelName));
59 for (int i = 0; i < GetNpar(); i++) {
61 }
62 return pack;
63 }
64
65 TString FemtoSourceModel::GetParamName(Int_t n) const {
66 if (n < 0) return "";
67 if (n >= fParametersNo) return "";
68 return fParameterNames[n];
69 }
70
71 void FemtoSourceModel::SetParameterByName(TString name, Double_t par) {
72 for (int i = 0; i < fParametersNo; i++) {
73 if (name == fParameterNames[i]) {
74 SetParameter(i, par);
75 return;
76 }
77 }
78 }
79
80 FemtoSourceModel::ENumProperty FemtoSourceModel::GetModelNumProp() const {
81 if (!fDensity) return ENumProperty::kNonAnalytical;
82 if (fDensity->IsAna1d() && fDensity->IsAna3d()) return ENumProperty::kFullyAnalytical;
83 if (fDensity->IsAna1d()) return ENumProperty::kAnalytical1d;
84 if (fDensity->IsAna3d()) return ENumProperty::kAnalytical3d;
85 return ENumProperty::kNonAnalytical;
86 }
87
88 FemtoSourceModel::~FemtoSourceModel() {
89 delete fRandom;
90 if (fDensity) delete fDensity;
91 if (fParams) delete[] fParams;
92 if (fParameterNames) delete[] fParameterNames;
93 }
94 // FemtoSourceModel1D
95
96 FemtoSourceModel1D::FemtoSourceModel1D(Int_t par) : FemtoSourceModel(par) {
97 SetParName(0, "R");
98 SetParameter(0, 1);
99 }
100
101 FemtoSourceModel1D::FemtoSourceModel1D() : FemtoSourceModel1D(1) {}
102
103 FemtoSourceModel1D::FemtoSourceModel1D(const FemtoSourceModel1D& model) : FemtoSourceModel(model) {}
104
105 FemtoSourceModel1D::~FemtoSourceModel1D() {}
106
107 // FemtoSourceModel3D
108
109 FemtoSourceModel3D::FemtoSourceModel3D() : FemtoSourceModel3D(3) {}
110
111 FemtoSourceModel3D::FemtoSourceModel3D(Int_t no) : FemtoSourceModel(no) {
112 if (no >= 3) {
113 SetParameter(0, 1);
114 SetParameter(1, 1);
115 SetParameter(2, 2);
116 SetParName(0, "R_{out}");
117 SetParName(1, "R_{side}");
118 SetParName(2, "R_{long}");
119 }
120 }
121
122 FemtoSourceModel3D::FemtoSourceModel3D(const FemtoSourceModel3D& model) : FemtoSourceModel(model) {}
123
124 void FemtoSourceModel3D::SetRadius(Double_t radii) {
125 SetOutRadius(radii);
126 SetSideRadius(radii);
127 SetLongRadius(radii);
128 }
129
130 FemtoSourceModel3D::~FemtoSourceModel3D() {}
131
132 void FemtoSourceModel::Print(Option_t* /*option*/) const {
133 Cout::Text(ClassName(), "L");
134 Cout::Database({"ParName", "Value"});
135 for (int i = 0; i < GetNpar(); i++) {
136 TString val = Form("%4.4f", GetParameter(i));
137 Cout::Database({GetParamName(i), val});
138 }
139 }
140} // namespace Hal
static void Text(TString text, TString option="L", Color_t color=-1)
Definition Cout.cxx:92
static void Database(Int_t no...)
void SetSideRadius(Double_t side)
virtual void SetRadius(Double_t radii)
void SetLongRadius(Double_t longr)
void SetOutRadius(Double_t out)
void SetParameter(Int_t par_no, Double_t par_val)
virtual Package * Report() const
Double_t GetParameter(Int_t n) const
void SetParameterByName(TString name, Double_t par)
ENumProperty GetModelNumProp() const
FemtoSourceModel(Int_t nparams=1)
TString GetParamName(Int_t n) const
FemtoSourceDensity * fDensity
void AddObject(TObject *object)
Definition Package.cxx:209