TMaterial.cxx

Go to the documentation of this file.
00001 // @(#)root/g3d:$Id: TMaterial.cxx 31811 2009-12-10 15:45:31Z couet $
00002 // Author: Rene Brun   03/10/95
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #include "TGeometry.h"
00013 #include "TMaterial.h"
00014 
00015 ClassImp(TMaterial)
00016 
00017 //______________________________________________________________________________
00018 //
00019 // Manages a detector material. See class TGeometry
00020 //
00021 
00022 //______________________________________________________________________________
00023 TMaterial::TMaterial()
00024 {
00025    // Material default constructor.
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    // Material normal constructor.
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    // Material normal constructor.
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    // Material default destructor.
00074 
00075    if (gGeometry) gGeometry->GetListOfMaterials()->Remove(this);
00076 
00077 }
00078 
00079 
00080 //______________________________________________________________________________
00081 void TMaterial::Streamer(TBuffer &R__b)
00082 {
00083    // Stream an object of class TMaterial.
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 }

Generated on Tue Jul 5 14:16:40 2011 for ROOT_528-00b_version by  doxygen 1.5.1