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