Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
21Manages 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
40TMaterial::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
56TMaterial::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
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);
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");
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);
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}
#define a(i)
Definition RSha256.hxx:99
short Version_t
Definition RtypesCore.h:65
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
#define ClassImp(name)
Definition Rtypes.h:377
char name[80]
Definition TGX11.cxx:110
R__EXTERN TGeometry * gGeometry
Definition TGeometry.h:158
Fill Area Attributes class.
Definition TAttFill.h:19
virtual void Streamer(TBuffer &)
Buffer base class used for serializing objects.
Definition TBuffer.h:43
virtual Version_t ReadVersion(UInt_t *start=nullptr, UInt_t *bcnt=nullptr, const TClass *cl=nullptr)=0
virtual void ClassBegin(const TClass *, Version_t=-1)=0
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion=kFALSE)=0
virtual void ClassEnd(const TClass *)=0
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
virtual void ClassMember(const char *, const char *=nullptr, Int_t=-1, Int_t=-1)=0
Bool_t IsReading() const
Definition TBuffer.h:86
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE)=0
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
TGeometry description.
Definition TGeometry.h:39
THashList * GetListOfMaterials() const
Definition TGeometry.h:77
TObject * Remove(TObject *obj) override
Remove object from the list.
void Add(TObject *obj) override
Definition TList.h:83
Manages a detector material.
Definition TMaterial.h:28
TMaterial()
Material default constructor.
Definition TMaterial.cxx:27
Float_t fZ
Definition TMaterial.h:32
Float_t fA
Definition TMaterial.h:31
Int_t fNumber
Definition TMaterial.h:30
void Streamer(TBuffer &) override
Stream an object of class TMaterial.
Definition TMaterial.cxx:81
Float_t fInterLength
Definition TMaterial.h:35
TClass * IsA() const override
Definition TMaterial.h:49
~TMaterial() override
Material default destructor.
Definition TMaterial.cxx:72
Float_t fDensity
Definition TMaterial.h:33
Float_t fRadLength
Definition TMaterial.h:34
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
void Streamer(TBuffer &) override
Stream an object of class TObject.