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 Revision 1.11 2001/05/16 08:17:49 hristov
19 Bug fixed in the StepManager to account for the difference in the geometry
20 tree for the ITS pixels. This fixes both the funny distribution of pixel
21 coordinates and the missing hits/digits/points in many sectors of the ITS
22 pixel barrel. Also included is a patch to properly get and use the detector
23 dimensions through out the ITS code. (B.Nilsen)
25 Revision 1.10 2001/04/26 22:44:34 nilsen
28 Revision 1.9 2001/02/09 00:00:57 nilsen
29 Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed
30 bugs in iostream based streamers used to read and write .det files. Fixed
31 some detector sizes. Fixed bugs in some default-special constructors.
33 Revision 1.8 2001/02/03 00:00:30 nilsen
34 New version of AliITSgeom and related files. Now uses automatic streamers,
35 set up for new formatted .det file which includes detector information.
36 Additional smaller modifications are still to come.
40 ////////////////////////////////////////////////////////////////////////
41 // This class is for the Silicon Pixel Detector, SPD, specific geometry.
42 // It is being replaced by AliITSsegmentationSPD class. This file also
43 // constains classes derived from AliITSgeomSPD which do nothing but
44 // initilize this one with predefined values.
45 ////////////////////////////////////////////////////////////////////////
52 #include "AliITSgeomSPD.h"
54 ClassImp(AliITSgeomSPD)
56 AliITSgeomSPD::AliITSgeomSPD(){
57 // Default Constructor. Set everthing to null.
65 //______________________________________________________________________
66 AliITSgeomSPD::AliITSgeomSPD(Float_t dy,Int_t nx,Float_t *bx,
67 Int_t nz,Float_t *bz){
68 // Standard Constructor. Set everthing to null.
75 ReSetBins(dy,nx,bx,nz,bz);
78 //______________________________________________________________________
79 void AliITSgeomSPD::ReSetBins(Float_t dy,Int_t nx,Float_t *bx,
80 Int_t nz,Float_t *bz){
81 // delets the contents of this and replaces it with the given values.
83 Float_t dx = 0.0, dz = 0.0;
85 // Compute size in x and z (based on bins).
86 for(i=0;i<nx;i++) dx += bx[i];
87 for(i=0;i<nz;i++) dz += bz[i];
91 delete fShapeSPD; // delete existing shape
92 if(this->fLowBinEdgeX) delete[] this->fLowBinEdgeX; // delete existing
93 if(this->fLowBinEdgeZ) delete[] this->fLowBinEdgeZ; // delete existing
99 fLowBinEdgeX[0] = -dx;
100 fLowBinEdgeZ[0] = -dz;
101 for(i=0;i<nx;i++) fLowBinEdgeX[i+1] = fLowBinEdgeX[i] + bx[i];
102 for(i=0;i<nz;i++) fLowBinEdgeZ[i+1] = fLowBinEdgeZ[i] + bz[i];
103 SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,dy,dz);
106 //______________________________________________________________________
107 AliITSgeomSPD::AliITSgeomSPD(AliITSgeomSPD &source){
110 *this = source; // just use the = operator for now.
113 //______________________________________________________________________
114 AliITSgeomSPD& AliITSgeomSPD::operator=(AliITSgeomSPD &source){
118 if(&source == this) return *this;
119 this->fShapeSPD = new TBRIK(*(source.fShapeSPD));
120 if(this->fLowBinEdgeX) delete[] this->fLowBinEdgeX;
121 if(this->fLowBinEdgeZ) delete[] this->fLowBinEdgeZ;
122 this->fNbinx = source.fNbinx;
123 this->fNbinz = source.fNbinz;
124 this->InitLowBinEdgeX();
125 this->InitLowBinEdgeZ();
126 for(i=0;i<fNbinx;i++) this->fLowBinEdgeX[i] = source.fLowBinEdgeX[i];
127 for(i=0;i<fNbinz;i++) this->fLowBinEdgeZ[i] = source.fLowBinEdgeZ[i];
130 //______________________________________________________________________
131 AliITSgeomSPD::~AliITSgeomSPD(){
135 if(this->fLowBinEdgeX) delete[] this->fLowBinEdgeX;
136 if(this->fLowBinEdgeZ) delete[] this->fLowBinEdgeZ;
143 //______________________________________________________________________
144 void AliITSgeomSPD::LToDet(Float_t xl,Float_t zl,Int_t &row,Int_t &col){
145 // Returns the row and column pixel numbers for a given local coordinate
146 // system. If they are outside then it will return -1 or fNbinx/z.
149 if(xl<fLowBinEdgeX[0]) row = -1;
151 for(i=0;i<fNbinx;i++) if(xl<=fLowBinEdgeX[i]) break;
154 if(zl<fLowBinEdgeX[0]) col = -1;
156 for(i=0;i<fNbinz;i++) if(zl<=fLowBinEdgeZ[i]) break;
161 //______________________________________________________________________
162 void AliITSgeomSPD::DetToL(Int_t row,Int_t col,Float_t &xl,Float_t &zl){
163 // returns the pixel center local coordinate system location for a given
164 // row and column number. It the row or column number is outside of the
165 // defined range then it will return the nearest detector edge.
167 if(row>=0||row<fNbinx-1) xl = 0.5*(fLowBinEdgeX[row]+fLowBinEdgeX[row+1]);
168 else if(row<0) xl = fLowBinEdgeX[0];else xl = fLowBinEdgeX[fNbinx-1];
169 if(col>=0||col<fNbinz-1) zl = 0.5*(fLowBinEdgeZ[col]+fLowBinEdgeZ[col+1]);
170 else if(col<0) zl = fLowBinEdgeZ[0];else zl = fLowBinEdgeZ[fNbinz-1];
173 //______________________________________________________________________
174 void AliITSgeomSPD::Print(ostream *os) const {
175 // Standard output format for this class
179 fmt = os->setf(ios::scientific); // set scientific floating point output
180 *os << "TBRIK" << " ";
181 *os << setprecision(16) << GetDx() << " ";
182 *os << setprecision(16) << GetDy() << " ";
183 *os << setprecision(16) << GetDz() << " ";
184 *os << fNbinx-1 << " " << fNbinz-1 << " ";
185 for(i=0;i<fNbinx;i++) *os << setprecision(16) << fLowBinEdgeX[i] << " ";
186 for(i=0;i<fNbinz;i++) *os << setprecision(16) << fLowBinEdgeZ[i] << " ";
191 //______________________________________________________________________
192 void AliITSgeomSPD::Read(istream *is){
193 // Standard input format for this class
198 for(i=0;i<20;i++) shape[i]='\0';
200 if(strcmp(shape,"TBRIK")) Warning("::Read","Shape not a TBRIK");
201 *is >> dx >> dy >> dz;
202 if(fShapeSPD!=0) delete fShapeSPD;
203 SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,dy,dz);
209 for(i=0;i<fNbinx;i++) *is >> fLowBinEdgeX[i];
210 for(i=0;i<fNbinz;i++) *is >> fLowBinEdgeZ[i];
213 //----------------------------------------------------------------------
214 ostream &operator<<(ostream &os,AliITSgeomSPD &p){
215 ////////////////////////////////////////////////////////////////////////
216 // Standard output streaming function.
217 ////////////////////////////////////////////////////////////////////////
222 //----------------------------------------------------------------------
223 istream &operator>>(istream &is,AliITSgeomSPD &r){
224 ////////////////////////////////////////////////////////////////////////
225 // Standard input streaming function.
226 ////////////////////////////////////////////////////////////////////////
231 //=====================================================================
235 Revision 1.11 2001/05/16 08:17:49 hristov
236 Bug fixed in the StepManager to account for the difference in the geometry tree for the ITS pixels. This fixes both the funny distribution of pixel coordinates and the missing hits/digits/points in many sectors of the ITS pixel barrel. Also included is a patch to properly get and use the detector dimensions through out the ITS code. (B.Nilsen)
238 Revision 1.10 2001/04/26 22:44:34 nilsen
241 Revision 1.9 2001/02/09 00:00:57 nilsen
242 Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed
243 bugs in iostream based streamers used to read and write .det files. Fixed
244 some detector sizes. Fixed bugs in some default-special constructors.
246 Revision 1.8 2001/02/03 00:00:30 nilsen
247 New version of AliITSgeom and related files. Now uses automatic streamers,
248 set up for new formatted .det file which includes detector information.
249 Additional smaller modifications are still to come.
251 Revision 1.7 2000/10/02 16:32:35 barbera
252 Forward declaration added
254 Revision 1.1.2.8 2000/10/02 15:52:05 barbera
255 Forward declaration added
257 Revision 1.6 2000/07/10 16:07:18 fca
258 Release version of ITS code
260 Revision 1.4 2000/06/10 20:34:37 nilsen
261 Fixed compilation warning with HP unix.
263 Revision 1.3 2000/06/10 10:43:04 nilsen
264 Fixed bug in copy and operator =.
268 //#include "AliITSgeomSPD300.h"
270 ClassImp(AliITSgeomSPD300)
272 AliITSgeomSPD300::AliITSgeomSPD300() : AliITSgeomSPD(){
273 ////////////////////////////////////////////////////////////////////////
274 // default constructor, for ITS TDR geometry. This only consists of
275 // a default constructor to construct the defalut TDR SPD detector geometry
276 // 256 X 279 300 by 50 micron pixels.
277 ////////////////////////////////////////////////////////////////////////
278 const Float_t kdx=0.6400,kdy=0.0075,kdz=4.1900; // cm; Standard pixel detector
279 // size is 2dx wide, 2dz long,
280 // and 2dy thick. Geant 3.12
282 const Float_t kbinx0 = 0.0050; // cm; Standard pixel size in x direction.
283 const Int_t knbinx = 256; // number of pixels along x direction.
284 const Float_t kbinz0 = 0.0300; // cm; Standard pixel size in z direction.
285 const Float_t kbinz1 = 0.0350; // cm; Edge pixel size in z direction.
286 const Int_t knbinz = 279; // number of pixels along z direction.
288 Float_t dx=0.0,dz=0.0;
290 // cout << "AliITSgeomSPD300 default creator called: start" << endl;
292 SetNbinX(knbinx); // default number of bins in x.
293 SetNbinZ(knbinz); // default number of bins in z.
295 for(i=0;i<knbinx;i++) dx += kbinx0; // Compute size x.
297 for(i=0;i<knbinz;i++) dz += kbinz0; // Compute size z.
298 dz += 2.0*(kbinz1-kbinz0);
302 SetLowBinEdgeX(0,-dx); // Starting position X
303 for(i=0;i<knbinx;i++) SetLowBinEdgeX(i+1,GetBinLowEdgeX(i)+kbinx0);
304 SetLowBinEdgeZ(0,-dz); // Starting position z
305 SetLowBinEdgeZ(1,GetBinLowEdgeZ(0)+kbinz1);
306 for(i=1;i<knbinz;i++) SetLowBinEdgeZ(i+1,GetBinLowEdgeZ(i)+kbinz0);
307 SetLowBinEdgeZ(knbinz,GetBinLowEdgeZ(knbinz-1)+kbinz1);
309 if(TMath::Abs(dx-kdx)>1.0E-4 || TMath::Abs(dz-kdz)>1.0E-4)
310 Warning("Default Creator","Detector size may not be write.");
311 SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,kdy,dz);
312 // cout << "AliITSgeomSPD300 default creator called: end" << endl;
314 //----------------------------------------------------------------------
315 ostream &operator<<(ostream &os,AliITSgeomSPD300 &p){
316 ////////////////////////////////////////////////////////////////////////
317 // Standard output streaming function.
318 ////////////////////////////////////////////////////////////////////////
323 //----------------------------------------------------------------------
324 istream &operator>>(istream &is,AliITSgeomSPD300 &r){
325 ////////////////////////////////////////////////////////////////////////
326 // Standard input streaming function.
327 ////////////////////////////////////////////////////////////////////////
332 //=====================================================================
335 Revision 1.11 2001/05/16 08:17:49 hristov
336 Bug fixed in the StepManager to account for the difference in the geometry tree for the ITS pixels. This fixes both the funny distribution of pixel coordinates and the missing hits/digits/points in many sectors of the ITS pixel barrel. Also included is a patch to properly get and use the detector dimensions through out the ITS code. (B.Nilsen)
338 Revision 1.10 2001/04/26 22:44:34 nilsen
341 Revision 1.9 2001/02/09 00:00:57 nilsen
342 Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed
343 bugs in iostream based streamers used to read and write .det files. Fixed
344 some detector sizes. Fixed bugs in some default-special constructors.
346 Revision 1.8 2001/02/03 00:00:30 nilsen
347 New version of AliITSgeom and related files. Now uses automatic streamers,
348 set up for new formatted .det file which includes detector information.
349 Additional smaller modifications are still to come.
351 Revision 1.7 2000/10/02 16:32:35 barbera
352 Forward declaration added
354 Revision 1.1.2.8 2000/10/02 15:52:05 barbera
355 Forward declaration added
357 Revision 1.6 2000/07/10 16:07:18 fca
358 Release version of ITS code
360 Revision 1.4 2000/06/10 20:34:22 nilsen
361 Fixed compilation warning with HP unix.
363 Revision 1.3 2000/06/10 10:42:49 nilsen
364 Fixed bug in copy and operator =.
369 //#include "AliITSgeomSPD425Short.h"
371 ClassImp(AliITSgeomSPD425Short)
373 AliITSgeomSPD425Short::AliITSgeomSPD425Short() : AliITSgeomSPD(){
374 ////////////////////////////////////////////////////////////////////////
375 // default constructor, for ITS post TDR geometry. This only consists of
376 // a default constructor to construct the defalut post TDR SPD detector
377 // geometry 256 X 197 425 by 50 micron pixels with interleaved 625 by 50
378 // micron pixels (large detector).
379 ////////////////////////////////////////////////////////////////////////
381 //----------------------------------------------------------------------
382 AliITSgeomSPD425Short::AliITSgeomSPD425Short(Int_t npar,Float_t *par) :
384 ////////////////////////////////////////////////////////////////////////
385 // Standard constructor, for ITS post TDR geometry. This only consists of
386 // a default constructor to construct the defalut post TDR SPD detector
387 // geometry 256 X 197 425 by 50 micron pixels with interleaved 625 by 50
388 // micron pixels (large detector).
389 ////////////////////////////////////////////////////////////////////////
391 const Float_t kdx=0.6400/*,kdy=0.015*/,kdz=3.480; // cm; Standard pixel
392 // detector size is 2dx
393 // wide, 2dz long, and
394 // 2dy thick. Geant 3.12
396 const Float_t kbinx0 = 0.0050; // cm; Standard pixel size in x direction.
397 const Int_t knbinx = 256; // number of pixels along x direction.
398 const Float_t kbinz0 = 0.0425; // cm; Standard pixel size in z direction.
399 const Float_t kbinz1 = 0.0625; // cm; Special pixel size in z direction.
400 const Int_t knbinz = 160; // number of pixels along z direction.
402 Float_t dx,dz,*binSizeX,*binSizeZ;
404 SetNbinX(knbinx); // default number of bins in x.
405 SetNbinZ(knbinz); // default number of bins in z.
407 binSizeX = new Float_t[knbinx]; // array of bin sizes along x.
408 for(i=0;i<knbinx;i++) binSizeX[i] = kbinx0; // default x bin size.
409 binSizeZ = new Float_t[knbinz]; // array of bin sizes along z.
410 for(i=0;i<knbinz;i++) binSizeZ[i] = kbinz0; // default z bin size.
411 binSizeZ[ 31] = kbinz1;
412 binSizeZ[ 32] = kbinz1;
414 binSizeZ[ 63] = kbinz1;
415 binSizeZ[ 64] = kbinz1;
417 binSizeZ[ 95] = kbinz1;
418 binSizeZ[ 96] = kbinz1;
420 binSizeZ[127] = kbinz1;
421 binSizeZ[128] = kbinz1;
423 // correct detector size for bin size.
425 for(i=0;i<knbinx;i++) dx += binSizeX[i];
428 for(i=0;i<knbinz;i++) dz += binSizeZ[i];
431 SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",
432 par[0],par[1],par[2]);
433 if(TMath::Abs(dx-kdx)>1.0E-4 || TMath::Abs(dz-kdz)>1.0E-4)
434 Warning("Default Creator","Detector size may not be write.");
436 InitLowBinEdgeX(); // array of bin sizes along x.
437 InitLowBinEdgeZ(); // array of bin sizes along x.
438 SetLowBinEdgeX(0,-dx);
439 SetLowBinEdgeZ(0,-dz);
440 for(i=0;i<knbinx;i++) SetLowBinEdgeX(i+1,GetBinLowEdgeX(i)+binSizeX[i]);
441 for(i=0;i<knbinz;i++) SetLowBinEdgeZ(i+1,GetBinLowEdgeZ(i)+binSizeZ[i]);
443 //----------------------------------------------------------------------
444 ostream &operator<<(ostream &os,AliITSgeomSPD425Short &p){
445 ////////////////////////////////////////////////////////////////////////
446 // Standard output streaming function.
447 ////////////////////////////////////////////////////////////////////////
452 //----------------------------------------------------------------------
453 istream &operator>>(istream &is,AliITSgeomSPD425Short &r){
454 ////////////////////////////////////////////////////////////////////////
455 // Standard input streaming function.
456 ////////////////////////////////////////////////////////////////////////
461 //======================================================================
465 Revision 1.11 2001/05/16 08:17:49 hristov
466 Bug fixed in the StepManager to account for the difference in the geometry tree for the ITS pixels. This fixes both the funny distribution of pixel coordinates and the missing hits/digits/points in many sectors of the ITS pixel barrel. Also included is a patch to properly get and use the detector dimensions through out the ITS code. (B.Nilsen)
468 Revision 1.10 2001/04/26 22:44:34 nilsen
471 Revision 1.9 2001/02/09 00:00:57 nilsen
472 Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed
473 bugs in iostream based streamers used to read and write .det files. Fixed
474 some detector sizes. Fixed bugs in some default-special constructors.
476 Revision 1.8 2001/02/03 00:00:30 nilsen
477 New version of AliITSgeom and related files. Now uses automatic streamers,
478 set up for new formatted .det file which includes detector information.
479 Additional smaller modifications are still to come.
481 Revision 1.7 2000/10/02 16:32:35 barbera
482 Forward declaration added
484 Revision 1.1.2.8 2000/10/02 15:52:05 barbera
485 Forward declaration added
487 Revision 1.6 2000/07/10 16:07:18 fca
488 Release version of ITS code
490 Revision 1.4 2000/06/10 20:34:22 nilsen
491 Fixed compilation warning with HP unix.
493 Revision 1.3 2000/06/10 10:42:49 nilsen
494 Fixed bug in copy and operator =.
499 //#include "AliITSgeomSPD425Long.h"
501 ClassImp(AliITSgeomSPD425Long)
503 AliITSgeomSPD425Long::AliITSgeomSPD425Long(){
504 ////////////////////////////////////////////////////////////////////////
505 // default constructor, for ITS post TDR geometry. This only consists of
506 // a default constructor to construct the defalut post TDR SPD detector
507 // geometry 256 X 197 425 by 50 micron pixels with interleaved 625 by 50
508 // micron pixels (large detector).
509 ////////////////////////////////////////////////////////////////////////
511 const Float_t kdx=0.6400,kdy=0.0075,kdz=4.2650; // cm; Standard pixel
512 // detector size is 2dx
513 // wide, 2dz long, and
514 // 2dy thick. Geant 3.12
516 const Float_t kbinx0 = 0.0050; // cm; Standard pixel size in x direction.
517 const Int_t knbinx = 256; // number of pixels along x direction.
518 const Float_t kbinz0 = 0.0425; // cm; Standard pixel size in z direction.
519 const Float_t kbinz1 = 0.0625; // cm; Special pixel size in z direction.
520 const Int_t knbinz = 192; // number of pixels along z direction.
522 Float_t dx,dz,*binSizeX,*binSizeZ;
524 SetNbinX(knbinx); // default number of bins in x.
525 SetNbinZ(knbinz); // default number of bins in z.
527 binSizeX = new Float_t[knbinx]; // array of bin sizes along x.
528 for(i=0;i<knbinx;i++) binSizeX[i] = kbinx0; // default x bin size.
529 binSizeZ = new Float_t[knbinz]; // array of bin sizes along z.
530 for(i=0;i<knbinz;i++) binSizeZ[i] = kbinz0; // default z bin size.
531 binSizeZ[ 31] = kbinz1;
532 binSizeZ[ 32] = kbinz1;
534 binSizeZ[ 63] = kbinz1;
535 binSizeZ[ 64] = kbinz1;
537 binSizeZ[ 95] = kbinz1;
538 binSizeZ[ 96] = kbinz1;
540 binSizeZ[127] = kbinz1;
541 binSizeZ[128] = kbinz1;
543 binSizeZ[159] = kbinz1;
544 binSizeZ[160] = kbinz1;
546 // correct detector size for bin size.
548 for(i=0;i<knbinx;i++) dx += binSizeX[i];
551 for(i=0;i<knbinz;i++) dz += binSizeZ[i];
554 SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,kdy,dz);
555 if(TMath::Abs(dx-kdx)>1.0E-4 || TMath::Abs(dz-kdz)>1.0E-4)
556 Warning("Default Creator","Detector size may not be write.");
558 InitLowBinEdgeX(); // array of bin sizes along x.
559 InitLowBinEdgeZ(); // array of bin sizes along x.
560 SetLowBinEdgeX(0,-dx);
561 SetLowBinEdgeZ(0,-dz);
562 for(i=0;i<knbinx;i++) SetLowBinEdgeX(i+1,GetBinLowEdgeX(i)+binSizeX[i]);
563 for(i=0;i<knbinz;i++) SetLowBinEdgeZ(i+1,GetBinLowEdgeZ(i)+binSizeZ[i]);
565 //----------------------------------------------------------------------
566 ostream &operator<<(ostream &os,AliITSgeomSPD425Long &p){
567 ////////////////////////////////////////////////////////////////////////
568 // Standard output streaming function.
569 ////////////////////////////////////////////////////////////////////////
574 //----------------------------------------------------------------------
575 istream &operator>>(istream &is,AliITSgeomSPD425Long &r){
576 ////////////////////////////////////////////////////////////////////////
577 // Standard input streaming function.
578 ////////////////////////////////////////////////////////////////////////
583 //======================================================================