KaliVeda
Toolkit for HIC analysis
KVCaloBase.cpp
1 /*
2 $Id: KVCaloBase.cpp,v 1.4 2009/01/23 15:25:52 franklan Exp $
3 $Revision: 1.4 $
4 $Date: 2009/01/23 15:25:52 $
5 */
6 
7 //Created by KVClassFactory on Mon Apr 14 15:01:51 2008
8 //Author: eric bonnet,,,
9 
10 #include "KVCaloBase.h"
11 #include "KVNDTManager.h"
12 
14 
15 
16 
19 void KVCaloBase::Copy(TObject& a) const
20 {
21 // Methode de Copy
23  nvl_ing.Copy(dynamic_cast<KVCaloBase&>(a).nvl_ing);
24 }
25 
26 
27 
31 
33 {
34  // Init() is called by KVGVList::MakeBranches(), so this is the latest they
35  // can be set up.
36  SetNameIndex("Zsum", 0);
37  SetNameIndex("Asum", 1);
38  SetNameIndex("Eksum", 2);
39  SetNameIndex("Qsum", 3);
40  SetNameIndex("Msum", 4);
41  SetNameIndex("Qini", 5);
42  SetNameIndex("Exci", 6);
43 }
44 
45 
46 
50 
52 {
53  // Remise a zero avant le
54  // traitement d'un evenement
55 
56 #ifdef WITH_CPP11
57  for (auto& par : nvl_ing) {
58  par.Set(0.0);
59  }
60 #else
61  for (KVNameValueList::Iterator it = nvl_ing.begin(); it != nvl_ing.end(); ++it)(*it).Set(0.0);
62 #endif
64 }
65 
66 
67 
72 
73 void KVCaloBase::Print(Option_t* option) const
74 {
75  //printf information on the object
76  //opt==ing, print the list of ingredients computed
77  //opt==par, print the list of parameters
78 
79  if (!strcmp(option, "ing"))
80  nvl_ing.Print();
81  else if (!strcmp(option, "par"))
82  GetParameters().Print();
83  else
85 
86 }
87 
88 
89 
94 
96 {
97  //retourne la KVNameValueList ou sont enregistres les ingredients (option=="ing")
98  //ou les parametres (option=="par")
99  //
100  if (!strcmp(option, "ing"))
101  return nvl_ing;
102  if (!strcmp(option, "par"))
103  return GetParameters();
104  else {
105  Info("GetList", "type has to be equal to \"ing\" or \"par\"");
106  return GetParameters();
107  }
108 
109 }
110 
111 
112 
117 
119 {
120  // can't assume all ingredients declared to SetNameIndex in list nvl_ing exist
121  // - as they are dynamically created as data is filled
122  // therefore use NameIndex to retrieve name, then look for value in list by name
123 
124  return GetIngValue(GetValueName(i));
125 }
126 
127 
128 
153 
155 {
156  // Returns type of value depending on name:
157  // Zsum I
158  // Asum I
159  // Eksum D
160  // Qsum D
161  // Msum I
162  // Aneu I
163  // Qneu D
164  // Mneu I
165  // Qini D
166  // Temp D
167  // Exci D
168  // Ekneu D
169  // Zpart I
170  // Apart I
171  // Ekpart D
172  // Qpart D
173  // Mpart I
174  // Zfrag I
175  // Afrag I
176  // Ekfrag D
177  // Qfrag D
178  // Mfrag I
179 
181  if (name.BeginsWith("E") || name.BeginsWith("Q") || name.BeginsWith("T")) return 'D';
182  else return 'I';
183 }
184 
185 
186 
189 
190 std::vector<Double_t> KVCaloBase::GetValueVector(void) const
191 {
192  // On retourne un tableau rassemblant l'ensemble des ingredients
193 
194  std::vector<Double_t> tab;
195  for (Int_t ii = 0; ii < GetNumberOfValues(); ++ii)
196  tab.push_back(getvalue_int(ii));
197  return tab;
198 }
199 
200 
201 
206 
208 {
209  // protected method
210  // Private initialisation method called by all constructors.
211  // All member initialisations should be done here.
212 
213  fType = KVVarGlob::kOneBody; // this is a 1-body variable
214  //KVNameValueList contentant les ingredients et les parametres
215  //de la variable globale
216  //Elles sont remplies au fur et a mesure des
217  //methodes, pas besoin de definition a priori des
218  //noms des ingredients / parametres
219  nvl_ing.SetName("Ingredients");
220  kIsModified = kTRUE;
221 }
222 
223 
224 
228 
230 {
231  //return the value of a name given ingredient
232  //if it is not defined return 0
233  if (!nvl_ing.HasParameter(name.Data())) return 0;
234  return nvl_ing.GetDoubleValue(name.Data());
235 }
236 
237 
241 
243 {
244  // protected method,
245  //return the value of a index given ingredient
246  return nvl_ing.GetDoubleValue(idx);
247 }
248 
249 
253 
255 {
256  // protected method,
257  //set the value a name given ingredient
258  nvl_ing.SetValue(name.Data(), value);
259 }
260 
261 
266 
268 {
269  // protected method,
270  //increment the value of a name given ingredient
271  //if it is not defined, it's created
272  Double_t before = GetIngValue(name);
273  before += value;
274  SetIngValue(name, before);
275 }
276 
277 
278 
286 
288 {
289  // Remplissage des energies, masse, charge et defaut de masse
290  // Pour l'energie cinetique, si l'utilisateur a utilise en amont
291  // la methode KVVarGlob::SetFrame(const Char_t*), c'est dans ce repere que les energies sont sommees
292  // (a condition que chaque KVNucleus possede le repere avec un nom identique)
293  //
294  // somme simple sur les A, Z, Ek, Q sans distinction du type de particules
295 
296  kIsModified = kTRUE;
297  AddIngValue("Zsum", n->GetZ());
298  AddIngValue("Asum", n->GetA());
299  AddIngValue("Eksum", n->GetKE());
300  AddIngValue("Qsum", n->GetMassExcess());
301  AddIngValue("Msum", 1);
302 }
303 
304 
305 
318 
320 {
321  // protected method
322  // Appele par Calculate pour mettre a jour les differents ingredients
323  // de la calorimetrie :
324  //
325  // Trois modes de sommes:
326  //------------------
327  //
328  // determination de l exces de masse de la source recontruite, dernier ingredient de l'equation :
329  // Exci + Qini = \Sigma Ek + \Sigma Q -> Exci = \Sigma Ek + \Sigma Q - Qini
330  //
331  // defaut de masse de la source reconstruite
332 
334 
335 }
336 
337 
338 
340 
342 {
343  Double_t exci = GetIngValue("Qsum") + GetIngValue("Eksum") - GetIngValue("Qini");
344  SetIngValue("Exci", exci);
345 }
346 
347 
348 
352 
354 {
355  //Add extra neutrons
356  // multiplicity (number) and mean kinetic energy
357 
358  kIsModified = kTRUE;
359  AddIngValue("Asum", mult);
360  AddIngValue("Eksum", mult * mke);
361  AddIngValue("Qsum", mult * nn.GetMassExcess(0, 1));
362  AddIngValue("Msum", mult);
363 
364 }
365 
366 
377 
379 {
380  //Realisation de la calorimetrie
381  //Calcul de l'energie d'excitation
382  //appel de SumUp()
383  //
384  // Resolution de l'equation
385  // Exci + Qini = \Sigma Ek + \Sigma Q
386  // -> Exci = \Sigma Ek + \Sigma Q - Qini
387  //
388  //
389 
390  if (!kIsModified) return;
392  // premier calcul depuis le dernier remplissage par Fill
393  SumUp();
394 
396 }
397 
398 
399 
416 
418 {
419  // protected method
420  //
421  // calcul les racines du polynome d'ordre 2 : aa*x*x + bb*xx + cc = 0
422  // les racines sont accessibles par les variables kracine_min et kracine_max
423  //
424  // kroot_status>=0 -> tout c'est bien passe la fonction retourne kTRUE
425  // =0 2 racines reelles distinctes
426  // =1 2 racines reelles egales (aa==0)
427  //
428  // kroot_status<0 les deux racines sont mises a zero la fonction retourne kFALSE
429  // =-1 2 racines imaginaires (Delta<0)
430  // =-2 aa=bb=0
431  // le calcul n'est alors pas poursuivi, la methode Calculate() retournera kFALSE
432  // la cause peut etre discriminee en appelant la methode GetValue("RootStatus")
433  //
434  kracine_max = 0, kracine_min = 0;
435  Double_t x1, x2;
436  kroot_status = 0;
437  if (aa != 0) {
438  Double_t Delta = TMath::Power(bb, 2.) - 4.*aa * cc;
439  if (Delta < 0) {
440  //Warning("RootSquare","Delta<0 - Solutions imaginaires");
441  kroot_status = -1;
442  SetIngValue("RootStatus", kroot_status);
443  }
444  else {
445  Double_t racDelta = TMath::Sqrt(Delta);
446  x1 = (-1.*bb + racDelta) / (2.*aa);
447  x2 = (-1.*(bb + racDelta)) / (2.*aa);
448  kroot_status = 0;
449  if (x1 > x2) {
450  kracine_max = x1;
451  kracine_min = x2;
452  }
453  else {
454  kracine_max = x2;
455  kracine_min = x1;
456  }
457  }
458  }
459  else {
460  if (bb != 0) {
461  kroot_status = 1;
462  kracine_max = kracine_min = -1.*cc / bb;
463  }
464  else {
465  kroot_status = -2;
466  kracine_max = kracine_min = 0;
467  SetIngValue("RootStatus", kroot_status);
468  }
469  }
470  if (kroot_status < 0) {
471  SetIngValue("RootStatus", kroot_status);
472  return kFALSE;
473  }
474  else {
475  return kTRUE;
476  }
477 
478 }
479 
480 
int Int_t
bool Bool_t
char Char_t
constexpr Bool_t kFALSE
double Double_t
constexpr Bool_t kTRUE
const char Option_t
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
char name[80]
Calorimetry of hot nuclei.
Definition: KVCaloBase.h:63
Bool_t kIsModified
indique les ingredients ont ete modifies
Definition: KVCaloBase.h:72
KVNucleus nn
permet d utiliser des methodes de KVNucleus
Definition: KVCaloBase.h:69
virtual Char_t GetValueType(Int_t) const
Definition: KVCaloBase.cpp:154
std::vector< Double_t > GetValueVector(void) const
On retourne un tableau rassemblant l'ensemble des ingredients.
Definition: KVCaloBase.cpp:190
void init_KVCaloBase()
Definition: KVCaloBase.cpp:207
void Init()
Definition: KVCaloBase.cpp:32
KVNameValueList nvl_ing
//Contains all ingredients computed
Definition: KVCaloBase.h:70
Double_t kracine_min
deux racines issues de la resolution de RootSquare
Definition: KVCaloBase.h:76
Double_t GetIngValue(Int_t idx) const
Definition: KVCaloBase.cpp:242
void ComputeExcitationEnergy()
Definition: KVCaloBase.cpp:341
virtual Double_t getvalue_int(Int_t) const
Definition: KVCaloBase.cpp:118
void AddIngValue(KVString name, Double_t value)
Definition: KVCaloBase.cpp:267
void AddNeutrons(Int_t mult, Double_t mke)
Definition: KVCaloBase.cpp:353
virtual void SumUp()
Definition: KVCaloBase.cpp:319
virtual void fill(const KVNucleus *)
Definition: KVCaloBase.cpp:287
void Print(Option_t *opt="") const
Definition: KVCaloBase.cpp:73
virtual void Calculate()
Definition: KVCaloBase.cpp:378
const KVNameValueList & GetList(Option_t *opt="ing") const
Definition: KVCaloBase.cpp:95
void SetIngValue(KVString name, Double_t value)
Definition: KVCaloBase.cpp:254
Bool_t RootSquare(Double_t aaa, Double_t bbb, Double_t ccc)
Definition: KVCaloBase.cpp:417
Int_t kroot_status
statut pour la methode de RootSquare
Definition: KVCaloBase.h:77
Double_t kracine_max
Definition: KVCaloBase.h:76
void Reset()
Definition: KVCaloBase.cpp:51
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
virtual void Print(Option_t *opt="") const
Iterator begin() const
Double_t GetDoubleValue(const Char_t *name) const
void SetValue(const Char_t *name, value_type value)
Iterator end() const
Bool_t HasParameter(const Char_t *name) const
Description of properties and kinematics of atomic nuclei.
Definition: KVNucleus.h:126
Double_t GetMassExcess(Int_t z=-1, Int_t a=-1) const
Definition: KVNucleus.cpp:886
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:73
KVNameValueList & GetParameters()
Definition: KVVarGlob.h:324
void Print(Option_t *="") const
Definition: KVVarGlob.cpp:277
virtual Int_t GetNumberOfValues() const
Definition: KVVarGlob.h:638
void Copy(TObject &obj) const
Definition: KVVarGlob.h:346
void SetNameIndex(const Char_t *name, Int_t index)
Definition: KVVarGlob.cpp:223
virtual TString GetValueName(Int_t i) const
Definition: KVVarGlob.h:654
Int_t fType
type of variable global; = kOneBody, kTwoBody or kNBody
Definition: KVVarGlob.h:243
virtual void SetName(const char *name)
virtual void Info(const char *method, const char *msgfmt,...) const
const Int_t n
Int_t Nint(T x)
Double_t Power(Double_t x, Double_t y)
Double_t Sqrt(Double_t x)
TArc a
ClassImp(TPyArg)