Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CCalAMaterial Class Reference

#include <CCalAMaterial.hh>

Inheritance diagram for CCalAMaterial:
Collaboration diagram for CCalAMaterial:

Public Member Functions

 CCalAMaterial (G4String mat, double dens, int nelem, CCalAMaterial **constituents, double *weights)
 
 CCalAMaterial (G4String elemat, double Aeff, double dens)
 
 CCalAMaterial (const CCalAMaterial &)
 
virtual ~CCalAMaterial ()
 
G4double Aeff () const
 
CCalAMaterialoperator= (const CCalAMaterial &)
 
- Public Member Functions inherited from CCalMaterial
 CCalMaterial (G4String mat, double dens, int nelem, CCalMaterial **constituents, double *weights, FractionType=FTWeight)
 
 CCalMaterial (const CCalMaterial &)
 
virtual ~CCalMaterial ()
 
G4String Name () const
 
double Density () const
 
int NElements () const
 
G4String Element (int i) const
 
double Weight (int i) const
 
G4bool operator== (const CCalMaterial &) const
 
G4bool operator!= (const CCalMaterial &) const
 
CCalMaterialoperator= (const CCalMaterial &)
 

Protected Member Functions

void computeAeff (G4int nconst, CCalAMaterial **constituents, double *weights)
 
- Protected Member Functions inherited from CCalMaterial
 CCalMaterial ()
 
void computeDensity (int nconst, CCalMaterial **constituents, double *weights, FractionType ft)
 
void closeMaterial ()
 

Protected Attributes

double aEff
 
- Protected Attributes inherited from CCalMaterial
G4String name
 
double density
 
int nElem
 
G4StringtheElements
 
double * theWeights
 

Friends

std::ostream & operator<< (std::ostream &, const CCalAMaterial &)
 

Additional Inherited Members

- Public Types inherited from CCalMaterial
enum  FractionType { FTWeight, FTVolume }
 

Detailed Description

Definition at line 38 of file CCalAMaterial.hh.

Constructor & Destructor Documentation

CCalAMaterial::CCalAMaterial ( G4String  mat,
double  dens,
int  nelem,
CCalAMaterial **  constituents,
double *  weights 
)

Definition at line 33 of file CCalAMaterial.cc.

34  {
35  name=mat;
36  nElem=0;
37  int i=0;
38  for (i=0; i<nconst; i++)
39  nElem += (constituents[i]->NElements());
40 
41  theElements = new G4String[nElem];
42  theWeights = new double[nElem];
43 
44  double factor;
45  int nelem=0;
46  for (i=0; i<nconst; i++) {
47  factor=constituents[i]->Aeff();
48  for (int j=0; j<constituents[i]->NElements(); j++) {
49  theElements[nelem] = constituents[i]->Element(j);
50  theWeights[nelem] = constituents[i]->Weight(j)* weights[i] * factor;
51  nelem++;
52  }
53  }
54 
55  if (dens>0)
56  density=dens;
57  else //Let's compute density
58  computeDensity(nconst,(CCalMaterial**)constituents, weights, FTVolume);
59 
60  computeAeff(nconst, constituents, weights);
61  closeMaterial();
62 }
int NElements() const
Definition: CCalMaterial.hh:53
const XML_Char * name
Definition: expat.h:151
double Weight(int i) const
Definition: CCalMaterial.hh:55
void computeAeff(G4int nconst, CCalAMaterial **constituents, double *weights)
G4String * theElements
Definition: CCalMaterial.hh:73
void computeDensity(int nconst, CCalMaterial **constituents, double *weights, FractionType ft)
Definition: CCalMaterial.cc:84
G4String Element(int i) const
Definition: CCalMaterial.hh:54
G4double Aeff() const
void closeMaterial()
double density
Definition: CCalMaterial.hh:71
double * theWeights
Definition: CCalMaterial.hh:74

Here is the call graph for this function:

CCalAMaterial::CCalAMaterial ( G4String  elemat,
double  Aeff,
double  dens 
)

Definition at line 64 of file CCalAMaterial.cc.

64  {
65  name=elemat;
66  density=dens;
67  nElem=1;
68  theElements = new G4String[nElem];
69  theWeights = new double[nElem];
70 
71  theElements[0] = elemat;
72  theWeights[0] = 1;
73 
74  aEff=eff;
75 }
const XML_Char * name
Definition: expat.h:151
G4String * theElements
Definition: CCalMaterial.hh:73
double density
Definition: CCalMaterial.hh:71
double * theWeights
Definition: CCalMaterial.hh:74
CCalAMaterial::CCalAMaterial ( const CCalAMaterial mat)

Definition at line 81 of file CCalAMaterial.cc.

82  : CCalMaterial( mat ) {
83  name = mat.name;
84  density = mat.density;
85  nElem = mat.nElem;
86  theElements = new G4String[nElem];
87  theWeights = new double[nElem];
88  for (int i=0; i<nElem; i++){
89  theElements[i]=mat.theElements[i];
90  theWeights[i]=mat.theWeights[i];
91  }
92 }
const XML_Char * name
Definition: expat.h:151
G4String name
Definition: CCalMaterial.hh:70
G4String * theElements
Definition: CCalMaterial.hh:73
double density
Definition: CCalMaterial.hh:71
double * theWeights
Definition: CCalMaterial.hh:74
CCalAMaterial::~CCalAMaterial ( )
virtual

Definition at line 77 of file CCalAMaterial.cc.

77  {
78  //The base class destructor is called?
79 }

Member Function Documentation

G4double CCalAMaterial::Aeff ( ) const
inline

Definition at line 51 of file CCalAMaterial.hh.

51 {return aEff;}

Here is the caller graph for this function:

void CCalAMaterial::computeAeff ( G4int  nconst,
CCalAMaterial **  constituents,
double *  weights 
)
protected

Definition at line 114 of file CCalAMaterial.cc.

116  {
117  aEff=0;
118  for (int i=0; i<nconst; i++)
119  aEff += weights[i] * constituents[i]->Aeff();
120 }
G4double Aeff() const

Here is the call graph for this function:

Here is the caller graph for this function:

CCalAMaterial & CCalAMaterial::operator= ( const CCalAMaterial mat)

Definition at line 94 of file CCalAMaterial.cc.

94  {
95  if(theElements)
96  delete[] theElements;
97  if(theWeights)
98  delete[] theWeights;
99 
100  name=mat.name;
101  density=mat.density;
102  nElem=mat.nElem;
103  aEff=mat.aEff;
104 
105  theElements = new G4String[nElem];
106  theWeights = new double[nElem];
107  for (int i=0; i<nElem; i++){
108  theElements[i]=mat.theElements[i];
109  theWeights[i]=mat.theWeights[i];
110  }
111  return *this;
112 }
const XML_Char * name
Definition: expat.h:151
G4String name
Definition: CCalMaterial.hh:70
G4String * theElements
Definition: CCalMaterial.hh:73
double density
Definition: CCalMaterial.hh:71
double * theWeights
Definition: CCalMaterial.hh:74

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const CCalAMaterial mat 
)
friend

Definition at line 122 of file CCalAMaterial.cc.

122  {
123  os << mat.name << G4endl;
124  os << "Density= " << mat.density << " g/cm3. Number of Elements: "
125  << mat.nElem
126  << ". Aeff= " << mat.aEff << G4endl;
127  for (int i=0; i<mat.nElem; i++)
128  os << '\t' << mat.theElements[i] << '\t' << mat.theWeights[i] << G4endl;
129  return os;
130 }
G4String name
Definition: CCalMaterial.hh:70
G4String * theElements
Definition: CCalMaterial.hh:73
#define G4endl
Definition: G4ios.hh:61
double density
Definition: CCalMaterial.hh:71
double * theWeights
Definition: CCalMaterial.hh:74

Member Data Documentation

double CCalAMaterial::aEff
protected

Definition at line 59 of file CCalAMaterial.hh.


The documentation for this class was generated from the following files: