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.10 2001/04/26 22:44:34 nilsen
21 Revision 1.9 2001/02/09 00:00:57 nilsen
22 Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed
23 bugs in iostream based streamers used to read and write .det files. Fixed
24 some detector sizes. Fixed bugs in some default-special constructors.
26 Revision 1.8 2001/02/03 00:00:30 nilsen
27 New version of AliITSgeom and related files. Now uses automatic streamers,
28 set up for new formatted .det file which includes detector information.
29 Additional smaller modifications are still to come.
38 #include "AliITSgeomSPD.h"
40 ClassImp(AliITSgeomSPD)
42 AliITSgeomSPD::AliITSgeomSPD(){
43 // Default Constructor. Set everthing to null.
51 //______________________________________________________________________
52 AliITSgeomSPD::AliITSgeomSPD(Float_t dy,Int_t nx,Float_t *bx,
53 Int_t nz,Float_t *bz){
54 // Standard Constructor. Set everthing to null.
61 ReSetBins(dy,nx,bx,nz,bz);
64 //______________________________________________________________________
65 void AliITSgeomSPD::ReSetBins(Float_t dy,Int_t nx,Float_t *bx,
66 Int_t nz,Float_t *bz){
67 // delets the contents of this and replaces it with the given values.
69 Float_t dx = 0.0, dz = 0.0;
71 // Compute size in x and z (based on bins).
72 for(i=0;i<nx;i++) dx += bx[i];
73 for(i=0;i<nz;i++) dz += bz[i];
77 delete fShapeSPD; // delete existing shape
78 if(this->fLowBinEdgeX) delete[] this->fLowBinEdgeX; // delete existing
79 if(this->fLowBinEdgeZ) delete[] this->fLowBinEdgeZ; // delete existing
85 fLowBinEdgeX[0] = -dx;
86 fLowBinEdgeZ[0] = -dz;
87 for(i=0;i<nx;i++) fLowBinEdgeX[i+1] = fLowBinEdgeX[i] + bx[i];
88 for(i=0;i<nz;i++) fLowBinEdgeZ[i+1] = fLowBinEdgeZ[i] + bz[i];
89 SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,dy,dz);
92 //______________________________________________________________________
93 AliITSgeomSPD::AliITSgeomSPD(AliITSgeomSPD &source){
96 *this = source; // just use the = operator for now.
99 //______________________________________________________________________
100 AliITSgeomSPD& AliITSgeomSPD::operator=(AliITSgeomSPD &source){
104 if(&source == this) return *this;
105 this->fShapeSPD = new TBRIK(*(source.fShapeSPD));
106 if(this->fLowBinEdgeX) delete[] this->fLowBinEdgeX;
107 if(this->fLowBinEdgeZ) delete[] this->fLowBinEdgeZ;
108 this->fNbinx = source.fNbinx;
109 this->fNbinz = source.fNbinz;
110 this->InitLowBinEdgeX();
111 this->InitLowBinEdgeZ();
112 for(i=0;i<fNbinx;i++) this->fLowBinEdgeX[i] = source.fLowBinEdgeX[i];
113 for(i=0;i<fNbinz;i++) this->fLowBinEdgeZ[i] = source.fLowBinEdgeZ[i];
116 //______________________________________________________________________
117 AliITSgeomSPD::~AliITSgeomSPD(){
121 if(this->fLowBinEdgeX) delete[] this->fLowBinEdgeX;
122 if(this->fLowBinEdgeZ) delete[] this->fLowBinEdgeZ;
129 //______________________________________________________________________
130 void AliITSgeomSPD::LToDet(Float_t xl,Float_t zl,Int_t &row,Int_t &col){
131 // Returns the row and column pixel numbers for a given local coordinate
132 // system. If they are outside then it will return -1 or fNbinx/z.
135 if(xl<fLowBinEdgeX[0]) row = -1;
137 for(i=0;i<fNbinx;i++) if(xl<=fLowBinEdgeX[i]) break;
140 if(zl<fLowBinEdgeX[0]) col = -1;
142 for(i=0;i<fNbinz;i++) if(zl<=fLowBinEdgeZ[i]) break;
147 //______________________________________________________________________
148 void AliITSgeomSPD::DetToL(Int_t row,Int_t col,Float_t &xl,Float_t &zl){
149 // returns the pixel center local coordinate system location for a given
150 // row and column number. It the row or column number is outside of the
151 // defined range then it will return the nearest detector edge.
153 if(row>=0||row<fNbinx-1) xl = 0.5*(fLowBinEdgeX[row]+fLowBinEdgeX[row+1]);
154 else if(row<0) xl = fLowBinEdgeX[0];else xl = fLowBinEdgeX[fNbinx-1];
155 if(col>=0||col<fNbinz-1) zl = 0.5*(fLowBinEdgeZ[col]+fLowBinEdgeZ[col+1]);
156 else if(col<0) zl = fLowBinEdgeZ[0];else zl = fLowBinEdgeZ[fNbinz-1];
159 //______________________________________________________________________
160 void AliITSgeomSPD::Print(ostream *os) const {
161 // Standard output format for this class
165 fmt = os->setf(ios::scientific); // set scientific floating point output
166 *os << "TBRIK" << " ";
167 *os << setprecision(16) << GetDx() << " ";
168 *os << setprecision(16) << GetDy() << " ";
169 *os << setprecision(16) << GetDz() << " ";
170 *os << fNbinx-1 << " " << fNbinz-1 << " ";
171 for(i=0;i<fNbinx;i++) *os << setprecision(16) << fLowBinEdgeX[i] << " ";
172 for(i=0;i<fNbinz;i++) *os << setprecision(16) << fLowBinEdgeZ[i] << " ";
177 //______________________________________________________________________
178 void AliITSgeomSPD::Read(istream *is){
179 // Standard input format for this class
184 for(i=0;i<20;i++) shape[i]='\0';
186 if(strcmp(shape,"TBRIK")) Warning("::Read","Shape not a TBRIK");
187 *is >> dx >> dy >> dz;
188 if(fShapeSPD!=0) delete fShapeSPD;
189 SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,dy,dz);
195 for(i=0;i<fNbinx;i++) *is >> fLowBinEdgeX[i];
196 for(i=0;i<fNbinz;i++) *is >> fLowBinEdgeZ[i];
199 //----------------------------------------------------------------------
200 ostream &operator<<(ostream &os,AliITSgeomSPD &p){
201 ////////////////////////////////////////////////////////////////////////
202 // Standard output streaming function.
203 ////////////////////////////////////////////////////////////////////////
208 //----------------------------------------------------------------------
209 istream &operator>>(istream &is,AliITSgeomSPD &r){
210 ////////////////////////////////////////////////////////////////////////
211 // Standard input streaming function.
212 ////////////////////////////////////////////////////////////////////////
217 //=====================================================================
221 Revision 1.10 2001/04/26 22:44:34 nilsen
224 Revision 1.9 2001/02/09 00:00:57 nilsen
225 Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed
226 bugs in iostream based streamers used to read and write .det files. Fixed
227 some detector sizes. Fixed bugs in some default-special constructors.
229 Revision 1.8 2001/02/03 00:00:30 nilsen
230 New version of AliITSgeom and related files. Now uses automatic streamers,
231 set up for new formatted .det file which includes detector information.
232 Additional smaller modifications are still to come.
234 Revision 1.7 2000/10/02 16:32:35 barbera
235 Forward declaration added
237 Revision 1.1.2.8 2000/10/02 15:52:05 barbera
238 Forward declaration added
240 Revision 1.6 2000/07/10 16:07:18 fca
241 Release version of ITS code
243 Revision 1.4 2000/06/10 20:34:37 nilsen
244 Fixed compilation warning with HP unix.
246 Revision 1.3 2000/06/10 10:43:04 nilsen
247 Fixed bug in copy and operator =.
251 //#include "AliITSgeomSPD300.h"
253 ClassImp(AliITSgeomSPD300)
255 AliITSgeomSPD300::AliITSgeomSPD300() : AliITSgeomSPD(){
256 ////////////////////////////////////////////////////////////////////////
257 // default constructor, for ITS TDR geometry. This only consists of
258 // a default constructor to construct the defalut TDR SPD detector geometry
259 // 256 X 279 300 by 50 micron pixels.
260 ////////////////////////////////////////////////////////////////////////
261 const Float_t kdx=0.6400,kdy=0.0075,kdz=4.1900; // cm; Standard pixel detector
262 // size is 2dx wide, 2dz long,
263 // and 2dy thick. Geant 3.12
265 const Float_t kbinx0 = 0.0050; // cm; Standard pixel size in x direction.
266 const Int_t knbinx = 256; // number of pixels along x direction.
267 const Float_t kbinz0 = 0.0300; // cm; Standard pixel size in z direction.
268 const Float_t kbinz1 = 0.0350; // cm; Edge pixel size in z direction.
269 const Int_t knbinz = 279; // number of pixels along z direction.
271 Float_t dx=0.0,dz=0.0;
273 // cout << "AliITSgeomSPD300 default creator called: start" << endl;
275 SetNbinX(knbinx); // default number of bins in x.
276 SetNbinZ(knbinz); // default number of bins in z.
278 for(i=0;i<knbinx;i++) dx += kbinx0; // Compute size x.
280 for(i=0;i<knbinz;i++) dz += kbinz0; // Compute size z.
281 dz += 2.0*(kbinz1-kbinz0);
285 SetLowBinEdgeX(0,-dx); // Starting position X
286 for(i=0;i<knbinx;i++) SetLowBinEdgeX(i+1,GetBinLowEdgeX(i)+kbinx0);
287 SetLowBinEdgeZ(0,-dz); // Starting position z
288 SetLowBinEdgeZ(1,GetBinLowEdgeZ(0)+kbinz1);
289 for(i=1;i<knbinz;i++) SetLowBinEdgeZ(i+1,GetBinLowEdgeZ(i)+kbinz0);
290 SetLowBinEdgeZ(knbinz,GetBinLowEdgeZ(knbinz-1)+kbinz1);
292 if(TMath::Abs(dx-kdx)>1.0E-4 || TMath::Abs(dz-kdz)>1.0E-4)
293 Warning("Default Creator","Detector size may not be write.");
294 SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,kdy,dz);
295 // cout << "AliITSgeomSPD300 default creator called: end" << endl;
297 //----------------------------------------------------------------------
298 ostream &operator<<(ostream &os,AliITSgeomSPD300 &p){
299 ////////////////////////////////////////////////////////////////////////
300 // Standard output streaming function.
301 ////////////////////////////////////////////////////////////////////////
306 //----------------------------------------------------------------------
307 istream &operator>>(istream &is,AliITSgeomSPD300 &r){
308 ////////////////////////////////////////////////////////////////////////
309 // Standard input streaming function.
310 ////////////////////////////////////////////////////////////////////////
315 //=====================================================================
318 Revision 1.10 2001/04/26 22:44:34 nilsen
321 Revision 1.9 2001/02/09 00:00:57 nilsen
322 Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed
323 bugs in iostream based streamers used to read and write .det files. Fixed
324 some detector sizes. Fixed bugs in some default-special constructors.
326 Revision 1.8 2001/02/03 00:00:30 nilsen
327 New version of AliITSgeom and related files. Now uses automatic streamers,
328 set up for new formatted .det file which includes detector information.
329 Additional smaller modifications are still to come.
331 Revision 1.7 2000/10/02 16:32:35 barbera
332 Forward declaration added
334 Revision 1.1.2.8 2000/10/02 15:52:05 barbera
335 Forward declaration added
337 Revision 1.6 2000/07/10 16:07:18 fca
338 Release version of ITS code
340 Revision 1.4 2000/06/10 20:34:22 nilsen
341 Fixed compilation warning with HP unix.
343 Revision 1.3 2000/06/10 10:42:49 nilsen
344 Fixed bug in copy and operator =.
349 //#include "AliITSgeomSPD425Short.h"
351 ClassImp(AliITSgeomSPD425Short)
353 AliITSgeomSPD425Short::AliITSgeomSPD425Short() : AliITSgeomSPD(){
354 ////////////////////////////////////////////////////////////////////////
355 // default constructor, for ITS post TDR geometry. This only consists of
356 // a default constructor to construct the defalut post TDR SPD detector
357 // geometry 256 X 197 425 by 50 micron pixels with interleaved 625 by 50
358 // micron pixels (large detector).
359 ////////////////////////////////////////////////////////////////////////
361 //----------------------------------------------------------------------
362 AliITSgeomSPD425Short::AliITSgeomSPD425Short(Int_t npar,Float_t *par) :
364 ////////////////////////////////////////////////////////////////////////
365 // Standard constructor, for ITS post TDR geometry. This only consists of
366 // a default constructor to construct the defalut post TDR SPD detector
367 // geometry 256 X 197 425 by 50 micron pixels with interleaved 625 by 50
368 // micron pixels (large detector).
369 ////////////////////////////////////////////////////////////////////////
371 const Float_t kdx=0.6400,kdy=0.015,kdz=3.480; // cm; Standard pixel
372 // detector size is 2dx
373 // wide, 2dz long, and
374 // 2dy thick. Geant 3.12
376 const Float_t kbinx0 = 0.0050; // cm; Standard pixel size in x direction.
377 const Int_t knbinx = 256; // number of pixels along x direction.
378 const Float_t kbinz0 = 0.0425; // cm; Standard pixel size in z direction.
379 const Float_t kbinz1 = 0.0625; // cm; Special pixel size in z direction.
380 const Int_t knbinz = 160; // number of pixels along z direction.
382 Float_t dx,dz,*binSizeX,*binSizeZ;
384 SetNbinX(knbinx); // default number of bins in x.
385 SetNbinZ(knbinz); // default number of bins in z.
387 binSizeX = new Float_t[knbinx]; // array of bin sizes along x.
388 for(i=0;i<knbinx;i++) binSizeX[i] = kbinx0; // default x bin size.
389 binSizeZ = new Float_t[knbinz]; // array of bin sizes along z.
390 for(i=0;i<knbinz;i++) binSizeZ[i] = kbinz0; // default z bin size.
391 binSizeZ[ 31] = kbinz1;
392 binSizeZ[ 32] = kbinz1;
394 binSizeZ[ 63] = kbinz1;
395 binSizeZ[ 64] = kbinz1;
397 binSizeZ[ 95] = kbinz1;
398 binSizeZ[ 96] = kbinz1;
400 binSizeZ[127] = kbinz1;
401 binSizeZ[128] = kbinz1;
403 // correct detector size for bin size.
405 for(i=0;i<knbinx;i++) dx += binSizeX[i];
408 for(i=0;i<knbinz;i++) dz += binSizeZ[i];
411 SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",
412 par[0],par[1],par[2]);
413 if(TMath::Abs(dx-kdx)>1.0E-4 || TMath::Abs(dz-kdz)>1.0E-4)
414 Warning("Default Creator","Detector size may not be write.");
416 InitLowBinEdgeX(); // array of bin sizes along x.
417 InitLowBinEdgeZ(); // array of bin sizes along x.
418 SetLowBinEdgeX(0,-dx);
419 SetLowBinEdgeZ(0,-dz);
420 for(i=0;i<knbinx;i++) SetLowBinEdgeX(i+1,GetBinLowEdgeX(i)+binSizeX[i]);
421 for(i=0;i<knbinz;i++) SetLowBinEdgeZ(i+1,GetBinLowEdgeZ(i)+binSizeZ[i]);
423 //----------------------------------------------------------------------
424 ostream &operator<<(ostream &os,AliITSgeomSPD425Short &p){
425 ////////////////////////////////////////////////////////////////////////
426 // Standard output streaming function.
427 ////////////////////////////////////////////////////////////////////////
432 //----------------------------------------------------------------------
433 istream &operator>>(istream &is,AliITSgeomSPD425Short &r){
434 ////////////////////////////////////////////////////////////////////////
435 // Standard input streaming function.
436 ////////////////////////////////////////////////////////////////////////
441 //======================================================================
445 Revision 1.10 2001/04/26 22:44:34 nilsen
448 Revision 1.9 2001/02/09 00:00:57 nilsen
449 Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed
450 bugs in iostream based streamers used to read and write .det files. Fixed
451 some detector sizes. Fixed bugs in some default-special constructors.
453 Revision 1.8 2001/02/03 00:00:30 nilsen
454 New version of AliITSgeom and related files. Now uses automatic streamers,
455 set up for new formatted .det file which includes detector information.
456 Additional smaller modifications are still to come.
458 Revision 1.7 2000/10/02 16:32:35 barbera
459 Forward declaration added
461 Revision 1.1.2.8 2000/10/02 15:52:05 barbera
462 Forward declaration added
464 Revision 1.6 2000/07/10 16:07:18 fca
465 Release version of ITS code
467 Revision 1.4 2000/06/10 20:34:22 nilsen
468 Fixed compilation warning with HP unix.
470 Revision 1.3 2000/06/10 10:42:49 nilsen
471 Fixed bug in copy and operator =.
476 //#include "AliITSgeomSPD425Long.h"
478 ClassImp(AliITSgeomSPD425Long)
480 AliITSgeomSPD425Long::AliITSgeomSPD425Long(){
481 ////////////////////////////////////////////////////////////////////////
482 // default constructor, for ITS post TDR geometry. This only consists of
483 // a default constructor to construct the defalut post TDR SPD detector
484 // geometry 256 X 197 425 by 50 micron pixels with interleaved 625 by 50
485 // micron pixels (large detector).
486 ////////////////////////////////////////////////////////////////////////
488 const Float_t kdx=0.6400,kdy=0.0075,kdz=4.2650; // cm; Standard pixel
489 // detector size is 2dx
490 // wide, 2dz long, and
491 // 2dy thick. Geant 3.12
493 const Float_t kbinx0 = 0.0050; // cm; Standard pixel size in x direction.
494 const Int_t knbinx = 256; // number of pixels along x direction.
495 const Float_t kbinz0 = 0.0425; // cm; Standard pixel size in z direction.
496 const Float_t kbinz1 = 0.0625; // cm; Special pixel size in z direction.
497 const Int_t knbinz = 192; // number of pixels along z direction.
499 Float_t dx,dz,*binSizeX,*binSizeZ;
501 SetNbinX(knbinx); // default number of bins in x.
502 SetNbinZ(knbinz); // default number of bins in z.
504 binSizeX = new Float_t[knbinx]; // array of bin sizes along x.
505 for(i=0;i<knbinx;i++) binSizeX[i] = kbinx0; // default x bin size.
506 binSizeZ = new Float_t[knbinz]; // array of bin sizes along z.
507 for(i=0;i<knbinz;i++) binSizeZ[i] = kbinz0; // default z bin size.
508 binSizeZ[ 31] = kbinz1;
509 binSizeZ[ 32] = kbinz1;
511 binSizeZ[ 63] = kbinz1;
512 binSizeZ[ 64] = kbinz1;
514 binSizeZ[ 95] = kbinz1;
515 binSizeZ[ 96] = kbinz1;
517 binSizeZ[127] = kbinz1;
518 binSizeZ[128] = kbinz1;
520 binSizeZ[159] = kbinz1;
521 binSizeZ[160] = kbinz1;
523 // correct detector size for bin size.
525 for(i=0;i<knbinx;i++) dx += binSizeX[i];
528 for(i=0;i<knbinz;i++) dz += binSizeZ[i];
531 SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,kdy,dz);
532 if(TMath::Abs(dx-kdx)>1.0E-4 || TMath::Abs(dz-kdz)>1.0E-4)
533 Warning("Default Creator","Detector size may not be write.");
535 InitLowBinEdgeX(); // array of bin sizes along x.
536 InitLowBinEdgeZ(); // array of bin sizes along x.
537 SetLowBinEdgeX(0,-dx);
538 SetLowBinEdgeZ(0,-dz);
539 for(i=0;i<knbinx;i++) SetLowBinEdgeX(i+1,GetBinLowEdgeX(i)+binSizeX[i]);
540 for(i=0;i<knbinz;i++) SetLowBinEdgeZ(i+1,GetBinLowEdgeZ(i)+binSizeZ[i]);
542 //----------------------------------------------------------------------
543 ostream &operator<<(ostream &os,AliITSgeomSPD425Long &p){
544 ////////////////////////////////////////////////////////////////////////
545 // Standard output streaming function.
546 ////////////////////////////////////////////////////////////////////////
551 //----------------------------------------------------------------------
552 istream &operator>>(istream &is,AliITSgeomSPD425Long &r){
553 ////////////////////////////////////////////////////////////////////////
554 // Standard input streaming function.
555 ////////////////////////////////////////////////////////////////////////
560 //======================================================================