#include "TGeometry.h"
#include "TMaterial.h"
ClassImp(TMaterial)
TMaterial::TMaterial()
{
fA = 0;
fDensity = 0;
fInterLength = 0;
fNumber = 0;
fRadLength = 0;
fZ = 0;
}
TMaterial::TMaterial(const char *name, const char *title, Float_t a, Float_t z, Float_t density)
:TNamed(name,title), TAttFill(0,1)
{
if (!gGeometry) gGeometry = new TGeometry("Geometry","Default Geometry");
fA = a;
fZ = z;
fDensity = density;
fNumber = gGeometry->GetListOfMaterials()->GetSize();
fRadLength = 0;
fInterLength = 0;
gGeometry->GetListOfMaterials()->Add(this);
}
TMaterial::TMaterial(const char *name, const char *title, Float_t a, Float_t z, Float_t density, Float_t radl, Float_t inter)
:TNamed(name,title), TAttFill(0,1)
{
if (!gGeometry) gGeometry = new TGeometry("Geometry","Default Geometry");
fA = a;
fZ = z;
fDensity = density;
fNumber = gGeometry->GetListOfMaterials()->GetSize();
fRadLength = radl;
fInterLength = inter;
gGeometry->GetListOfMaterials()->Add(this);
}
TMaterial::~TMaterial()
{
if (gGeometry) gGeometry->GetListOfMaterials()->Remove(this);
}
void TMaterial::Streamer(TBuffer &R__b)
{
UInt_t R__s, R__c;
if (R__b.IsReading()) {
Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
TNamed::Streamer(R__b);
R__b >> fNumber;
R__b >> fA;
R__b >> fZ;
R__b >> fDensity;
if (R__v > 2) {
TAttFill::Streamer(R__b);
R__b >> fRadLength;
R__b >> fInterLength;
} else {
fRadLength = 0;
fInterLength = 0;
}
R__b.CheckByteCount(R__s, R__c, TMaterial::IsA());
} else {
R__c = R__b.WriteVersion(TMaterial::IsA(), kTRUE);
TNamed::Streamer(R__b);
R__b << fNumber;
R__b << fA;
R__b << fZ;
R__b << fDensity;
TAttFill::Streamer(R__b);
R__b << fRadLength;
R__b << fInterLength;
R__b.SetByteCount(R__c, kTRUE);
}
}