00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "TGeometry.h"
00013 #include "TMaterial.h"
00014
00015 ClassImp(TMaterial)
00016
00017
00018
00019
00020
00021
00022
00023 TMaterial::TMaterial()
00024 {
00025
00026
00027 fA = 0;
00028 fDensity = 0;
00029 fInterLength = 0;
00030 fNumber = 0;
00031 fRadLength = 0;
00032 fZ = 0;
00033 }
00034
00035
00036
00037 TMaterial::TMaterial(const char *name, const char *title, Float_t a, Float_t z, Float_t density)
00038 :TNamed(name,title), TAttFill(0,1)
00039 {
00040
00041
00042 if (!gGeometry) gGeometry = new TGeometry("Geometry","Default Geometry");
00043 fA = a;
00044 fZ = z;
00045 fDensity = density;
00046 fNumber = gGeometry->GetListOfMaterials()->GetSize();
00047 fRadLength = 0;
00048 fInterLength = 0;
00049 gGeometry->GetListOfMaterials()->Add(this);
00050 }
00051
00052
00053
00054 TMaterial::TMaterial(const char *name, const char *title, Float_t a, Float_t z, Float_t density, Float_t radl, Float_t inter)
00055 :TNamed(name,title), TAttFill(0,1)
00056 {
00057
00058
00059 if (!gGeometry) gGeometry = new TGeometry("Geometry","Default Geometry");
00060 fA = a;
00061 fZ = z;
00062 fDensity = density;
00063 fNumber = gGeometry->GetListOfMaterials()->GetSize();
00064 fRadLength = radl;
00065 fInterLength = inter;
00066 gGeometry->GetListOfMaterials()->Add(this);
00067 }
00068
00069
00070
00071 TMaterial::~TMaterial()
00072 {
00073
00074
00075 if (gGeometry) gGeometry->GetListOfMaterials()->Remove(this);
00076
00077 }
00078
00079
00080
00081 void TMaterial::Streamer(TBuffer &R__b)
00082 {
00083
00084
00085 UInt_t R__s, R__c;
00086 if (R__b.IsReading()) {
00087 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
00088 TNamed::Streamer(R__b);
00089 R__b >> fNumber;
00090 R__b >> fA;
00091 R__b >> fZ;
00092 R__b >> fDensity;
00093 if (R__v > 2) {
00094 TAttFill::Streamer(R__b);
00095 R__b >> fRadLength;
00096 R__b >> fInterLength;
00097 } else {
00098 fRadLength = 0;
00099 fInterLength = 0;
00100 }
00101 R__b.CheckByteCount(R__s, R__c, TMaterial::IsA());
00102 } else {
00103 R__c = R__b.WriteVersion(TMaterial::IsA(), kTRUE);
00104 TNamed::Streamer(R__b);
00105 R__b << fNumber;
00106 R__b << fA;
00107 R__b << fZ;
00108 R__b << fDensity;
00109 TAttFill::Streamer(R__b);
00110 R__b << fRadLength;
00111 R__b << fInterLength;
00112 R__b.SetByteCount(R__c, kTRUE);
00113 }
00114 }