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