# Re: [ROOT] TGeoMixture: how to define with the proportion by number of atoms?

From: Andrei Gheata (Andrei.Gheata@cern.ch)
Date: Thu Oct 14 2004 - 11:43:55 MEST

```Hi Yuri,

Implemented in CVS. You can do:

{
Int_t z, iel, natoms;
Double_t density = 1.39;
TGeoMixture *mat4 = new TGeoMixture("MYLAR",3,density);

mat4->DefineElement(iel=0, z=6, natoms=10);
mat4->DefineElement(iel=1, z=1, natoms=8);
mat4->DefineElement(iel=2, z=8, natoms=4);

mat4->Print();
}

You get:

Mixture MYLAR    Aeff=8.73491 Zeff=4.54545 rho=1.39 radlen=32.2432 index=0
Element #0 : Z=  6.00 A= 12.01 w=  0.45
Element #1 : Z=  1.00 A=  1.01 w=  0.36
Element #2 : Z=  8.00 A= 16.00 w=  0.18

So you do not have to define elements youself.

Andrei

Y. Shitov wrote:

>Hi, ROOT team,
>
>Is it possible to implement GEANT-3 GSMIXT() NLMAT-like option in
>TGeoMixture?
>
>-----------------from GEANT-3 doc----------->
>CALL GSMIXT (IMATE,NAMATE,A,Z,DENS,NLMAT,WMAT*)
>...
>NLMAT -  number of elements in the mixture;
>	 > 0 WMAT contains the proportion by weights of each material in
>		  the mixture;
>	 < 0 WMAT contains the proportion by number of atoms of each kind,
>		  the content of WMAT in output is changed to contain the relative
>		  weights;
>-----------------from GEANT-3 doc----------->
>
>I think it will be suitable to define materials according to its
>chemical formulas like:
>
>TGeoElement* O = new TGeoElement ("O","Oxygen",15.9994,8,);
>TGeoElement* C = new TGeoElement ("C","Carbon",12.0107,6,);
>TGeoElement* H = new TGeoElement ("H","Hydrogen",1.00794,1);
>
>// Mylar wrapper C10H8O4
>TGeoMixture *mat4 = new TGeoMixture("MYLAR",3,dmyl);
>mat4->SetUniqueID(   4);
>mat4->DefineElement(C,-10.);
>mat4->DefineElement(H,-8.);
>mat4->DefineElement(O,-4.);
>
>Best,
>Yuri
>
>
>
>
```

This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:09 MET