KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVTGIDZA.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  KVTGIDZA.cpp - description
3  -------------------
4  begin : 5 July 2005
5  copyright : (C) 2005 by J.D. Frankland
6  email : frankland@ganil.fr
7 
8 $Id: KVTGIDZA.cpp,v 1.12 2009/03/03 14:27:15 franklan Exp $
9 ***************************************************************************/
10 #include "KVTGIDZA.h"
11 #include "KVIDZAGrid.h"
12 #include "KVIDZALine.h"
13 #include "KVNucleus.h"
14 
16 
17 
18 
24 KVTGIDZA::KVTGIDZA(const Char_t* name,
25  const Char_t* function,
26  Double_t xmin, Double_t xmax, Int_t npar,
27  Int_t x_par, Int_t y_par)
28  : KVTGIDZ(name, function, xmin, xmax, npar, x_par, y_par)
29 {
30  //Create A identification with given name,
31  //using a KVTGIDFunctions namespace function (e.g. "tassangot_A"),
32  //for 'x' values from xmin to xmax, npar parameters, and defining
33  //the parameter indices corresponding to 'x' and 'y' coordinates.
34 
35  fZorA = 0;
36 }
37 
38 
39 
40 
47 
48 KVTGIDZA::KVTGIDZA(const Char_t* name, Int_t npar, Int_t type, Int_t light)
49  : KVTGIDZ(name, npar, type, light, -1)
50 {
51  // Create A identification with given "name", using the generalised
52  // Tassan-Got functional KVTGIDFunctions::fede.
53  // npar = total number of parameters
54  // type = functional type (0: standard, 1:extended)
55  // light = with (1) or without (0) CsI light-energy dependence
56 
57  fZorA = 0;
58  SetParameter(2, fZorA);
59  SetParName(3, "Z");
60 }
61 
62 
63 
64 
72 
74 {
75  //Set atomic number Z and mass of identification line (KVIDZALine)
76  //Id should be given as 100*Z + A
77  // i.e. proton Id = 101
78  // alpha Id = 204
79  // lithium-11 Id = 311
80 
81  //decode Z and A
82  Int_t za = (Int_t) Id;
83  Int_t z = za / 100;
84  Int_t a = za % 100;
85  line->SetZ(z);
86  line->SetA(a);
87 }
88 
89 
90 
91 
94 
96 {
97  //Add a new KVIDZALine to the grid
98  return (KVIDLine*)g->Add("ID", "KVIDZALine");
99 }
100 
101 
102 
103 
122 
124  Double_t xmin, Double_t xmax, Bool_t log_scale)
125 {
126  //Add a line to the grid 'g' for identification label 'Z' with 'npoints' points calculated between
127  //X-coordinates xmin and xmax. Points are omitted if the resulting value of the functional is
128  //not a number (TMath::IsNan = kTRUE).
129  //
130  //For Z<=8 several KVIDZALines are added for common isotopes (p,d,t, 3He, etc.)
131  //For Z>8 a line for the current Z is drawn, with the A corresponding to Charity's EAL formula
132  //
133  //Before using this method the user must have set the name of
134  //the parameter in the identification functional which corresponds to the
135  //atomic number Z i.e. using
136  // SetParName(i,"Z")
137  //with i=the relevant parameter index.
138  //
139  // If log_scale=kTRUE (default is kFALSE), more points are used at the beginning
140  // of the line than at the end, with a logarithmic dependence.
141 
142  //A & Z identification
143  //on va faire: p,d,t,3He,4He,6He,6Li,7Li,8Li,7Be,9Be, etc.
144  static Int_t Ziso[] = {
145  1, 1, 1,
146  2, 2, 2,
147  3, 3, 3,
148  4, 4, 4,
149  5, 5, 5,
150  6, 6, 6,
151  7, 7, 7,
152  8, 8, 8
153  };
154  static Int_t Aiso[] = {
155  1, 2, 3,
156  3, 4, 6,
157  6, 7, 8,
158  7, 9, 10,
159  10, 11, 12,
160  12, 13, 14,
161  14, 15, 16,
162  15, 16, 17
163  };
164  static Int_t nisotopes = 24; //number of isotopes in arrays
165  static Int_t Zindex_start[] = { -1, 0, 3, 6, 9, 12, 15, 18, 21 }; //index of first isotope for each Z
166  static Int_t Zindex_stop[] = { -1, 2, 5, 8, 11, 14, 17, 20, 23 }; //index of last isotope for each Z
167 
168  if (Z <= Ziso[nisotopes - 1]) {
169  //Z is included in table of isotopes
170  //we add several lines corresponding to the tabulated isotopes
171  for (int iso = Zindex_start[Z]; iso <= Zindex_stop[Z]; iso++) { //loop over isotopes for this Z
172  //add new line to grid
173  KVIDLine* new_line = AddLine(g);
174 
175  //set identification label for line
176  Double_t idlab = 100. * Ziso[iso] + Aiso[iso];
177  SetIdent(new_line, idlab);
178 
179  //set Z of line in functional
180  SetParameter("Z", (Double_t) Ziso[iso]);
181  //loop over points of line
182  Int_t p_index = 0;
183  Double_t X, dX;
184  Double_t Y = 0.;
185  Double_t logXmin = TMath::Log(TMath::Max(xmin, 1.0));
186  if (log_scale)
187  dX = (TMath::Log(xmax) - logXmin) / (npoints - 1.);
188  else
189  dX = (xmax - xmin) / (Double_t)(npoints - 1);
190 
191  for (Int_t i = 0; i < npoints; i++) {
192 
193  //x coordinate of this point
194  if (log_scale)
195  X = TMath::Exp(logXmin + i * dX);
196  else
197  X = xmin + dX * ((Double_t) i);
198 
199  //leave value Y as it is. The value of GetIDFunc()->Eval(ID)
200  //is the vertical distance delta_Y from point (X,Y) to the line; therefore the
201  //Y coordinate of the point on the line is Y + delta_Y, whatever the value Y.
202 
203  //set values of parameters which correspond to X and Y coordinates in grid
204  SetParameter("X", X);
205  SetParameter("Y", Y);
206 
207  Y += Eval((Double_t) Aiso[iso]);
208 
209  if (!TMath::IsNaN(Y))
210  new_line->SetPoint(p_index++, X, Y);
211  else
212  Y = 0.; //reset Y to 0 if it ever becomes NaN
213  }
214  }
215  }
216  else {
217  //Z is bigger than largest Z for which we have isotopes
218  //we add one line for this Z using mass formula
219 
220  //get mass for nucleus
222  //add new line to grid
223  KVIDLine* new_line = AddLine(g);
224  //set identification label for line
225  Double_t idlab = 100. * Z + A;
226  SetIdent(new_line, idlab);
227 
228  //set Z of line in functional
229  SetParameter("Z", (Double_t) Z);
230  //loop over points of line
231  Int_t p_index = 0;
232  Double_t Y = 0., X, dX = (xmax - xmin) / (Double_t)(npoints - 1);
233 
234  for (Int_t i = 0; i < npoints; i++) {
235 
236  //x coordinate of this point
237  X = xmin + dX * ((Double_t) i);
238 
239  //leave value Y as it is. The value of GetIDFunc()->Eval(ID)
240  //is the vertical distance delta_Y from point (X,Y) to the line; therefore the
241  //Y coordinate of the point on the line is Y + delta_Y, whatever the value Y.
242 
243  //set values of parameters which correspond to X and Y coordinates in grid
244  SetParameter("X", X);
245  SetParameter("Y", Y);
246 
247  Y += Eval((Double_t) A);
248 
249  if (!TMath::IsNaN(Y))
250  new_line->SetPoint(p_index++, X, Y);
251  else
252  Y = 0.; //reset Y to 0 if it ever becomes NaN
253  }
254  }
255 }
256 
257 
int Int_t
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
char Char_t
bool Bool_t
double Double_t
int type
float xmin
float xmax
Abstract base class for 2D identification grids in e.g. (dE,E) maps.
Definition: KVIDGrid.h:73
Base class for lines/cuts used for particle identification in 2D data maps.
Definition: KVIDLine.h:142
static Int_t GetAFromZ(Double_t, Char_t mt)
Definition: KVNucleus.cpp:564
Base class for charged particle Z & A identfication using functionals developed by L....
Definition: KVTGIDZA.h:39
void AddLineToGrid(KVIDGrid *g, Int_t ID, Int_t npoints, Double_t xmin, Double_t xmax, Bool_t logscale=kFALSE)
Definition: KVTGIDZA.cpp:123
virtual void SetIdent(KVIDLine *, Double_t ID)
Definition: KVTGIDZA.cpp:73
virtual KVIDLine * AddLine(KVIDGrid *)
Add a new KVIDZALine to the grid.
Definition: KVTGIDZA.cpp:95
KVTGIDZA()
Definition: KVTGIDZA.h:45
Abstract base class for charged particle Z identfication using functionals developed by L....
Definition: KVTGIDZ.h:32
Int_t fZorA
used for Z (1) or A (0) identification
Definition: KVTGID.h:65
Int_t fMassFormula
mass formula used to calculate A from Z (if Z identification used)
Definition: KVTGID.h:66
virtual void SetParName(Int_t ipar, const char *name)
virtual Double_t Eval(Double_t x, Double_t y=0, Double_t z=0, Double_t t=0) const
virtual void SetParameter(const TString &name, Double_t value)
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
TLine * line
const long double g
masses
Definition: KVUnits.h:72
Bool_t IsNaN(Double_t x)
Double_t Exp(Double_t x)
Double_t Log(Double_t x)
Double_t Max(Double_t a, Double_t b)
auto * a