]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSgeomSPD425.cxx
Fixed compilation warning with HP unix.
[u/mrichter/AliRoot.git] / ITS / AliITSgeomSPD425.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 Revision 1.3  2000/06/10 10:42:49  nilsen
19 Fixed bug in copy and operator =.
20
21
22 */
23
24 #include <TShape.h>
25
26 #include "AliITSgeomSPD425.h"
27
28 ClassImp(AliITSgeomSPD425)
29
30 AliITSgeomSPD425::AliITSgeomSPD425(){
31 ////////////////////////////////////////////////////////////////////////
32 //    default constructor, for ITS post TDR geometry.
33 ////////////////////////////////////////////////////////////////////////
34
35 const Float_t kdx=0.6400,kdy=0.0075,kdz=4.23625;// cm; Standard pixel detector
36                                                 // size is 2dx wide, 2dz long,
37                                                 // and 2dy thick. Geant 3.12
38                                                 // units.
39 const Float_t kbinx0 = 0.0050; // cm; Standard pixel size in x direction.
40 const Int_t   knbinx = 256;    // number of pixels along x direction.
41 const Float_t kbinz0 = 0.0425; // cm; Standard pixel size in z direction.
42 const Float_t kbinz1 = 0.0625; // cm; Special pixel size in z direction.
43 const Int_t   knbinz = 197;    // number of pixels along z direction.
44     Int_t i;
45
46     fdx = kdx;  // default value.
47     fdy = kdy;  // default value.
48     fdz = kdz;  // default value.
49     fNbinx = knbinx; // default number of bins in x.
50     fNbinz = knbinz; // default number of bins in z.
51
52     fBinSizeX = new Float_t[fNbinx]; // array of bin sizes along x.
53     for(i=0;i<fNbinx;i++) fBinSizeX[i] = kbinx0; // default x bin size.
54     fBinSizeZ = new Float_t[fNbinz]; // array of bin sizes along z.
55     for(i=0;i<fNbinz;i++) fBinSizeZ[i] = kbinz0; // default z bin size.
56     fBinSizeZ[ 31] = kbinz1;
57     fBinSizeZ[ 32] = kbinz1;
58
59     fBinSizeZ[ 64] = kbinz1;
60     fBinSizeZ[ 65] = kbinz1;
61
62     fBinSizeZ[ 97] = kbinz1;
63     fBinSizeZ[ 98] = kbinz1;
64
65     fBinSizeZ[130] = kbinz1;
66     fBinSizeZ[131] = kbinz1;
67
68     fBinSizeZ[163] = kbinz1;
69     fBinSizeZ[164] = kbinz1;
70
71     // correct detector size for bin size.
72     fdx = 0.0;
73     for(i=0;i<fNbinx;i++) fdx +=fBinSizeX[i];
74     fdx *= 0.5;
75     fdz = 0.0;
76     for(i=0;i<fNbinz;i++) fdz +=fBinSizeZ[i];
77     fdz *= 0.5;
78
79     fShapeSPD = new TBRIK("ActiveSPD","Active volume of SPD","SPD SI DET",
80                           fdx,fdy,fdz);
81 }
82 //______________________________________________________________________
83 AliITSgeomSPD425::AliITSgeomSPD425(Float_t dy,Int_t nx,Float_t *bx,
84                                                 Int_t nz,Float_t *bz){
85 ////////////////////////////////////////////////////////////////////////
86 //    default constructor, for a User modified TDR based geometry.
87 ////////////////////////////////////////////////////////////////////////
88     Int_t i;
89     fdx = 0.0;
90     fdy =  dy;
91     fdz = 0.0;
92     fNbinx = nx; // new number of bins in x.
93     fNbinz = nz; // new number of bins in z.
94
95     fBinSizeX = new Float_t[fNbinx]; // array of bin sizes along x.
96     for(i=0;i<fNbinx;i++) fBinSizeX[i] = bx[i]; // new x bin size.
97     fBinSizeZ = new Float_t[fNbinz]; // array of bin sizes along z.
98     for(i=0;i<fNbinz;i++) fBinSizeZ[i] = bz[i]; // new z bin size.
99
100     // correct detector size for bin size.
101     for(i=0;i<fNbinx;i++) fdx +=fBinSizeX[i];
102     fdx *= 0.5;
103     for(i=0;i<fNbinz;i++) fdz +=fBinSizeZ[i];
104     fdz *= 0.5;
105
106     fShapeSPD = new TBRIK("ActiveSPD","Active volume of SPD","SPD SI DET",
107                           fdx,fdy,fdz);
108 }
109 //______________________________________________________________________
110 AliITSgeomSPD425::AliITSgeomSPD425(AliITSgeomSPD425 &source){
111   // copy constructor
112     Int_t i;
113     if(&source == this) return;
114     this->fShapeSPD = new TBRIK(*(source.fShapeSPD));
115     this->fdx = source.fdx;
116     this->fdy = source.fdy;
117     this->fdz = source.fdz;
118     if(this->fBinSizeX) delete[] this->fBinSizeX; 
119     if(this->fBinSizeX) delete[] this->fBinSizeZ;
120     this->fNbinx = source.fNbinx;
121     this->fBinSizeX = new Float_t[this->fNbinx];
122     this->fNbinz = source.fNbinz;
123     this->fBinSizeZ = new Float_t[this->fNbinz];
124     for(i=0;i<fNbinx;i++) this->fBinSizeX[i] = source.fBinSizeX[i];
125     for(i=0;i<fNbinz;i++) this->fBinSizeZ[i] = source.fBinSizeZ[i];
126 }
127 //______________________________________________________________________
128 AliITSgeomSPD425& AliITSgeomSPD425::operator=(AliITSgeomSPD425 &source){
129   // = operator
130     Int_t i;
131     if(&source == this) return *this;
132     this->fShapeSPD = new TBRIK(*(source.fShapeSPD));
133     this->fdx = source.fdx;
134     this->fdy = source.fdy;
135     this->fdz = source.fdz;
136     if(this->fBinSizeX) delete[] this->fBinSizeX; 
137     if(this->fBinSizeX) delete[] this->fBinSizeZ;
138     this->fNbinx = source.fNbinx;
139     this->fBinSizeX = new Float_t[this->fNbinx];
140     this->fNbinz = source.fNbinz;
141     this->fBinSizeZ = new Float_t[this->fNbinz];
142     for(i=0;i<fNbinx;i++) this->fBinSizeX[i] = source.fBinSizeX[i];
143     for(i=0;i<fNbinz;i++) this->fBinSizeZ[i] = source.fBinSizeZ[i];
144     return *this;
145 }
146 //______________________________________________________________________
147 AliITSgeomSPD425::~AliITSgeomSPD425(){
148   // destructor
149     delete[] fBinSizeX;
150     delete[] fBinSizeZ;
151     delete   fShapeSPD;
152 }
153 //______________________________________________________________________
154 void AliITSgeomSPD425::ReSetBins(Float_t dy,Int_t nx,Float_t *bx,
155                                         Int_t nz,Float_t *bz){
156 ////////////////////////////////////////////////////////////////////////
157 //    default constructor, for a User modified TDR based geometry.
158 ////////////////////////////////////////////////////////////////////////
159     Int_t i;
160     fdx = 0.0;
161     fdy =  dy;
162     fdz = 0.0;
163     fNbinx = nx; // new number of bins in x.
164     fNbinz = nz; // new number of bins in z.
165
166     if(fBinSizeX!=0) delete[] fBinSizeX;
167     fBinSizeX = new Float_t[fNbinx]; // array of bin sizes along x.
168     for(i=0;i<fNbinx;i++) fBinSizeX[i] = bx[i]; // new x bin size.
169     if(fBinSizeZ!=0) delete[] fBinSizeZ;
170     fBinSizeZ = new Float_t[fNbinz]; // array of bin sizes along z.
171     for(i=0;i<fNbinz;i++) fBinSizeZ[i] = bz[i]; // new z bin size.
172
173     // correct detector size for bin size.
174     for(i=0;i<fNbinx;i++) fdx +=fBinSizeX[i];
175     fdx *= 0.5;
176     for(i=0;i<fNbinz;i++) fdz +=fBinSizeZ[i];
177     fdz *= 0.5;
178
179     fShapeSPD = new TBRIK("ActiveSPD","Active volume of SPD","SPD SI DET",
180                           fdx,fdy,fdz);
181 }
182 //----------------------------------------------------------------------
183 void AliITSgeomSPD425::Streamer(TBuffer &R__b){
184     // Streamer function for the class AliITSgeomSPD425.
185     UInt_t R__s, R__c;
186
187     if(R__b.IsReading()){
188         Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
189         if(R__v==1){
190             TObject::Streamer(R__b);
191             fShapeSPD->Streamer(R__b);
192             R__b >> fdx;
193             R__b >> fdy;
194             R__b >> fdz;
195         }else if (R__v==2){
196             AliITSgeomSPD::Streamer(R__b);
197             fShapeSPD->Streamer(R__b);
198             R__b >> fdx;
199             R__b >> fdy;
200             R__b >> fdz;
201             R__b >> fNbinx;
202             if(fBinSizeX!=0) delete[] fBinSizeX;
203             fBinSizeX = new Float_t[fNbinx];
204             for(Int_t i=0;i<fNbinx;i++) R__b >> fBinSizeX[i];
205             R__b >> fNbinz;
206             if(fBinSizeZ!=0) delete[] fBinSizeZ;
207             fBinSizeZ = new Float_t[fNbinz];
208             for(Int_t i=0;i<fNbinz;i++) R__b >> fBinSizeZ[i];
209             R__b.CheckByteCount(R__s, R__c, AliITSgeomSPD425::IsA());
210         } // end if R__v==1
211     } else { // IsWriting.
212         R__c = R__b.WriteVersion(AliITSgeomSPD425::IsA(), kTRUE);
213         AliITSgeomSPD::Streamer(R__b);
214         fShapeSPD->Streamer(R__b);
215         R__b << fdx;
216         R__b << fdy;
217         R__b << fdz;
218         R__b << fNbinx;
219         for(Int_t i=0;i<fNbinx;i++) R__b << fBinSizeX[i];
220         R__b << fNbinz;
221         for(Int_t i=0;i<fNbinz;i++) R__b << fBinSizeZ[i];
222         R__b.SetByteCount(R__c, kTRUE);
223     } // end if R__b.IsReading()
224 }
225 //----------------------------------------------------------------------