Logo ROOT  
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 "TMaterial.h"
13 
14 #include "TBuffer.h"
15 #include "TGeometry.h"
16 
18 
19 /** \class TMaterial
20 \ingroup g3d
21 Manages a detector material. See class TGeometry
22 */
23 
24 ////////////////////////////////////////////////////////////////////////////////
25 /// Material default constructor.
26 
28 {
29  fA = 0;
30  fDensity = 0;
31  fInterLength = 0;
32  fNumber = 0;
33  fRadLength = 0;
34  fZ = 0;
35 }
36 
37 ////////////////////////////////////////////////////////////////////////////////
38 /// Material normal constructor.
39 
40 TMaterial::TMaterial(const char *name, const char *title, Float_t a, Float_t z, Float_t density)
41  :TNamed(name,title), TAttFill(0,1)
42 {
43  if (!gGeometry) gGeometry = new TGeometry("Geometry","Default Geometry");
44  fA = a;
45  fZ = z;
46  fDensity = density;
48  fRadLength = 0;
49  fInterLength = 0;
51 }
52 
53 ////////////////////////////////////////////////////////////////////////////////
54 /// Material normal constructor.
55 
56 TMaterial::TMaterial(const char *name, const char *title, Float_t a, Float_t z, Float_t density, Float_t radl, Float_t inter)
57  :TNamed(name,title), TAttFill(0,1)
58 {
59  if (!gGeometry) gGeometry = new TGeometry("Geometry","Default Geometry");
60  fA = a;
61  fZ = z;
62  fDensity = density;
64  fRadLength = radl;
65  fInterLength = inter;
67 }
68 
69 ////////////////////////////////////////////////////////////////////////////////
70 /// Material default destructor.
71 
73 {
75 
76 }
77 
78 ////////////////////////////////////////////////////////////////////////////////
79 /// Stream an object of class TMaterial.
80 
81 void TMaterial::Streamer(TBuffer &R__b)
82 {
83  UInt_t R__s, R__c;
84  if (R__b.IsReading()) {
85  Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
86  R__b.ClassBegin(TMaterial::IsA());
87  R__b.ClassMember("TNamed");
88  TNamed::Streamer(R__b);
89  R__b.ClassMember("fNumber", "Int_t");
90  R__b >> fNumber;
91  R__b.ClassMember("fA", "Float_t");
92  R__b >> fA;
93  R__b.ClassMember("fZ", "Float_t");
94  R__b >> fZ;
95  R__b.ClassMember("fDensity", "Float_t");
96  R__b >> fDensity;
97  if (R__v > 2) {
98  R__b.ClassMember("TAttFill");
99  TAttFill::Streamer(R__b);
100  R__b.ClassMember("fRadLength", "Float_t");
101  R__b >> fRadLength;
102  R__b.ClassMember("fInterLength", "Float_t");
103  R__b >> fInterLength;
104  } else {
105  fRadLength = 0;
106  fInterLength = 0;
107  }
108  R__b.ClassEnd(TMaterial::IsA());
109  R__b.CheckByteCount(R__s, R__c, TMaterial::IsA());
110  } else {
111  R__c = R__b.WriteVersion(TMaterial::IsA(), kTRUE);
112  R__b.ClassBegin(TMaterial::IsA());
113  R__b.ClassMember("TNamed");
114  TNamed::Streamer(R__b);
115  R__b.ClassMember("fNumber", "Int_t");
116  R__b << fNumber;
117  R__b.ClassMember("fA", "Float_t");
118  R__b << fA;
119  R__b.ClassMember("fZ", "Float_t");
120  R__b << fZ;
121  R__b.ClassMember("fDensity", "Float_t");
122  R__b << fDensity;
123  R__b.ClassMember("TAttFill");
124  TAttFill::Streamer(R__b);
125  R__b.ClassMember("fRadLength", "Float_t");
126  R__b << fRadLength;
127  R__b.ClassMember("fInterLength", "Float_t");
128  R__b << fInterLength;
129  R__b.ClassEnd(TMaterial::IsA());
130  R__b.SetByteCount(R__c, kTRUE);
131  }
132 }
TMaterial::fA
Float_t fA
Definition: TMaterial.h:37
TBuffer::ClassMember
virtual void ClassMember(const char *, const char *=0, Int_t=-1, Int_t=-1)=0
TMaterial::TMaterial
TMaterial()
Material default constructor.
Definition: TMaterial.cxx:27
TMaterial::fDensity
Float_t fDensity
Definition: TMaterial.h:39
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
Version_t
short Version_t
Definition: RtypesCore.h:65
TMaterial::fRadLength
Float_t fRadLength
Definition: TMaterial.h:40
TMaterial.h
TBuffer::WriteVersion
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE)=0
TBuffer::SetByteCount
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion=kFALSE)=0
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
TMaterial::~TMaterial
virtual ~TMaterial()
Material default destructor.
Definition: TMaterial.cxx:72
Float_t
float Float_t
Definition: RtypesCore.h:57
gGeometry
R__EXTERN TGeometry * gGeometry
Definition: TGeometry.h:158
TBuffer
Definition: TBuffer.h:43
TBuffer::CheckByteCount
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
TGeometry
Definition: TGeometry.h:39
TMaterial::fZ
Float_t fZ
Definition: TMaterial.h:38
TGeometry.h
TMaterial::fNumber
Int_t fNumber
Definition: TMaterial.h:36
TBuffer.h
a
auto * a
Definition: textangle.C:12
TMaterial
Definition: TMaterial.h:28
TNamed
Definition: TNamed.h:29
TBuffer::ClassBegin
virtual void ClassBegin(const TClass *, Version_t=-1)=0
UInt_t
unsigned int UInt_t
Definition: RtypesCore.h:46
THashList::Remove
TObject * Remove(TObject *obj)
Remove object from the list.
Definition: THashList.cxx:378
TBuffer::ReadVersion
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
TBuffer::ClassEnd
virtual void ClassEnd(const TClass *)=0
TBuffer::IsReading
Bool_t IsReading() const
Definition: TBuffer.h:86
TCollection::GetSize
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Definition: TCollection.h:182
TList::Add
virtual void Add(TObject *obj)
Definition: TList.h:87
name
char name[80]
Definition: TGX11.cxx:110
TAttFill
Definition: TAttFill.h:19
TGeometry::GetListOfMaterials
THashList * GetListOfMaterials() const
Definition: TGeometry.h:77
TMaterial::fInterLength
Float_t fInterLength
Definition: TMaterial.h:41