Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGeoMaterial.cxx
Go to the documentation of this file.
1// @(#)root/geom:$Id$
2// Author: Andrei Gheata 25/10/01
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 TGeoMaterial
13\ingroup Materials_classes
14
15Base class describing materials.
16
17## Important note about units
18Since **v6-17-02** the geometry package adopted a system of units, upon the request to support
19an in-memory material representation consistent with the one in Geant4. The adoption was done
20gradually and starting with **v6-19-02** (back-ported to **v6-18-02**) the package supports changing
21the default units to either ROOT (CGS) or Geant4 ones. In the same version the Geant4 units were
22set to be the default ones, changing the previous behavior and making material properties such
23as radiation and interaction lengths having in memory values an order of magnitude lower. This behavior
24affected versions up to **v6-25-01**, after which the default units were restored to be the ROOT ones.
25
26For users needing to restore the CGS behavior for material properties, the following sequence needs
27to be called before creating the TGeoManager instance:
28 * From **v6-18-02** to **v6-22-06**:
29```
30 TGeoUnit::setUnitType(TGeoUnit::kTGeoUnits);
31```
32
33 * From **v6-22-08** to **v6-25-01**:
34```
35 TGeoManager::LockDefaultUnits(false);
36 TGeoManager::SetDefaultUnits(kRootUnits);
37 TGeoManager::LockDefaultUnits(true);
38```
39*/
40
41#include <iostream>
42#include <limits>
43#include "TMath.h"
44#include "TObjArray.h"
45#include "TGeoElement.h"
46#include "TGeoManager.h"
47#include "TGeoExtension.h"
48#include "TGeoMaterial.h"
51#include "TGDMLMatrix.h"
52
53// statics and globals
54
56
57////////////////////////////////////////////////////////////////////////////////
58/// Default constructor.
59
61 :TNamed(), TAttFill(),
62 fIndex(0),
63 fA(0.),
64 fZ(0.),
65 fDensity(0.),
66 fRadLen(0.),
67 fIntLen(0.),
68 fTemperature(0.),
69 fPressure(0.),
70 fState(kMatStateUndefined),
71 fShader(NULL),
72 fCerenkov(NULL),
73 fElement(NULL),
74 fUserExtension(0),
75 fFWExtension(0)
76{
77 TGeoManager::SetDefaultUnits(TGeoManager::GetDefaultUnits()); // Ensure nobody changes the units afterwards
79 fIndex = -1;
83}
84
85////////////////////////////////////////////////////////////////////////////////
86/// Constructor.
87///
88/// \param name material name.
89
91 :TNamed(name, ""), TAttFill(),
92 fIndex(0),
93 fA(0.),
94 fZ(0.),
95 fDensity(0.),
96 fRadLen(0.),
97 fIntLen(0.),
98 fTemperature(0.),
99 fPressure(0.),
100 fState(kMatStateUndefined),
101 fShader(NULL),
102 fCerenkov(NULL),
103 fElement(NULL),
104 fUserExtension(0),
105 fFWExtension(0)
106{
107 TGeoManager::SetDefaultUnits(TGeoManager::GetDefaultUnits()); // Ensure nobody changes the units afterwards
108 fName = fName.Strip();
110 fIndex = -1;
114
115 if (!gGeoManager) {
116 gGeoManager = new TGeoManager("Geometry", "default geometry");
117 }
119}
120
121////////////////////////////////////////////////////////////////////////////////
122/// Constructor.
123///
124/// \param name material name.
125/// \param a atomic mass.
126/// \param z atomic number.
127/// \param rho material density in g/cm3.
128/// \param radlen
129/// \param intlen
130
132 Double_t rho, Double_t radlen, Double_t intlen)
133 :TNamed(name, ""), TAttFill(),
134 fIndex(0),
135 fA(a),
136 fZ(z),
137 fDensity(rho),
138 fRadLen(0.),
139 fIntLen(0.),
140 fTemperature(0.),
141 fPressure(0.),
142 fState(kMatStateUndefined),
143 fShader(NULL),
144 fCerenkov(NULL),
145 fElement(NULL),
146 fUserExtension(0),
147 fFWExtension(0)
148{
149 TGeoManager::SetDefaultUnits(TGeoManager::GetDefaultUnits()); // Ensure nobody changes the units afterwards
150 fName = fName.Strip();
152 fIndex = -1;
153 fA = a;
154 fZ = z;
155 fDensity = rho;
159 SetRadLen(radlen, intlen);
160 if (!gGeoManager) {
161 gGeoManager = new TGeoManager("Geometry", "default geometry");
162 }
163 if (fZ - Int_t(fZ) > 1E-3)
164 Warning("ctor", "Material %s defined with fractional Z=%f", GetName(), fZ);
165 if (GetElement()) GetElement()->SetUsed();
167}
168
169////////////////////////////////////////////////////////////////////////////////
170/// Constructor with state, temperature and pressure.
171///
172/// \param name material name.
173/// \param a atomic mass.
174/// \param z atomic number.
175/// \param rho material density in g/cm3.
176/// \param state
177/// \param temperature
178/// \param pressure
179
180
182 EGeoMaterialState state, Double_t temperature, Double_t pressure)
183 :TNamed(name, ""), TAttFill(),
184 fIndex(0),
185 fA(a),
186 fZ(z),
187 fDensity(rho),
188 fRadLen(0.),
189 fIntLen(0.),
190 fTemperature(temperature),
191 fPressure(pressure),
192 fState(state),
193 fShader(NULL),
194 fCerenkov(NULL),
195 fElement(NULL),
196 fUserExtension(0),
197 fFWExtension(0)
198{
199 TGeoManager::SetDefaultUnits(TGeoManager::GetDefaultUnits()); // Ensure nobody changes the units afterwards
200 fName = fName.Strip();
202 fIndex = -1;
203 SetRadLen(0,0);
204 if (!gGeoManager) {
205 gGeoManager = new TGeoManager("Geometry", "default geometry");
206 }
207 if (fZ - Int_t(fZ) > 1E-3)
208 Warning("ctor", "Material %s defined with fractional Z=%f", GetName(), fZ);
209 if (GetElement()) GetElement()->SetUsed();
211}
212
213////////////////////////////////////////////////////////////////////////////////
214/// Constructor.
215///
216/// \param name material name.
217/// \param elem
218/// \param rho material density in g/cm3.
219
221 :TNamed(name, ""), TAttFill(),
222 fIndex(0),
223 fA(0.),
224 fZ(0.),
225 fDensity(rho),
226 fRadLen(0.),
227 fIntLen(0.),
228 fTemperature(0.),
229 fPressure(0.),
230 fState(kMatStateUndefined),
231 fShader(NULL),
232 fCerenkov(NULL),
233 fElement(elem),
234 fUserExtension(0),
235 fFWExtension(0)
236{
237 TGeoManager::SetDefaultUnits(TGeoManager::GetDefaultUnits()); // Ensure nobody changes the units afterwards
238 fName = fName.Strip();
240 fIndex = -1;
241 fA = elem->A();
242 fZ = elem->Z();
243 SetRadLen(0,0);
247 if (!gGeoManager) {
248 gGeoManager = new TGeoManager("Geometry", "default geometry");
249 }
250 if (fZ - Int_t(fZ) > 1E-3)
251 Warning("ctor", "Material %s defined with fractional Z=%f", GetName(), fZ);
252 if (GetElement()) GetElement()->SetUsed();
254}
255
256////////////////////////////////////////////////////////////////////////////////
257
259 TNamed(gm),
260 TAttFill(gm),
261 fIndex(gm.fIndex),
262 fA(gm.fA),
263 fZ(gm.fZ),
264 fDensity(gm.fDensity),
265 fRadLen(gm.fRadLen),
266 fIntLen(gm.fIntLen),
267 fTemperature(gm.fTemperature),
268 fPressure(gm.fPressure),
269 fState(gm.fState),
270 fShader(gm.fShader),
271 fCerenkov(gm.fCerenkov),
272 fElement(gm.fElement),
273 fUserExtension(gm.fUserExtension->Grab()),
274 fFWExtension(gm.fFWExtension->Grab())
275
276{
277 //copy constructor
278 TGeoManager::SetDefaultUnits(TGeoManager::GetDefaultUnits()); // Ensure nobody changes the units afterwards
280 TIter next(&fProperties);
281 TNamed *property;
282 while ((property = (TNamed*)next())) fProperties.Add(new TNamed(*property));
283}
284
285////////////////////////////////////////////////////////////////////////////////
286///assignment operator
287
289{
290 if(this!=&gm) {
292 TAttFill::operator=(gm);
293 fIndex=gm.fIndex;
294 fA=gm.fA;
295 fZ=gm.fZ;
297 fRadLen=gm.fRadLen;
298 fIntLen=gm.fIntLen;
301 fState=gm.fState;
302 fShader=gm.fShader;
308 TIter next(&fProperties);
309 TNamed *property;
310 while ((property = (TNamed*)next())) fProperties.Add(new TNamed(*property));
311 }
312 return *this;
313}
314
315////////////////////////////////////////////////////////////////////////////////
316/// Destructor
317
319{
322}
323
324////////////////////////////////////////////////////////////////////////////////
325/// Connect user-defined extension to the material. The material "grabs" a copy, so
326/// the original object can be released by the producer. Release the previously
327/// connected extension if any.
328///
329/// NOTE: This interface is intended for user extensions and is guaranteed not
330/// to be used by TGeo
331
333{
335 fUserExtension = 0;
336 if (ext) fUserExtension = ext->Grab();
337}
338
339//_____________________________________________________________________________
340const char *TGeoMaterial::GetPropertyRef(const char *property) const
341{
342 // Find reference for a given property
343 TNamed *prop = (TNamed*)fProperties.FindObject(property);
344 return (prop) ? prop->GetTitle() : nullptr;
345}
346
347//_____________________________________________________________________________
348TGDMLMatrix *TGeoMaterial::GetProperty(const char *property) const
349{
350 // Find reference for a given property
351 TNamed *prop = (TNamed*)fProperties.FindObject(property);
352 if ( !prop ) return nullptr;
353 return gGeoManager->GetGDMLMatrix(prop->GetTitle());
354}
355
356//_____________________________________________________________________________
358{
359 // Find reference for a given property
360 TNamed *prop = (TNamed*)fProperties.At(i);
361 if ( !prop ) return nullptr;
362 return gGeoManager->GetGDMLMatrix(prop->GetTitle());
363}
364
365//_____________________________________________________________________________
366const char *TGeoMaterial::GetConstPropertyRef(const char *property) const
367{
368 // Find reference for a given constant property
369 TNamed *prop = (TNamed*)fConstProperties.FindObject(property);
370 return (prop) ? prop->GetTitle() : nullptr;
371}
372
373//_____________________________________________________________________________
374Double_t TGeoMaterial::GetConstProperty(const char *property, Bool_t *err) const
375{
376 // Find reference for a given constant property
377 TNamed *prop = (TNamed*)fConstProperties.FindObject(property);
378 if (!prop) {
379 if (err) *err = kTRUE;
380 return 0.;
381 }
382 return gGeoManager->GetProperty(prop->GetTitle(), err);
383}
384
385//_____________________________________________________________________________
387{
388 // Find reference for a given constant property
389 TNamed *prop = (TNamed*)fConstProperties.At(i);
390 if (!prop) {
391 if (err) *err = kTRUE;
392 return 0.;
393 }
394 return gGeoManager->GetProperty(prop->GetTitle(), err);
395}
396
397//_____________________________________________________________________________
398bool TGeoMaterial::AddProperty(const char *property, const char *ref)
399{
401 if (GetPropertyRef(property)) {
402 Error("AddProperty", "Property %s already added to material %s",
403 property, GetName());
404 return false;
405 }
406 fProperties.Add(new TNamed(property, ref));
407 return true;
408}
409
410//_____________________________________________________________________________
411bool TGeoMaterial::AddConstProperty(const char *property, const char *ref)
412{
414 if (GetConstPropertyRef(property)) {
415 Error("AddConstProperty", "Constant property %s already added to material %s",
416 property, GetName());
417 return false;
418 }
419 fConstProperties.Add(new TNamed(property, ref));
420 return true;
421}
422
423////////////////////////////////////////////////////////////////////////////////
424/// Connect framework defined extension to the material. The material "grabs" a copy,
425/// so the original object can be released by the producer. Release the previously
426/// connected extension if any.
427///
428/// NOTE: This interface is intended for the use by TGeo and the users should
429/// NOT connect extensions using this method
430
432{
434 fFWExtension = 0;
435 if (ext) fFWExtension = ext->Grab();
436}
437
438////////////////////////////////////////////////////////////////////////////////
439/// Get a copy of the user extension pointer. The user must call Release() on
440/// the copy pointer once this pointer is not needed anymore (equivalent to
441/// delete() after calling new())
442
444{
445 if (fUserExtension) return fUserExtension->Grab();
446 return 0;
447}
448
449////////////////////////////////////////////////////////////////////////////////
450/// Get a copy of the framework extension pointer. The user must call Release() on
451/// the copy pointer once this pointer is not needed anymore (equivalent to
452/// delete() after calling new())
453
455{
456 if (fFWExtension) return fFWExtension->Grab();
457 return 0;
458}
459
460////////////////////////////////////////////////////////////////////////////////
461/// Provide a pointer name containing uid.
462
464{
465 static TString name;
466 name = TString::Format("pMat%d", GetUniqueID());
467 return (char*)name.Data();
468}
469
470////////////////////////////////////////////////////////////////////////////////
471/// Set radiation/absorption lengths. If the values are negative, their absolute value
472/// is taken, otherwise radlen is recomputed using G3 formula.
473
475{
476 fRadLen = TMath::Abs(radlen);
477 fIntLen = TMath::Abs(intlen);
478 // Check for vacuum
479 if (fA<0.9 || fZ<0.9) {
480 if (radlen<-1e5 || intlen<-1e-5) {
481 Error("SetRadLen","Material %s: user values taken for vacuum: radlen=%g or intlen=%g - too small", GetName(),fRadLen, fIntLen);
482 return;
483 }
484 // Ignore positive values and take big numbers
485 if (radlen>=0) fRadLen = 1.E30;
486 if (intlen>=0) fIntLen = 1.E30;
487 return;
488 }
490 // compute radlen systematically with G3 formula for a valid material
491 if (radlen >= 0) {
492 //taken grom Geant3 routine GSMATE
493 constexpr Double_t alr2av = 1.39621E-03;
494 constexpr Double_t al183 = 5.20948;
497 // fRadLen is in TGeo units. Apply conversion factor in requested length-units
499 }
500 // Compute interaction length using the same formula as in GEANT4
501 if (intlen >= 0) {
502 constexpr Double_t lambda0 = 35. * TGeoUnit::g / TGeoUnit::cm2; // [g/cm^2]
503 Double_t nilinv = 0.0;
504 TGeoElement *elem = GetElement();
505 if (!elem) {
506 Fatal("SetRadLen", "Element not found for material %s", GetName());
507 return;
508 }
509 Double_t nbAtomsPerVolume = TGeoUnit::Avogadro*fDensity/elem->A();
510 nilinv += nbAtomsPerVolume*TMath::Power(elem->Neff(), 0.6666667);
511 nilinv *= TGeoUnit::amu / lambda0;
512 fIntLen = (nilinv <= 0) ? TGeoShape::Big() : (1.0 / nilinv);
513 // fIntLen is in TGeo units. Apply conversion factor in requested length-units
515 }
516}
517
518////////////////////////////////////////////////////////////////////////////////
519/// static function
520/// Compute Coulomb correction for pair production and Brem
521/// REFERENCE : EGS MANUAL SLAC 210 - UC32 - JUNE 78
522/// FORMULA 2.7.17
523
525{
528 Double_t az2 = az*az;
529 Double_t az4 = az2 * az2;
530 Double_t fp = ( 0.0083*az4 + 0.20206 + 1./(1.+az2) ) * az2;
531 Double_t fm = ( 0.0020*az4 + 0.0369 ) * az4;
532 return fp - fm;
533}
534
535////////////////////////////////////////////////////////////////////////////////
536/// return true if the other material has the same physical properties
537
539{
540 if (other==this) return kTRUE;
541 if (other->IsMixture()) return kFALSE;
542 if (TMath::Abs(fA-other->GetA())>1E-3) return kFALSE;
543 if (TMath::Abs(fZ-other->GetZ())>1E-3) return kFALSE;
544 if (TMath::Abs(fDensity-other->GetDensity())>1E-6) return kFALSE;
545 if (GetCerenkovProperties() != other->GetCerenkovProperties()) return kFALSE;
546// if (fRadLen != other->GetRadLen()) return kFALSE;
547// if (fIntLen != other->GetIntLen()) return kFALSE;
548 return kTRUE;
549}
550
551////////////////////////////////////////////////////////////////////////////////
552/// print characteristics of this material
553
554void TGeoMaterial::Print(const Option_t * /*option*/) const
555{
556 printf("Material %s %s A=%g Z=%g rho=%g radlen=%g intlen=%g index=%i\n", GetName(), GetTitle(),
558}
559
560////////////////////////////////////////////////////////////////////////////////
561/// Save a primitive as a C++ statement(s) on output stream "out".
562
563void TGeoMaterial::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
564{
566 char *name = GetPointerName();
567 out << "// Material: " << GetName() << std::endl;
568 out << " a = " << fA << ";" << std::endl;
569 out << " z = " << fZ << ";" << std::endl;
570 out << " density = " << fDensity << ";" << std::endl;
571 out << " radl = " << fRadLen << ";" << std::endl;
572 out << " absl = " << fIntLen << ";" << std::endl;
573
574 out << " " << name << " = new TGeoMaterial(\"" << GetName() << "\", a,z,density,radl,absl);" << std::endl;
575 out << " " << name << "->SetIndex(" << GetIndex() << ");" << std::endl;
577}
578
579////////////////////////////////////////////////////////////////////////////////
580/// Get some default color related to this material.
581
583{
585 return (2+id%6);
586}
587
588////////////////////////////////////////////////////////////////////////////////
589/// Get a pointer to the element this material is made of.
590/// This second call is to avoid warnings to not call a virtual
591/// method from the constructor
592
594{
595 if (fElement) return fElement;
597 return table->GetElement(Int_t(fZ));
598}
599
600////////////////////////////////////////////////////////////////////////////////
601/// Get a pointer to the element this material is made of.
602
604{
605 if (fElement) return fElement;
607 return table->GetElement(Int_t(fZ));
608}
609
610////////////////////////////////////////////////////////////////////////////////
611/// Single interface to get element properties.
612
614{
615 a = fA;
616 z = fZ;
617 w = 1.;
618}
619
620////////////////////////////////////////////////////////////////////////////////
621/// Retrieve material index in the list of materials
622
624{
625 if (fIndex>=0) return fIndex;
627 fIndex = matlist->IndexOf(this);
628 return fIndex;
629}
630
631////////////////////////////////////////////////////////////////////////////////
632/// Create the material representing the decay product of this material at a
633/// given time. The precision represent the minimum cumulative branching ratio for
634/// which decay products are still taken into account.
635
637{
638 TObjArray *pop = new TObjArray();
639 if (!fElement || !fElement->IsRadioNuclide()) return this;
640 FillMaterialEvolution(pop, precision);
641 Int_t ncomp = pop->GetEntriesFast();
642 if (!ncomp) return this;
643 TGeoElementRN *el;
644 Double_t *weight = new Double_t[ncomp];
645 Double_t amed = 0.;
646 Int_t i;
647 for (i=0; i<ncomp; i++) {
648 el = (TGeoElementRN *)pop->At(i);
649 weight[i] = el->Ratio()->Concentration(time) * el->A();
650 amed += weight[i];
651 }
652 Double_t rho = fDensity*amed/fA;
653 TGeoMixture *mix = 0;
654 Int_t ncomp1 = ncomp;
655 for (i=0; i<ncomp; i++) {
656 if ((weight[i]/amed)<precision) {
657 amed -= weight[i];
658 ncomp1--;
659 }
660 }
661 if (ncomp1<2) {
662 el = (TGeoElementRN *)pop->At(0);
663 delete [] weight;
664 delete pop;
665 if (ncomp1==1) return new TGeoMaterial(TString::Format("%s-evol",GetName()), el, rho);
666 return NULL;
667 }
668 mix = new TGeoMixture(TString::Format("%s-evol",GetName()), ncomp, rho);
669 for (i=0; i<ncomp; i++) {
670 weight[i] /= amed;
671 if (weight[i]<precision) continue;
672 el = (TGeoElementRN *)pop->At(i);
673 mix->AddElement(el, weight[i]);
674 }
675 delete [] weight;
676 delete pop;
677 return mix;
678}
679
680////////////////////////////////////////////////////////////////////////////////
681/// Fills a user array with all the elements deriving from the possible
682/// decay of the top element composing the mixture. Each element contained
683/// by `<population>` may be a radionuclide having a Bateman solution attached.
684/// The precision represent the minimum cumulative branching ratio for
685/// which decay products are still taken into account.
686/// To visualize the time evolution of each decay product one can use:
687/// ~~~ {.cpp}
688/// TGeoElement *elem = population->At(index);
689/// TGeoElementRN *elemrn = 0;
690/// if (elem->IsRadioNuclide()) elemrn = (TGeoElementRN*)elem;
691/// ~~~
692/// One can get Ni/N1(t=0) at any moment of time. Ni is the number of atoms
693/// of one of the decay products, N1(0) is the number of atoms of the top
694/// element at t=0.
695/// ~~~ {.cpp}
696/// Double_t fraction_weight = elemrn->Ratio()->Concentration(time);
697/// ~~~
698/// One can also display the time evolution of the fractional weight:
699/// ~~~ {.cpp}
700/// elemrn->Ratio()->Draw(option);
701/// ~~~
702
704{
705 if (population->GetEntriesFast()) {
706 Error("FillMaterialEvolution", "Provide an empty array !");
707 return;
708 }
710 TGeoElement *elem;
711 TGeoElementRN *elemrn;
712 TIter next(table->GetElementsRN());
713 while ((elemrn=(TGeoElementRN*)next())) elemrn->ResetRatio();
714 elem = GetElement();
715 if (!elem) {
716 Fatal("FillMaterialEvolution", "Element not found for material %s", GetName());
717 return;
718 }
719 if (!elem->IsRadioNuclide()) {
720 population->Add(elem);
721 return;
722 }
723 elemrn = (TGeoElementRN*)elem;
724 elemrn->FillPopulation(population, precision);
725}
726
727/** \class TGeoMixture
728\ingroup Materials_classes
729
730Mixtures of elements.
731
732*/
733
735
736////////////////////////////////////////////////////////////////////////////////
737/// Default constructor
738
740{
741 fNelements = 0;
742 fZmixture = 0;
743 fAmixture = 0;
744 fWeights = 0;
745 fNatoms = 0;
747 fElements = 0;
748}
749
750////////////////////////////////////////////////////////////////////////////////
751/// constructor
752
753TGeoMixture::TGeoMixture(const char *name, Int_t /*nel*/, Double_t rho)
755{
756 fZmixture = 0;
757 fAmixture = 0;
758 fWeights = 0;
759 fNelements = 0;
760 fNatoms = 0;
762 fDensity = rho;
763 fElements = 0;
764 if (fDensity < 0) fDensity = 0.001;
765}
766
767////////////////////////////////////////////////////////////////////////////////
768/// Destructor
769
771{
772 if (fZmixture) delete[] fZmixture;
773 if (fAmixture) delete[] fAmixture;
774 if (fWeights) delete[] fWeights;
775 if (fNatoms) delete[] fNatoms;
777 if (fElements) delete fElements;
778}
779
780////////////////////////////////////////////////////////////////////////////////
781/// Compute effective A/Z and radiation length
782
784{
785 constexpr const Double_t na = TGeoUnit::Avogadro;
786 constexpr const Double_t alr2av = 1.39621E-03;
787 constexpr const Double_t al183 = 5.20948;
788 constexpr const Double_t lambda0 = 35. * TGeoUnit::g / TGeoUnit::cm2; // [g/cm^2]
789 Double_t radinv = 0.0;
790 Double_t nilinv = 0.0;
791 Double_t nbAtomsPerVolume;
792 fA = 0;
793 fZ = 0;
794 for (Int_t j=0;j<fNelements;j++) {
795 if (fWeights[j] <= 0) continue;
796 fA += fWeights[j]*fAmixture[j];
797 fZ += fWeights[j]*fZmixture[j];
798 nbAtomsPerVolume = na*fDensity*fWeights[j]/GetElement(j)->A();
799 nilinv += nbAtomsPerVolume*TMath::Power(GetElement(j)->Neff(), 0.6666667);
800 Double_t zc = fZmixture[j];
801 Double_t alz = TMath::Log(zc)/3.;
802 Double_t xinv = zc*(zc+TGeoMaterial::ScreenFactor(zc))*
803 (al183-alz-TGeoMaterial::Coulomb(zc))/fAmixture[j];
804 radinv += xinv*fWeights[j];
805 }
806 radinv *= alr2av*fDensity;
807 fRadLen = (radinv <= 0) ? TGeoShape::Big() : 1.0 / radinv;
808 // fRadLen is in TGeo units. Apply conversion factor in requested length-units
810
811 // Compute interaction length
812 nilinv *= TGeoUnit::amu / lambda0;
813 fIntLen = (nilinv <= 0) ? TGeoShape::Big() : 1.0 / nilinv;
814 // fIntLen is in TGeo units. Apply conversion factor in requested length-units
816}
817
818////////////////////////////////////////////////////////////////////////////////
819/// add an element to the mixture using fraction by weight
820/// Check if the element is already defined
821
823{
825
826 // Check preconditions
827 if (weight < 0e0) {
828 Fatal("AddElement", "Cannot add element with negative weight %g to mixture %s", weight, GetName());
829 }
830 else if ( weight < std::numeric_limits<Double_t>::epsilon() ) {
831 return;
832 }
833 else if (z<1 || z>table->GetNelements()-1) {
834 Fatal("AddElement", "Cannot add element having Z=%d to mixture %s", (Int_t)z, GetName());
835 }
836 Int_t i;
837 for (i=0; i<fNelements; i++) {
838 if (!fElements && TMath::Abs(z-fZmixture[i])<1.e-6 && TMath::Abs(a-fAmixture[i])<1.e-6) {
839 fWeights[i] += weight;
841 return;
842 }
843 }
844 if (!fNelements) {
845 fZmixture = new Double_t[1];
846 fAmixture = new Double_t[1];
847 fWeights = new Double_t[1];
848 } else {
849 Int_t nelements = fNelements+1;
850 Double_t *zmixture = new Double_t[nelements];
851 Double_t *amixture = new Double_t[nelements];
852 Double_t *weights = new Double_t[nelements];
853 for (Int_t j=0; j<fNelements; j++) {
854 zmixture[j] = fZmixture[j];
855 amixture[j] = fAmixture[j];
856 weights[j] = fWeights[j];
857 }
858 delete [] fZmixture;
859 delete [] fAmixture;
860 delete [] fWeights;
861 fZmixture = zmixture;
862 fAmixture = amixture;
863 fWeights = weights;
864 }
865
866 fNelements++;
867 i = fNelements - 1;
868 fZmixture[i] = z;
869 fAmixture[i] = a;
870 fWeights[i] = weight;
871 if (z - Int_t(z) > 1E-3)
872 Warning("DefineElement", "Mixture %s has element defined with fractional Z=%f", GetName(), z);
874 table->GetElement((Int_t)z)->SetDefined();
875
876 //compute equivalent radiation length (taken from Geant3/GSMIXT)
878}
879
880////////////////////////////////////////////////////////////////////////////////
881/// Define one component of the mixture as an existing material/mixture.
882
884{
885 TGeoElement *elnew, *elem;
886 Double_t a,z;
887
888 // Check preconditions
889 if (!mat) {
890 Fatal("AddElement", "Cannot add INVALID material to mixture %s", GetName());
891 }
892 else if (weight < 0e0) {
893 Fatal("AddElement", "Cannot add material %s with negative weight %g to mixture %s",
894 mat->GetName(), weight, GetName());
895 }
896 else if ( weight < std::numeric_limits<Double_t>::epsilon() ) {
897 return;
898 }
899 if (!mat->IsMixture()) {
900 elem = mat->GetBaseElement();
901 if (elem) {
902 AddElement(elem, weight);
903 } else {
904 a = mat->GetA();
905 z = mat->GetZ();
906 AddElement(a, z, weight);
907 }
908 return;
909 }
910 // The material is a mixture.
911 TGeoMixture *mix = (TGeoMixture*)mat;
912 Double_t wnew;
913 Int_t nelem = mix->GetNelements();
914 Bool_t elfound;
915 Int_t i,j;
916 // loop the elements of the daughter mixture
917 for (i=0; i<nelem; i++) {
918 elfound = kFALSE;
919 elnew = mix->GetElement(i);
920 if (!elnew) continue;
921 // check if we have the element already defined in the parent mixture
922 for (j=0; j<fNelements; j++) {
923 if ( fWeights[j] < 0e0 ) continue;
924 elem = GetElement(j);
925 if (elem == elnew) {
926 // element found, compute new weight
927 fWeights[j] += weight * (mix->GetWmixt())[i];
928 elfound = kTRUE;
929 break;
930 }
931 }
932 if (elfound) continue;
933 // element not found, define it
934 wnew = weight * (mix->GetWmixt())[i];
935 AddElement(elnew, wnew);
936 }
937}
938
939////////////////////////////////////////////////////////////////////////////////
940/// add an element to the mixture using fraction by weight
941
943{
944 TGeoElement *elemold;
946 if (!fElements) fElements = new TObjArray(128);
947 Bool_t exist = kFALSE;
948
949 // Check preconditions
950 if (!elem) {
951 Fatal("AddElement", "Cannot add INVALID element to mixture %s", GetName());
952 }
953 else if (weight < 0e0) {
954 Fatal("AddElement", "Cannot add element %s with negative weight %g to mixture %s",
955 elem->GetName(), weight, GetName());
956 }
957 else if ( weight < std::numeric_limits<Double_t>::epsilon() ) {
958 return;
959 }
960 // If previous elements were defined by A/Z, add corresponding TGeoElements
961 for (Int_t i=0; i<fNelements; i++) {
962 elemold = (TGeoElement*)fElements->At(i);
963 if (!elemold) {
964 // Add element with corresponding Z in the list
965 fElements->AddAt(elemold = table->GetElement((Int_t)fZmixture[i]), i);
966 elemold->SetDefined();
967 }
968 if (elemold == elem) {
969 fWeights[i] += weight;
970 exist = kTRUE;
971 }
972 }
973 if (!exist) {
975 AddElement(elem->A(), elem->Z(), weight);
976 } else {
978 }
979}
980
981////////////////////////////////////////////////////////////////////////////////
982/// Add a mixture element by number of atoms in the chemical formula.
983
985{
986 Int_t i,j;
987 Double_t amol;
988 TGeoElement *elemold;
990 if (!fElements) fElements = new TObjArray(128);
991 // Check if the element is already defined
992 for (i=0; i<fNelements; i++) {
993 elemold = (TGeoElement*)fElements->At(i);
994 if (!elemold) fElements->AddAt(table->GetElement((Int_t)fZmixture[i]), i);
995 else if (elemold != elem) continue;
996 if ((elem==elemold) ||
997 (TMath::Abs(elem->Z()-fZmixture[i])<1.e-6 && TMath::Abs(elem->A()-fAmixture[i])<1.e-6)) {
998 fNatoms[i] += natoms;
999 amol = 0.;
1000 for (j=0; j<fNelements; j++) amol += fAmixture[j]*fNatoms[j];
1001 for (j=0; j<fNelements; j++) fWeights[j] = fNatoms[j]*fAmixture[j]/amol;
1003 return;
1004 }
1005 }
1006 // New element
1007 if (!fNelements) {
1008 fZmixture = new Double_t[1];
1009 fAmixture = new Double_t[1];
1010 fWeights = new Double_t[1];
1011 fNatoms = new Int_t[1];
1012 } else {
1013 if (!fNatoms) {
1014 Fatal("AddElement", "Cannot add element by natoms in mixture %s after defining elements by weight",
1015 GetName());
1016 return;
1017 }
1018 Int_t nelements = fNelements+1;
1019 Double_t *zmixture = new Double_t[nelements];
1020 Double_t *amixture = new Double_t[nelements];
1021 Double_t *weights = new Double_t[nelements];
1022 Int_t *nnatoms = new Int_t[nelements];
1023 for (j=0; j<fNelements; j++) {
1024 zmixture[j] = fZmixture[j];
1025 amixture[j] = fAmixture[j];
1026 weights[j] = fWeights[j];
1027 nnatoms[j] = fNatoms[j];
1028 }
1029 delete [] fZmixture;
1030 delete [] fAmixture;
1031 delete [] fWeights;
1032 delete [] fNatoms;
1033 fZmixture = zmixture;
1034 fAmixture = amixture;
1035 fWeights = weights;
1036 fNatoms = nnatoms;
1037 }
1038 fNelements++;
1039 Int_t iel = fNelements-1;
1040 fZmixture[iel] = elem->Z();
1041 fAmixture[iel] = elem->A();
1042 fNatoms[iel] = natoms;
1043 fElements->AddAtAndExpand(elem, iel);
1044 amol = 0.;
1045 for (i=0; i<fNelements; i++) {
1046 if (fNatoms[i]<=0) return;
1047 amol += fAmixture[i]*fNatoms[i];
1048 }
1049 for (i=0; i<fNelements; i++) fWeights[i] = fNatoms[i]*fAmixture[i]/amol;
1050 table->GetElement(elem->Z())->SetDefined();
1052}
1053
1054////////////////////////////////////////////////////////////////////////////////
1055/// Define the mixture element at index iel by number of atoms in the chemical formula.
1056
1058{
1060 TGeoElement *elem = table->GetElement(z);
1061 if (!elem) {
1062 Fatal("DefineElement", "In mixture %s, element with Z=%i not found",GetName(),z);
1063 return;
1064 }
1065 AddElement(elem, natoms);
1066}
1067
1068////////////////////////////////////////////////////////////////////////////////
1069/// Retrieve the pointer to the element corresponding to component I.
1070
1072{
1073 if (i<0 || i>=fNelements) {
1074 Error("GetElement", "Mixture %s has only %d elements", GetName(), fNelements);
1075 return 0;
1076 }
1077 TGeoElement *elem = 0;
1078 if (fElements) elem = (TGeoElement*)fElements->At(i);
1079 if (elem) return elem;
1081 return table->GetElement(Int_t(fZmixture[i]));
1082}
1083
1084////////////////////////////////////////////////////////////////////////////////
1085/// Get specific activity (in Bq/gram) for the whole mixture (no argument) or
1086/// for a given component.
1087
1089{
1090 if (i>=0 && i<fNelements) return fWeights[i]*GetElement(i)->GetSpecificActivity();
1091 Double_t sa = 0;
1092 for (Int_t iel=0; iel<fNelements; iel++) {
1093 sa += fWeights[iel]*GetElement(iel)->GetSpecificActivity();
1094 }
1095 return sa;
1096}
1097
1098////////////////////////////////////////////////////////////////////////////////
1099/// Return true if the other material has the same physical properties
1100
1102{
1103 if (other->IsEqual(this)) return kTRUE;
1104 if (!other->IsMixture()) return kFALSE;
1105 TGeoMixture *mix = (TGeoMixture*)other;
1106 if (!mix) return kFALSE;
1107 if (fNelements != mix->GetNelements()) return kFALSE;
1108 if (TMath::Abs(fA-other->GetA())>1E-3) return kFALSE;
1109 if (TMath::Abs(fZ-other->GetZ())>1E-3) return kFALSE;
1110 if (TMath::Abs(fDensity-other->GetDensity())>1E-6) return kFALSE;
1111 if (GetCerenkovProperties() != other->GetCerenkovProperties()) return kFALSE;
1112// if (fRadLen != other->GetRadLen()) return kFALSE;
1113// if (fIntLen != other->GetIntLen()) return kFALSE;
1114 for (Int_t i=0; i<fNelements; i++) {
1115 if (TMath::Abs(fZmixture[i]-(mix->GetZmixt())[i])>1E-3) return kFALSE;
1116 if (TMath::Abs(fAmixture[i]-(mix->GetAmixt())[i])>1E-3) return kFALSE;
1117 if (TMath::Abs(fWeights[i]-(mix->GetWmixt())[i])>1E-3) return kFALSE;
1118 }
1119 return kTRUE;
1120}
1121
1122////////////////////////////////////////////////////////////////////////////////
1123/// print characteristics of this material
1124
1125void TGeoMixture::Print(const Option_t * /*option*/) const
1126{
1127 printf("Mixture %s %s Aeff=%g Zeff=%g rho=%g radlen=%g intlen=%g index=%i\n", GetName(), GetTitle(),
1129 for (Int_t i=0; i<fNelements; i++) {
1130 if (fElements && fElements->At(i)) {
1131 printf(" Element #%i : %s Z=%6.2f A=%6.2f w=%6.3f\n", i, GetElement(i)->GetName(), fZmixture[i],
1132 fAmixture[i], fWeights[i]);
1133 continue;
1134 }
1135 if (fNatoms) printf(" Element #%i : %s Z=%6.2f A=%6.2f w=%6.3f natoms=%d\n", i, GetElement(i)->GetName(),fZmixture[i],
1136 fAmixture[i], fWeights[i], fNatoms[i]);
1137 else printf(" Element #%i : %s Z=%6.2f A=%6.2f w=%6.3f\n", i, GetElement(i)->GetName(),fZmixture[i],
1138 fAmixture[i], fWeights[i]);
1139 }
1140}
1141
1142////////////////////////////////////////////////////////////////////////////////
1143/// Save a primitive as a C++ statement(s) on output stream "out".
1144
1145void TGeoMixture::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
1146{
1148 char *name = GetPointerName();
1149 out << "// Mixture: " << GetName() << std::endl;
1150 out << " nel = " << fNelements << ";" << std::endl;
1151 out << " density = " << fDensity << ";" << std::endl;
1152 out << " " << name << " = new TGeoMixture(\"" << GetName() << "\", nel,density);" << std::endl;
1153 for (Int_t i=0; i<fNelements; i++) {
1154 TGeoElement *el = GetElement(i);
1155 out << " a = " << fAmixture[i] << "; z = "<< fZmixture[i] << "; w = " << fWeights[i] << "; // " << el->GetName() << std::endl;
1156 out << " " << name << "->DefineElement(" << i << ",a,z,w);" << std::endl;
1157 }
1158 out << " " << name << "->SetIndex(" << GetIndex() << ");" << std::endl;
1160}
1161
1162////////////////////////////////////////////////////////////////////////////////
1163/// Create the mixture representing the decay product of this material at a
1164/// given time. The precision represent the minimum cumulative branching ratio for
1165/// which decay products are still taken into account.
1166
1168{
1169 TObjArray *pop = new TObjArray();
1170 FillMaterialEvolution(pop, precision);
1171 Int_t ncomp = pop->GetEntriesFast();
1172 if (!ncomp) return this;
1173 TGeoElement *elem;
1174 TGeoElementRN *el;
1175 Double_t *weight = new Double_t[ncomp];
1176 Double_t amed = 0.;
1177 Int_t i, j;
1178 for (i=0; i<ncomp; i++) {
1179 elem = (TGeoElement *)pop->At(i);
1180 if (!elem->IsRadioNuclide()) {
1181 j = fElements->IndexOf(elem);
1182 weight[i] = fWeights[j]*fAmixture[0]/fWeights[0];
1183 } else {
1184 el = (TGeoElementRN*)elem;
1185 weight[i] = el->Ratio()->Concentration(time) * el->A();
1186 }
1187 amed += weight[i];
1188 }
1189 Double_t rho = fDensity * fWeights[0] * amed/fAmixture[0];
1190 TGeoMixture *mix = 0;
1191 Int_t ncomp1 = ncomp;
1192 for (i=0; i<ncomp; i++) {
1193 if ((weight[i]/amed)<precision) {
1194 amed -= weight[i];
1195 ncomp1--;
1196 }
1197 }
1198 if (ncomp1<2) {
1199 el = (TGeoElementRN *)pop->At(0);
1200 delete [] weight;
1201 delete pop;
1202 if (ncomp1==1) return new TGeoMaterial(TString::Format("%s-evol",GetName()), el, rho);
1203 return NULL;
1204 }
1205 mix = new TGeoMixture(TString::Format("%s-evol",GetName()), ncomp, rho);
1206 for (i=0; i<ncomp; i++) {
1207 weight[i] /= amed;
1208 if (weight[i]<precision) continue;
1209 el = (TGeoElementRN *)pop->At(i);
1210 mix->AddElement(el, weight[i]);
1211 }
1212 delete [] weight;
1213 delete pop;
1214 return mix;
1215}
1216
1217////////////////////////////////////////////////////////////////////////////////
1218/// Fills a user array with all the elements deriving from the possible
1219/// decay of the top elements composing the mixture. Each element contained
1220/// by `<population>` may be a radionuclide having a Bateman solution attached.
1221/// The precision represent the minimum cumulative branching ratio for
1222/// which decay products are still taken into account.
1223/// To visualize the time evolution of each decay product one can use:
1224/// ~~~ {.cpp}
1225/// TGeoElement *elem = population->At(index);
1226/// TGeoElementRN *elemrn = 0;
1227/// if (elem->IsRadioNuclide()) elemrn = (TGeoElementRN*)elem;
1228/// ~~~
1229/// One can get Ni/N1(t=0) at any moment of time. Ni is the number of atoms
1230/// of one of the decay products, N1(0) is the number of atoms of the first top
1231/// element at t=0.
1232/// ~~~ {.cpp}
1233/// Double_t fraction_weight = elemrn->Ratio()->Concentration(time);
1234/// ~~~
1235/// One can also display the time evolution of the fractional weight:
1236/// ~~~ {.cpp}
1237/// elemrn->Ratio()->Draw(option);
1238/// ~~~
1239
1241{
1242 if (population->GetEntriesFast()) {
1243 Error("FillMaterialEvolution", "Provide an empty array !");
1244 return;
1245 }
1247 TGeoElement *elem;
1248 TGeoElementRN *elemrn;
1249 TIter next(table->GetElementsRN());
1250 while ((elemrn=(TGeoElementRN*)next())) elemrn->ResetRatio();
1251 Double_t factor;
1252 for (Int_t i=0; i<fNelements; i++) {
1253 elem = GetElement(i);
1254 if (!elem->IsRadioNuclide()) {
1255 population->Add(elem);
1256 continue;
1257 }
1258 elemrn = (TGeoElementRN*)elem;
1259 factor = fWeights[i]*fAmixture[0]/(fWeights[0]*fAmixture[i]);
1260 elemrn->FillPopulation(population, precision, factor);
1261 }
1262}
1263
1264////////////////////////////////////////////////////////////////////////////////
1265/// static function
1266/// Compute screening factor for pair production and Bremsstrahlung
1267/// REFERENCE : EGS MANUAL SLAC 210 - UC32 - JUNE 78
1268/// FORMULA 2.7.22
1269
1271{
1272 const Double_t al183= 5.20948 , al1440 = 7.27239;
1273 Double_t alz = TMath::Log(z)/3.;
1274 Double_t factor = (al1440 - 2*alz) / (al183 - alz - TGeoMaterial::Coulomb(z));
1275 return factor;
1276}
1277
1278////////////////////////////////////////////////////////////////////////////////
1279/// Compute Derived Quantities as in Geant4
1280
1282{
1285
1287
1289
1290 // Formula taken from G4Material.cxx L312
1291 double sumweights = 0;
1292 for (Int_t i=0; i<fNelements; ++i) {
1293 sumweights += fWeights[i];
1295 }
1296 if (TMath::Abs(sumweights - 1) > 0.001)
1297 Warning("ComputeDerivedQuantities", "Mixture %s: sum of weights is: %g", GetName(), sumweights);
1300}
1301
1302
1303////////////////////////////////////////////////////////////////////////////////
1304/// Compute Radiation Length based on Geant4 formula
1305
1307{
1308 // Formula taken from G4Material.cxx L556
1309 Double_t radinv = 0.0 ;
1310 // GetfRadTsai is in units of cm2 due to <unit>::alpha_rcl2. Correction must be applied to end up in TGeo cm.
1312 for (Int_t i=0;i<fNelements;++i) {
1313 radinv += fVecNbOfAtomsPerVolume[i] * ((TGeoElement *)fElements->At(i))->GetfRadTsai() / denom;
1314 }
1315 fRadLen = (radinv <= 0.0 ? DBL_MAX : 1.0 / radinv);
1316 // fRadLen is in TGeo units. Apply conversion factor in requested length-units
1318}
1319
1320////////////////////////////////////////////////////////////////////////////////
1321/// Compute Nuclear Interaction Length based on Geant4 formula
1323{
1324 // Formula taken from G4Material.cxx L567
1325 constexpr Double_t lambda0 = 35. * TGeoUnit::g / TGeoUnit::cm2; // [g/cm^2]
1326 const Double_t twothird = 2.0/3.0;
1327 Double_t NILinv = 0.0;
1328 for (Int_t i=0; i<fNelements; ++i) {
1329 Int_t Z = static_cast<Int_t>(((TGeoElement *)fElements->At(i))->Z() + 0.5);
1330 Double_t A = ((TGeoElement*)fElements->At(i))->Neff();
1331 if(1 == Z) {
1332 NILinv += fVecNbOfAtomsPerVolume[i] * A;
1333 } else {
1334 NILinv += fVecNbOfAtomsPerVolume[i] * TMath::Exp(twothird * TMath::Log(A));
1335 }
1336 }
1337 NILinv *= TGeoUnit::amu / lambda0;
1338 fIntLen = (NILinv <= 0.0 ? DBL_MAX : 1.0 / NILinv);
1339 // fIntLen is in TGeo units. Apply conversion factor in requested length-units
1341}
#define a(i)
Definition RSha256.hxx:99
#define e(i)
Definition RSha256.hxx:103
int Int_t
Definition RtypesCore.h:45
const Bool_t kFALSE
Definition RtypesCore.h:92
double Double_t
Definition RtypesCore.h:59
const Bool_t kTRUE
Definition RtypesCore.h:91
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:364
char name[80]
Definition TGX11.cxx:110
R__EXTERN TGeoManager * gGeoManager
static const Double_t STP_temperature
static const Double_t STP_pressure
Fill Area Attributes class.
Definition TAttFill.h:19
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
This class is used in the process of reading and writing the GDML "matrix" tag.
Definition TGDMLMatrix.h:34
Double_t Concentration(Double_t time) const
Find concentration of the element at a given time.
Class representing a radionuclidevoid TGeoManager::SetDefaultRootUnits() { if ( fgDefaultUnits == kRo...
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.
TGeoBatemanSol * Ratio() const
void ResetRatio()
Clears the existing ratio.
Table of elements.
TGeoElement * GetElement(Int_t z)
TObjArray * GetElementsRN() const
Int_t GetNelements() const
Base class for chemical elements.
Definition TGeoElement.h:37
virtual Double_t GetSpecificActivity() const
Definition TGeoElement.h:84
Double_t A() const
Definition TGeoElement.h:76
void SetDefined(Bool_t flag=kTRUE)
Definition TGeoElement.h:90
virtual Bool_t IsRadioNuclide() const
Definition TGeoElement.h:87
Double_t Neff() const
Returns effective number of nucleons.
Int_t Z() const
Definition TGeoElement.h:73
void SetUsed(Bool_t flag=kTRUE)
Definition TGeoElement.h:91
ABC for user objects attached to TGeoVolume or TGeoNode.
virtual TGeoExtension * Grab()=0
virtual void Release() const =0
The manager class for any TGeo geometry.
Definition TGeoManager.h:45
static EDefaultUnits GetDefaultUnits()
TGeoElementTable * GetElementTable()
Returns material table. Creates it if not existing.
static void SetDefaultUnits(EDefaultUnits new_value)
Int_t AddMaterial(const TGeoMaterial *material)
Add a material to the list. Returns index of the material in list.
Double_t GetProperty(const char *name, Bool_t *error=nullptr) const
Get a user-defined property.
TGDMLMatrix * GetGDMLMatrix(const char *name) const
Get GDML matrix with a given name;.
TList * GetListOfMaterials() const
Base class describing materials.
virtual ~TGeoMaterial()
Destructor.
Double_t GetConstProperty(const char *property, Bool_t *error=nullptr) const
void SetUserExtension(TGeoExtension *ext)
Connect user-defined extension to the material.
char * GetPointerName() const
Provide a pointer name containing uid.
virtual TObject * GetCerenkovProperties() const
EGeoMaterialState fState
static Double_t ScreenFactor(Double_t z)
static function Compute screening factor for pair production and Bremsstrahlung REFERENCE : EGS MANUA...
const char * GetConstPropertyRef(const char *property) const
virtual Bool_t IsMixture() const
Double_t fPressure
void SetFWExtension(TGeoExtension *ext)
Connect framework defined extension to the material.
bool AddConstProperty(const char *property, const char *ref)
Double_t fTemperature
virtual void GetElementProp(Double_t &a, Double_t &z, Double_t &w, Int_t i=0)
Single interface to get element properties.
virtual void Print(const Option_t *option="") const
print characteristics of this material
virtual TGeoMaterial * DecayMaterial(Double_t time, Double_t precision=0.001)
Create the material representing the decay product of this material at a given time.
TList fProperties
bool AddProperty(const char *property, const char *ref)
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
Double_t fZ
void SetRadLen(Double_t radlen, Double_t intlen=0.)
Set radiation/absorption lengths.
TGeoElement * GetElement() const
Get a pointer to the element this material is made of.
virtual Bool_t IsEq(const TGeoMaterial *other) const
return true if the other material has the same physical properties
TGeoElement * GetBaseElement() const
const char * GetPropertyRef(const char *property) const
Double_t fA
TGDMLMatrix * GetProperty(const char *name) const
TObject * fCerenkov
Double_t fDensity
void SetUsed(Bool_t flag=kTRUE)
virtual void FillMaterialEvolution(TObjArray *population, Double_t precision=0.001)
Fills a user array with all the elements deriving from the possible decay of the top element composin...
Int_t GetIndex()
Retrieve material index in the list of materials.
Double_t fIntLen
TGeoExtension * fUserExtension
TList fConstProperties
TGeoElement * fElement
TGeoMaterial & operator=(const TGeoMaterial &)
assignment operator
TObject * fShader
TGeoExtension * GrabUserExtension() const
Get a copy of the user extension pointer.
Double_t fRadLen
TGeoExtension * GrabFWExtension() const
Get a copy of the framework extension pointer.
virtual Int_t GetDefaultColor() const
Get some default color related to this material.
TGeoMaterial()
Default constructor.
static Double_t Coulomb(Double_t z)
static function Compute Coulomb correction for pair production and Brem REFERENCE : EGS MANUAL SLAC 2...
virtual Double_t GetA() const
TGeoExtension * fFWExtension
Transient user-defined extension to materials.
virtual Double_t GetDensity() const
virtual Double_t GetZ() const
Mixtures of elements.
TObjArray * fElements
virtual TGeoElement * GetElement(Int_t i=0) const
Retrieve the pointer to the element corresponding to component I.
void ComputeNuclearInterLength()
Compute Nuclear Interaction Length based on Geant4 formula.
Double_t * GetZmixt() const
void AddElement(Double_t a, Double_t z, Double_t weight)
add an element to the mixture using fraction by weight Check if the element is already defined
Double_t * fZmixture
virtual Double_t GetSpecificActivity(Int_t i=-1) const
Get specific activity (in Bq/gram) for the whole mixture (no argument) or for a given component.
TGeoMixture()
Default constructor.
virtual ~TGeoMixture()
Destructor.
void ComputeDerivedQuantities()
Compute Derived Quantities as in Geant4.
virtual void Print(const Option_t *option="") const
print characteristics of this material
void ComputeRadiationLength()
Compute Radiation Length based on Geant4 formula.
Double_t * fVecNbOfAtomsPerVolume
virtual void FillMaterialEvolution(TObjArray *population, Double_t precision=0.001)
Fills a user array with all the elements deriving from the possible decay of the top elements composi...
Double_t * fAmixture
void AverageProperties()
Compute effective A/Z and radiation length.
Double_t * GetWmixt() const
virtual TGeoMaterial * DecayMaterial(Double_t time, Double_t precision=0.001)
Create the mixture representing the decay product of this material at a given time.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
virtual Int_t GetNelements() const
Int_t * fNatoms
virtual Bool_t IsEq(const TGeoMaterial *other) const
Return true if the other material has the same physical properties.
Double_t * fWeights
void DefineElement(Int_t iel, Double_t a, Double_t z, Double_t weight)
Double_t * GetAmixt() const
static Double_t Big()
Definition TGeoShape.h:88
A doubly linked list.
Definition TList.h:44
virtual void Add(TObject *obj)
Definition TList.h:87
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
Definition TList.cxx:578
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
Definition TList.cxx:357
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
TNamed()
Definition TNamed.h:36
TString fName
Definition TNamed.h:32
virtual const char * GetTitle() const
Returns title of object.
Definition TNamed.h:48
TNamed & operator=(const TNamed &rhs)
TNamed assignment operator.
Definition TNamed.cxx:51
virtual const char * GetName() const
Returns name of object.
Definition TNamed.h:47
An array of TObjects.
Definition TObjArray.h:37
Int_t IndexOf(const TObject *obj) const
Int_t GetEntriesFast() const
Definition TObjArray.h:64
virtual void AddAtAndExpand(TObject *obj, Int_t idx)
Add object at position idx.
void Add(TObject *obj)
Definition TObjArray.h:74
virtual void AddAt(TObject *obj, Int_t idx)
Add object at position ids.
TObject * At(Int_t idx) const
Definition TObjArray.h:166
virtual Bool_t IsEqual(const TObject *obj) const
Default equal comparison (objects are equal if they have the same address in memory).
Definition TObject.cxx:485
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:187
virtual UInt_t GetUniqueID() const
Return the unique object id.
Definition TObject.cxx:377
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition TObject.cxx:879
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:696
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:893
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
Definition TObject.cxx:921
virtual Int_t IndexOf(const TObject *obj) const
Return index of object in collection.
Basic string class.
Definition TString.h:136
TSubString Strip(EStripType s=kTrailing, char c=' ') const
Return a substring of self stripped at beginning and/or end.
Definition TString.cxx:1126
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:2331
static constexpr double fine_structure_const
static constexpr double cm2
static constexpr double Avogadro
static constexpr double cm
static constexpr double amu
static constexpr double cm
static constexpr double fine_structure_const
static constexpr double cm2
static constexpr double Avogadro
static constexpr double g
Double_t Exp(Double_t x)
Definition TMath.h:727
Double_t Log(Double_t x)
Definition TMath.h:760
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Definition TMath.h:735
Short_t Abs(Short_t d)
Definition TMathBase.h:120