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.9 2001/02/09 00:00:57 nilsen
19 Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed
20 bugs in iostream based streamers used to read and write .det files. Fixed
21 some detector sizes. Fixed bugs in some default-special constructors.
23 Revision 1.8 2001/02/03 00:00:30 nilsen
24 New version of AliITSgeom and related files. Now uses automatic streamers,
25 set up for new formatted .det file which includes detector information.
26 Additional smaller modifications are still to come.
35 #include "AliITSgeomSPD.h"
37 ClassImp(AliITSgeomSPD)
39 AliITSgeomSPD::AliITSgeomSPD(){
40 // Default Constructor. Set everthing to null.
48 //______________________________________________________________________
49 AliITSgeomSPD::AliITSgeomSPD(Float_t dy,Int_t nx,Float_t *bx,
50 Int_t nz,Float_t *bz){
51 // Standard Constructor. Set everthing to null.
58 ReSetBins(dy,nx,bx,nz,bz);
61 //______________________________________________________________________
62 void AliITSgeomSPD::ReSetBins(Float_t dy,Int_t nx,Float_t *bx,
63 Int_t nz,Float_t *bz){
64 // delets the contents of this and replaces it with the given values.
66 Float_t dx = 0.0, dz = 0.0;
68 // Compute size in x and z (based on bins).
69 for(i=0;i<nx;i++) dx += bx[i];
70 for(i=0;i<nz;i++) dz += bz[i];
74 delete fShapeSPD; // delete existing shape
75 if(this->fLowBinEdgeX) delete[] this->fLowBinEdgeX; // delete existing
76 if(this->fLowBinEdgeZ) delete[] this->fLowBinEdgeZ; // delete existing
82 fLowBinEdgeX[0] = -dx;
83 fLowBinEdgeZ[0] = -dz;
84 for(i=0;i<nx;i++) fLowBinEdgeX[i+1] = fLowBinEdgeX[i] + bx[i];
85 for(i=0;i<nz;i++) fLowBinEdgeZ[i+1] = fLowBinEdgeZ[i] + bz[i];
86 SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,dy,dz);
89 //______________________________________________________________________
90 AliITSgeomSPD::AliITSgeomSPD(AliITSgeomSPD &source){
93 *this = source; // just use the = operator for now.
96 //______________________________________________________________________
97 AliITSgeomSPD& AliITSgeomSPD::operator=(AliITSgeomSPD &source){
101 if(&source == this) return *this;
102 this->fShapeSPD = new TBRIK(*(source.fShapeSPD));
103 if(this->fLowBinEdgeX) delete[] this->fLowBinEdgeX;
104 if(this->fLowBinEdgeZ) delete[] this->fLowBinEdgeZ;
105 this->fNbinx = source.fNbinx;
106 this->fNbinz = source.fNbinz;
107 this->InitLowBinEdgeX();
108 this->InitLowBinEdgeZ();
109 for(i=0;i<fNbinx;i++) this->fLowBinEdgeX[i] = source.fLowBinEdgeX[i];
110 for(i=0;i<fNbinz;i++) this->fLowBinEdgeZ[i] = source.fLowBinEdgeZ[i];
113 //______________________________________________________________________
114 AliITSgeomSPD::~AliITSgeomSPD(){
118 if(this->fLowBinEdgeX) delete[] this->fLowBinEdgeX;
119 if(this->fLowBinEdgeZ) delete[] this->fLowBinEdgeZ;
126 //______________________________________________________________________
127 void AliITSgeomSPD::LToDet(Float_t xl,Float_t zl,Int_t &row,Int_t &col){
128 // Returns the row and column pixel numbers for a given local coordinate
129 // system. If they are outside then it will return -1 or fNbinx/z.
132 if(xl<fLowBinEdgeX[0]) row = -1;
134 for(i=0;i<fNbinx;i++) if(xl<=fLowBinEdgeX[i]) break;
137 if(zl<fLowBinEdgeX[0]) col = -1;
139 for(i=0;i<fNbinz;i++) if(zl<=fLowBinEdgeZ[i]) break;
144 //______________________________________________________________________
145 void AliITSgeomSPD::DetToL(Int_t row,Int_t col,Float_t &xl,Float_t &zl){
146 // returns the pixel center local coordinate system location for a given
147 // row and column number. It the row or column number is outside of the
148 // defined range then it will return the nearest detector edge.
150 if(row>=0||row<fNbinx-1) xl = 0.5*(fLowBinEdgeX[row]+fLowBinEdgeX[row+1]);
151 else if(row<0) xl = fLowBinEdgeX[0];else xl = fLowBinEdgeX[fNbinx-1];
152 if(col>=0||col<fNbinz-1) zl = 0.5*(fLowBinEdgeZ[col]+fLowBinEdgeZ[col+1]);
153 else if(col<0) zl = fLowBinEdgeZ[0];else zl = fLowBinEdgeZ[fNbinz-1];
156 //______________________________________________________________________
157 void AliITSgeomSPD::Print(ostream *os) const {
158 // Standard output format for this class
162 fmt = os->setf(ios::scientific); // set scientific floating point output
163 *os << "TBRIK" << " ";
164 *os << setprecision(16) << GetDx() << " ";
165 *os << setprecision(16) << GetDy() << " ";
166 *os << setprecision(16) << GetDz() << " ";
167 *os << fNbinx-1 << " " << fNbinz-1 << " ";
168 for(i=0;i<fNbinx;i++) *os << setprecision(16) << fLowBinEdgeX[i] << " ";
169 for(i=0;i<fNbinz;i++) *os << setprecision(16) << fLowBinEdgeZ[i] << " ";
174 //______________________________________________________________________
175 void AliITSgeomSPD::Read(istream *is){
176 // Standard input format for this class
181 for(i=0;i<20;i++) shape[i]='\0';
183 if(strcmp(shape,"TBRIK")) Warning("::Read","Shape not a TBRIK");
184 *is >> dx >> dy >> dz;
185 if(fShapeSPD!=0) delete fShapeSPD;
186 SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,dy,dz);
192 for(i=0;i<fNbinx;i++) *is >> fLowBinEdgeX[i];
193 for(i=0;i<fNbinz;i++) *is >> fLowBinEdgeZ[i];
196 //----------------------------------------------------------------------
197 ostream &operator<<(ostream &os,AliITSgeomSPD &p){
198 ////////////////////////////////////////////////////////////////////////
199 // Standard output streaming function.
200 ////////////////////////////////////////////////////////////////////////
205 //----------------------------------------------------------------------
206 istream &operator>>(istream &is,AliITSgeomSPD &r){
207 ////////////////////////////////////////////////////////////////////////
208 // Standard input streaming function.
209 ////////////////////////////////////////////////////////////////////////
214 //=====================================================================
218 Revision 1.9 2001/02/09 00:00:57 nilsen
219 Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed
220 bugs in iostream based streamers used to read and write .det files. Fixed
221 some detector sizes. Fixed bugs in some default-special constructors.
223 Revision 1.8 2001/02/03 00:00:30 nilsen
224 New version of AliITSgeom and related files. Now uses automatic streamers,
225 set up for new formatted .det file which includes detector information.
226 Additional smaller modifications are still to come.
228 Revision 1.7 2000/10/02 16:32:35 barbera
229 Forward declaration added
231 Revision 1.1.2.8 2000/10/02 15:52:05 barbera
232 Forward declaration added
234 Revision 1.6 2000/07/10 16:07:18 fca
235 Release version of ITS code
237 Revision 1.4 2000/06/10 20:34:37 nilsen
238 Fixed compilation warning with HP unix.
240 Revision 1.3 2000/06/10 10:43:04 nilsen
241 Fixed bug in copy and operator =.
245 //#include "AliITSgeomSPD300.h"
247 ClassImp(AliITSgeomSPD300)
249 AliITSgeomSPD300::AliITSgeomSPD300() : AliITSgeomSPD(){
250 ////////////////////////////////////////////////////////////////////////
251 // default constructor, for ITS TDR geometry. This only consists of
252 // a default constructor to construct the defalut TDR SPD detector geometry
253 // 256 X 279 300 by 50 micron pixels.
254 ////////////////////////////////////////////////////////////////////////
255 const Float_t kdx=0.6400,kdy=0.0075,kdz=4.1900; // cm; Standard pixel detector
256 // size is 2dx wide, 2dz long,
257 // and 2dy thick. Geant 3.12
259 const Float_t kbinx0 = 0.0050; // cm; Standard pixel size in x direction.
260 const Int_t knbinx = 256; // number of pixels along x direction.
261 const Float_t kbinz0 = 0.0300; // cm; Standard pixel size in z direction.
262 const Float_t kbinz1 = 0.0350; // cm; Edge pixel size in z direction.
263 const Int_t knbinz = 279; // number of pixels along z direction.
265 Float_t dx=0.0,dz=0.0;
267 // cout << "AliITSgeomSPD300 default creator called: start" << endl;
269 SetNbinX(knbinx); // default number of bins in x.
270 SetNbinZ(knbinz); // default number of bins in z.
272 for(i=0;i<knbinx;i++) dx += kbinx0; // Compute size x.
274 for(i=0;i<knbinz;i++) dz += kbinz0; // Compute size z.
275 dz += 2.0*(kbinz1-kbinz0);
279 SetLowBinEdgeX(0,-dx); // Starting position X
280 for(i=0;i<knbinx;i++) SetLowBinEdgeX(i+1,GetBinLowEdgeX(i)+kbinx0);
281 SetLowBinEdgeZ(0,-dz); // Starting position z
282 SetLowBinEdgeZ(1,GetBinLowEdgeZ(0)+kbinz1);
283 for(i=1;i<knbinz;i++) SetLowBinEdgeZ(i+1,GetBinLowEdgeZ(i)+kbinz0);
284 SetLowBinEdgeZ(knbinz,GetBinLowEdgeZ(knbinz-1)+kbinz1);
286 if(TMath::Abs(dx-kdx)>1.0E-4 || TMath::Abs(dz-kdz)>1.0E-4)
287 Warning("Default Creator","Detector size may not be write.");
288 SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,kdy,dz);
289 // cout << "AliITSgeomSPD300 default creator called: end" << endl;
291 //----------------------------------------------------------------------
292 ostream &operator<<(ostream &os,AliITSgeomSPD300 &p){
293 ////////////////////////////////////////////////////////////////////////
294 // Standard output streaming function.
295 ////////////////////////////////////////////////////////////////////////
300 //----------------------------------------------------------------------
301 istream &operator>>(istream &is,AliITSgeomSPD300 &r){
302 ////////////////////////////////////////////////////////////////////////
303 // Standard input streaming function.
304 ////////////////////////////////////////////////////////////////////////
309 //=====================================================================
312 Revision 1.9 2001/02/09 00:00:57 nilsen
313 Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed
314 bugs in iostream based streamers used to read and write .det files. Fixed
315 some detector sizes. Fixed bugs in some default-special constructors.
317 Revision 1.8 2001/02/03 00:00:30 nilsen
318 New version of AliITSgeom and related files. Now uses automatic streamers,
319 set up for new formatted .det file which includes detector information.
320 Additional smaller modifications are still to come.
322 Revision 1.7 2000/10/02 16:32:35 barbera
323 Forward declaration added
325 Revision 1.1.2.8 2000/10/02 15:52:05 barbera
326 Forward declaration added
328 Revision 1.6 2000/07/10 16:07:18 fca
329 Release version of ITS code
331 Revision 1.4 2000/06/10 20:34:22 nilsen
332 Fixed compilation warning with HP unix.
334 Revision 1.3 2000/06/10 10:42:49 nilsen
335 Fixed bug in copy and operator =.
340 //#include "AliITSgeomSPD425Short.h"
342 ClassImp(AliITSgeomSPD425Short)
344 AliITSgeomSPD425Short::AliITSgeomSPD425Short(){
345 ////////////////////////////////////////////////////////////////////////
346 // default constructor, for ITS post TDR geometry. This only consists of
347 // a default constructor to construct the defalut post TDR SPD detector
348 // geometry 256 X 197 425 by 50 micron pixels with interleaved 625 by 50
349 // micron pixels (large detector).
350 ////////////////////////////////////////////////////////////////////////
352 const Float_t kdx=0.6400,kdy=0.015,kdz=3.480; // cm; Standard pixel
353 // detector size is 2dx
354 // wide, 2dz long, and
355 // 2dy thick. Geant 3.12
357 const Float_t kbinx0 = 0.0050; // cm; Standard pixel size in x direction.
358 const Int_t knbinx = 256; // number of pixels along x direction.
359 const Float_t kbinz0 = 0.0425; // cm; Standard pixel size in z direction.
360 const Float_t kbinz1 = 0.0625; // cm; Special pixel size in z direction.
361 const Int_t knbinz = 161; // number of pixels along z direction.
363 Float_t dx,dz,*binSizeX,*binSizeZ;
365 SetNbinX(knbinx); // default number of bins in x.
366 SetNbinZ(knbinz); // default number of bins in z.
368 binSizeX = new Float_t[knbinx]; // array of bin sizes along x.
369 for(i=0;i<knbinx;i++) binSizeX[i] = kbinx0; // default x bin size.
370 binSizeZ = new Float_t[knbinz]; // array of bin sizes along z.
371 for(i=0;i<knbinz;i++) binSizeZ[i] = kbinz0; // default z bin size.
372 binSizeZ[ 31] = kbinz1;
373 binSizeZ[ 32] = kbinz1;
375 binSizeZ[ 63] = kbinz1;
376 binSizeZ[ 64] = kbinz1;
378 binSizeZ[ 95] = kbinz1;
379 binSizeZ[ 96] = kbinz1;
381 binSizeZ[127] = kbinz1;
382 binSizeZ[128] = kbinz1;
384 // correct detector size for bin size.
386 for(i=0;i<knbinx;i++) dx += binSizeX[i];
389 for(i=0;i<knbinz;i++) dz += binSizeZ[i];
392 SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,kdy,dz);
393 if(TMath::Abs(dx-kdx)>1.0E-4 || TMath::Abs(dz-kdz)>1.0E-4)
394 Warning("Default Creator","Detector size may not be write.");
396 InitLowBinEdgeX(); // array of bin sizes along x.
397 InitLowBinEdgeZ(); // array of bin sizes along x.
398 SetLowBinEdgeX(0,-dx);
399 SetLowBinEdgeZ(0,-dz);
400 for(i=0;i<knbinx;i++) SetLowBinEdgeX(i+1,GetBinLowEdgeX(i)+binSizeX[i]);
401 for(i=0;i<knbinz;i++) SetLowBinEdgeZ(i+1,GetBinLowEdgeZ(i)+binSizeZ[i]);
403 //----------------------------------------------------------------------
404 ostream &operator<<(ostream &os,AliITSgeomSPD425Short &p){
405 ////////////////////////////////////////////////////////////////////////
406 // Standard output streaming function.
407 ////////////////////////////////////////////////////////////////////////
412 //----------------------------------------------------------------------
413 istream &operator>>(istream &is,AliITSgeomSPD425Short &r){
414 ////////////////////////////////////////////////////////////////////////
415 // Standard input streaming function.
416 ////////////////////////////////////////////////////////////////////////
421 //======================================================================
425 Revision 1.9 2001/02/09 00:00:57 nilsen
426 Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed
427 bugs in iostream based streamers used to read and write .det files. Fixed
428 some detector sizes. Fixed bugs in some default-special constructors.
430 Revision 1.8 2001/02/03 00:00:30 nilsen
431 New version of AliITSgeom and related files. Now uses automatic streamers,
432 set up for new formatted .det file which includes detector information.
433 Additional smaller modifications are still to come.
435 Revision 1.7 2000/10/02 16:32:35 barbera
436 Forward declaration added
438 Revision 1.1.2.8 2000/10/02 15:52:05 barbera
439 Forward declaration added
441 Revision 1.6 2000/07/10 16:07:18 fca
442 Release version of ITS code
444 Revision 1.4 2000/06/10 20:34:22 nilsen
445 Fixed compilation warning with HP unix.
447 Revision 1.3 2000/06/10 10:42:49 nilsen
448 Fixed bug in copy and operator =.
453 //#include "AliITSgeomSPD425Long.h"
455 ClassImp(AliITSgeomSPD425Long)
457 AliITSgeomSPD425Long::AliITSgeomSPD425Long(){
458 ////////////////////////////////////////////////////////////////////////
459 // default constructor, for ITS post TDR geometry. This only consists of
460 // a default constructor to construct the defalut post TDR SPD detector
461 // geometry 256 X 197 425 by 50 micron pixels with interleaved 625 by 50
462 // micron pixels (large detector).
463 ////////////////////////////////////////////////////////////////////////
465 const Float_t kdx=0.6400,kdy=0.0075,kdz=4.2650; // cm; Standard pixel
466 // detector size is 2dx
467 // wide, 2dz long, and
468 // 2dy thick. Geant 3.12
470 const Float_t kbinx0 = 0.0050; // cm; Standard pixel size in x direction.
471 const Int_t knbinx = 256; // number of pixels along x direction.
472 const Float_t kbinz0 = 0.0425; // cm; Standard pixel size in z direction.
473 const Float_t kbinz1 = 0.0625; // cm; Special pixel size in z direction.
474 const Int_t knbinz = 192; // number of pixels along z direction.
476 Float_t dx,dz,*binSizeX,*binSizeZ;
478 SetNbinX(knbinx); // default number of bins in x.
479 SetNbinZ(knbinz); // default number of bins in z.
481 binSizeX = new Float_t[knbinx]; // array of bin sizes along x.
482 for(i=0;i<knbinx;i++) binSizeX[i] = kbinx0; // default x bin size.
483 binSizeZ = new Float_t[knbinz]; // array of bin sizes along z.
484 for(i=0;i<knbinz;i++) binSizeZ[i] = kbinz0; // default z bin size.
485 binSizeZ[ 31] = kbinz1;
486 binSizeZ[ 32] = kbinz1;
488 binSizeZ[ 63] = kbinz1;
489 binSizeZ[ 64] = kbinz1;
491 binSizeZ[ 95] = kbinz1;
492 binSizeZ[ 96] = kbinz1;
494 binSizeZ[127] = kbinz1;
495 binSizeZ[128] = kbinz1;
497 binSizeZ[159] = kbinz1;
498 binSizeZ[160] = kbinz1;
500 // correct detector size for bin size.
502 for(i=0;i<knbinx;i++) dx += binSizeX[i];
505 for(i=0;i<knbinz;i++) dz += binSizeZ[i];
508 SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,kdy,dz);
509 if(TMath::Abs(dx-kdx)>1.0E-4 || TMath::Abs(dz-kdz)>1.0E-4)
510 Warning("Default Creator","Detector size may not be write.");
512 InitLowBinEdgeX(); // array of bin sizes along x.
513 InitLowBinEdgeZ(); // array of bin sizes along x.
514 SetLowBinEdgeX(0,-dx);
515 SetLowBinEdgeZ(0,-dz);
516 for(i=0;i<knbinx;i++) SetLowBinEdgeX(i+1,GetBinLowEdgeX(i)+binSizeX[i]);
517 for(i=0;i<knbinz;i++) SetLowBinEdgeZ(i+1,GetBinLowEdgeZ(i)+binSizeZ[i]);
519 //----------------------------------------------------------------------
520 ostream &operator<<(ostream &os,AliITSgeomSPD425Long &p){
521 ////////////////////////////////////////////////////////////////////////
522 // Standard output streaming function.
523 ////////////////////////////////////////////////////////////////////////
528 //----------------------------------------------------------------------
529 istream &operator>>(istream &is,AliITSgeomSPD425Long &r){
530 ////////////////////////////////////////////////////////////////////////
531 // Standard input streaming function.
532 ////////////////////////////////////////////////////////////////////////
537 //======================================================================