KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVTGIDFunctions.cpp
Go to the documentation of this file.
1 //$Id: KVTGIDFunctions.cpp,v 1.14 2009/03/03 14:27:15 franklan Exp $
2 
3 #include "KVTGIDFunctions.h"
4 #include "KVNucleus.h"
5 #include "TMath.h"
6 #include "Riostream.h"
7 
8 #ifndef ROOT_Rtypes
9 #include "Rtypes.h"
10 #endif
11 
12 #ifndef ROOT_RVersion
13 #include "RVersion.h"
14 #endif
15 
16 #if ROOT_VERSION_CODE > ROOT_VERSION(4, 1, 2)
17 // Without this macro the THtml doc can not be generated
18 #if !defined(R__ALPHA) && !defined(R__SOLARIS) && !defined(R__ACC) && !defined(R__MACOSX)
20 #endif
21 #endif
22 
23 
24 
108 
110 {
111  // General Tassan-Got functional used with KVTGIDFitter
112  // It gives Y as a function of X and Z or A (depending on parameters).
113  //
114  // par[0] = ixt -----> type of functional
115  // * ixt : =0->basic functional <>0->extended functional
116  // * * For the basic formula :
117  // * yy = ((g*E)**(mu+1)+lambda**(mu+1)*Z**2*A**mu)**(1/(mu+1))-g*E + pdy
118  // * * For the extended formula :
119  // * yy = ((g*E)**(mu+nu+1)+(lambda*Z**alpha*A**beta)**(mu+nu+1)+
120  // * xi*Z*Z*A**mu*(g*E)**nu)**(1/(mu+nu+1))-g*E + pdy
121  //
122  // par[1] = ih -----> treatment of CsI total light output
123  // * ih : =0->no non-linear light response <>0->non-linear light response included
124  // * * If ih=0 no non-linear light response : E=xx-pdx
125  // * * If ih<>0 non-linear light response included :
126  // * E = sqrt(h**2+2*rho*h*(1+log(1+h/rho)))
127  // * rho=eta*Z**2*A and h=xx-pdx
128  //
129  // par[2] = ZorA -----> whether x[0]=Z or x[0]=A
130  // * ZorA : =0->x[0]=A <>0->x[0]=Z
131  // * * If ZorA=1, we calculate A using the mass formula indicated
132  // * by the value of MassForm=par[3]
133  // * * If ZorA=0, Z is given by the value of par[3]
134  //
135  // par[3] = mass formula or Z
136  // * If ZorA=1, par[3] = mass formula, for values see KVNucleus::GetAFromZ
137  // * If ZorA=0, par[3] = Z
138  //
139  // par[4] = X coordinate
140  // par[5] = Y coordinate
141  //
142  // The number & order of remaining parameters depend on ixt and ih.
143  // * ixt=0 ih=0 5 parameters: lambda, mu, g, pdx, pdy
144  // * ixt=0 ih<>0 6 parameters: lambda, mu, g, pdx, pdy, eta
145  // * ixt<>0 ih=0 9 parameters: lambda, alpha, beta, mu, nu,
146  // * xi, g, pdx, pdy
147  // * ixt<>0 ih<>0 10 parameters: lambda, alpha, beta, mu, nu,
148  // * xi, g, pdx, pdy, eta
149  //
150  // Therefore:
151  //
152  // ixt=0, ih=0: Double_t par[11];
153  // ============
154  // par[6] = lambda
155  // par[7] = mu
156  // par[8] = g
157  // par[9] = pdx
158  // par[10] = pdy
159  //
160  // ixt=0, ih<>0: Double_t par[12];
161  // ============
162  // par[6] = lambda
163  // par[7] = mu
164  // par[8] = g
165  // par[9] = pdx
166  // par[10] = pdy
167  // par[11] = eta
168  //
169  // ixt<>0, ih=0: Double_t par[15];
170  // ============
171  // par[6] = lambda
172  // par[7] = alpha
173  // par[8] = beta
174  // par[9] = mu
175  // par[10] = nu
176  // par[11] = xi
177  // par[12] = g
178  // par[13] = pdx
179  // par[14] = pdy
180  //
181  // ixt<>0, ih<>0: Double_t par[16];
182  // ============
183  // par[6] = lambda
184  // par[7] = alpha
185  // par[8] = beta
186  // par[9] = mu
187  // par[10] = nu
188  // par[11] = xi
189  // par[12] = g
190  // par[13] = pdx
191  // par[14] = pdy
192  // par[15] = eta
193 
194  Int_t ixt, ih, ZorA;
195  ixt = (Int_t)par[0];
196  ih = (Int_t)par[1];
197  ZorA = (Int_t)par[2];
198 
199  Double_t A = 1, Z = 1;
200  if (ZorA == 0) {
201  // A given as function argument, Z is parameter
202  A = x[0];
203  Z = par[3];
204  }
205  else if (ZorA == 1) {
206  // Z given as function argument, calculate A
207  Z = x[0];
208  A = KVNucleus::GetRealAFromZ(Z, (Int_t)par[3]);
209  }
210 
211  Double_t E, pdx, pdy, eta, lambda, mu, g, yy;
212  eta = 0.;
213  lambda = par[6];
214  if (ixt) {
215  //extended formula
216  pdx = par[13];
217  pdy = par[14];
218  mu = par[9];
219  g = par[12];
220  Double_t alpha = par[7];
221  Double_t beta = par[8];
222  Double_t nu = par[10];
223  Double_t xi = par[11];
224  Double_t gamma = mu + nu + 1.;
225  if (ih) {
226  eta = par[15];
227  //calculate energy from total light
228  Double_t h = par[4] - pdx;
229  if (h > 0) {
230  Double_t rho = eta * Z * Z * A;
231  if (rho > 0) {
232  E = TMath::Sqrt(h * h + 2 * rho * h * (1 + TMath::Log(1 + h / rho)));
233  }
234  else
235  E = h;
236  }
237  else {
238  E = 0;
239  }
240  }
241  else {
242  E = par[4] - pdx;
243  }
244  Double_t gE = g * E;
245  //yy = ((g*E)**(mu+nu+1)+(lambda*Z**alpha*A**beta)**(mu+nu+1)+
246  // xi*Z**2*A**mu*(g*E)**nu)**(1/(mu+nu+1))-g*E + pdy
247  yy = TMath::Power(gE, gamma)
248  + TMath::Power((lambda * TMath::Power(Z, alpha) * TMath::Power(A, beta)), gamma)
249  + xi * Z * Z * TMath::Power(A, mu) * TMath::Power(gE, nu);
250  yy = TMath::Power(yy, 1. / gamma) - gE + pdy;
251  }
252  else {
253  //"standard" formula
254  mu = par[7];
255  g = par[8];
256  pdx = par[9];
257  pdy = par[10];
258  Double_t muplus = mu + 1.;
259  if (ih) {
260  eta = par[11];
261  //calculate energy from total light
262  Double_t h = par[4] - pdx;
263  if (h > 0) {
264  Double_t rho = eta * Z * Z * A;
265  if (rho > 0) {
266  E = TMath::Sqrt(h * h + 2 * rho * h * (1 + TMath::Log(1 + h / rho)));
267  }
268  else
269  E = h;
270  }
271  else {
272  E = 0;
273  }
274  }
275  else {
276  E = par[4] - pdx;
277  }
278  Double_t gE = g * E;
279  //yy = ((g*E)**(mu+1)+lambda**(mu+1)*Z**2*A**mu)**(1/(mu+1))-g*E + pdy
280  yy = TMath::Power(gE, muplus) + TMath::Power(lambda, muplus) * Z * Z * TMath::Power(A, mu);
281  yy = TMath::Power(yy, 1. / muplus) - gE + pdy;
282  }
283  return yy - par[5];
284 }
285 
286 
287 
300 
302 {
303  //Tassan-Got formula used for Z identification in ChIo-Si telescopes.
304  //Charity EAL mass used for Z>5
305  //
306  //Returns difference between measured ChIo energy (dE)
307  //and that calculated for given (Z, Si energy (E)).
308  //
309  //Arguments are
310  //x[0] Z of nucleus considered
311  //par[0], ..., par[8] 9 parameters of Tassan-Got formula
312  //par[9] Si energy (in MeV) X-coordinate = dE
313  //par[10] ChIo energy (in MeV) Y-coordinate = E
314 
315  Double_t A = KVNucleus::GetRealAFromZ(x[0], KVNucleus::kEALMass); //Deduce A from Z
316 
317  Double_t gamma = par[3] + par[4] + 1.0;
318  Double_t E = par[9] - par[7];
319  Double_t de = par[10] - par[8];
320 
321  return (TMath::Power((TMath::Power((par[6] * E), gamma)
322 
323  +
324  TMath::
325  Power((par[0] * TMath::Power(x[0], par[1]) *
326  TMath::Power(A, par[2])), gamma)
327 
328  + par[5] * TMath::Power(x[0], 2) * TMath::Power(A,
329  par
330  [3])
331  * TMath::Power((par[6] * E), par[4]))
332 
333  , (1. / gamma))
334 
335  - par[6] * E - de);
336 }
337 
338 
339 
340 
353 
355 {
356  //Tassan-Got formula (10 parameters) used for Z identification in Si-CsI or ChIo-CsI
357  //telescopes - 12 parameters
358  //Charity EAL mass used for Z>5
359  //Returns difference between measured ChIo/Si PG/GG channel
360  //and that calculated for given (Z, CsI light output).
361  //
362  //Arguments are
363  //x[0] Z of nucleus considered
364  //par[0], ..., par[9] 10 parameters of Tassan-Got formula
365  //par[10] measured total light output of CsI - X coord
366  //par[11] measured ChIo/Si PG or GG channel - Y coord
367 
368  Double_t A = KVNucleus::GetRealAFromZ(x[0], KVNucleus::kEALMass); //Deduce A from Z
369 
370  Double_t gamma = par[3] + par[4] + 1.0;
371  Double_t h = par[10] - par[7];
372  Double_t de = par[11] - par[8];
373 
374  Double_t rho = par[9] * TMath::Power(x[0], 2) * A;
375  Double_t E;
376  if (h > 0) {
377  if (rho > 0) {
378  E = TMath::Sqrt(TMath::Power(h, 2) + 2 * rho * h * (1 + TMath::Log(1 + h / rho)));
379  }
380  else
381  E = h;
382  }
383  else
384  E = 0;
385 
386  return (TMath::Power((TMath::Power((par[6] * E), gamma)
387  +
388  TMath::
389  Power((par[0] * TMath::Power(x[0], par[1]) *
390  TMath::Power(A, par[2])), gamma)
391  + par[5] * TMath::Power(x[0], 2) * TMath::Power(A,
392  par
393  [3])
394  * TMath::Power((par[6] * E), par[4])),
395  (1. / gamma)) - par[6] * E - de);
396 }
397 
398 
399 
400 
425 
427 {
428  //Tassan-Got formula (10 parameters) used for Z identification in Si-CsI or ChIo-CsI
429  //5th campaign telescopes - 12 parameters
430  //As per Matthieu Pichon's these, we use A = 2Z for the mass.
431  //Returns difference between measured ChIo/Si PG/GG channel
432  //and that calculated for given (Z, CsI light output).
433  //
434  //Corresponds to Eq.11 of NIM B194 (2002) 503 with Eq.13 for the
435  //light-energy dependence
436  //
437  //Arguments are
438  //x[0] Z of nucleus considered
439  // par[0] : lambda
440  // par[1] : alpha (1: 0.5 - 1.5)
441  // par[2] : beta (0.5: 0.2 - 1)
442  // par[3] : mu (1: 0.2 - 1.5)
443  // par[4] : nu (1: 0.1 - 4)
444  // par[5] : zeta (?? squiggly epsilon thingy ??) (>0)
445  // par[6] : g
446  // par[7] : pedestal of x-coordinate
447  // par[8] : pedestal of y-coordinate
448  // par[9] : eta
449  //par[10] measured total light output of CsI - X coord
450  //par[11] measured ChIo/Si PG or GG channel - Y coord
451 
452  Double_t Z = x[0];
453  Double_t A = 2. * Z; //Deduce A from Z, A=2Z
454 
455  Double_t gamma = par[3] + par[4] + 1.0;//gamma=mu+nu+1
456  Double_t h = par[10] - par[7];
457  Double_t de = par[11] - par[8];
458 
459  Double_t rho = par[9] * TMath::Power(Z, 2) * A;//=eta*Z^2*A
460  Double_t E;
461  if (h > 0) {
462  if (rho > 0) {
463  E = TMath::Sqrt(TMath::Power(h, 2) + 2 * rho * h * (1 + TMath::Log(1 + h / rho)));
464  }
465  else
466  E = h;
467  }
468  else
469  E = 0;
470 
471  Double_t gE = par[6] * E;//=g*E
472  Double_t gE_to_the_gamma = TMath::Power(gE, gamma);
473  Double_t gE_to_the_nu = TMath::Power(gE, par[4]);
474  Double_t lambda_Z_alpha_A_beta =
475  par[0] * TMath::Power(Z, par[1]) * TMath::Power(A, par[2]);
476  Double_t zeta_Z2_A_mu = par[5] * TMath::Power(Z, 2) * TMath::Power(A, par[3]);
477  Double_t one_over_gamma = 1. / gamma;
478  Double_t Delta_E = gE_to_the_gamma + TMath::Power(lambda_Z_alpha_A_beta, gamma)
479  + zeta_Z2_A_mu * gE_to_the_nu;
480  Delta_E = TMath::Power(Delta_E, one_over_gamma) - gE;
481  return (Delta_E - de);
482 }
483 
484 
485 
486 
498 
500 {
501  //Tassan-Got formula (13 parameters) for A identification (known Z)
502  //Returns difference between measured ChIo/Si PG/GG channel and that calculated for given
503  //(Z, A, CsI light output)
504  //
505  //Arguments are
506  //x[0] A of nucleus considered
507  //par[0], ..., par[9] 10 parameters of corrected Tassan-Got formula
508  //par[10] Z of nucleus considered
509  //par[11] measured total light output of CsI - X coord
510  //par[12] measured ChIo/Si PG or GG channel - Y coord
511 
512  Double_t gamma = par[3] + par[4] + 1.0;
513  Double_t h = par[11] - par[7];
514  Double_t de = par[12] - par[8];
515 
516  Double_t rho = par[9] * TMath::Power(par[10], 2) * x[0];
517  Double_t E;
518  if (h > 0) {
519  if (rho > 0) {
520  E = TMath::Sqrt(TMath::Power(h, 2) + 2 * rho * h * (1 + TMath::Log(1 + h / rho)));
521  }
522  else
523  E = h;
524  }
525  else
526  E = 0;
527 
528  return (TMath::Power((TMath::Power((par[6] * E), gamma)
529  +
530  TMath::
531  Power((par[0] * TMath::Power(par[10], par[1]) *
532  TMath::Power(x[0], par[2])), gamma)
533  + par[5] * TMath::Power(par[10],
534  2) * TMath::Power(x[0],
535  par[3])
536  * TMath::Power((par[6] * E), par[4])),
537  (1. / gamma)) - par[6] * E - de);
538 }
539 
540 
541 
554 
556 {
557  //Tassan-Got formula with Pawlowski correction (11th parameter) for Z identification
558  //A = 2*Z + 1
559  //13 parameters in all.
560  //Returns difference between measured Si PG/GG channel
561  //and that calculated for given (Z, CsI light output).
562  //
563  //Arguments are
564  //x[0] Z of nucleus considered
565  //par[0], ..., par[10] 11 parameters of corrected Tassan-Got formula
566  //par[11] measured total light output of CsI - X coord
567  //par[12] measured ChIo/Si PG or GG channel - Y coord
568 
569  Double_t A = 2.*x[0] + 1; //Deduce A from Z
570 
571  Double_t gamma = par[3] + par[4] + 1.0;//gamma=mu+nu+1
572  Double_t h = par[11] - par[7];
573  h = 0.5 * (h + TMath::Sqrt(TMath::Power(h, 2) + par[10])); //Correction P. Pawlowski
574  Double_t de = par[12] - par[8];
575 
576  Double_t rho = par[9] * TMath::Power(x[0], 2) * A;//=eta*Z^2*A
577  Double_t E;
578  if (h > 0) {
579  if (rho > 0) {
580  E = TMath::Sqrt(TMath::Power(h, 2) + 2 * rho * h * (1 + TMath::Log(1 + h / rho)));
581  }
582  else
583  E = h;
584  }
585  else
586  E = 0;
587 
588  Double_t gE = par[6] * E;//=g*E
589  Double_t gE_to_the_gamma = TMath::Power(gE, gamma);
590  Double_t gE_to_the_nu = TMath::Power(gE, par[4]);
591  Double_t lambda_Z_alpha_A_beta =
592  par[0] * TMath::Power(x[0], par[1]) * TMath::Power(A, par[2]);
593  Double_t zeta_Z2_A_mu = par[5] * TMath::Power(x[0], 2) * TMath::Power(A, par[3]);
594  Double_t one_over_gamma = 1. / gamma;
595  Double_t Delta_E = gE_to_the_gamma + TMath::Power(lambda_Z_alpha_A_beta, gamma)
596  + zeta_Z2_A_mu * gE_to_the_nu;
597  Delta_E = TMath::Power(Delta_E, one_over_gamma) - gE;
598  return (Delta_E - de);
599 }
600 
601 
602 
603 
615 
617 {
618  //Tassan-Got formula with Pawlowski correction (11th parameter) for A identification (Z known).
619  //Returns difference between measured ChIo/Si PG/GG channel and that calculated for given
620  //(Z, A, CsI light output)
621  //14 parameters in all
622  //Arguments are
623  //x[0] A of nucleus considered
624  //par[0], ..., par[10] 11 parameters of corrected Tassan-Got formula
625  //par[11] Z of nucleus considered
626  //par[12] measured total light output of CsI - X coord
627  //par[13] measured ChIo/Si PG or GG channel - Y coord
628 
629  Double_t gamma = par[3] + par[4] + 1.0;
630  Double_t h = par[12] - par[7];
631 
632  h = 0.5 * (h + TMath::Sqrt(TMath::Power(h, 2) + par[10])); //Correction P. Pawlowski
633  Double_t rho = par[9] * TMath::Power(par[11], 2) * x[0];//=eta*Z^2*A
634  Double_t E;
635  if (h > 0) {
636  if (rho > 0) {
637  E = TMath::Sqrt(TMath::Power(h, 2) + 2 * rho * h * (1 + TMath::Log(1 + h / rho)));
638  }
639  else
640  E = h;
641  }
642  else
643  E = 0;
644  Double_t de = par[13] - par[8];
645 
646 
647  return (TMath::Power((TMath::Power((par[6] * E), gamma)
648  +
649  TMath::
650  Power((par[0] * TMath::Power(par[11], par[1]) *
651  TMath::Power(x[0], par[2])), gamma)
652  + par[5] * TMath::Power(par[11],
653  2) * TMath::Power(x[0],
654  par[3])
655  * TMath::Power((par[6] * E), par[4])),
656  (1. / gamma)) - par[6] * E - de);
657 }
658 
659 
660 
661 
669 
671 {
672  //Function used to fit starting points' y-coordinate as a function of Z
673  //and get initial values for lambda, alpha
674  //Function is : DE(E=0) = lambda * (Z**alpha) * (A**0.5)
675  //
676  //par0 = lambda
677  //par1 = alpha
678 
679  Double_t A = KVNucleus::GetRealAFromZ(x[0], KVNucleus::kEALMass); //Deduce A from Z
680  return par[0] * TMath::Power(x[0], par[1]) * TMath::Power(A, 0.5);
681 }
682 
683 
684 
685 
695 
697 {
698  //Function used to fit starting points' y-coordinate as a function of A
699  //and get initial values for lambda, alpha and beta
700  //Function is : DE(E=0) = lambda * (Z**alpha) * (A**beta)
701  //
702  //par0 = lambda
703  //par1 = alpha
704  //par2 = beta
705  //par3 = Z
706 
707  Double_t Z = par[3];
708  return par[0] * TMath::Power(Z, par[1]) * TMath::Power(x[0], par[2]);
709 }
710 
711 
int Int_t
double Double_t
#define NamespaceImp(name)
static Double_t GetRealAFromZ(Double_t, Char_t mt)
Definition: KVNucleus.cpp:444
double beta(double x, double y)
Double_t x[n]
TH1 * h
Double_t pichon_Z(Double_t *x, Double_t *par)
Double_t pawlowski_Z(Double_t *x, Double_t *par)
Double_t starting_points_A(Double_t *x, Double_t *par)
Double_t tassangot_A(Double_t *x, Double_t *par)
Double_t fede(Double_t *x, Double_t *par)
Double_t tassangot_Z(Double_t *x, Double_t *par)
Double_t pawlowski_A(Double_t *x, Double_t *par)
Double_t starting_points_Z(Double_t *x, Double_t *par)
Double_t chiosi_Z(Double_t *x, Double_t *par)
const long double g
masses
Definition: KVUnits.h:72
double gamma(double x)
Double_t Power(Double_t x, Double_t y)
constexpr Double_t E()
Double_t Log(Double_t x)
Double_t Sqrt(Double_t x)