Logo ROOT   6.08/07
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  TNamed::Streamer(R__b);
87  R__b >> fNumber;
88  R__b >> fA;
89  R__b >> fZ;
90  R__b >> fDensity;
91  if (R__v > 2) {
92  TAttFill::Streamer(R__b);
93  R__b >> fRadLength;
94  R__b >> fInterLength;
95  } else {
96  fRadLength = 0;
97  fInterLength = 0;
98  }
99  R__b.CheckByteCount(R__s, R__c, TMaterial::IsA());
100  } else {
101  R__c = R__b.WriteVersion(TMaterial::IsA(), kTRUE);
102  TNamed::Streamer(R__b);
103  R__b << fNumber;
104  R__b << fA;
105  R__b << fZ;
106  R__b << fDensity;
107  TAttFill::Streamer(R__b);
108  R__b << fRadLength;
109  R__b << fInterLength;
110  R__b.SetByteCount(R__c, kTRUE);
111  }
112 }
Bool_t IsReading() const
Definition: TBuffer.h:83
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:42
TMaterial()
Material default constructor.
Definition: TMaterial.cxx:27
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
THashList * GetListOfMaterials() const
Definition: TGeometry.h:81
Fill Area Attributes class.
Definition: TAttFill.h:24
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
Int_t fNumber
Definition: TMaterial.h:34
TObject * Remove(TObject *obj)
Remove object from the list.
Definition: THashList.cxx:285
unsigned int UInt_t
Definition: RtypesCore.h:42
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion=kFALSE)=0
#define ClassImp(name)
Definition: Rtypes.h:279
Float_t fA
Definition: TMaterial.h:35
you should not use this method at all Int_t Int_t z
Definition: TRolke.cxx:630
virtual void Add(TObject *obj)
Definition: TList.h:81
virtual Int_t GetSize() const
Definition: TCollection.h:95
virtual ~TMaterial()
Material default destructor.
Definition: TMaterial.cxx:72
const Bool_t kTRUE
Definition: Rtypes.h:91
R__EXTERN TGeometry * gGeometry
Definition: TGeometry.h:162
Float_t fRadLength
Definition: TMaterial.h:38
char name[80]
Definition: TGX11.cxx:109
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0