Logo ROOT  
Reference Guide
TGeoElement.cxx
Go to the documentation of this file.
1 // @(#)root/geom:$Id$
2 // Author: Andrei Gheata 17/06/04
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 /** \class TGeoElement
13 \ingroup Geometry_classes
14 Base class for chemical elements
15 */
16 
17 /** \class TGeoElementRN
18 \ingroup Geometry_classes
19 Class representing a radionuclide
20 */
21 
22 /** \class TGeoElemIter
23 \ingroup Geometry_classes
24 Iterator for decay branches
25 */
26 
27 /** \class TGeoDecayChannel
28 \ingroup Geometry_classes
29 A decay channel for a radionuclide
30 */
31 
32 /** \class TGeoElementTable
33 \ingroup Geometry_classes
34 Table of elements
35 */
36 
37 #include "RConfigure.h"
38 
39 #include <fstream>
40 #include <iomanip>
41 
42 #include "TSystem.h"
43 #include "TROOT.h"
44 #include "TObjArray.h"
45 #include "TVirtualGeoPainter.h"
46 #include "TGeoManager.h"
47 #include "TGeoElement.h"
48 #include "TMath.h"
49 #include "TGeoPhysicalConstants.h"
51 
52 // statics and globals
53 static const Int_t gMaxElem = 110;
54 static const Int_t gMaxLevel = 8;
55 static const Int_t gMaxDecay = 15;
56 
57 static const char gElName[gMaxElem][3] = {
58  "H ","He","Li","Be","B ","C ","N ","O ","F ","Ne","Na","Mg",
59  "Al","Si","P ","S ","Cl","Ar","K ","Ca","Sc","Ti","V ","Cr",
60  "Mn","Fe","Co","Ni","Cu","Zn","Ga","Ge","As","Se","Br","Kr",
61  "Rb","Sr","Y ","Zr","Nb","Mo","Tc","Ru","Rh","Pd","Ag","Cd",
62  "In","Sn","Sb","Te","I ","Xe","Cs","Ba","La","Ce","Pr","Nd",
63  "Pm","Sm","Eu","Gd","Tb","Dy","Ho","Er","Tm","Yb","Lu","Hf",
64  "Ta","W ","Re","Os","Ir","Pt","Au","Hg","Tl","Pb","Bi","Po",
65  "At","Rn","Fr","Ra","Ac","Th","Pa","U ","Np","Pu","Am","Cm",
66  "Bk","Cf","Es","Fm","Md","No","Lr","Rf","Db","Sg","Bh","Hs",
67  "Mt","Ds" };
68 
69 static const char *gDecayName[gMaxDecay+1] = {
70  "2BetaMinus", "BetaMinus", "NeutronEm", "ProtonEm", "Alpha", "ECF",
71  "ElecCapt", "IsoTrans", "I", "SpontFiss", "2ProtonEm", "2NeutronEm",
72  "2Alpha", "Carbon12", "Carbon14", "Stable" };
73 
74 static const Int_t gDecayDeltaA[gMaxDecay] = {
75  0, 0, -1, -1, -4,
76  -99, 0, 0, -99, -99,
77  -2, -2, -8, -12, -14 };
78 
79 static const Int_t gDecayDeltaZ[gMaxDecay] = {
80  2, 1, 0, -1, -2,
81  -99, -1, 0, -99, -99,
82  -2, 0, -4, -6, -6 };
83 static const char gLevName[gMaxLevel]=" mnpqrs";
84 
86 
87 ////////////////////////////////////////////////////////////////////////////////
88 /// Default constructor
89 
91 {
92  TGeoUnit::setUnitType(TGeoUnit::unitType()); // Ensure nobody changes the units afterwards
94  SetUsed(kFALSE);
95  fZ = 0;
96  fN = 0;
97  fNisotopes = 0;
98  fA = 0.0;
99  fIsotopes = NULL;
100  fAbundances = NULL;
101 }
102 
103 ////////////////////////////////////////////////////////////////////////////////
104 /// Obsolete constructor
105 
106 TGeoElement::TGeoElement(const char *name, const char *title, Int_t z, Double_t a)
107  :TNamed(name, title)
108 {
109  TGeoUnit::setUnitType(TGeoUnit::unitType()); // Ensure nobody changes the units afterwards
111  SetUsed(kFALSE);
112  fZ = z;
113  fN = Int_t(a);
114  fNisotopes = 0;
115  fA = a;
116  fIsotopes = NULL;
117  fAbundances = NULL;
119 }
120 
121 ////////////////////////////////////////////////////////////////////////////////
122 /// Element having isotopes.
123 
124 TGeoElement::TGeoElement(const char *name, const char *title, Int_t nisotopes)
125  :TNamed(name, title)
126 {
127  TGeoUnit::setUnitType(TGeoUnit::unitType()); // Ensure nobody changes the units afterwards
129  SetUsed(kFALSE);
130  fZ = 0;
131  fN = 0;
132  fNisotopes = nisotopes;
133  fA = 0.0;
134  fIsotopes = new TObjArray(nisotopes);
135  fAbundances = new Double_t[nisotopes];
136 }
137 
138 ////////////////////////////////////////////////////////////////////////////////
139 /// Constructor
140 
141 TGeoElement::TGeoElement(const char *name, const char *title, Int_t z, Int_t n, Double_t a)
142  :TNamed(name, title)
143 {
144  TGeoUnit::setUnitType(TGeoUnit::unitType()); // Ensure nobody changes the units afterwards
146  SetUsed(kFALSE);
147  fZ = z;
148  fN = n;
149  fNisotopes = 0;
150  fA = a;
151  fIsotopes = NULL;
152  fAbundances = NULL;
154 }
155 
156 ////////////////////////////////////////////////////////////////////////////////
157 /// destructor
158 
160 {
161  delete fIsotopes;
162  delete [] fAbundances;
163 }
164 
165 
166 ////////////////////////////////////////////////////////////////////////////////
167 /// Calculate properties for an atomic number
168 
170 {
171  // Radiation Length
174 }
175 ////////////////////////////////////////////////////////////////////////////////
176 /// Compute Coulomb correction factor (Phys Rev. D50 3-1 (1994) page 1254)
177 
179 {
180  static constexpr Double_t k1 = 0.0083 , k2 = 0.20206 ,k3 = 0.0020 , k4 = 0.0369;
183  Double_t az2 = (fsc*fZ)*(fsc*fZ);
184  Double_t az4 = az2 * az2;
185 
186  fCoulomb = (k1*az4 + k2 + 1./(1.+az2))*az2 - (k3*az4 + k4)*az4;
187 }
188 ////////////////////////////////////////////////////////////////////////////////
189 /// Compute Tsai's Expression for the Radiation Length (Phys Rev. D50 3-1 (1994) page 1254)
190 
192 {
193  static constexpr Double_t Lrad_light[] = {5.31 , 4.79 , 4.74 , 4.71} ;
194  static constexpr Double_t Lprad_light[] = {6.144 , 5.621 , 5.805 , 5.924} ;
195 
196  fRadTsai = 0.0;
197  if (fZ == 0) return;
198  const Double_t logZ3 = TMath::Log(fZ)/3.;
199 
200  Double_t Lrad, Lprad;
203  Int_t iz = static_cast<Int_t>(fZ+0.5) - 1 ; // The static cast comes from G4lrint
204  static const Double_t log184 = TMath::Log(184.15);
205  static const Double_t log1194 = TMath::Log(1194.);
206  if (iz <= 3) { Lrad = Lrad_light[iz] ; Lprad = Lprad_light[iz] ; }
207  else { Lrad = log184 - logZ3 ; Lprad = log1194 - 2*logZ3;}
208 
209  fRadTsai = 4*alpha_rcl2*fZ*(fZ*(Lrad-fCoulomb) + Lprad);
210 }
211 ////////////////////////////////////////////////////////////////////////////////
212 /// Print this isotope
213 
214 void TGeoElement::Print(Option_t *option) const
215 {
216  printf("Element: %s Z=%d N=%f A=%f [g/mole]\n", GetName(), fZ,Neff(),fA);
217  if (HasIsotopes()) {
218  for (Int_t i=0; i<fNisotopes; i++) {
219  TGeoIsotope *iso = GetIsotope(i);
220  printf("=>Isotope %s, abundance=%f :\n", iso->GetName(), fAbundances[i]);
221  iso->Print(option);
222  }
223  }
224 }
225 
226 ////////////////////////////////////////////////////////////////////////////////
227 /// Returns pointer to the table.
228 
230 {
231  if (!gGeoManager) {
232  ::Error("TGeoElementTable::GetElementTable", "Create a geometry manager first");
233  return NULL;
234  }
235  return gGeoManager->GetElementTable();
236 }
237 
238 ////////////////////////////////////////////////////////////////////////////////
239 /// Add an isotope for this element. All isotopes have to be isotopes of the same element.
240 
241 void TGeoElement::AddIsotope(TGeoIsotope *isotope, Double_t relativeAbundance)
242 {
243  if (!fIsotopes) {
244  Fatal("AddIsotope", "Cannot add isotopes to normal elements. Use constructor with number of isotopes.");
245  return;
246  }
247  Int_t ncurrent = 0;
248  TGeoIsotope *isocrt;
249  for (ncurrent=0; ncurrent<fNisotopes; ncurrent++)
250  if (!fIsotopes->At(ncurrent)) break;
251  if (ncurrent==fNisotopes) {
252  Error("AddIsotope", "All %d isotopes of element %s already defined", fNisotopes, GetName());
253  return;
254  }
255  // Check Z of the new isotope
256  if ((fZ!=0) && (isotope->GetZ()!=fZ)) {
257  Fatal("AddIsotope", "Trying to add isotope %s with different Z to the same element %s",
258  isotope->GetName(), GetName());
259  return;
260  } else {
261  fZ = isotope->GetZ();
262  }
263  fIsotopes->Add(isotope);
264  fAbundances[ncurrent] = relativeAbundance;
265  if (ncurrent==fNisotopes-1) {
266  Double_t weight = 0.0;
267  Double_t aeff = 0.0;
268  Double_t neff = 0.0;
269  for (Int_t i=0; i<fNisotopes; i++) {
270  isocrt = (TGeoIsotope*)fIsotopes->At(i);
271  aeff += fAbundances[i]*isocrt->GetA();
272  neff += fAbundances[i]*isocrt->GetN();
273  weight += fAbundances[i];
274  }
275  aeff /= weight;
276  neff /= weight;
277  fN = (Int_t)neff;
278  fA = aeff;
279  }
281 }
282 
283 ////////////////////////////////////////////////////////////////////////////////
284 /// Returns effective number of nucleons.
285 
287 {
288  if (!fNisotopes) return fN;
289  TGeoIsotope *isocrt;
290  Double_t weight = 0.0;
291  Double_t neff = 0.0;
292  for (Int_t i=0; i<fNisotopes; i++) {
293  isocrt = (TGeoIsotope*)fIsotopes->At(i);
294  neff += fAbundances[i]*isocrt->GetN();
295  weight += fAbundances[i];
296  }
297  neff /= weight;
298  return neff;
299 }
300 
301 ////////////////////////////////////////////////////////////////////////////////
302 /// Return i-th isotope in the element.
303 
305 {
306  if (i>=0 && i<fNisotopes) {
307  return (TGeoIsotope*)fIsotopes->At(i);
308  }
309  return NULL;
310 }
311 
312 ////////////////////////////////////////////////////////////////////////////////
313 /// Return relative abundance of i-th isotope in this element.
314 
316 {
317  if (i>=0 && i<fNisotopes) return fAbundances[i];
318  return 0.0;
319 }
320 
322 
323 ////////////////////////////////////////////////////////////////////////////////
324 /// Dummy I/O constructor
325 
327  :TNamed(),
328  fZ(0),
329  fN(0),
330  fA(0)
331 {
332 }
333 
334 ////////////////////////////////////////////////////////////////////////////////
335 /// Constructor
336 
338  :TNamed(name,""),
339  fZ(z),
340  fN(n),
341  fA(a)
342 {
343  if (z<1) Fatal("ctor", "Not allowed Z=%d (<1) for isotope: %s", z,name);
344  if (n<z) Fatal("ctor", "Not allowed Z=%d < N=%d for isotope: %s", z,n,name);
346 }
347 
348 ////////////////////////////////////////////////////////////////////////////////
349 /// Find existing isotope by name.
350 
352 {
354  if (!elTable) return 0;
355  return elTable->FindIsotope(name);
356 }
357 
358 ////////////////////////////////////////////////////////////////////////////////
359 /// Print this isotope
360 
362 {
363  printf("Isotope: %s Z=%d N=%d A=%f [g/mole]\n", GetName(), fZ,fN,fA);
364 }
365 
367 
368 ////////////////////////////////////////////////////////////////////////////////
369 /// Default constructor
370 
372 {
374  fENDFcode = 0;
375  fIso = 0;
376  fLevel = 0;
377  fDeltaM = 0;
378  fHalfLife = 0;
379  fNatAbun = 0;
380  fTH_F = 0;
381  fTG_F = 0;
382  fTH_S = 0;
383  fTG_S = 0;
384  fStatus = 0;
385  fRatio = 0;
386  fDecays = 0;
387 }
388 
389 ////////////////////////////////////////////////////////////////////////////////
390 /// Constructor.
391 
393  Double_t deltaM, Double_t halfLife, const char* JP,
394  Double_t natAbun, Double_t th_f, Double_t tg_f, Double_t th_s,
395  Double_t tg_s, Int_t status)
396  :TGeoElement("", JP, zz, aa)
397 {
399  fENDFcode = ENDF(aa,zz,iso);
400  fIso = iso;
401  fLevel = level;
402  fDeltaM = deltaM;
403  fHalfLife = halfLife;
404  fTitle = JP;
405  if (!fTitle.Length()) fTitle = "?";
406  fNatAbun = natAbun;
407  fTH_F = th_f;
408  fTG_F = tg_f;
409  fTH_S = th_s;
410  fTG_S = tg_s;
411  fStatus = status;
412  fDecays = 0;
413  fRatio = 0;
414  MakeName(aa,zz,iso);
415  if ((TMath::Abs(fHalfLife)<1.e-30) || fHalfLife<-1) Warning("ctor","Element %s has T1/2=%g [s]", fName.Data(), fHalfLife);
416 }
417 
418 ////////////////////////////////////////////////////////////////////////////////
419 /// Destructor.
420 
422 {
423  if (fDecays) {
424  fDecays->Delete();
425  delete fDecays;
426  }
427  if (fRatio) delete fRatio;
428 }
429 
430 ////////////////////////////////////////////////////////////////////////////////
431 /// Adds a decay mode for this element.
432 
433 void TGeoElementRN::AddDecay(Int_t decay, Int_t diso, Double_t branchingRatio, Double_t qValue)
434 {
435  if (branchingRatio<1E-20) {
436  TString decayName;
437  TGeoDecayChannel::DecayName(decay, decayName);
438  Warning("AddDecay", "Decay %s of %s has BR=0. Not added.", decayName.Data(),fName.Data());
439  return;
440  }
441  TGeoDecayChannel *dc = new TGeoDecayChannel(decay,diso,branchingRatio, qValue);
442  dc->SetParent(this);
443  if (!fDecays) fDecays = new TObjArray(5);
444  fDecays->Add(dc);
445 }
446 
447 ////////////////////////////////////////////////////////////////////////////////
448 /// Adds a decay channel to the list of decays.
449 
451 {
452  dc->SetParent(this);
453  if (!fDecays) fDecays = new TObjArray(5);
454  fDecays->Add(dc);
455 }
456 
457 ////////////////////////////////////////////////////////////////////////////////
458 /// Get number of decay channels of this element.
459 
461 {
462  if (!fDecays) return 0;
463  return fDecays->GetEntriesFast();
464 }
465 
466 ////////////////////////////////////////////////////////////////////////////////
467 /// Get the activity in Bq of a gram of material made from this element.
468 
470 {
471  static const Double_t ln2 = TMath::Log(2.);
472  Double_t sa = (fHalfLife>0 && fA>0)?(ln2*TMath::Na()/fHalfLife/fA):0.;
473  return sa;
474 }
475 
476 ////////////////////////////////////////////////////////////////////////////////
477 /// Check if all decay chain of the element is OK.
478 
480 {
482  TObject *oelem = (TObject*)this;
483  TGeoDecayChannel *dc;
484  TGeoElementRN *elem;
486  TString decayName;
487  if (!table) {
488  Error("CheckDecays", "Element table not present");
489  return kFALSE;
490  }
491  Bool_t resultOK = kTRUE;
492  if (!fDecays) {
493  oelem->SetBit(kElementChecked,kTRUE);
494  return resultOK;
495  }
496  Double_t br = 0.;
497  Int_t decayResult = 0;
498  TIter next(fDecays);
499  while ((dc=(TGeoDecayChannel*)next())) {
500  br += dc->BranchingRatio();
501  decayResult = DecayResult(dc);
502  if (decayResult) {
503  elem = table->GetElementRN(decayResult);
504  if (!elem) {
505  TGeoDecayChannel::DecayName(dc->Decay(),decayName);
506  Error("CheckDecays", "Element after decay %s of %s not found in DB", decayName.Data(),fName.Data());
507  return kFALSE;
508  }
509  dc->SetDaughter(elem);
510  resultOK = elem->CheckDecays();
511  }
512  }
513  if (TMath::Abs(br-100) > 1.E-3) {
514  Warning("CheckDecays", "BR for decays of element %s sum-up = %f", fName.Data(), br);
515  resultOK = kFALSE;
516  }
517  oelem->SetBit(kElementChecked,kTRUE);
518  return resultOK;
519 }
520 
521 ////////////////////////////////////////////////////////////////////////////////
522 /// Returns ENDF code of decay result.
523 
525 {
526  Int_t da, dz, diso;
527  dc->DecayShift(da, dz, diso);
528  if (da == -99 || dz == -99) return 0;
529  return ENDF(Int_t(fA)+da,fZ+dz,fIso+diso);
530 }
531 
532 ////////////////////////////////////////////////////////////////////////////////
533 /// Fills the input array with the set of RN elements resulting from the decay of
534 /// this one. All element in the list will contain the time evolution of their
535 /// proportion by number with respect to this element. The proportion can be
536 /// retrieved via the method TGeoElementRN::Ratio().
537 /// The precision represent the minimum cumulative branching ratio for
538 /// which decay products are still taken into account.
539 
540 void TGeoElementRN::FillPopulation(TObjArray *population, Double_t precision, Double_t factor)
541 {
542  TGeoElementRN *elem;
543  TGeoElemIter next(this, precision);
544  TGeoBatemanSol s(this);
545  s.Normalize(factor);
546  AddRatio(s);
547  if (!population->FindObject(this)) population->Add(this);
548  while ((elem=next())) {
549  TGeoBatemanSol ratio(next.GetBranch());
550  ratio.Normalize(factor);
551  elem->AddRatio(ratio);
552  if (!population->FindObject(elem)) population->Add(elem);
553  }
554 }
555 
556 ////////////////////////////////////////////////////////////////////////////////
557 /// Generate a default name for the element.
558 
560 {
561  fName = "";
562  if (z==0 && a==1) {
563  fName = "neutron";
564  return;
565  }
566  if (z>=1 && z<= gMaxElem) fName += TString::Format("%3d-%s-",z,gElName[z-1]);
567  else fName = "?? -?? -";
568  if (a>=1 && a<=999) fName += TString::Format("%3.3d",a);
569  else fName += "??";
570  if (iso>0 && iso<gMaxLevel) fName += TString::Format("%c", gLevName[iso]);
571  fName.ReplaceAll(" ","");
572 }
573 
574 ////////////////////////////////////////////////////////////////////////////////
575 /// Print info about the element;
576 
577 void TGeoElementRN::Print(Option_t *option) const
578 {
579  printf("\n%-12s ",fName.Data());
580  printf("ENDF=%d; ",fENDFcode);
581  printf("A=%d; ",(Int_t)fA);
582  printf("Z=%d; ",fZ);
583  printf("Iso=%d; ",fIso);
584  printf("Level=%g[MeV]; ",fLevel);
585  printf("Dmass=%g[MeV]; ",fDeltaM);
586  if (fHalfLife>0) printf("Hlife=%g[s]\n",fHalfLife);
587  else printf("Hlife=INF\n");
588  printf("%13s"," ");
589  printf("J/P=%s; ",fTitle.Data());
590  printf("Abund=%g; ",fNatAbun);
591  printf("Htox=%g; ",fTH_F);
592  printf("Itox=%g; ",fTG_F);
593  printf("Stat=%d\n",fStatus);
594  if(!fDecays) return;
595  printf("Decay modes:\n");
596  TIter next(fDecays);
597  TGeoDecayChannel *dc;
598  while ((dc=(TGeoDecayChannel*)next())) dc->Print(option);
599 }
600 
601 ////////////////////////////////////////////////////////////////////////////////
602 /// Create element from line record.
603 
605 {
606  Int_t a,z,iso,status;
607  Double_t level, deltaM, halfLife, natAbun, th_f, tg_f, th_s, tg_s;
608  char name[20],jp[20];
609  sscanf(&line[0], "%s%d%d%d%lg%lg%lg%s%lg%lg%lg%lg%lg%d%d", name,&a,&z,&iso,&level,&deltaM,
610  &halfLife,jp,&natAbun,&th_f,&tg_f,&th_s,&tg_s,&status,&ndecays);
611  TGeoElementRN *elem = new TGeoElementRN(a,z,iso,level,deltaM,halfLife,
612  jp,natAbun,th_f,tg_f,th_s,tg_s,status);
613  return elem;
614 }
615 
616 ////////////////////////////////////////////////////////////////////////////////
617 /// Save primitive for RN elements.
618 
619 void TGeoElementRN::SavePrimitive(std::ostream &out, Option_t *option)
620 {
621  if (!strcmp(option,"h")) {
622  // print a header if requested
623  out << "#====================================================================================================================================" << std::endl;
624  out << "# Name A Z ISO LEV[MeV] DM[MeV] T1/2[s] J/P ABUND[%] HTOX ITOX HTOX ITOX STAT NDCY" << std::endl;
625  out << "#====================================================================================================================================" << std::endl;
626  }
627  out << std::setw(11) << fName.Data();
628  out << std::setw(5) << (Int_t)fA;
629  out << std::setw(5) << fZ;
630  out << std::setw(5) << fIso;
631  out << std::setw(10) << std::setiosflags(std::ios::fixed) << std::setprecision(5) << fLevel;
632  out << std::setw(10) << std::setiosflags(std::ios::fixed) << std::setprecision(5) << fDeltaM;
633  out << std::setw(10) << std::setiosflags(std::ios::scientific) << std::setprecision(3) << fHalfLife;
634  out << std::setw(13) << fTitle.Data();
635  out << std::setw(10) << std::setiosflags(std::ios::fixed) << std::setprecision(5) << fNatAbun;
636  out << std::setw(10) << std::setiosflags(std::ios::fixed) << std::setprecision(5) << fTH_F;
637  out << std::setw(10) << std::setiosflags(std::ios::fixed) << std::setprecision(5) << fTG_F;
638  out << std::setw(10) << std::setiosflags(std::ios::fixed) << std::setprecision(5) << fTH_S;
639  out << std::setw(10) << std::setiosflags(std::ios::fixed) << std::setprecision(5) << fTG_S;
640  out << std::setw(5) << fStatus;
641  Int_t ndecays = 0;
642  if (fDecays) ndecays = fDecays->GetEntries();
643  out << std::setw(5) << ndecays;
644  out << std::endl;
645  if (fDecays) {
646  TIter next(fDecays);
647  TGeoDecayChannel *dc;
648  while ((dc=(TGeoDecayChannel*)next())) dc->SavePrimitive(out);
649  }
650 }
651 
652 ////////////////////////////////////////////////////////////////////////////////
653 /// Adds a proportion ratio to the existing one.
654 
656 {
657  if (!fRatio) fRatio = new TGeoBatemanSol(ratio);
658  else *fRatio += ratio;
659 }
660 
661 ////////////////////////////////////////////////////////////////////////////////
662 /// Clears the existing ratio.
663 
665 {
666  if (fRatio) {
667  delete fRatio;
668  fRatio = 0;
669  }
670 }
671 
673 
674 ////////////////////////////////////////////////////////////////////////////////
675 /// Assignment.
676 ///assignment operator
677 
679 {
680  if(this!=&dc) {
681  TObject::operator=(dc);
682  fDecay = dc.fDecay;
683  fDiso = dc.fDiso;
685  fQvalue = dc.fQvalue;
686  fParent = dc.fParent;
687  fDaughter = dc.fDaughter;
688  }
689  return *this;
690 }
691 
692 ////////////////////////////////////////////////////////////////////////////////
693 /// Returns name of decay.
694 
695 const char *TGeoDecayChannel::GetName() const
696 {
697  static TString name = "";
698  name = "";
699  if (!fDecay) return gDecayName[gMaxDecay];
700  for (Int_t i=0; i<gMaxDecay; i++) {
701  if (1<<i & fDecay) {
702  if (name.Length()) name += "+";
703  name += gDecayName[i];
704  }
705  }
706  return name.Data();
707 }
708 
709 ////////////////////////////////////////////////////////////////////////////////
710 /// Returns decay name.
711 
713 {
714  if (!decay) {
716  return;
717  }
718  name = "";
719  for (Int_t i=0; i<gMaxDecay; i++) {
720  if (1<<i & decay) {
721  if (name.Length()) name += "+";
722  name += gDecayName[i];
723  }
724  }
725 }
726 
727 ////////////////////////////////////////////////////////////////////////////////
728 /// Get index of this channel in the list of decays of the parent nuclide.
729 
731 {
732  return fParent->Decays()->IndexOf(this);
733 }
734 
735 ////////////////////////////////////////////////////////////////////////////////
736 /// Prints decay info.
737 
739 {
740  TString name;
742  printf("%-20s Diso: %3d BR: %9.3f%% Qval: %g\n", name.Data(),fDiso,fBranchingRatio,fQvalue);
743 }
744 
745 ////////////////////////////////////////////////////////////////////////////////
746 /// Create element from line record.
747 
749 {
750  char name[80];
751  Int_t decay,diso;
752  Double_t branchingRatio, qValue;
753  sscanf(&line[0], "%s%d%d%lg%lg", name,&decay,&diso,&branchingRatio,&qValue);
754  TGeoDecayChannel *dc = new TGeoDecayChannel(decay,diso,branchingRatio,qValue);
755  return dc;
756 }
757 
758 ////////////////////////////////////////////////////////////////////////////////
759 /// Save primitive for decays.
760 
761 void TGeoDecayChannel::SavePrimitive(std::ostream &out, Option_t *)
762 {
763  TString decayName;
764  DecayName(fDecay, decayName);
765  out << std::setw(50) << decayName.Data();
766  out << std::setw(10) << fDecay;
767  out << std::setw(10) << fDiso;
768  out << std::setw(12) << std::setiosflags(std::ios::fixed) << std::setprecision(6) << fBranchingRatio;
769  out << std::setw(12) << std::setiosflags(std::ios::fixed) << std::setprecision(6) << fQvalue;
770  out << std::endl;
771 }
772 
773 ////////////////////////////////////////////////////////////////////////////////
774 /// Returns variation in A, Z and Iso after decay.
775 
777 {
778  dA=dZ=0;
779  dI=fDiso;
780  for(Int_t i=0; i<gMaxDecay; ++i) {
781  if(1<<i & fDecay) {
782  if(gDecayDeltaA[i] == -99 || gDecayDeltaZ[i] == -99 ) {
783  dA=dZ=-99;
784  return;
785  }
786  dA += gDecayDeltaA[i];
787  dZ += gDecayDeltaZ[i];
788  }
789  }
790 }
791 
793 
794 ////////////////////////////////////////////////////////////////////////////////
795 /// Default constructor.
796 
798  : fTop(top), fElem(top), fBranch(0), fLevel(0), fLimitRatio(limit), fRatio(1.)
799 {
800  fBranch = new TObjArray(10);
801 }
802 
803 ////////////////////////////////////////////////////////////////////////////////
804 /// Copy ctor.
805 
807  :fTop(iter.fTop),
808  fElem(iter.fElem),
809  fBranch(0),
810  fLevel(iter.fLevel),
811  fLimitRatio(iter.fLimitRatio),
812  fRatio(iter.fRatio)
813 {
814  if (iter.fBranch) {
815  fBranch = new TObjArray(10);
816  for (Int_t i=0; i<fLevel; i++) fBranch->Add(iter.fBranch->At(i));
817  }
818 }
819 
820 ////////////////////////////////////////////////////////////////////////////////
821 /// Destructor.
822 
824 {
825  if (fBranch) delete fBranch;
826 }
827 
828 ////////////////////////////////////////////////////////////////////////////////
829 /// Assignment.
830 
832 {
833  if (&iter == this) return *this;
834  fTop = iter.fTop;
835  fElem = iter.fElem;
836  fLevel = iter.fLevel;
837  if (iter.fBranch) {
838  fBranch = new TObjArray(10);
839  for (Int_t i=0; i<fLevel; i++) fBranch->Add(iter.fBranch->At(i));
840  }
841  fLimitRatio = iter.fLimitRatio;
842  fRatio = iter.fRatio;
843  return *this;
844 }
845 
846 ////////////////////////////////////////////////////////////////////////////////
847 /// () operator.
848 
850 {
851  return Next();
852 }
853 
854 ////////////////////////////////////////////////////////////////////////////////
855 /// Go upwards from the current location until the next branching, then down.
856 
858 {
859  TGeoDecayChannel *dc;
860  Int_t ind, nd;
861  while (fLevel) {
862  // Current decay channel
863  dc = (TGeoDecayChannel*)fBranch->At(fLevel-1);
864  ind = dc->GetIndex();
865  nd = dc->Parent()->GetNdecays();
866  fRatio /= 0.01*dc->BranchingRatio();
867  fElem = dc->Parent();
868  fBranch->RemoveAt(--fLevel);
869  ind++;
870  while (ind<nd) {
871  if (Down(ind++)) return (TGeoElementRN*)fElem;
872  }
873  }
874  fElem = NULL;
875  return NULL;
876 }
877 
878 ////////////////////////////////////////////////////////////////////////////////
879 /// Go downwards from current level via ibranch as low in the tree as possible.
880 /// Return value flags if the operation was successful.
881 
883 {
884  TGeoDecayChannel *dc = (TGeoDecayChannel*)fElem->Decays()->At(ibranch);
885  if (!dc->Daughter()) return NULL;
886  Double_t br = 0.01*fRatio*dc->BranchingRatio();
887  if (br < fLimitRatio) return NULL;
888  fLevel++;
889  fRatio = br;
890  fBranch->Add(dc);
891  fElem = dc->Daughter();
892  return (TGeoElementRN*)fElem;
893 }
894 
895 ////////////////////////////////////////////////////////////////////////////////
896 /// Return next element.
897 
899 {
900  if (!fElem) return NULL;
901  // Check if this is the first iteration.
902  Int_t nd = fElem->GetNdecays();
903  for (Int_t i=0; i<nd; i++) if (Down(i)) return (TGeoElementRN*)fElem;
904  return Up();
905 }
906 
907 ////////////////////////////////////////////////////////////////////////////////
908 /// Print info about the current decay branch.
909 
910 void TGeoElemIter::Print(Option_t * /*option*/) const
911 {
912  TGeoElementRN *elem;
913  TGeoDecayChannel *dc;
914  TString indent = "";
915  printf("=== Chain with %g %%\n", 100*fRatio);
916  for (Int_t i=0; i<fLevel; i++) {
917  dc = (TGeoDecayChannel*)fBranch->At(i);
918  elem = dc->Parent();
919  printf("%s%s (%g%% %s) T1/2=%g\n", indent.Data(), elem->GetName(),dc->BranchingRatio(),dc->GetName(),elem->HalfLife());
920  indent += " ";
921  if (i==fLevel-1) {
922  elem = dc->Daughter();
923  printf("%s%s\n", indent.Data(), elem->GetName());
924  }
925  }
926 }
927 
929 
930 ////////////////////////////////////////////////////////////////////////////////
931 /// default constructor
932 
934 {
935  fNelements = 0;
936  fNelementsRN = 0;
937  fNisotopes = 0;
938  fList = 0;
939  fListRN = 0;
940  fIsotopes = 0;
941 }
942 
943 ////////////////////////////////////////////////////////////////////////////////
944 /// constructor
945 
947 {
948  fNelements = 0;
949  fNelementsRN = 0;
950  fNisotopes = 0;
951  fList = new TObjArray(128);
952  fListRN = 0;
953  fIsotopes = 0;
955 // BuildElementsRN();
956 }
957 
958 ////////////////////////////////////////////////////////////////////////////////
959 ///copy constructor
960 
962  TObject(get),
963  fNelements(get.fNelements),
964  fNelementsRN(get.fNelementsRN),
965  fNisotopes(get.fNisotopes),
966  fList(get.fList),
967  fListRN(get.fListRN),
968  fIsotopes(0)
969 {
970 }
971 
972 ////////////////////////////////////////////////////////////////////////////////
973 ///assignment operator
974 
976 {
977  if(this!=&get) {
978  TObject::operator=(get);
982  fList=get.fList;
983  fListRN=get.fListRN;
984  fIsotopes = 0;
985  }
986  return *this;
987 }
988 
989 ////////////////////////////////////////////////////////////////////////////////
990 /// destructor
991 
993 {
994  if (fList) {
995  fList->Delete();
996  delete fList;
997  }
998  if (fListRN) {
999  fListRN->Delete();
1000  delete fListRN;
1001  }
1002  if (fIsotopes) {
1003  fIsotopes->Delete();
1004  delete fIsotopes;
1005  }
1006 }
1007 
1008 ////////////////////////////////////////////////////////////////////////////////
1009 /// Add an element to the table. Obsolete.
1010 
1011 void TGeoElementTable::AddElement(const char *name, const char *title, Int_t z, Double_t a)
1012 {
1013  if (!fList) fList = new TObjArray(128);
1014  fList->AddAtAndExpand(new TGeoElement(name,title,z,a), fNelements++);
1015 }
1016 
1017 ////////////////////////////////////////////////////////////////////////////////
1018 /// Add an element to the table.
1019 
1020 void TGeoElementTable::AddElement(const char *name, const char *title, Int_t z, Int_t n, Double_t a)
1021 {
1022  if (!fList) fList = new TObjArray(128);
1023  fList->AddAtAndExpand(new TGeoElement(name,title,z,n,a), fNelements++);
1024 }
1025 
1026 ////////////////////////////////////////////////////////////////////////////////
1027 /// Add a custom element to the table.
1028 
1030 {
1031  if (!fList) fList = new TObjArray(128);
1032  TGeoElement *orig = FindElement(elem->GetName());
1033  if (orig) {
1034  Error("AddElement", "Found element with same name: %s (%s). Cannot add to table.",
1035  orig->GetName(), orig->GetTitle());
1036  return;
1037  }
1038  fList->AddAtAndExpand(elem, fNelements++);
1039 }
1040 
1041 ////////////////////////////////////////////////////////////////////////////////
1042 /// Add a radionuclide to the table and map it.
1043 
1045 {
1046  if (!fListRN) fListRN = new TObjArray(3600);
1047  if (HasRNElements() && GetElementRN(elem->ENDFCode())) return;
1048 // elem->Print();
1049  fListRN->Add(elem);
1050  fNelementsRN++;
1051  fElementsRN.insert(ElementRNMap_t::value_type(elem->ENDFCode(), elem));
1052 }
1053 
1054 ////////////////////////////////////////////////////////////////////////////////
1055 /// Add isotope to the table.
1056 
1058 {
1059  if (FindIsotope(isotope->GetName())) {
1060  Error("AddIsotope", "Isotope with the same name: %s already in table. Not adding.",isotope->GetName());
1061  return;
1062  }
1063  if (!fIsotopes) fIsotopes = new TObjArray();
1064  fIsotopes->Add(isotope);
1065 }
1066 
1067 ////////////////////////////////////////////////////////////////////////////////
1068 /// Creates the default element table
1069 
1071 {
1072  if (HasDefaultElements()) return;
1073  AddElement("VACUUM","VACUUM" ,0, 0, 0.0);
1074  AddElement("H" ,"HYDROGEN" ,1, 1, 1.00794);
1075  AddElement("HE" ,"HELIUM" ,2, 4, 4.002602);
1076  AddElement("LI" ,"LITHIUM" ,3, 7, 6.941);
1077  AddElement("BE" ,"BERYLLIUM" ,4, 9, 9.01218);
1078  AddElement("B" ,"BORON" ,5, 11, 10.811);
1079  AddElement("C" ,"CARBON" ,6, 12, 12.0107);
1080  AddElement("N" ,"NITROGEN" ,7, 14, 14.00674);
1081  AddElement("O" ,"OXYGEN" ,8, 16, 15.9994);
1082  AddElement("F" ,"FLUORINE" ,9, 19, 18.9984032);
1083  AddElement("NE" ,"NEON" ,10, 20, 20.1797);
1084  AddElement("NA" ,"SODIUM" ,11, 23, 22.989770);
1085  AddElement("MG" ,"MAGNESIUM" ,12, 24, 24.3050);
1086  AddElement("AL" ,"ALUMINIUM" ,13, 27, 26.981538);
1087  AddElement("SI" ,"SILICON" ,14, 28, 28.0855);
1088  AddElement("P" ,"PHOSPHORUS" ,15, 31, 30.973761);
1089  AddElement("S" ,"SULFUR" ,16, 32, 32.066);
1090  AddElement("CL" ,"CHLORINE" ,17, 35, 35.4527);
1091  AddElement("AR" ,"ARGON" ,18, 40, 39.948);
1092  AddElement("K" ,"POTASSIUM" ,19, 39, 39.0983);
1093  AddElement("CA" ,"CALCIUM" ,20, 40, 40.078);
1094  AddElement("SC" ,"SCANDIUM" ,21, 45, 44.955910);
1095  AddElement("TI" ,"TITANIUM" ,22, 48, 47.867);
1096  AddElement("V" ,"VANADIUM" ,23, 51, 50.9415);
1097  AddElement("CR" ,"CHROMIUM" ,24, 52, 51.9961);
1098  AddElement("MN" ,"MANGANESE" ,25, 55, 54.938049);
1099  AddElement("FE" ,"IRON" ,26, 56, 55.845);
1100  AddElement("CO" ,"COBALT" ,27, 59, 58.933200);
1101  AddElement("NI" ,"NICKEL" ,28, 59, 58.6934);
1102  AddElement("CU" ,"COPPER" ,29, 64, 63.546);
1103  AddElement("ZN" ,"ZINC" ,30, 65, 65.39);
1104  AddElement("GA" ,"GALLIUM" ,31, 70, 69.723);
1105  AddElement("GE" ,"GERMANIUM" ,32, 73, 72.61);
1106  AddElement("AS" ,"ARSENIC" ,33, 75, 74.92160);
1107  AddElement("SE" ,"SELENIUM" ,34, 79, 78.96);
1108  AddElement("BR" ,"BROMINE" ,35, 80, 79.904);
1109  AddElement("KR" ,"KRYPTON" ,36, 84, 83.80);
1110  AddElement("RB" ,"RUBIDIUM" ,37, 85, 85.4678);
1111  AddElement("SR" ,"STRONTIUM" ,38, 88, 87.62);
1112  AddElement("Y" ,"YTTRIUM" ,39, 89, 88.90585);
1113  AddElement("ZR" ,"ZIRCONIUM" ,40, 91, 91.224);
1114  AddElement("NB" ,"NIOBIUM" ,41, 93, 92.90638);
1115  AddElement("MO" ,"MOLYBDENUM" ,42, 96, 95.94);
1116  AddElement("TC" ,"TECHNETIUM" ,43, 98, 98.0);
1117  AddElement("RU" ,"RUTHENIUM" ,44, 101, 101.07);
1118  AddElement("RH" ,"RHODIUM" ,45, 103, 102.90550);
1119  AddElement("PD" ,"PALLADIUM" ,46, 106, 106.42);
1120  AddElement("AG" ,"SILVER" ,47, 108, 107.8682);
1121  AddElement("CD" ,"CADMIUM" ,48, 112, 112.411);
1122  AddElement("IN" ,"INDIUM" ,49, 115, 114.818);
1123  AddElement("SN" ,"TIN" ,50, 119, 118.710);
1124  AddElement("SB" ,"ANTIMONY" ,51, 122, 121.760);
1125  AddElement("TE" ,"TELLURIUM" ,52, 128, 127.60);
1126  AddElement("I" ,"IODINE" ,53, 127, 126.90447);
1127  AddElement("XE" ,"XENON" ,54, 131, 131.29);
1128  AddElement("CS" ,"CESIUM" ,55, 133, 132.90545);
1129  AddElement("BA" ,"BARIUM" ,56, 137, 137.327);
1130  AddElement("LA" ,"LANTHANUM" ,57, 139, 138.9055);
1131  AddElement("CE" ,"CERIUM" ,58, 140, 140.116);
1132  AddElement("PR" ,"PRASEODYMIUM" ,59, 141, 140.90765);
1133  AddElement("ND" ,"NEODYMIUM" ,60, 144, 144.24);
1134  AddElement("PM" ,"PROMETHIUM" ,61, 145, 145.0);
1135  AddElement("SM" ,"SAMARIUM" ,62, 150, 150.36);
1136  AddElement("EU" ,"EUROPIUM" ,63, 152, 151.964);
1137  AddElement("GD" ,"GADOLINIUM" ,64, 157, 157.25);
1138  AddElement("TB" ,"TERBIUM" ,65, 159, 158.92534);
1139  AddElement("DY" ,"DYSPROSIUM" ,66, 162, 162.50);
1140  AddElement("HO" ,"HOLMIUM" ,67, 165, 164.93032);
1141  AddElement("ER" ,"ERBIUM" ,68, 167, 167.26);
1142  AddElement("TM" ,"THULIUM" ,69, 169, 168.93421);
1143  AddElement("YB" ,"YTTERBIUM" ,70, 173, 173.04);
1144  AddElement("LU" ,"LUTETIUM" ,71, 175, 174.967);
1145  AddElement("HF" ,"HAFNIUM" ,72, 178, 178.49);
1146  AddElement("TA" ,"TANTALUM" ,73, 181, 180.9479);
1147  AddElement("W" ,"TUNGSTEN" ,74, 184, 183.84);
1148  AddElement("RE" ,"RHENIUM" ,75, 186, 186.207);
1149  AddElement("OS" ,"OSMIUM" ,76, 190, 190.23);
1150  AddElement("IR" ,"IRIDIUM" ,77, 192, 192.217);
1151  AddElement("PT" ,"PLATINUM" ,78, 195, 195.078);
1152  AddElement("AU" ,"GOLD" ,79, 197, 196.96655);
1153  AddElement("HG" ,"MERCURY" ,80, 200, 200.59);
1154  AddElement("TL" ,"THALLIUM" ,81, 204, 204.3833);
1155  AddElement("PB" ,"LEAD" ,82, 207, 207.2);
1156  AddElement("BI" ,"BISMUTH" ,83, 209, 208.98038);
1157  AddElement("PO" ,"POLONIUM" ,84, 209, 209.0);
1158  AddElement("AT" ,"ASTATINE" ,85, 210, 210.0);
1159  AddElement("RN" ,"RADON" ,86, 222, 222.0);
1160  AddElement("FR" ,"FRANCIUM" ,87, 223, 223.0);
1161  AddElement("RA" ,"RADIUM" ,88, 226, 226.0);
1162  AddElement("AC" ,"ACTINIUM" ,89, 227, 227.0);
1163  AddElement("TH" ,"THORIUM" ,90, 232, 232.0381);
1164  AddElement("PA" ,"PROTACTINIUM" ,91, 231, 231.03588);
1165  AddElement("U" ,"URANIUM" ,92, 238, 238.0289);
1166  AddElement("NP" ,"NEPTUNIUM" ,93, 237, 237.0);
1167  AddElement("PU" ,"PLUTONIUM" ,94, 244, 244.0);
1168  AddElement("AM" ,"AMERICIUM" ,95, 243, 243.0);
1169  AddElement("CM" ,"CURIUM" ,96, 247, 247.0);
1170  AddElement("BK" ,"BERKELIUM" ,97, 247, 247.0);
1171  AddElement("CF" ,"CALIFORNIUM",98, 251, 251.0);
1172  AddElement("ES" ,"EINSTEINIUM",99, 252, 252.0);
1173  AddElement("FM" ,"FERMIUM" ,100, 257, 257.0);
1174  AddElement("MD" ,"MENDELEVIUM",101, 258, 258.0);
1175  AddElement("NO" ,"NOBELIUM" ,102, 259, 259.0);
1176  AddElement("LR" ,"LAWRENCIUM" ,103, 262, 262.0);
1177  AddElement("RF" ,"RUTHERFORDIUM",104, 261, 261.0);
1178  AddElement("DB" ,"DUBNIUM" ,105, 262, 262.0);
1179  AddElement("SG" ,"SEABORGIUM" ,106, 263, 263.0);
1180  AddElement("BH" ,"BOHRIUM" ,107, 262, 262.0);
1181  AddElement("HS" ,"HASSIUM" ,108, 265, 265.0);
1182  AddElement("MT" ,"MEITNERIUM" ,109, 266, 266.0);
1183  AddElement("UUN" ,"UNUNNILIUM" ,110, 269, 269.0);
1184  AddElement("UUU" ,"UNUNUNIUM" ,111, 272, 272.0);
1185  AddElement("UUB" ,"UNUNBIUM" ,112, 277, 277.0);
1186 
1188 }
1189 
1190 ////////////////////////////////////////////////////////////////////////////////
1191 /// Creates the list of radionuclides.
1192 
1194 {
1195  if (HasRNElements()) return;
1196  TGeoElementRN *elem;
1197  TString rnf = "RadioNuclides.txt";
1199  FILE *fp = fopen(rnf, "r");
1200  if (!fp) {
1201  Error("ImportElementsRN","File RadioNuclides.txt not found");
1202  return;
1203  }
1204  char line[150];
1205  Int_t ndecays = 0;
1206  Int_t i;
1207  while (fgets(&line[0],140,fp)) {
1208  if (line[0]=='#') continue;
1209  elem = TGeoElementRN::ReadElementRN(line, ndecays);
1210  for (i=0; i<ndecays; i++) {
1211  if (!fgets(&line[0],140,fp)) {
1212  Error("ImportElementsRN", "Error parsing RadioNuclides.txt file");
1213  fclose(fp);
1214  return;
1215  }
1217  elem->AddDecay(dc);
1218  }
1219  AddElementRN(elem);
1220 // elem->Print();
1221  }
1223  CheckTable();
1224  fclose(fp);
1225 }
1226 
1227 ////////////////////////////////////////////////////////////////////////////////
1228 /// Checks status of element table.
1229 
1231 {
1232  if (!HasRNElements()) return HasDefaultElements();
1233  TGeoElementRN *elem;
1234  Bool_t result = kTRUE;
1235  TIter next(fListRN);
1236  while ((elem=(TGeoElementRN*)next())) {
1237  if (!elem->CheckDecays()) result = kFALSE;
1238  }
1239  return result;
1240 }
1241 
1242 ////////////////////////////////////////////////////////////////////////////////
1243 /// Export radionuclides in a file.
1244 
1245 void TGeoElementTable::ExportElementsRN(const char *filename)
1246 {
1247  if (!HasRNElements()) return;
1248  TString sname = filename;
1249  if (!sname.Length()) sname = "RadioNuclides.txt";
1250  std::ofstream out;
1251  out.open(sname.Data(), std::ios::out);
1252  if (!out.good()) {
1253  Error("ExportElementsRN", "Cannot open file %s", sname.Data());
1254  return;
1255  }
1256 
1257  TGeoElementRN *elem;
1258  TIter next(fListRN);
1259  Int_t i=0;
1260  while ((elem=(TGeoElementRN*)next())) {
1261  if ((i%48)==0) elem->SavePrimitive(out,"h");
1262  else elem->SavePrimitive(out);
1263  i++;
1264  }
1265  out.close();
1266 }
1267 
1268 ////////////////////////////////////////////////////////////////////////////////
1269 /// Search an element by symbol or full name
1270 /// Exact matching
1271 
1273 {
1274  TGeoElement *elem;
1275  elem = (TGeoElement*)fList->FindObject(name);
1276  if (elem) return elem;
1277  // Search case insensitive by element name
1278  TString s(name);
1279  s.ToUpper();
1280  elem = (TGeoElement*)fList->FindObject(s.Data());
1281  if (elem) return elem;
1282  // Search by full name
1283  TIter next(fList);
1284  while ((elem=(TGeoElement*)next())) {
1285  if (s == elem->GetTitle()) return elem;
1286  }
1287  return 0;
1288 }
1289 
1290 ////////////////////////////////////////////////////////////////////////////////
1291 /// Find existing isotope by name. Not optimized for a big number of isotopes.
1292 
1294 {
1295  if (!fIsotopes) return NULL;
1296  return (TGeoIsotope*)fIsotopes->FindObject(name);
1297 }
1298 
1299 ////////////////////////////////////////////////////////////////////////////////
1300 /// Retrieve a radionuclide by ENDF code.
1301 
1303 {
1304  if (!HasRNElements()) {
1305  TGeoElementTable *table = (TGeoElementTable*)this;
1306  table->ImportElementsRN();
1307  if (!fListRN) return 0;
1308  }
1309  ElementRNMap_t::const_iterator it = fElementsRN.find(ENDFcode);
1310  if (it != fElementsRN.end()) return it->second;
1311  return 0;
1312 }
1313 
1314 ////////////////////////////////////////////////////////////////////////////////
1315 /// Retrieve a radionuclide by a, z, and isomeric state.
1316 
1318 {
1319  return GetElementRN(TGeoElementRN::ENDF(a,z,iso));
1320 }
1321 
1322 ////////////////////////////////////////////////////////////////////////////////
1323 /// Print table of elements. The accepted options are:
1324 /// "" - prints everything by default
1325 /// "D" - prints default elements only
1326 /// "I" - prints isotopes
1327 /// "R" - prints radio-nuclides only if imported
1328 /// "U" - prints user-defined elements only
1329 
1331 {
1332  TString opt(option);
1333  opt.ToUpper();
1334  Int_t induser = HasDefaultElements() ? 113 : 0;
1335  // Default elements
1336  if (opt=="" || opt=="D") {
1337  if (induser) printf("================\nDefault elements\n================\n");
1338  for (Int_t iel=0; iel<induser; ++iel) fList->At(iel)->Print();
1339  }
1340  // Isotopes
1341  if (opt=="" || opt=="I") {
1342  if (fIsotopes) {
1343  printf("================\nIsotopes\n================\n");
1344  fIsotopes->Print();
1345  }
1346  }
1347  // Radio-nuclides
1348  if (opt=="" || opt=="R") {
1349  if (HasRNElements()) {
1350  printf("================\nRadio-nuclides\n================\n");
1351  fListRN->Print();
1352  }
1353  }
1354  // User-defined elements
1355  if (opt=="" || opt=="U") {
1356  if (fNelements>induser) printf("================\nUser elements\n================\n");
1357  for (Int_t iel=induser; iel<fNelements; ++iel) fList->At(iel)->Print();
1358  }
1359 }
1360 
1362 
1363 ////////////////////////////////////////////////////////////////////////////////
1364 /// Default ctor.
1365 
1367  :TObject(), TAttLine(), TAttFill(), TAttMarker(),
1368  fElem(elem),
1369  fElemTop(elem),
1370  fCsize(10),
1371  fNcoeff(0),
1372  fFactor(1.),
1373  fTmin(0.),
1374  fTmax(0.),
1375  fCoeff(NULL)
1376 {
1377  fCoeff = new BtCoef_t[fCsize];
1378  fNcoeff = 1;
1379  fCoeff[0].cn = 1.;
1380  Double_t t12 = elem->HalfLife();
1381  if (t12 == 0.) t12 = 1.e-30;
1382  if (elem->Stable()) fCoeff[0].lambda = 0.;
1383  else fCoeff[0].lambda = TMath::Log(2.)/t12;
1384 }
1385 
1386 ////////////////////////////////////////////////////////////////////////////////
1387 /// Default ctor.
1388 
1390  :TObject(), TAttLine(), TAttFill(), TAttMarker(),
1391  fElem(NULL),
1392  fElemTop(NULL),
1393  fCsize(0),
1394  fNcoeff(0),
1395  fFactor(1.),
1396  fTmin(0.),
1397  fTmax(0.),
1398  fCoeff(NULL)
1399 {
1400  TGeoDecayChannel *dc = (TGeoDecayChannel*)chain->At(0);
1401  if (dc) fElemTop = dc->Parent();
1402  dc = (TGeoDecayChannel*)chain->At(chain->GetEntriesFast()-1);
1403  if (dc) {
1404  fElem = dc->Daughter();
1405  fCsize = chain->GetEntriesFast()+1;
1406  fCoeff = new BtCoef_t[fCsize];
1407  FindSolution(chain);
1408  }
1409 }
1410 
1411 ////////////////////////////////////////////////////////////////////////////////
1412 /// Copy constructor.
1413 
1415  :TObject(other), TAttLine(other), TAttFill(other), TAttMarker(other),
1416  fElem(other.fElem),
1417  fElemTop(other.fElemTop),
1418  fCsize(other.fCsize),
1419  fNcoeff(other.fNcoeff),
1420  fFactor(other.fFactor),
1421  fTmin(other.fTmin),
1422  fTmax(other.fTmax),
1423  fCoeff(NULL)
1424 {
1425  if (fCsize) {
1426  fCoeff = new BtCoef_t[fCsize];
1427  for (Int_t i=0; i<fNcoeff; i++) {
1428  fCoeff[i].cn = other.fCoeff[i].cn;
1429  fCoeff[i].lambda = other.fCoeff[i].lambda;
1430  }
1431  }
1432 }
1433 
1434 ////////////////////////////////////////////////////////////////////////////////
1435 /// Destructor.
1436 
1438 {
1439  if (fCoeff) delete [] fCoeff;
1440 }
1441 
1442 ////////////////////////////////////////////////////////////////////////////////
1443 /// Assignment.
1444 
1446 {
1447  if (this == &other) return *this;
1448  TObject::operator=(other);
1449  TAttLine::operator=(other);
1450  TAttFill::operator=(other);
1451  TAttMarker::operator=(other);
1452  fElem = other.fElem;
1453  fElemTop = other.fElemTop;
1454  if (fCoeff) delete [] fCoeff;
1455  fCoeff = 0;
1456  fCsize = other.fCsize;
1457  fNcoeff = other.fNcoeff;
1458  fFactor = other.fFactor;
1459  fTmin = other.fTmin;
1460  fTmax = other.fTmax;
1461  if (fCsize) {
1462  fCoeff = new BtCoef_t[fCsize];
1463  for (Int_t i=0; i<fNcoeff; i++) {
1464  fCoeff[i].cn = other.fCoeff[i].cn;
1465  fCoeff[i].lambda = other.fCoeff[i].lambda;
1466  }
1467  }
1468  return *this;
1469 }
1470 
1471 ////////////////////////////////////////////////////////////////////////////////
1472 /// Addition of other solution.
1473 
1475 {
1476  if (other.GetElement() != fElem) {
1477  Error("operator+=", "Cannot add 2 solutions for different elements");
1478  return *this;
1479  }
1480  Int_t i,j;
1481  BtCoef_t *coeff = fCoeff;
1482  Int_t ncoeff = fNcoeff + other.fNcoeff;
1483  if (ncoeff > fCsize) {
1484  fCsize = ncoeff;
1485  coeff = new BtCoef_t[ncoeff];
1486  for (i=0; i<fNcoeff; i++) {
1487  coeff[i].cn = fCoeff[i].cn;
1488  coeff[i].lambda = fCoeff[i].lambda;
1489  }
1490  delete [] fCoeff;
1491  fCoeff = coeff;
1492  }
1493  ncoeff = fNcoeff;
1494  for (j=0; j<other.fNcoeff; j++) {
1495  for (i=0; i<fNcoeff; i++) {
1496  if (coeff[i].lambda == other.fCoeff[j].lambda) {
1497  coeff[i].cn += fFactor * other.fCoeff[j].cn;
1498  break;
1499  }
1500  }
1501  if (i == fNcoeff) {
1502  coeff[ncoeff].cn = fFactor * other.fCoeff[j].cn;
1503  coeff[ncoeff].lambda = other.fCoeff[j].lambda;
1504  ncoeff++;
1505  }
1506  }
1507  fNcoeff = ncoeff;
1508  return *this;
1509 }
1510 ////////////////////////////////////////////////////////////////////////////////
1511 /// Find concentration of the element at a given time.
1512 
1514 {
1515  Double_t conc = 0.;
1516  for (Int_t i=0; i<fNcoeff; i++)
1517  conc += fCoeff[i].cn * TMath::Exp(-fCoeff[i].lambda * time);
1518  return conc;
1519 }
1520 
1521 ////////////////////////////////////////////////////////////////////////////////
1522 /// Draw the solution of Bateman equation versus time.
1523 
1525 {
1526  if (!gGeoManager) return;
1527  gGeoManager->GetGeomPainter()->DrawBatemanSol(this, option);
1528 }
1529 
1530 ////////////////////////////////////////////////////////////////////////////////
1531 /// Find the solution for the Bateman equations corresponding to the decay
1532 /// chain described by an array ending with element X.
1533 /// A->B->...->X
1534 /// Cn = SUM [Ain * exp(-LMBDi*t)];
1535 /// Cn - concentration Nx/Na
1536 /// n - order of X in chain (A->B->X => n=3)
1537 /// LMBDi - decay constant for element of order i in the chain
1538 /// Ain = LMBD1*...*LMBD(n-1) * br1*...*br(n-1)/(LMBD1-LMBDi)...(LMBDn-LMBDi)
1539 /// bri - branching ratio for decay Ei->Ei+1
1540 
1542 {
1543  fNcoeff = 0;
1544  if (!array || !array->GetEntriesFast()) return;
1545  Int_t n = array->GetEntriesFast();
1546  TGeoDecayChannel *dc = (TGeoDecayChannel*)array->At(n-1);
1547  TGeoElementRN *elem = dc->Daughter();
1548  if (elem != fElem) {
1549  Error("FindSolution", "Last element in the list must be %s\n", fElem->GetName());
1550  return;
1551  }
1552  Int_t i,j;
1553  Int_t order = n+1;
1554  if (!fCoeff) {
1555  fCsize = order;
1556  fCoeff = new BtCoef_t[fCsize];
1557  }
1558  if (fCsize < order) {
1559  delete [] fCoeff;
1560  fCsize = order;
1561  fCoeff = new BtCoef_t[fCsize];
1562  }
1563 
1564  Double_t *lambda = new Double_t[order];
1565  Double_t *br = new Double_t[n];
1566  Double_t halflife;
1567  for (i=0; i<n; i++) {
1568  dc = (TGeoDecayChannel*)array->At(i);
1569  elem = dc->Parent();
1570  br[i] = 0.01 * dc->BranchingRatio();
1571  halflife = elem->HalfLife();
1572  if (halflife==0.) halflife = 1.e-30;
1573  if (elem->Stable()) lambda[i] = 0.;
1574  else lambda[i] = TMath::Log(2.)/halflife;
1575  if (i==n-1) {
1576  elem = dc->Daughter();
1577  halflife = elem->HalfLife();
1578  if (halflife==0.) halflife = 1.e-30;
1579  if (elem->Stable()) lambda[n] = 0.;
1580  else lambda[n] = TMath::Log(2.)/halflife;
1581  }
1582  }
1583  // Check if we have equal lambdas
1584  for (i=0; i<order-1; i++) {
1585  for (j=i+1; j<order; j++) {
1586  if (lambda[j] == lambda[i]) lambda[j] += 0.001*lambda[j];
1587  }
1588  }
1589  Double_t ain;
1590  Double_t pdlambda, plambdabr=1.;
1591  for (j=0; j<n; j++) plambdabr *= lambda[j]*br[j];
1592  for (i=0; i<order; i++) {
1593  pdlambda = 1.;
1594  for (j=0; j<n+1; j++) {
1595  if (j == i) continue;
1596  pdlambda *= lambda[j] - lambda[i];
1597  }
1598  if (pdlambda == 0.) {
1599  Error("FindSolution", "pdlambda=0 !!!");
1600  delete [] lambda;
1601  delete [] br;
1602  return;
1603  }
1604  ain = plambdabr/pdlambda;
1605  fCoeff[i].cn = ain;
1606  fCoeff[i].lambda = lambda[i];
1607  }
1608  fNcoeff = order;
1609  Normalize(fFactor);
1610  delete [] lambda;
1611  delete [] br;
1612 }
1613 
1614 ////////////////////////////////////////////////////////////////////////////////
1615 /// Normalize all coefficients with a given factor.
1616 
1618 {
1619  for (Int_t i=0; i<fNcoeff; i++) fCoeff[i].cn *= factor;
1620 }
1621 
1622 ////////////////////////////////////////////////////////////////////////////////
1623 /// Print concentration evolution.
1624 
1625 void TGeoBatemanSol::Print(Option_t * /*option*/) const
1626 {
1627  TString formula;
1628  formula.Form("N[%s]/N[%s] = ", fElem->GetName(), fElemTop->GetName());
1629  for (Int_t i=0; i<fNcoeff; i++) {
1630  if (i == fNcoeff-1) formula += TString::Format("%g*exp(-%g*t)", fCoeff[i].cn, fCoeff[i].lambda);
1631  else formula += TString::Format("%g*exp(-%g*t) + ", fCoeff[i].cn, fCoeff[i].lambda);
1632  }
1633  printf("%s\n", formula.Data());
1634 }
1635 
TGeoElementTable::fIsotopes
TObjArray * fIsotopes
Definition: TGeoElement.h:378
TGeoBatemanSol::fTmax
Double_t fTmax
Definition: TGeoElement.h:294
TGeoBatemanSol::BtCoef_t::lambda
Double_t lambda
Definition: TGeoElement.h:286
TGeoIsotope
Definition: TGeoElement.h:108
TGeoElementRN::ENDFCode
virtual Int_t ENDFCode() const
Definition: TGeoElement.h:178
n
const Int_t n
Definition: legend1.C:16
TGeoBatemanSol::fCsize
Int_t fCsize
Definition: TGeoElement.h:290
TGeoElementTable::HasDefaultElements
Bool_t HasDefaultElements() const
Definition: TGeoElement.h:414
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TGeoElementRN::fLevel
Double_t fLevel
Definition: TGeoElement.h:143
e
#define e(i)
Definition: RSha256.hxx:121
TObjArray::Delete
virtual void Delete(Option_t *option="")
Remove all objects from the array AND delete all heap based objects.
Definition: TObjArray.cxx:356
TGeoElement::GetRelativeAbundance
Double_t GetRelativeAbundance(Int_t i) const
Return relative abundance of i-th isotope in this element.
Definition: TGeoElement.cxx:315
TObject::TestBit
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:172
TGeoElementRN::fTG_F
Double_t fTG_F
Definition: TGeoElement.h:149
TGeoIsotope::FindIsotope
static TGeoIsotope * FindIsotope(const char *name)
Find existing isotope by name.
Definition: TGeoElement.cxx:351
TCollection::Print
virtual void Print(Option_t *option="") const
Default print for collections, calls Print(option, 1).
Definition: TCollection.cxx:476
TObjArray
Definition: TObjArray.h:37
TGeoBatemanSol::GetElement
TGeoElementRN * GetElement() const
Definition: TGeoElement.h:310
TGeoIsotope::Print
virtual void Print(Option_t *option="") const
Print this isotope.
Definition: TGeoElement.cxx:361
TGeoElemIter::fBranch
TObjArray * fBranch
Definition: TGeoElement.h:333
TGeoElement::fZ
Int_t fZ
Definition: TGeoElement.h:45
TGeoElemIter::GetBranch
TObjArray * GetBranch() const
Definition: TGeoElement.h:352
TObject::Print
virtual void Print(Option_t *option="") const
This method must be overridden when a class wants to print itself.
Definition: TObject.cxx:552
TGeoElementRN::~TGeoElementRN
virtual ~TGeoElementRN()
Destructor.
Definition: TGeoElement.cxx:421
TGeoElement::fAbundances
Double_t * fAbundances
Definition: TGeoElement.h:50
gGeoManager
R__EXTERN TGeoManager * gGeoManager
Definition: TGeoManager.h:602
TString::Data
const char * Data() const
Definition: TString.h:369
TGeoBatemanSol::TGeoBatemanSol
TGeoBatemanSol()
Definition: TGeoElement.h:297
TGeoElement::fCoulomb
Double_t fCoulomb
Definition: TGeoElement.h:51
TGeoIsotope::fA
Double_t fA
Definition: TGeoElement.h:113
TGeoBatemanSol::BtCoef_t
Definition: TGeoElement.h:284
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
TGeoIsotope::GetZ
Int_t GetZ() const
Definition: TGeoElement.h:120
TNamed::GetTitle
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:54
TGeoBatemanSol::fCoeff
BtCoef_t * fCoeff
Definition: TGeoElement.h:295
TGeoElementRN::HalfLife
Double_t HalfLife() const
Definition: TGeoElement.h:186
TObjArray::RemoveAt
virtual TObject * RemoveAt(Int_t idx)
Remove object at index idx.
Definition: TObjArray.cxx:694
gMaxElem
static const Int_t gMaxElem
Definition: TGeoElement.cxx:53
TMath::Log
Double_t Log(Double_t x)
Definition: TMath.h:760
TObject::Error
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:890
TGeoDecayChannel::GetIndex
Int_t GetIndex() const
Get index of this channel in the list of decays of the parent nuclide.
Definition: TGeoElement.cxx:730
TGeoElementRN::fIso
Int_t fIso
Definition: TGeoElement.h:142
TGeoElementRN::fTG_S
Double_t fTG_S
Definition: TGeoElement.h:151
TGeoIsotope::GetN
Int_t GetN() const
Definition: TGeoElement.h:121
TGeant4Unit::kTGeoUnits
@ kTGeoUnits
Definition: TGeant4SystemOfUnits.h:337
TGeoElementTable::BuildDefaultElements
void BuildDefaultElements()
Creates the default element table.
Definition: TGeoElement.cxx:1070
operator=
Binding & operator=(OUT(*fun)(void))
Definition: TRInterface_Binding.h:11
TGeoElementRN::DecayResult
Int_t DecayResult(TGeoDecayChannel *dc) const
Returns ENDF code of decay result.
Definition: TGeoElement.cxx:524
TObjArray::IndexOf
Int_t IndexOf(const TObject *obj) const
Definition: TObjArray.cxx:605
TMath::Exp
Double_t Exp(Double_t x)
Definition: TMath.h:727
TGeant4Unit::s
static constexpr double s
Definition: TGeant4SystemOfUnits.h:168
TGeoElementRN::Decays
TObjArray * Decays() const
Definition: TGeoElement.h:195
TObject::Fatal
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
Definition: TObject.cxx:918
TGeoElementRN::MakeName
void MakeName(Int_t a, Int_t z, Int_t iso)
Generate a default name for the element.
Definition: TGeoElement.cxx:559
Int_t
int Int_t
Definition: RtypesCore.h:45
TGeoDecayChannel::SetDaughter
void SetDaughter(TGeoElementRN *daughter)
Definition: TGeoElement.h:265
TGeoElementRN::fENDFcode
Int_t fENDFcode
Definition: TGeoElement.h:141
TNamed::fName
TString fName
Definition: TNamed.h:38
TGeant4Unit::fine_structure_const
static constexpr double fine_structure_const
Definition: TGeant4PhysicalConstants.h:96
TGeoIsotope::fN
Int_t fN
Definition: TGeoElement.h:112
TGeoElementTable::AddElement
void AddElement(const char *name, const char *title, Int_t z, Double_t a)
Add an element to the table. Obsolete.
Definition: TGeoElement.cxx:1011
TObjArray::GetEntries
Int_t GetEntries() const
Return the number of objects in array (i.e.
Definition: TObjArray.cxx:523
TString::Length
Ssiz_t Length() const
Definition: TString.h:410
TGeoElementRN::Print
virtual void Print(Option_t *option="") const
Print info about the element;.
Definition: TGeoElement.cxx:577
TGeoElement::HasIsotopes
Bool_t HasIsotopes() const
Definition: TGeoElement.h:85
indent
static void indent(ostringstream &buf, int indent_level)
Definition: TClingCallFunc.cxx:87
TGeoElement::TGeoElement
TGeoElement()
Default constructor.
Definition: TGeoElement.cxx:90
TMath::Abs
Short_t Abs(Short_t d)
Definition: TMathBase.h:120
TSystem::PrependPathName
virtual const char * PrependPathName(const char *dir, TString &name)
Concatenate a directory and a file name.
Definition: TSystem.cxx:1079
TGeoElement::GetIsotope
TGeoIsotope * GetIsotope(Int_t i) const
Return i-th isotope in the element.
Definition: TGeoElement.cxx:304
TGeoElement::fRadTsai
Double_t fRadTsai
Definition: TGeoElement.h:52
TObjArray::At
TObject * At(Int_t idx) const
Definition: TObjArray.h:166
TGeoElementTable::fNisotopes
Int_t fNisotopes
Definition: TGeoElement.h:375
TString::Format
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition: TString.cxx:2311
TString
Definition: TString.h:136
TGeoDecayChannel::ReadDecay
static TGeoDecayChannel * ReadDecay(const char *record)
Create element from line record.
Definition: TGeoElement.cxx:748
TGeoBatemanSol::Concentration
Double_t Concentration(Double_t time) const
Find concentration of the element at a given time.
Definition: TGeoElement.cxx:1513
TGeoElement::AddIsotope
void AddIsotope(TGeoIsotope *isotope, Double_t relativeAbundance)
Add an isotope for this element. All isotopes have to be isotopes of the same element.
Definition: TGeoElement.cxx:241
TGeoBatemanSol::operator+=
TGeoBatemanSol & operator+=(const TGeoBatemanSol &other)
Addition of other solution.
Definition: TGeoElement.cxx:1474
TGeoElementTable::fElementsRN
ElementRNMap_t fElementsRN
Definition: TGeoElement.h:382
TGeoElementTable::GetElementRN
TGeoElementRN * GetElementRN(Int_t ENDFcode) const
Retrieve a radionuclide by ENDF code.
Definition: TGeoElement.cxx:1302
TGeoDecayChannel::fQvalue
Double_t fQvalue
Definition: TGeoElement.h:222
TGeoElemIter::fLimitRatio
Double_t fLimitRatio
Definition: TGeoElement.h:335
TGeoElementTable::FindElement
TGeoElement * FindElement(const char *name) const
Search an element by symbol or full name Exact matching.
Definition: TGeoElement.cxx:1272
TGeoIsotope::GetA
Double_t GetA() const
Definition: TGeoElement.h:122
bool
TString::ReplaceAll
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:692
TGeoElemIter::fLevel
Int_t fLevel
Definition: TGeoElement.h:334
TGeant4PhysicalConstants.h
TGeoDecayChannel::fDiso
Int_t fDiso
Definition: TGeoElement.h:220
TObjArray::Add
void Add(TObject *obj)
Definition: TObjArray.h:74
TGeoElement::ComputeDerivedQuantities
void ComputeDerivedQuantities()
Calculate properties for an atomic number.
Definition: TGeoElement.cxx:169
TNamed::fTitle
TString fTitle
Definition: TNamed.h:39
TGeoElementTable::Print
virtual void Print(Option_t *option="") const
Print table of elements.
Definition: TGeoElement.cxx:1330
TGeoBatemanSol::fElem
TGeoElementRN * fElem
Definition: TGeoElement.h:288
TGeoElementRN::fDecays
TObjArray * fDecays
Definition: TGeoElement.h:155
TGeoBatemanSol
Definition: TGeoElement.h:281
TGeoElemIter
Definition: TGeoElement.h:328
TROOT.h
TGeoElemIter::fTop
const TGeoElementRN * fTop
Definition: TGeoElement.h:331
TGeoElementRN::fTH_S
Double_t fTH_S
Definition: TGeoElement.h:150
TGeoElementTable::kETDefaultElements
@ kETDefaultElements
Definition: TGeoElement.h:397
TString::ToUpper
void ToUpper()
Change string to upper case.
Definition: TString.cxx:1138
TGeoElement::Neff
Double_t Neff() const
Returns effective number of nucleons.
Definition: TGeoElement.cxx:286
TGeoBatemanSol::Print
virtual void Print(Option_t *option="") const
Print concentration evolution.
Definition: TGeoElement.cxx:1625
TGeoBatemanSol::Draw
virtual void Draw(Option_t *option="")
Draw the solution of Bateman equation versus time.
Definition: TGeoElement.cxx:1524
gElName
static const char gElName[gMaxElem][3]
Definition: TGeoElement.cxx:57
TGeoElement::fN
Int_t fN
Definition: TGeoElement.h:46
TGeoPhysicalConstants.h
TString::Form
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2289
TGeoElementTable::fNelements
Int_t fNelements
Definition: TGeoElement.h:373
TGeoBatemanSol::fElemTop
TGeoElementRN * fElemTop
Definition: TGeoElement.h:289
TGeoDecayChannel::Daughter
TGeoElementRN * Daughter() const
Definition: TGeoElement.h:260
TGeoElemIter::fElem
const TGeoElementRN * fElem
Definition: TGeoElement.h:332
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
TGeoElemIter::Print
virtual void Print(Option_t *option="") const
Print info about the current decay branch.
Definition: TGeoElement.cxx:910
TGeoBatemanSol::fFactor
Double_t fFactor
Definition: TGeoElement.h:292
TGeoElementTable::CheckTable
Bool_t CheckTable() const
Checks status of element table.
Definition: TGeoElement.cxx:1230
TGeoElementTable::fListRN
TObjArray * fListRN
Definition: TGeoElement.h:377
TGeoElement::~TGeoElement
virtual ~TGeoElement()
destructor
Definition: TGeoElement.cxx:159
TGeoDecayChannel
Definition: TGeoElement.h:216
TGeoElementTable::operator=
TGeoElementTable & operator=(const TGeoElementTable &)
assignment operator
Definition: TGeoElement.cxx:975
TAttLine
Definition: TAttLine.h:18
TGeoDecayChannel::SetParent
void SetParent(TGeoElementRN *parent)
Definition: TGeoElement.h:264
TSystem.h
gDecayName
static const char * gDecayName[gMaxDecay+1]
Definition: TGeoElement.cxx:69
TGeoElementRN::GetSpecificActivity
virtual Double_t GetSpecificActivity() const
Get the activity in Bq of a gram of material made from this element.
Definition: TGeoElement.cxx:469
TGeoElement::fA
Double_t fA
Definition: TGeoElement.h:48
gMaxDecay
static const Int_t gMaxDecay
Definition: TGeoElement.cxx:55
TGeoElement
Definition: TGeoElement.h:36
TGeoManager::GetGeomPainter
TVirtualGeoPainter * GetGeomPainter()
Make a default painter if none present. Returns pointer to it.
Definition: TGeoManager.cxx:2685
TGeoDecayChannel::fDaughter
TGeoElementRN * fDaughter
Definition: TGeoElement.h:224
TObject::SetBit
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:696
TGeoDecayChannel::fParent
TGeoElementRN * fParent
Definition: TGeoElement.h:223
TGeoIsotope::TGeoIsotope
TGeoIsotope()
Dummy I/O constructor.
Definition: TGeoElement.cxx:326
TGeoElement.h
TGeoElementRN::FillPopulation
void FillPopulation(TObjArray *population, Double_t precision=0.001, Double_t factor=1.)
Fills the input array with the set of RN elements resulting from the decay of this one.
Definition: TGeoElement.cxx:540
TGeoElementRN
Definition: TGeoElement.h:138
TObjArray::GetEntriesFast
Int_t GetEntriesFast() const
Definition: TObjArray.h:64
a
auto * a
Definition: textangle.C:12
TNamed
Definition: TNamed.h:29
TGeoBatemanSol::~TGeoBatemanSol
~TGeoBatemanSol()
Destructor.
Definition: TGeoElement.cxx:1437
TGeoElementTable
Definition: TGeoElement.h:369
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
gDecayDeltaZ
static const Int_t gDecayDeltaZ[gMaxDecay]
Definition: TGeoElement.cxx:79
TGeoElement::GetElementTable
static TGeoElementTable * GetElementTable()
Returns pointer to the table.
Definition: TGeoElement.cxx:229
TGeoElementRN::CheckDecays
Bool_t CheckDecays() const
Check if all decay chain of the element is OK.
Definition: TGeoElement.cxx:479
TGeoElementTable::fList
TObjArray * fList
Definition: TGeoElement.h:376
TGeoElemIter::Next
TGeoElementRN * Next()
Return next element.
Definition: TGeoElement.cxx:898
TGeoIsotope::fZ
Int_t fZ
Definition: TGeoElement.h:111
TGeoDecayChannel::Parent
TGeoElementRN * Parent() const
Definition: TGeoElement.h:261
TGeoElementRN::ENDF
static Int_t ENDF(Int_t a, Int_t z, Int_t iso)
Definition: TGeoElement.h:175
TGeoElementRN::fRatio
TGeoBatemanSol * fRatio
Definition: TGeoElement.h:153
TGeoElementTable::ImportElementsRN
void ImportElementsRN()
Creates the list of radionuclides.
Definition: TGeoElement.cxx:1193
TAttMarker
Definition: TAttMarker.h:19
TObjArray::AddAtAndExpand
virtual void AddAtAndExpand(TObject *obj, Int_t idx)
Add object at position idx.
Definition: TObjArray.cxx:235
TGeoDecayChannel::TGeoDecayChannel
TGeoDecayChannel()
Definition: TGeoElement.h:244
TGeoElementRN::AddDecay
void AddDecay(Int_t decay, Int_t diso, Double_t branchingRatio, Double_t qValue)
Adds a decay mode for this element.
Definition: TGeoElement.cxx:433
TGeoElement::ComputeCoulombFactor
void ComputeCoulombFactor()
Compute Coulomb correction factor (Phys Rev. D50 3-1 (1994) page 1254)
Definition: TGeoElement.cxx:178
TGeoElementTable::kETRNElements
@ kETRNElements
Definition: TGeoElement.h:398
TGeoElementTable::TGeoElementTable
TGeoElementTable()
default constructor
Definition: TGeoElement.cxx:933
TGeoElemIter::TGeoElemIter
TGeoElemIter()
Definition: TGeoElement.h:339
TGeoElemIter::~TGeoElemIter
virtual ~TGeoElemIter()
Destructor.
Definition: TGeoElement.cxx:823
TGeoElement::SetUsed
void SetUsed(Bool_t flag=kTRUE)
Definition: TGeoElement.h:91
TGeoElementTable::ExportElementsRN
void ExportElementsRN(const char *filename="")
Export radionuclides in a file.
Definition: TGeoElement.cxx:1245
line
TLine * line
Definition: entrylistblock_figure1.C:235
TGeoBatemanSol::fNcoeff
Int_t fNcoeff
Definition: TGeoElement.h:291
TObject::Warning
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:876
TGeoDecayChannel::DecayName
static void DecayName(UInt_t decay, TString &name)
Returns decay name.
Definition: TGeoElement.cxx:712
TGeoBatemanSol::fTmin
Double_t fTmin
Definition: TGeoElement.h:293
unsigned int
gLevName
static const char gLevName[gMaxLevel]
Definition: TGeoElement.cxx:83
TGeoElement::Print
virtual void Print(Option_t *option="") const
Print this isotope.
Definition: TGeoElement.cxx:214
TGeoElementRN::ResetRatio
void ResetRatio()
Clears the existing ratio.
Definition: TGeoElement.cxx:664
TGeoUnit::unitType
UnitType unitType()
Access the currently set units type.
TGeoElement::fIsotopes
TObjArray * fIsotopes
Definition: TGeoElement.h:49
TROOT::GetEtcDir
static const TString & GetEtcDir()
Get the sysconfig directory in the installation. Static utility function.
Definition: TROOT.cxx:2958
gSystem
R__EXTERN TSystem * gSystem
Definition: TSystem.h:559
TGeoManager.h
TGeoElemIter::Down
TGeoElementRN * Down(Int_t ibranch)
Go downwards from current level via ibranch as low in the tree as possible.
Definition: TGeoElement.cxx:882
TGeoDecayChannel::BranchingRatio
Double_t BranchingRatio() const
Definition: TGeoElement.h:257
TGeoElementRN::AddRatio
void AddRatio(TGeoBatemanSol &ratio)
Adds a proportion ratio to the existing one.
Definition: TGeoElement.cxx:655
TGeoBatemanSol::Normalize
void Normalize(Double_t factor)
Normalize all coefficients with a given factor.
Definition: TGeoElement.cxx:1617
TGeoElementRN::ReadElementRN
static TGeoElementRN * ReadElementRN(const char *record, Int_t &ndecays)
Create element from line record.
Definition: TGeoElement.cxx:604
TGeoElement::fNisotopes
Int_t fNisotopes
Definition: TGeoElement.h:47
TGeoElemIter::Up
TGeoElementRN * Up()
Go upwards from the current location until the next branching, then down.
Definition: TGeoElement.cxx:857
TGeoElementRN::TGeoElementRN
TGeoElementRN()
Default constructor.
Definition: TGeoElement.cxx:371
TGeoDecayChannel::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive for decays.
Definition: TGeoElement.cxx:761
TGeoElementRN::GetNdecays
Int_t GetNdecays() const
Get number of decay channels of this element.
Definition: TGeoElement.cxx:460
TGeoElementRN::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive for RN elements.
Definition: TGeoElement.cxx:619
TVirtualGeoPainter.h
Double_t
double Double_t
Definition: RtypesCore.h:59
TGeoElementTable::fNelementsRN
Int_t fNelementsRN
Definition: TGeoElement.h:374
TGeoBatemanSol::FindSolution
void FindSolution(const TObjArray *array)
Find the solution for the Bateman equations corresponding to the decay chain described by an array en...
Definition: TGeoElement.cxx:1541
TGeoElementTable::HasRNElements
Bool_t HasRNElements() const
Definition: TGeoElement.h:415
TObject::operator=
TObject & operator=(const TObject &rhs)
TObject assignment operator.
Definition: TObject.h:268
TGeoElement::ComputeLradTsaiFactor
void ComputeLradTsaiFactor()
Compute Tsai's Expression for the Radiation Length (Phys Rev. D50 3-1 (1994) page 1254)
Definition: TGeoElement.cxx:191
TObjArray.h
TGeoDecayChannel::Print
virtual void Print(Option_t *opt=" ") const
Prints decay info.
Definition: TGeoElement.cxx:738
TGeoElementRN::fStatus
Int_t fStatus
Definition: TGeoElement.h:152
TObjArray::FindObject
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
Definition: TObjArray.cxx:415
TGeoElementRN::fHalfLife
Double_t fHalfLife
Definition: TGeoElement.h:145
TObject
Definition: TObject.h:37
TGeoElemIter::operator=
TGeoElemIter & operator=(const TGeoElemIter &iter)
Assignment.
Definition: TGeoElement.cxx:831
TGeoDecayChannel::GetName
virtual const char * GetName() const
Returns name of decay.
Definition: TGeoElement.cxx:695
TGeoElementRN::Stable
Bool_t Stable() const
Definition: TGeoElement.h:194
name
char name[80]
Definition: TGX11.cxx:110
TGeoManager::GetElementTable
TGeoElementTable * GetElementTable()
Returns material table. Creates it if not existing.
Definition: TGeoManager.cxx:3366
TGeoUnit::setUnitType
UnitType setUnitType(UnitType new_type)
Set the currently used unit type (Only ONCE possible)
TIter
Definition: TCollection.h:233
TVirtualGeoPainter::DrawBatemanSol
virtual void DrawBatemanSol(TGeoBatemanSol *sol, Option_t *option="")=0
gMaxLevel
static const Int_t gMaxLevel
Definition: TGeoElement.cxx:54
TGeoDecayChannel::fDecay
UInt_t fDecay
Definition: TGeoElement.h:219
TGeant4Unit::alpha_rcl2
static constexpr double alpha_rcl2
Definition: TGeant4PhysicalConstants.h:101
TAttFill
Definition: TAttFill.h:19
TGeoElement::kElementChecked
@ kElementChecked
Definition: TGeoElement.h:42
TNamed::GetName
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:53
TGeoElementTable::AddIsotope
void AddIsotope(TGeoIsotope *isotope)
Add isotope to the table.
Definition: TGeoElement.cxx:1057
gDecayDeltaA
static const Int_t gDecayDeltaA[gMaxDecay]
Definition: TGeoElement.cxx:74
TGeoElement::SetDefined
void SetDefined(Bool_t flag=kTRUE)
Definition: TGeoElement.h:90
TGeoDecayChannel::fBranchingRatio
Double_t fBranchingRatio
Definition: TGeoElement.h:221
TMath::Na
constexpr Double_t Na()
Avogadro constant (Avogadro's Number) in .
Definition: TMath.h:297
TGeoDecayChannel::Decay
UInt_t Decay() const
Definition: TGeoElement.h:256
TMath::E
constexpr Double_t E()
Base of natural log:
Definition: TMath.h:102
TGeoElementRN::fDeltaM
Double_t fDeltaM
Definition: TGeoElement.h:144
TGeoElementTable::AddElementRN
void AddElementRN(TGeoElementRN *elem)
Add a radionuclide to the table and map it.
Definition: TGeoElement.cxx:1044
TGeoElemIter::fRatio
Double_t fRatio
Definition: TGeoElement.h:336
TGeoElementRN::fTH_F
Double_t fTH_F
Definition: TGeoElement.h:148
TGeoDecayChannel::operator=
TGeoDecayChannel & operator=(const TGeoDecayChannel &dc)
Assignment.
Definition: TGeoElement.cxx:678
TMath.h
int
TGeoElemIter::operator()
TGeoElementRN * operator()()
() operator.
Definition: TGeoElement.cxx:849
TGeoElementRN::fNatAbun
Double_t fNatAbun
Definition: TGeoElement.h:146
TGeoElementTable::~TGeoElementTable
virtual ~TGeoElementTable()
destructor
Definition: TGeoElement.cxx:992
TGeoBatemanSol::BtCoef_t::cn
Double_t cn
Definition: TGeoElement.h:285
TGeoElementTable::FindIsotope
TGeoIsotope * FindIsotope(const char *name) const
Find existing isotope by name. Not optimized for a big number of isotopes.
Definition: TGeoElement.cxx:1293
TGeoBatemanSol::operator=
TGeoBatemanSol & operator=(const TGeoBatemanSol &other)
Assignment.
Definition: TGeoElement.cxx:1445
TGeoDecayChannel::DecayShift
virtual void DecayShift(Int_t &dA, Int_t &dZ, Int_t &dI) const
Returns variation in A, Z and Iso after decay.
Definition: TGeoElement.cxx:776