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