1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 ////////////////////////////////////////////////////////////////////////
19 // This class is for the Silicon Pixel Detector, SPD, specific geometry.
20 // It is being replaced by AliITSsegmentationSPD class. This file also
21 // constains classes derived from AliITSgeomSPD which do nothing but
22 // initilize this one with predefined values.
23 ////////////////////////////////////////////////////////////////////////
25 #include <Riostream.h>
29 #include "AliITSgeomSPD.h"
31 ClassImp(AliITSgeomSPD)
33 AliITSgeomSPD::AliITSgeomSPD(){
34 // Default Constructor. Set everthing to null.
42 //______________________________________________________________________
43 AliITSgeomSPD::AliITSgeomSPD(Float_t dy,Int_t nx,Float_t *bx,
44 Int_t nz,Float_t *bz){
45 // Standard Constructor. Set everthing to null.
52 ReSetBins(dy,nx,bx,nz,bz);
55 //______________________________________________________________________
56 void AliITSgeomSPD::ReSetBins(Float_t dy,Int_t nx,Float_t *bx,
57 Int_t nz,Float_t *bz){
58 // delets the contents of this and replaces it with the given values.
60 Float_t dx = 0.0, dz = 0.0;
62 // Compute size in x and z (based on bins).
63 for(i=0;i<nx;i++) dx += bx[i];
64 for(i=0;i<nz;i++) dz += bz[i];
68 delete fShapeSPD; // delete existing shape
69 if(this->fLowBinEdgeX) delete[] this->fLowBinEdgeX; // delete existing
70 if(this->fLowBinEdgeZ) delete[] this->fLowBinEdgeZ; // delete existing
76 fLowBinEdgeX[0] = -dx;
77 fLowBinEdgeZ[0] = -dz;
78 for(i=0;i<nx;i++) fLowBinEdgeX[i+1] = fLowBinEdgeX[i] + bx[i];
79 for(i=0;i<nz;i++) fLowBinEdgeZ[i+1] = fLowBinEdgeZ[i] + bz[i];
80 SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,dy,dz);
83 //______________________________________________________________________
84 AliITSgeomSPD::AliITSgeomSPD(AliITSgeomSPD &source) : TObject(source){
87 *this = source; // just use the = operator for now.
90 //______________________________________________________________________
91 AliITSgeomSPD& AliITSgeomSPD::operator=(AliITSgeomSPD &source){
95 if(&source == this) return *this;
96 this->fShapeSPD = new TBRIK(*(source.fShapeSPD));
97 if(this->fLowBinEdgeX) delete[] this->fLowBinEdgeX;
98 if(this->fLowBinEdgeZ) delete[] this->fLowBinEdgeZ;
99 this->fNbinx = source.fNbinx;
100 this->fNbinz = source.fNbinz;
101 this->InitLowBinEdgeX();
102 this->InitLowBinEdgeZ();
103 for(i=0;i<fNbinx;i++) this->fLowBinEdgeX[i] = source.fLowBinEdgeX[i];
104 for(i=0;i<fNbinz;i++) this->fLowBinEdgeZ[i] = source.fLowBinEdgeZ[i];
107 //______________________________________________________________________
108 AliITSgeomSPD::~AliITSgeomSPD(){
112 if(this->fLowBinEdgeX) delete[] this->fLowBinEdgeX;
113 if(this->fLowBinEdgeZ) delete[] this->fLowBinEdgeZ;
120 //______________________________________________________________________
121 void AliITSgeomSPD::LToDet(Float_t xl,Float_t zl,Int_t &row,Int_t &col){
122 // Returns the row and column pixel numbers for a given local coordinate
123 // system. If they are outside then it will return -1 or fNbinx/z.
126 if(xl<fLowBinEdgeX[0]) row = -1;
128 for(i=0;i<fNbinx;i++) if(xl<=fLowBinEdgeX[i]) break;
131 if(zl<fLowBinEdgeX[0]) col = -1;
133 for(i=0;i<fNbinz;i++) if(zl<=fLowBinEdgeZ[i]) break;
138 //______________________________________________________________________
139 void AliITSgeomSPD::DetToL(Int_t row,Int_t col,Float_t &xl,Float_t &zl){
140 // returns the pixel center local coordinate system location for a given
141 // row and column number. It the row or column number is outside of the
142 // defined range then it will return the nearest detector edge.
144 if(row>=0||row<fNbinx-1) xl = 0.5*(fLowBinEdgeX[row]+fLowBinEdgeX[row+1]);
145 else if(row<0) xl = fLowBinEdgeX[0];else xl = fLowBinEdgeX[fNbinx-1];
146 if(col>=0||col<fNbinz-1) zl = 0.5*(fLowBinEdgeZ[col]+fLowBinEdgeZ[col+1]);
147 else if(col<0) zl = fLowBinEdgeZ[0];else zl = fLowBinEdgeZ[fNbinz-1];
150 //______________________________________________________________________
151 void AliITSgeomSPD::Print(ostream *os) const {
152 // Standard output format for this class
161 #if defined __ICC || defined __ECC || defined __xlC__
168 fmt = os->setf(ios::scientific); // set scientific floating point output
169 *os << "TBRIK" << " ";
170 *os << setprecision(16) << GetDx() << " ";
171 *os << setprecision(16) << GetDy() << " ";
172 *os << setprecision(16) << GetDz() << " ";
173 *os << fNbinx-1 << " " << fNbinz-1 << " ";
174 for(i=0;i<fNbinx;i++) *os << setprecision(16) << fLowBinEdgeX[i] << " ";
175 for(i=0;i<fNbinz;i++) *os << setprecision(16) << fLowBinEdgeZ[i] << " ";
180 //______________________________________________________________________
181 void AliITSgeomSPD::Read(istream *is){
182 // Standard input format for this class
187 for(i=0;i<20;i++) shape[i]='\0';
189 if(strcmp(shape,"TBRIK")) Warning("::Read","Shape not a TBRIK");
190 *is >> dx >> dy >> dz;
191 if(fShapeSPD!=0) delete fShapeSPD;
192 SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,dy,dz);
198 for(i=0;i<fNbinx;i++) *is >> fLowBinEdgeX[i];
199 for(i=0;i<fNbinz;i++) *is >> fLowBinEdgeZ[i];
202 //----------------------------------------------------------------------
203 ostream &operator<<(ostream &os,AliITSgeomSPD &p){
204 ////////////////////////////////////////////////////////////////////////
205 // Standard output streaming function.
206 ////////////////////////////////////////////////////////////////////////
211 //----------------------------------------------------------------------
212 istream &operator>>(istream &is,AliITSgeomSPD &r){
213 ////////////////////////////////////////////////////////////////////////
214 // Standard input streaming function.
215 ////////////////////////////////////////////////////////////////////////
220 //=====================================================================
222 ClassImp(AliITSgeomSPD300)
224 AliITSgeomSPD300::AliITSgeomSPD300() : AliITSgeomSPD(){
225 ////////////////////////////////////////////////////////////////////////
226 // default constructor, for ITS TDR geometry. This only consists of
227 // a default constructor to construct the defalut TDR SPD detector geometry
228 // 256 X 279 300 by 50 micron pixels.
229 ////////////////////////////////////////////////////////////////////////
230 const Float_t kdx=0.6400,kdy=0.0075,kdz=4.1900; // cm; Standard pixel detector
231 // size is 2dx wide, 2dz long,
232 // and 2dy thick. Geant 3.12
234 const Float_t kbinx0 = 0.0050; // cm; Standard pixel size in x direction.
235 const Int_t knbinx = 256; // number of pixels along x direction.
236 const Float_t kbinz0 = 0.0300; // cm; Standard pixel size in z direction.
237 const Float_t kbinz1 = 0.0350; // cm; Edge pixel size in z direction.
238 const Int_t knbinz = 279; // number of pixels along z direction.
240 Float_t dx=0.0,dz=0.0;
242 // cout << "AliITSgeomSPD300 default creator called: start" << endl;
244 SetNbinX(knbinx); // default number of bins in x.
245 SetNbinZ(knbinz); // default number of bins in z.
247 for(i=0;i<knbinx;i++) dx += kbinx0; // Compute size x.
249 for(i=0;i<knbinz;i++) dz += kbinz0; // Compute size z.
250 dz += 2.0*(kbinz1-kbinz0);
254 SetLowBinEdgeX(0,-dx); // Starting position X
255 for(i=0;i<knbinx;i++) SetLowBinEdgeX(i+1,GetBinLowEdgeX(i)+kbinx0);
256 SetLowBinEdgeZ(0,-dz); // Starting position z
257 SetLowBinEdgeZ(1,GetBinLowEdgeZ(0)+kbinz1);
258 for(i=1;i<knbinz;i++) SetLowBinEdgeZ(i+1,GetBinLowEdgeZ(i)+kbinz0);
259 SetLowBinEdgeZ(knbinz,GetBinLowEdgeZ(knbinz-1)+kbinz1);
261 if(TMath::Abs(dx-kdx)>1.0E-4 || TMath::Abs(dz-kdz)>1.0E-4)
262 Warning("Default Creator","Detector size may not be write.");
263 SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,kdy,dz);
264 // cout << "AliITSgeomSPD300 default creator called: end" << endl;
266 //----------------------------------------------------------------------
267 ostream &operator<<(ostream &os,AliITSgeomSPD300 &p){
268 ////////////////////////////////////////////////////////////////////////
269 // Standard output streaming function.
270 ////////////////////////////////////////////////////////////////////////
275 //----------------------------------------------------------------------
276 istream &operator>>(istream &is,AliITSgeomSPD300 &r){
277 ////////////////////////////////////////////////////////////////////////
278 // Standard input streaming function.
279 ////////////////////////////////////////////////////////////////////////
284 //=====================================================================
286 ClassImp(AliITSgeomSPD425Short)
288 AliITSgeomSPD425Short::AliITSgeomSPD425Short() : AliITSgeomSPD(){
289 ////////////////////////////////////////////////////////////////////////
290 // default constructor, for ITS post TDR geometry. This only consists of
291 // a default constructor to construct the defalut post TDR SPD detector
292 // geometry 256 X 197 425 by 50 micron pixels with interleaved 625 by 50
293 // micron pixels (large detector).
294 ////////////////////////////////////////////////////////////////////////
296 //----------------------------------------------------------------------
297 AliITSgeomSPD425Short::AliITSgeomSPD425Short(Int_t npar,Float_t *par) :
299 ////////////////////////////////////////////////////////////////////////
300 // Standard constructor, for ITS post TDR geometry. This only consists of
301 // a default constructor to construct the defalut post TDR SPD detector
302 // geometry 256 X 197 425 by 50 micron pixels with interleaved 625 by 50
303 // micron pixels (large detector).
304 ////////////////////////////////////////////////////////////////////////
306 const Float_t kdx=0.6400/*,kdy=0.015*/,kdz=3.480; // cm; Standard pixel
307 // detector size is 2dx
308 // wide, 2dz long, and
309 // 2dy thick. Geant 3.12
311 const Float_t kbinx0 = 0.0050; // cm; Standard pixel size in x direction.
312 const Int_t knbinx = 256; // number of pixels along x direction.
313 const Float_t kbinz0 = 0.0425; // cm; Standard pixel size in z direction.
314 const Float_t kbinz1 = 0.0625; // cm; Special pixel size in z direction.
315 const Int_t knbinz = 160; // number of pixels along z direction.
317 Float_t dx,dz,*binSizeX,*binSizeZ;
319 SetNbinX(knbinx); // default number of bins in x.
320 SetNbinZ(knbinz); // default number of bins in z.
322 binSizeX = new Float_t[knbinx]; // array of bin sizes along x.
323 for(i=0;i<knbinx;i++) binSizeX[i] = kbinx0; // default x bin size.
324 binSizeZ = new Float_t[knbinz]; // array of bin sizes along z.
325 for(i=0;i<knbinz;i++) binSizeZ[i] = kbinz0; // default z bin size.
326 binSizeZ[ 31] = kbinz1;
327 binSizeZ[ 32] = kbinz1;
329 binSizeZ[ 63] = kbinz1;
330 binSizeZ[ 64] = kbinz1;
332 binSizeZ[ 95] = kbinz1;
333 binSizeZ[ 96] = kbinz1;
335 binSizeZ[127] = kbinz1;
336 binSizeZ[128] = kbinz1;
338 // correct detector size for bin size.
340 for(i=0;i<knbinx;i++) dx += binSizeX[i];
343 for(i=0;i<knbinz;i++) dz += binSizeZ[i];
347 Error("AliITSgeomSPD425Short",
348 "npar=%d<3 array par must be at least [3] or larger",npar);
351 SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",
352 par[0],par[1],par[2]);
353 if(TMath::Abs(dx-kdx)>1.0E-4 || TMath::Abs(dz-kdz)>1.0E-4)
354 Warning("Default Creator","Detector size may not be write.");
356 InitLowBinEdgeX(); // array of bin sizes along x.
357 InitLowBinEdgeZ(); // array of bin sizes along x.
358 SetLowBinEdgeX(0,-dx);
359 SetLowBinEdgeZ(0,-dz);
360 for(i=0;i<knbinx;i++) SetLowBinEdgeX(i+1,GetBinLowEdgeX(i)+binSizeX[i]);
361 for(i=0;i<knbinz;i++) SetLowBinEdgeZ(i+1,GetBinLowEdgeZ(i)+binSizeZ[i]);
363 //----------------------------------------------------------------------
364 ostream &operator<<(ostream &os,AliITSgeomSPD425Short &p){
365 ////////////////////////////////////////////////////////////////////////
366 // Standard output streaming function.
367 ////////////////////////////////////////////////////////////////////////
372 //----------------------------------------------------------------------
373 istream &operator>>(istream &is,AliITSgeomSPD425Short &r){
374 ////////////////////////////////////////////////////////////////////////
375 // Standard input streaming function.
376 ////////////////////////////////////////////////////////////////////////
381 //======================================================================
383 ClassImp(AliITSgeomSPD425Long)
385 AliITSgeomSPD425Long::AliITSgeomSPD425Long(){
386 ////////////////////////////////////////////////////////////////////////
387 // default constructor, for ITS post TDR geometry. This only consists of
388 // a default constructor to construct the defalut post TDR SPD detector
389 // geometry 256 X 197 425 by 50 micron pixels with interleaved 625 by 50
390 // micron pixels (large detector).
391 ////////////////////////////////////////////////////////////////////////
393 const Float_t kdx=0.6400,kdy=0.0075,kdz=4.2650; // cm; Standard pixel
394 // detector size is 2dx
395 // wide, 2dz long, and
396 // 2dy thick. Geant 3.12
398 const Float_t kbinx0 = 0.0050; // cm; Standard pixel size in x direction.
399 const Int_t knbinx = 256; // number of pixels along x direction.
400 const Float_t kbinz0 = 0.0425; // cm; Standard pixel size in z direction.
401 const Float_t kbinz1 = 0.0625; // cm; Special pixel size in z direction.
402 const Int_t knbinz = 192; // number of pixels along z direction.
404 Float_t dx,dz,*binSizeX,*binSizeZ;
406 SetNbinX(knbinx); // default number of bins in x.
407 SetNbinZ(knbinz); // default number of bins in z.
409 binSizeX = new Float_t[knbinx]; // array of bin sizes along x.
410 for(i=0;i<knbinx;i++) binSizeX[i] = kbinx0; // default x bin size.
411 binSizeZ = new Float_t[knbinz]; // array of bin sizes along z.
412 for(i=0;i<knbinz;i++) binSizeZ[i] = kbinz0; // default z bin size.
413 binSizeZ[ 31] = kbinz1;
414 binSizeZ[ 32] = kbinz1;
416 binSizeZ[ 63] = kbinz1;
417 binSizeZ[ 64] = kbinz1;
419 binSizeZ[ 95] = kbinz1;
420 binSizeZ[ 96] = kbinz1;
422 binSizeZ[127] = kbinz1;
423 binSizeZ[128] = kbinz1;
425 binSizeZ[159] = kbinz1;
426 binSizeZ[160] = kbinz1;
428 // correct detector size for bin size.
430 for(i=0;i<knbinx;i++) dx += binSizeX[i];
433 for(i=0;i<knbinz;i++) dz += binSizeZ[i];
436 SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,kdy,dz);
437 if(TMath::Abs(dx-kdx)>1.0E-4 || TMath::Abs(dz-kdz)>1.0E-4)
438 Warning("Default Creator","Detector size may not be write.");
440 InitLowBinEdgeX(); // array of bin sizes along x.
441 InitLowBinEdgeZ(); // array of bin sizes along x.
442 SetLowBinEdgeX(0,-dx);
443 SetLowBinEdgeZ(0,-dz);
444 for(i=0;i<knbinx;i++) SetLowBinEdgeX(i+1,GetBinLowEdgeX(i)+binSizeX[i]);
445 for(i=0;i<knbinz;i++) SetLowBinEdgeZ(i+1,GetBinLowEdgeZ(i)+binSizeZ[i]);
447 //----------------------------------------------------------------------
448 ostream &operator<<(ostream &os,AliITSgeomSPD425Long &p){
449 ////////////////////////////////////////////////////////////////////////
450 // Standard output streaming function.
451 ////////////////////////////////////////////////////////////////////////
456 //----------------------------------------------------------------------
457 istream &operator>>(istream &is,AliITSgeomSPD425Long &r){
458 ////////////////////////////////////////////////////////////////////////
459 // Standard input streaming function.
460 ////////////////////////////////////////////////////////////////////////
465 //======================================================================