ROOT  6.06/09
Reference Guide
TMaterial.cxx
Go to the documentation of this file.
1 // @(#)root/g3d:$Id$
2 // Author: Rene Brun 03/10/95
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #include "TGeometry.h"
13 #include "TMaterial.h"
14 
16 
17 /** \class TMaterial
18 \ingroup g3d
19 Manages a detector material. See class TGeometry
20 */
21 
22 ////////////////////////////////////////////////////////////////////////////////
23 /// Material default constructor.
24 
26 {
27  fA = 0;
28  fDensity = 0;
29  fInterLength = 0;
30  fNumber = 0;
31  fRadLength = 0;
32  fZ = 0;
33 }
34 
35 ////////////////////////////////////////////////////////////////////////////////
36 /// Material normal constructor.
37 
38 TMaterial::TMaterial(const char *name, const char *title, Float_t a, Float_t z, Float_t density)
39  :TNamed(name,title), TAttFill(0,1)
40 {
41  if (!gGeometry) gGeometry = new TGeometry("Geometry","Default Geometry");
42  fA = a;
43  fZ = z;
44  fDensity = density;
45  fNumber = gGeometry->GetListOfMaterials()->GetSize();
46  fRadLength = 0;
47  fInterLength = 0;
49 }
50 
51 ////////////////////////////////////////////////////////////////////////////////
52 /// Material normal constructor.
53 
54 TMaterial::TMaterial(const char *name, const char *title, Float_t a, Float_t z, Float_t density, Float_t radl, Float_t inter)
55  :TNamed(name,title), TAttFill(0,1)
56 {
57  if (!gGeometry) gGeometry = new TGeometry("Geometry","Default Geometry");
58  fA = a;
59  fZ = z;
60  fDensity = density;
61  fNumber = gGeometry->GetListOfMaterials()->GetSize();
62  fRadLength = radl;
63  fInterLength = inter;
65 }
66 
67 ////////////////////////////////////////////////////////////////////////////////
68 /// Material default destructor.
69 
71 {
73 
74 }
75 
76 ////////////////////////////////////////////////////////////////////////////////
77 /// Stream an object of class TMaterial.
78 
79 void TMaterial::Streamer(TBuffer &R__b)
80 {
81  UInt_t R__s, R__c;
82  if (R__b.IsReading()) {
83  Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
84  TNamed::Streamer(R__b);
85  R__b >> fNumber;
86  R__b >> fA;
87  R__b >> fZ;
88  R__b >> fDensity;
89  if (R__v > 2) {
90  TAttFill::Streamer(R__b);
91  R__b >> fRadLength;
92  R__b >> fInterLength;
93  } else {
94  fRadLength = 0;
95  fInterLength = 0;
96  }
97  R__b.CheckByteCount(R__s, R__c, TMaterial::IsA());
98  } else {
99  R__c = R__b.WriteVersion(TMaterial::IsA(), kTRUE);
100  TNamed::Streamer(R__b);
101  R__b << fNumber;
102  R__b << fA;
103  R__b << fZ;
104  R__b << fDensity;
105  TAttFill::Streamer(R__b);
106  R__b << fRadLength;
107  R__b << fInterLength;
108  R__b.SetByteCount(R__c, kTRUE);
109  }
110 }
Bool_t IsReading() const
Definition: TBuffer.h:81
short Version_t
Definition: RtypesCore.h:61
Float_t fZ
Definition: TMaterial.h:36
float Float_t
Definition: RtypesCore.h:53
Buffer base class used for serializing objects.
Definition: TBuffer.h:40
Float_t fDensity
Definition: TMaterial.h:37
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
TArc * a
Definition: textangle.C:12
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE)=0
Float_t fInterLength
Definition: TMaterial.h:39
Fill Area Attributes class.
Definition: TAttFill.h:32
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
Manages a detector material.
Definition: TMaterial.h:32
TGeometry description.
Definition: TGeometry.h:43
THashList * GetListOfMaterials() const
Definition: TGeometry.h:81
Int_t fNumber
Definition: TMaterial.h:34
TObject * Remove(TObject *obj)
Remove object from the list.
Definition: THashList.cxx:284
TClass * IsA() const
unsigned int UInt_t
Definition: RtypesCore.h:42
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion=kFALSE)=0
virtual Int_t GetSize() const
Definition: TCollection.h:95
#define ClassImp(name)
Definition: Rtypes.h:279
Float_t fA
Definition: TMaterial.h:35
#define name(a, b)
Definition: linkTestLib0.cpp:5
virtual void Add(TObject *obj)
Definition: TList.h:81
virtual ~TMaterial()
Material default destructor.
Definition: TMaterial.cxx:70
const Bool_t kTRUE
Definition: Rtypes.h:91
R__EXTERN TGeometry * gGeometry
Definition: TGeometry.h:162
Float_t fRadLength
Definition: TMaterial.h:38
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0