]> git.uio.no Git - u/mrichter/AliRoot.git/blob - GEODB/AliGMaterial.cxx
New Makefile containing AliPHOSv0hits class
[u/mrichter/AliRoot.git] / GEODB / AliGMaterial.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /*
17 $Log$
18 */
19
20 // -*- C++ -*-
21 // 
22 // 1998/10/19
23 // ---------------------------------------------------------------------------
24 //
25 // AliGMaterial Class
26 //
27 // This file is part of the ALICE Geometry Database .
28 //
29 // Author:  Joana E. Santo
30 //
31 // ---------------------------------------------------------------------------
32
33 #include "AliGMaterial.h"
34
35 ClassImp(AliGMaterial)
36
37
38 //-------------------------------------------------------------------------
39
40 AliGMaterial::AliGMaterial( Int_t imat, Text_t* name, Text_t* title, Int_t isvol, Int_t ifield, Float_t fieldm, Float_t tmaxfd, Float_t stemax, Float_t deemax, Float_t epsil, Float_t stmin, Float_t* ubuf, Int_t nbuf, Float_t a, Float_t z, Float_t dens, Float_t radl, Float_t absl, Float_t* buf, Int_t nwbuf ) : TNamed(name, title)
41 {
42     /* VIC: Very Important Constructor */
43
44     fImat   = imat;
45     fIsvol  = isvol;
46     fIfield = ifield;
47     fFieldm = fieldm;
48     fTmaxfd = tmaxfd;
49     fStemax = stemax;
50     fDeemax = deemax;
51     fEpsil  = epsil;
52     fStmin  = stmin;
53
54     fUbuf   = new Float_t[nbuf];
55     
56     for( int i=0; i<nbuf; i++ )
57         fUbuf[i] = ubuf[i];
58         
59     fNbuf   = nbuf;
60     fA      = a;
61     fZ      = z;
62     fDens   = dens;
63     fRadl   = radl;
64     fAbsl   = absl;
65     
66     fBuf    = new Float_t[nwbuf];
67
68     for( int j=0; j<nwbuf; j++ )
69         fBuf[j] = buf[j];
70         
71     fNwbuf  = nwbuf;
72 }
73
74 //-------------------------------------------------------------------------
75
76 AliGMaterial::AliGMaterial(Text_t* name, Text_t* title, Float_t A, Float_t Z, Float_t rho) : TNamed(name, title)
77 {
78     /* Constructor */
79     fA   = A;
80     fRho = rho;
81     fZ   = Z;
82 }
83
84 //-------------------------------------------------------------------------
85
86 AliGMaterial::AliGMaterial( AliGMaterial* Mat )
87 {
88     /* Copy Constructor */
89     if( Mat ) {
90         fImat   = Mat->fImat;
91         fIsvol  = Mat->fIsvol;
92         fIfield = Mat->fIfield;
93         fFieldm = Mat->fFieldm;
94         fTmaxfd = Mat->fTmaxfd;
95         fStemax = Mat->fStemax;
96         fDeemax = Mat->fDeemax;
97         fEpsil  = Mat->fEpsil;
98         fStmin  = Mat->fStmin;
99
100         fUbuf   = new Float_t[Mat->fNbuf];
101     
102         for( int i=0; i<Mat->fNbuf; i++ )
103             fUbuf[i] = Mat->fUbuf[i];
104         
105         fNbuf   = Mat->fNbuf;
106         fA      = Mat->fA;
107         fZ      = Mat->fZ;
108         fDens   = Mat->fDens;
109         fRadl   = Mat->fRadl;
110         fAbsl   = Mat->fAbsl;
111     
112         fBuf    = new Float_t[Mat->fNwbuf];
113
114         for( int j=0; j<Mat->fNwbuf; j++ )
115             fBuf[j] = Mat->fBuf[j];
116         
117         fNwbuf  = Mat->fNwbuf;
118
119         fName  = Mat->GetName();
120         fTitle = Mat->GetTitle();
121     }
122     else {
123         /* Default Constructor */
124         fImat   = 0;
125         fIsvol  = 0;
126         fIfield = 0;
127         fFieldm = 0.;
128         fTmaxfd = 0.;
129         fStemax = 0.;
130         fDeemax = 0.;
131         fEpsil  = 0.;
132         fStmin  = 0.;
133
134         fUbuf   = NULL;
135         
136         fNbuf   = 0;
137         fA      = 0.;
138         fZ      = 0.;
139         fDens   = 0.;
140         fRadl   = 0.;
141         fAbsl   = 0.;
142     
143         fBuf    = NULL;
144
145         fNwbuf  = 0;
146
147         fName  = "";
148         fTitle = "";
149     }
150 }
151
152 //-------------------------------------------------------------------------
153
154 AliGMaterial::~AliGMaterial()
155 {   /* Destructor */
156
157     if( fUbuf ) delete [] fUbuf;
158     if( fBuf  ) delete [] fBuf;
159 }
160
161 //-------------------------------------------------------------------------
162
163 AliGMaterial* AliGMaterial::operator=( const AliGMaterial* Mat )
164 {
165     /* Operator = */
166     if( this == Mat ) return this; // special case.
167
168     fA     = Mat->fA;
169     fName  = Mat->GetName();
170     fRho   = Mat->fRho;
171     fTitle = Mat->GetTitle();
172     fZ     = Mat->fZ;
173
174     return this;
175 }
176
177 //-------------------------------------------------------------------------
178
179 void AliGMaterial::Streamer(TBuffer &R__b)
180 {
181    // Stream an object of class AliGMaterial.
182
183    if (R__b.IsReading()) {
184       Version_t R__v = R__b.ReadVersion(); if (R__v) { }
185       TNamed::Streamer(R__b);
186       R__b >> fImat;
187       R__b >> fIsvol;
188       R__b >> fIfield;
189       R__b >> fFieldm;
190       R__b >> fTmaxfd;
191       R__b >> fStemax;
192       R__b >> fDeemax;
193       R__b >> fEpsil;
194       R__b >> fStmin;
195       R__b.ReadArray(fUbuf); //
196       R__b >> fNbuf;
197       R__b >> fA;
198       R__b >> fZ;
199       R__b >> fDens;
200       R__b >> fRadl;
201       R__b >> fAbsl;
202       R__b.ReadArray(fBuf); //
203       R__b >> fNwbuf;
204       R__b >> fRho;
205    } else {
206       R__b.WriteVersion(AliGMaterial::IsA());
207       TNamed::Streamer(R__b);
208       R__b << fImat;
209       R__b << fIsvol;
210       R__b << fIfield;
211       R__b << fFieldm;
212       R__b << fTmaxfd;
213       R__b << fStemax;
214       R__b << fDeemax;
215       R__b << fEpsil;
216       R__b << fStmin;
217       R__b.WriteArray(fUbuf, fNbuf); //
218       R__b << fNbuf;
219       R__b << fA;
220       R__b << fZ;
221       R__b << fDens;
222       R__b << fRadl;
223       R__b << fAbsl;
224       R__b.WriteArray(fBuf, fNbuf); //
225       R__b << fNwbuf;
226       R__b << fRho;
227    }
228 }
229
230 //-------------------------------------------------------------------------
231