KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
KVPulseHeightDefect.cpp
1/*
2$Id: KVPulseHeightDefect.cpp,v 1.5 2008/10/07 15:55:20 franklan Exp $
3$Revision: 1.5 $
4$Date: 2008/10/07 15:55:20 $
5*/
6
7//Created by KVClassFactory on Mon Feb 19 17:32:55 2007
8//Author: franklan
9
10#include "KVPulseHeightDefect.h"
11#include "TMath.h"
12
14
15
16
17
18
31
33{
34 //Returns Moulton PHD for given E and Z:
35 //
36 // log_10(PHD) = b(Z) + a(Z)*log_10(E), for Z > Zmin
37 //
38 // PHD = 0, for Z <= Zmin
39 //
40 // with a(Z) = a_1*(Z**2/1000) + a_2
41 // b(Z) = b_1*(100/Z) + b_2
42 // E = energy lost by particle in detector
43 //
44 // x[0] = E (MeV)
45 // par[0] = Z
46
47 Int_t Z = par[0];
48 // by definition, no PHD for Z=2 or less
49 if (Z < 3) return 0;
50 Double_t a_1 = GetParameter(0);
51 Double_t a_2 = GetParameter(1);
52 Double_t b_1 = GetParameter(2);
53 Double_t b_2 = GetParameter(3);
54
55 Double_t a = a_1 * Z * Z / 1000. + a_2;
56 Double_t b = b_1 * 100. / Z + b_2;
57 return (TMath::Power(10, b) * TMath::Power(x[0], a));
58}
59
60
61
62
65
67{
68 //default initialisations
69 SetType("Pulse Height Defect");
70 SetZ(1);
71 fMoulton = fDeltaEphd = 0;
72}
73
74
75
78
80{
81 //Default constructor
82 init();
83}
84
85
86
89
91{
92 //Associate PHD calculation to detector
93 init();
95}
96
97
98
101
108
109
110
111
124
126{
127 //Calculate the pulse height defect (in MeV) for a given energy loss in the detector
128 //and a given Z (the Z of the particle should be set first using method SetZ)
129 //The Moulton formula is used:
130 //
131 // log_10(PHD) = b(Z) + a(Z)*log_10(E)
132 //
133 // PHD = 0, for Z <= Zmin
134 //
135 // with a(Z) = a_1*(Z**2/1000) + a_2
136 // b(Z) = b_1*(100/Z) + b_2
137 // E = energy loss of particle
138
139 return const_cast<KVPulseHeightDefect*>(this)->GetMoultonPHDFunction(GetZ())->Eval(energy);
140}
141
142
143
152
154{
155 // Return pointer to TF1 giving energy loss in active layer of detector minus
156 // the pulse height defect for a given nucleus (Z,A).
157 //
158 // If Wrong=kTRUE (default:kFALSE) this will be calculated incorrectly
159 // (if the particle does not stop in the detector) by using the Moulton formula
160 // with the incident energy of the particle instead of the calculated energy
161 // loss of the particle.
162
163 wrong = Wrong;
164
165 if (!fDeltaEphd) {
166 fDeltaEphd = new TF1(Form("KVPulseHeightDefect:%s:ELossActive", GetDetector()->GetName()),
167 this, &KVPulseHeightDefect::ELossActive, 0., 1.e+04, 2, "KVPulseHeightDefect", "ELossActive");
168 fDeltaEphd->SetNpx(gEnv->GetValue("KVPulseHeightDefect.EnergyLoss.Npx", 20));
169 }
171 fDeltaEphd->SetRange(0., GetDetector()->GetSmallestEmaxValid(Z, A));
172 fDeltaEphd->SetTitle(Form("PHD dependent energy loss [MeV] in detector %s for Z=%d A=%d", GetDetector()->GetName(), Z, A));
174 return fDeltaEphd;
175}
176
177
178
184
186{
187 // Calculate energy lost in active layer of detector minus the Moulton PHD
188 // x[0] = incident energy
189 // par[0] = Z
190 // par[1] = A
191
192 Double_t e = x[0];
193 TIter next(GetDetector()->GetListOfAbsorbers());
194 KVMaterial* mat;
195 while ((mat = (KVMaterial*)next()) != GetDetector()->GetActiveLayer()) {
196 // calculate energy losses in absorbers before active layer
197 e = mat->GetERes(par[0], par[1], e); //residual energy after layer
198 if (e <= 0.)
199 return 0.; // return 0 if particle stops in layers before active layer
200 }
201 // calculate energy loss in active layer
202 Double_t dE = mat->GetDeltaE(par[0], par[1], e);
203 // calculate Moulton PHD corresponding to energy lost in active layer
204 Double_t phd;
205 if (wrong) phd = PHDMoulton(&e, par); //incorrect calculation using incident energy
206 else phd = PHDMoulton(&dE, par);
207
208 return dE - phd;
209}
210
211
212
215
217{
218 // Create TF1* fMoulton if not already done
219
220 if (!fMoulton) {
221 fMoulton = new TF1(Form("MoultonPHD:%s", GetDetector()->GetName()),
222 this, &KVPulseHeightDefect::PHDMoulton, 0., 1.e+04, 1, "KVPulseHeightDefect", "PHDMoulton");
223 fMoulton->SetNpx(500);
224 }
225 fMoulton->SetParameter(0, Z);
226 return fMoulton;
227}
228
229
230
231
236
238{
239 //Given the PHD (in MeV) of a particle of charge Z
240 //(set using SetZ() method), this method inverts the Moulton formula
241 //in order to find the energy loss of the particle in the detector.
242
243 const_cast<KVPulseHeightDefect*>(this)->GetMoultonPHDFunction(GetZ());
246 return fMoulton->GetX(energy, xmin, xmax);
247}
248
249
int Int_t
#define SafeDelete(p)
#define d(i)
#define e(i)
bool Bool_t
double Double_t
R__EXTERN TEnv * gEnv
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t b
float xmin
float xmax
char * Form(const char *fmt,...)
virtual void SetType(const Char_t *str)
Definition KVBase.h:173
Base class for all detector calibrations.
KVDetector * GetDetector() const
void SetDetector(KVDetector *d)
Base class for detector geometry description.
Definition KVDetector.h:160
Description of physical materials used to construct detectors & targets; interface to range tables.
Definition KVMaterial.h:94
virtual Double_t GetERes(Int_t Z, Int_t A, Double_t Einc)
virtual Double_t GetDeltaE(Int_t Z, Int_t A, Double_t Einc)
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
Silicon PHD described by Moulton formula.
virtual Double_t Invert(Double_t, const KVNameValueList &="") const
KVPulseHeightDefect()
Default constructor.
TF1 * GetELossFunction(Int_t Z, Int_t A, Bool_t Wrong=kFALSE)
virtual ~KVPulseHeightDefect()
Destructor.
Double_t ELossActive(Double_t *x, Double_t *par)
TF1 * fDeltaEphd
deltaE calculated including PHD
TF1 * fMoulton
Moulton formula for PHD = f(E,Z)
TF1 * GetMoultonPHDFunction(Int_t Z)
Create TF1* fMoulton if not already done.
Double_t PHDMoulton(Double_t *x, Double_t *par)
void init()
default initialisations
virtual Double_t Compute(Double_t, const KVNameValueList &="") const
virtual const char * GetValue(const char *name, const char *dflt) const
virtual void SetRange(Double_t xmin, Double_t xmax)
void SetTitle(const char *title="") override
virtual void SetNpx(Int_t npx=100)
virtual Double_t GetX(Double_t y, Double_t xmin=0, Double_t xmax=0, Double_t epsilon=1.E-10, Int_t maxiter=100, Bool_t logx=false) const
virtual void GetRange(Double_t &xmin, Double_t &xmax) const
virtual void SetParameters(const Double_t *params)
virtual void SetParameter(const TString &name, Double_t value)
const char * GetName() const override
Double_t x[n]
Eval
Double_t Power(Double_t x, Double_t y)
TArc a
ClassImp(TPyArg)