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():
45 // Default Constructor. Set everthing to null.
47 //______________________________________________________________________
48 AliITSgeomSPD::AliITSgeomSPD(Float_t dy,Int_t nx,Float_t *bx,
49 Int_t nz,Float_t *bz):
61 // Standard Constructor. Set everthing to null.
63 ReSetBins(dy,nx,bx,nz,bz);
66 //______________________________________________________________________
67 void AliITSgeomSPD::ReSetBins(Float_t dy,Int_t nx,Float_t *bx,
68 Int_t nz,Float_t *bz){
69 // delets the contents of this and replaces it with the given values.
71 Float_t dx = 0.0, dz = 0.0;
73 // Compute size in x and z (based on bins).
74 for(i=0;i<nx;i++) dx += bx[i];
75 for(i=0;i<nz;i++) dz += bz[i];
79 if(fLowBinEdgeX) delete[] fLowBinEdgeX; // delete existing
80 if(fLowBinEdgeZ) delete[] fLowBinEdgeZ; // delete existing
88 fLowBinEdgeX[0] = -dx;
89 fLowBinEdgeZ[0] = -dz;
90 for(i=0;i<nx;i++) fLowBinEdgeX[i+1] = fLowBinEdgeX[i] + bx[i];
91 for(i=0;i<nz;i++) fLowBinEdgeZ[i+1] = fLowBinEdgeZ[i] + bz[i];
92 SetShape("ActiveSPD","Active volume of SPD","",dx,dy,dz);
95 //______________________________________________________________________
96 AliITSgeomSPD::AliITSgeomSPD(AliITSgeomSPD &source) : TObject(source),
98 fTitle(source.fTitle),
103 fNbinx(source.fNbinx),
104 fNbinz(source.fNbinz),
110 for(Int_t i=0;i<fNbinx;i++) fLowBinEdgeX[i] = source.fLowBinEdgeX[i];
111 for(Int_t i=0;i<fNbinz;i++) fLowBinEdgeZ[i] = source.fLowBinEdgeZ[i];
115 //______________________________________________________________________
116 AliITSgeomSPD& AliITSgeomSPD::operator=(AliITSgeomSPD &source){
118 this->~AliITSgeomSPD();
119 new(this) AliITSgeomSPD(source);
122 //______________________________________________________________________
123 AliITSgeomSPD::~AliITSgeomSPD(){
126 if(fLowBinEdgeX) delete[] fLowBinEdgeX;
127 if(fLowBinEdgeZ) delete[] fLowBinEdgeZ;
133 //______________________________________________________________________
134 void AliITSgeomSPD::SetShape(const char *name,const char *title,
135 const char * /*mat*/,Float_t dx,Float_t dy,Float_t dz){
136 // Delete any existing shape info and replace it with a new
137 // shape information.
139 // char * name Name of the shape
140 // char * title Title of the shape
141 // char * mat Material name for the shape
142 // Float_t dx half width of the shape [cm]
143 // Float_t dy half thickness of the shape [cm]
144 // Float_t dz half length of the shape [cm]
157 //______________________________________________________________________
158 void AliITSgeomSPD::LToDet(Float_t xl,Float_t zl,Int_t &row,Int_t &col){
159 // Returns the row and column pixel numbers for a given local coordinate
160 // system. If they are outside then it will return -1 or fNbinx/z.
163 if(xl<fLowBinEdgeX[0]) row = -1;
165 for(i=0;i<fNbinx;i++) if(xl<=fLowBinEdgeX[i]) break;
168 if(zl<fLowBinEdgeX[0]) col = -1;
170 for(i=0;i<fNbinz;i++) if(zl<=fLowBinEdgeZ[i]) break;
175 //______________________________________________________________________
176 void AliITSgeomSPD::DetToL(Int_t row,Int_t col,Float_t &xl,Float_t &zl){
177 // returns the pixel center local coordinate system location for a given
178 // row and column number. It the row or column number is outside of the
179 // defined range then it will return the nearest detector edge.
181 if(row>=0||row<fNbinx-1) xl = 0.5*(fLowBinEdgeX[row]+fLowBinEdgeX[row+1]);
182 else if(row<0) xl = fLowBinEdgeX[0];else xl = fLowBinEdgeX[fNbinx-1];
183 if(col>=0||col<fNbinz-1) zl = 0.5*(fLowBinEdgeZ[col]+fLowBinEdgeZ[col+1]);
184 else if(col<0) zl = fLowBinEdgeZ[0];else zl = fLowBinEdgeZ[fNbinz-1];
187 //______________________________________________________________________
188 void AliITSgeomSPD::Print(ostream *os) const {
189 // Standard output format for this class
198 #if defined __ICC || defined __ECC || defined __xlC__
205 fmt = os->setf(ios::scientific); // set scientific floating point output
206 *os << "TBRIK" << " ";
207 *os << setprecision(16) << GetDx() << " ";
208 *os << setprecision(16) << GetDy() << " ";
209 *os << setprecision(16) << GetDz() << " ";
210 *os << fNbinx-1 << " " << fNbinz-1 << " ";
211 for(i=0;i<fNbinx;i++) *os << setprecision(16) << fLowBinEdgeX[i] << " ";
212 for(i=0;i<fNbinz;i++) *os << setprecision(16) << fLowBinEdgeZ[i] << " ";
217 //______________________________________________________________________
218 void AliITSgeomSPD::Read(istream *is){
219 // Standard input format for this class
224 for(i=0;i<20;i++) shape[i]='\0';
226 if(strcmp(shape,"TBRIK")) Warning("::Read","Shape not a TBRIK");
227 *is >> dx >> dy >> dz;
228 SetShape("ActiveSPD","Active volume of SPD","",dx,dy,dz);
234 for(i=0;i<fNbinx;i++) *is >> fLowBinEdgeX[i];
235 for(i=0;i<fNbinz;i++) *is >> fLowBinEdgeZ[i];
238 //----------------------------------------------------------------------
239 ostream &operator<<(ostream &os,AliITSgeomSPD &p){
240 ////////////////////////////////////////////////////////////////////////
241 // Standard output streaming function.
242 ////////////////////////////////////////////////////////////////////////
247 //----------------------------------------------------------------------
248 istream &operator>>(istream &is,AliITSgeomSPD &r){
249 ////////////////////////////////////////////////////////////////////////
250 // Standard input streaming function.
251 ////////////////////////////////////////////////////////////////////////
256 //=====================================================================
258 ClassImp(AliITSgeomSPD300)
260 AliITSgeomSPD300::AliITSgeomSPD300() : AliITSgeomSPD(){
261 ////////////////////////////////////////////////////////////////////////
262 // default constructor, for ITS TDR geometry. This only consists of
263 // a default constructor to construct the defalut TDR SPD detector geometry
264 // 256 X 279 300 by 50 micron pixels.
265 ////////////////////////////////////////////////////////////////////////
266 const Float_t kdx=0.6400,kdy=0.0075,kdz=4.1900; // cm; Standard pixel detector
267 // size is 2dx wide, 2dz long,
268 // and 2dy thick. Geant 3.12
270 const Float_t kbinx0 = 0.0050; // cm; Standard pixel size in x direction.
271 const Int_t knbinx = 256; // number of pixels along x direction.
272 const Float_t kbinz0 = 0.0300; // cm; Standard pixel size in z direction.
273 const Float_t kbinz1 = 0.0350; // cm; Edge pixel size in z direction.
274 const Int_t knbinz = 279; // number of pixels along z direction.
276 Float_t dx=0.0,dz=0.0;
278 SetNbinX(knbinx); // default number of bins in x.
279 SetNbinZ(knbinz); // default number of bins in z.
281 for(i=0;i<knbinx;i++) dx += kbinx0; // Compute size x.
283 for(i=0;i<knbinz;i++) dz += kbinz0; // Compute size z.
284 dz += 2.0*(kbinz1-kbinz0);
288 SetLowBinEdgeX(0,-dx); // Starting position X
289 for(i=0;i<knbinx;i++) SetLowBinEdgeX(i+1,GetBinLowEdgeX(i)+kbinx0);
290 SetLowBinEdgeZ(0,-dz); // Starting position z
291 SetLowBinEdgeZ(1,GetBinLowEdgeZ(0)+kbinz1);
292 for(i=1;i<knbinz;i++) SetLowBinEdgeZ(i+1,GetBinLowEdgeZ(i)+kbinz0);
293 SetLowBinEdgeZ(knbinz,GetBinLowEdgeZ(knbinz-1)+kbinz1);
295 if(TMath::Abs(dx-kdx)>1.0E-4 || TMath::Abs(dz-kdz)>1.0E-4)
296 Warning("Default Creator","Detector size may not be write.");
297 SetShape("ActiveSPD","Active volume of SPD","",dx,kdy,dz);
299 //----------------------------------------------------------------------
300 ostream &operator<<(ostream &os,AliITSgeomSPD300 &p){
301 ////////////////////////////////////////////////////////////////////////
302 // Standard output streaming function.
303 ////////////////////////////////////////////////////////////////////////
308 //----------------------------------------------------------------------
309 istream &operator>>(istream &is,AliITSgeomSPD300 &r){
310 ////////////////////////////////////////////////////////////////////////
311 // Standard input streaming function.
312 ////////////////////////////////////////////////////////////////////////
317 //=====================================================================
319 ClassImp(AliITSgeomSPD425Short)
321 AliITSgeomSPD425Short::AliITSgeomSPD425Short() : AliITSgeomSPD(){
322 ////////////////////////////////////////////////////////////////////////
323 // default constructor, for ITS post TDR geometry. This only consists of
324 // a default constructor to construct the defalut post TDR SPD detector
325 // geometry 256 X 197 425 by 50 micron pixels with interleaved 625 by 50
326 // micron pixels (large detector).
327 ////////////////////////////////////////////////////////////////////////
329 //----------------------------------------------------------------------
330 AliITSgeomSPD425Short::AliITSgeomSPD425Short(Int_t npar,Float_t *par) :
332 ////////////////////////////////////////////////////////////////////////
333 // Standard constructor, for ITS post TDR geometry. This only consists of
334 // a default constructor to construct the defalut post TDR SPD detector
335 // geometry 256 X 197 425 by 50 micron pixels with interleaved 625 by 50
336 // micron pixels (large detector).
337 ////////////////////////////////////////////////////////////////////////
339 const Float_t kdx=0.6400/*,kdy=0.015*/,kdz=3.480; // cm; Standard pixel
340 // detector size is 2dx
341 // wide, 2dz long, and
342 // 2dy thick. Geant 3.12
344 const Float_t kbinx0 = 0.0050; // cm; Standard pixel size in x direction.
345 const Int_t knbinx = 256; // number of pixels along x direction.
346 const Float_t kbinz0 = 0.0425; // cm; Standard pixel size in z direction.
347 const Float_t kbinz1 = 0.0625; // cm; Special pixel size in z direction.
348 const Int_t knbinz = 160; // number of pixels along z direction.
350 Float_t dx,dz,*binSizeX,*binSizeZ;
352 SetNbinX(knbinx); // default number of bins in x.
353 SetNbinZ(knbinz); // default number of bins in z.
355 binSizeX = new Float_t[knbinx]; // array of bin sizes along x.
356 for(i=0;i<knbinx;i++) binSizeX[i] = kbinx0; // default x bin size.
357 binSizeZ = new Float_t[knbinz]; // array of bin sizes along z.
358 for(i=0;i<knbinz;i++) binSizeZ[i] = kbinz0; // default z bin size.
359 binSizeZ[ 31] = kbinz1;
360 binSizeZ[ 32] = kbinz1;
362 binSizeZ[ 63] = kbinz1;
363 binSizeZ[ 64] = kbinz1;
365 binSizeZ[ 95] = kbinz1;
366 binSizeZ[ 96] = kbinz1;
368 binSizeZ[127] = kbinz1;
369 binSizeZ[128] = kbinz1;
371 // correct detector size for bin size.
373 for(i=0;i<knbinx;i++) dx += binSizeX[i];
376 for(i=0;i<knbinz;i++) dz += binSizeZ[i];
380 Error("AliITSgeomSPD425Short",
381 "npar=%d<3 array par must be at least [3] or larger",npar);
384 SetShape("ActiveSPD","Active volume of SPD","",
385 par[0],par[1],par[2]);
386 if(TMath::Abs(dx-kdx)>1.0E-4 || TMath::Abs(dz-kdz)>1.0E-4)
387 Warning("Default Creator","Detector size may not be write.");
389 InitLowBinEdgeX(); // array of bin sizes along x.
390 InitLowBinEdgeZ(); // array of bin sizes along x.
391 SetLowBinEdgeX(0,-dx);
392 SetLowBinEdgeZ(0,-dz);
393 for(i=0;i<knbinx;i++) SetLowBinEdgeX(i+1,GetBinLowEdgeX(i)+binSizeX[i]);
394 for(i=0;i<knbinz;i++) SetLowBinEdgeZ(i+1,GetBinLowEdgeZ(i)+binSizeZ[i]);
396 //----------------------------------------------------------------------
397 ostream &operator<<(ostream &os,AliITSgeomSPD425Short &p){
398 ////////////////////////////////////////////////////////////////////////
399 // Standard output streaming function.
400 ////////////////////////////////////////////////////////////////////////
405 //----------------------------------------------------------------------
406 istream &operator>>(istream &is,AliITSgeomSPD425Short &r){
407 ////////////////////////////////////////////////////////////////////////
408 // Standard input streaming function.
409 ////////////////////////////////////////////////////////////////////////
414 //======================================================================
416 ClassImp(AliITSgeomSPD425Long)
418 AliITSgeomSPD425Long::AliITSgeomSPD425Long(){
419 ////////////////////////////////////////////////////////////////////////
420 // default constructor, for ITS post TDR geometry. This only consists of
421 // a default constructor to construct the defalut post TDR SPD detector
422 // geometry 256 X 197 425 by 50 micron pixels with interleaved 625 by 50
423 // micron pixels (large detector).
424 ////////////////////////////////////////////////////////////////////////
426 const Float_t kdx=0.6400,kdy=0.0075,kdz=4.2650; // cm; Standard pixel
427 // detector size is 2dx
428 // wide, 2dz long, and
429 // 2dy thick. Geant 3.12
431 const Float_t kbinx0 = 0.0050; // cm; Standard pixel size in x direction.
432 const Int_t knbinx = 256; // number of pixels along x direction.
433 const Float_t kbinz0 = 0.0425; // cm; Standard pixel size in z direction.
434 const Float_t kbinz1 = 0.0625; // cm; Special pixel size in z direction.
435 const Int_t knbinz = 192; // number of pixels along z direction.
437 Float_t dx,dz,*binSizeX,*binSizeZ;
439 SetNbinX(knbinx); // default number of bins in x.
440 SetNbinZ(knbinz); // default number of bins in z.
442 binSizeX = new Float_t[knbinx]; // array of bin sizes along x.
443 for(i=0;i<knbinx;i++) binSizeX[i] = kbinx0; // default x bin size.
444 binSizeZ = new Float_t[knbinz]; // array of bin sizes along z.
445 for(i=0;i<knbinz;i++) binSizeZ[i] = kbinz0; // default z bin size.
446 binSizeZ[ 31] = kbinz1;
447 binSizeZ[ 32] = kbinz1;
449 binSizeZ[ 63] = kbinz1;
450 binSizeZ[ 64] = kbinz1;
452 binSizeZ[ 95] = kbinz1;
453 binSizeZ[ 96] = kbinz1;
455 binSizeZ[127] = kbinz1;
456 binSizeZ[128] = kbinz1;
458 binSizeZ[159] = kbinz1;
459 binSizeZ[160] = kbinz1;
461 // correct detector size for bin size.
463 for(i=0;i<knbinx;i++) dx += binSizeX[i];
466 for(i=0;i<knbinz;i++) dz += binSizeZ[i];
469 SetShape("ActiveSPD","Active volume of SPD","",dx,kdy,dz);
470 if(TMath::Abs(dx-kdx)>1.0E-4 || TMath::Abs(dz-kdz)>1.0E-4)
471 Warning("Default Creator","Detector size may not be write.");
473 InitLowBinEdgeX(); // array of bin sizes along x.
474 InitLowBinEdgeZ(); // array of bin sizes along x.
475 SetLowBinEdgeX(0,-dx);
476 SetLowBinEdgeZ(0,-dz);
477 for(i=0;i<knbinx;i++) SetLowBinEdgeX(i+1,GetBinLowEdgeX(i)+binSizeX[i]);
478 for(i=0;i<knbinz;i++) SetLowBinEdgeZ(i+1,GetBinLowEdgeZ(i)+binSizeZ[i]);
480 //----------------------------------------------------------------------
481 ostream &operator<<(ostream &os,AliITSgeomSPD425Long &p){
482 ////////////////////////////////////////////////////////////////////////
483 // Standard output streaming function.
484 ////////////////////////////////////////////////////////////////////////
489 //----------------------------------------------------------------------
490 istream &operator>>(istream &is,AliITSgeomSPD425Long &r){
491 ////////////////////////////////////////////////////////////////////////
492 // Standard input streaming function.
493 ////////////////////////////////////////////////////////////////////////
498 //======================================================================