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.8 2001/02/03 00:00:30 nilsen
19 New version of AliITSgeom and related files. Now uses automatic streamers,
20 set up for new formatted .det file which includes detector information.
21 Additional smaller modifications are still to come.
30 #include "AliITSgeomSPD.h"
32 ClassImp(AliITSgeomSPD)
34 AliITSgeomSPD::AliITSgeomSPD(){
35 // Default Constructor. Set everthing to null.
43 //______________________________________________________________________
44 AliITSgeomSPD::AliITSgeomSPD(Float_t dy,Int_t nx,Float_t *bx,
45 Int_t nz,Float_t *bz){
46 // Standard Constructor. Set everthing to null.
53 ReSetBins(dy,nx,bx,nz,bz);
56 //______________________________________________________________________
57 void AliITSgeomSPD::ReSetBins(Float_t dy,Int_t nx,Float_t *bx,
58 Int_t nz,Float_t *bz){
59 // delets the contents of this and replaces it with the given values.
61 Float_t dx = 0.0, dz = 0.0;
63 // Compute size in x and z (based on bins).
64 for(i=0;i<nx;i++) dx += bx[i];
65 for(i=0;i<nz;i++) dz += bz[i];
69 delete fShapeSPD; // delete existing shape
70 if(this->fLowBinEdgeX) delete[] this->fLowBinEdgeX; // delete existing
71 if(this->fLowBinEdgeZ) delete[] this->fLowBinEdgeZ; // delete existing
77 fLowBinEdgeX[0] = -dx;
78 fLowBinEdgeZ[0] = -dz;
79 for(i=0;i<nx;i++) fLowBinEdgeX[i+1] = fLowBinEdgeX[i] + bx[i];
80 for(i=0;i<nz;i++) fLowBinEdgeZ[i+1] = fLowBinEdgeZ[i] + bz[i];
81 SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,dy,dz);
84 //______________________________________________________________________
85 AliITSgeomSPD::AliITSgeomSPD(AliITSgeomSPD &source){
88 *this = source; // just use the = operator for now.
91 //______________________________________________________________________
92 AliITSgeomSPD& AliITSgeomSPD::operator=(AliITSgeomSPD &source){
96 if(&source == this) return *this;
97 this->fShapeSPD = new TBRIK(*(source.fShapeSPD));
98 if(this->fLowBinEdgeX) delete[] this->fLowBinEdgeX;
99 if(this->fLowBinEdgeZ) delete[] this->fLowBinEdgeZ;
100 this->fNbinx = source.fNbinx;
101 this->fNbinz = source.fNbinz;
102 this->InitLowBinEdgeX();
103 this->InitLowBinEdgeZ();
104 for(i=0;i<fNbinx;i++) this->fLowBinEdgeX[i] = source.fLowBinEdgeX[i];
105 for(i=0;i<fNbinz;i++) this->fLowBinEdgeZ[i] = source.fLowBinEdgeZ[i];
108 //______________________________________________________________________
109 AliITSgeomSPD::~AliITSgeomSPD(){
113 if(this->fLowBinEdgeX) delete[] this->fLowBinEdgeX;
114 if(this->fLowBinEdgeZ) delete[] this->fLowBinEdgeZ;
121 //______________________________________________________________________
122 void AliITSgeomSPD::LToDet(Float_t xl,Float_t zl,Int_t &row,Int_t &col){
123 // Returns the row and column pixel numbers for a given local coordinate
124 // system. If they are outside then it will return -1 or fNbinx/z.
127 if(xl<fLowBinEdgeX[0]) row = -1;
129 for(i=0;i<fNbinx;i++) if(xl<=fLowBinEdgeX[i]) break;
132 if(zl<fLowBinEdgeX[0]) col = -1;
134 for(i=0;i<fNbinz;i++) if(zl<=fLowBinEdgeZ[i]) break;
139 //______________________________________________________________________
140 void AliITSgeomSPD::DetToL(Int_t row,Int_t col,Float_t &xl,Float_t &zl){
141 // returns the pixel center local coordinate system location for a given
142 // row and column number. It the row or column number is outside of the
143 // defined range then it will return the nearest detector edge.
145 if(row>=0||row<fNbinx-1) xl = 0.5*(fLowBinEdgeX[row]+fLowBinEdgeX[row+1]);
146 else if(row<0) xl = fLowBinEdgeX[0];else xl = fLowBinEdgeX[fNbinx-1];
147 if(col>=0||col<fNbinz-1) zl = 0.5*(fLowBinEdgeZ[col]+fLowBinEdgeZ[col+1]);
148 else if(col<0) zl = fLowBinEdgeZ[0];else zl = fLowBinEdgeZ[fNbinz-1];
151 //______________________________________________________________________
152 void AliITSgeomSPD::Print(ostream *os) const {
153 // Standard output format for this class
157 fmt = os->setf(ios::scientific); // set scientific floating point output
158 *os << "TBRIK" << " ";
159 *os << setprecision(16) << GetDx() << " ";
160 *os << setprecision(16) << GetDy() << " ";
161 *os << setprecision(16) << GetDz() << " ";
162 *os << fNbinx-1 << " " << fNbinz-1 << " ";
163 for(i=0;i<fNbinx;i++) *os << setprecision(16) << fLowBinEdgeX[i] << " ";
164 for(i=0;i<fNbinz;i++) *os << setprecision(16) << fLowBinEdgeZ[i] << " ";
169 //______________________________________________________________________
170 void AliITSgeomSPD::Read(istream *is){
171 // Standard input format for this class
176 for(i=0;i<20;i++) shape[i]='\0';
178 if(strcmp(shape,"TBRIK")) Warning("::Read","Shape not a TBRIK");
179 *is >> dx >> dy >> dz;
180 if(fShapeSPD!=0) delete fShapeSPD;
181 SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,dy,dz);
187 for(i=0;i<fNbinx;i++) *is >> fLowBinEdgeX[i];
188 for(i=0;i<fNbinz;i++) *is >> fLowBinEdgeZ[i];
191 //----------------------------------------------------------------------
192 ostream &operator<<(ostream &os,AliITSgeomSPD &p){
193 ////////////////////////////////////////////////////////////////////////
194 // Standard output streaming function.
195 ////////////////////////////////////////////////////////////////////////
200 //----------------------------------------------------------------------
201 istream &operator>>(istream &is,AliITSgeomSPD &r){
202 ////////////////////////////////////////////////////////////////////////
203 // Standard input streaming function.
204 ////////////////////////////////////////////////////////////////////////
209 //=====================================================================
213 Revision 1.8 2001/02/03 00:00:30 nilsen
214 New version of AliITSgeom and related files. Now uses automatic streamers,
215 set up for new formatted .det file which includes detector information.
216 Additional smaller modifications are still to come.
218 Revision 1.7 2000/10/02 16:32:35 barbera
219 Forward declaration added
221 Revision 1.1.2.8 2000/10/02 15:52:05 barbera
222 Forward declaration added
224 Revision 1.6 2000/07/10 16:07:18 fca
225 Release version of ITS code
227 Revision 1.4 2000/06/10 20:34:37 nilsen
228 Fixed compilation warning with HP unix.
230 Revision 1.3 2000/06/10 10:43:04 nilsen
231 Fixed bug in copy and operator =.
235 //#include "AliITSgeomSPD300.h"
237 ClassImp(AliITSgeomSPD300)
239 AliITSgeomSPD300::AliITSgeomSPD300() : AliITSgeomSPD(){
240 ////////////////////////////////////////////////////////////////////////
241 // default constructor, for ITS TDR geometry. This only consists of
242 // a default constructor to construct the defalut TDR SPD detector geometry
243 // 256 X 279 300 by 50 micron pixels.
244 ////////////////////////////////////////////////////////////////////////
245 const Float_t kdx=0.6400,kdy=0.0075,kdz=4.1900; // cm; Standard pixel detector
246 // size is 2dx wide, 2dz long,
247 // and 2dy thick. Geant 3.12
249 const Float_t kbinx0 = 0.0050; // cm; Standard pixel size in x direction.
250 const Int_t knbinx = 256; // number of pixels along x direction.
251 const Float_t kbinz0 = 0.0300; // cm; Standard pixel size in z direction.
252 const Float_t kbinz1 = 0.0350; // cm; Edge pixel size in z direction.
253 const Int_t knbinz = 279; // number of pixels along z direction.
255 Float_t dx=0.0,dz=0.0;
257 // cout << "AliITSgeomSPD300 default creator called: start" << endl;
259 SetNbinX(knbinx); // default number of bins in x.
260 SetNbinZ(knbinz); // default number of bins in z.
262 for(i=0;i<knbinx;i++) dx += kbinx0; // Compute size x.
264 for(i=0;i<knbinz;i++) dz += kbinz0; // Compute size z.
265 dz += 2.0*(kbinz1-kbinz0);
269 SetLowBinEdgeX(0,-dx); // Starting position X
270 for(i=0;i<knbinx;i++) SetLowBinEdgeX(i+1,GetBinLowEdgeX(i)+kbinx0);
271 SetLowBinEdgeZ(0,-dz); // Starting position z
272 SetLowBinEdgeZ(1,GetBinLowEdgeZ(0)+kbinz1);
273 for(i=1;i<knbinz;i++) SetLowBinEdgeZ(i+1,GetBinLowEdgeZ(i)+kbinz0);
274 SetLowBinEdgeZ(knbinz,GetBinLowEdgeZ(knbinz-1)+kbinz1);
276 if(TMath::Abs(dx-kdx)>1.0E-4 || TMath::Abs(dz-kdz)>1.0E-4)
277 Warning("Default Creator","Detector size may not be write.");
278 SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,kdy,dz);
279 // cout << "AliITSgeomSPD300 default creator called: end" << endl;
281 //----------------------------------------------------------------------
282 ostream &operator<<(ostream &os,AliITSgeomSPD300 &p){
283 ////////////////////////////////////////////////////////////////////////
284 // Standard output streaming function.
285 ////////////////////////////////////////////////////////////////////////
290 //----------------------------------------------------------------------
291 istream &operator>>(istream &is,AliITSgeomSPD300 &r){
292 ////////////////////////////////////////////////////////////////////////
293 // Standard input streaming function.
294 ////////////////////////////////////////////////////////////////////////
299 //=====================================================================
302 Revision 1.8 2001/02/03 00:00:30 nilsen
303 New version of AliITSgeom and related files. Now uses automatic streamers,
304 set up for new formatted .det file which includes detector information.
305 Additional smaller modifications are still to come.
307 Revision 1.7 2000/10/02 16:32:35 barbera
308 Forward declaration added
310 Revision 1.1.2.8 2000/10/02 15:52:05 barbera
311 Forward declaration added
313 Revision 1.6 2000/07/10 16:07:18 fca
314 Release version of ITS code
316 Revision 1.4 2000/06/10 20:34:22 nilsen
317 Fixed compilation warning with HP unix.
319 Revision 1.3 2000/06/10 10:42:49 nilsen
320 Fixed bug in copy and operator =.
325 //#include "AliITSgeomSPD425Short.h"
327 ClassImp(AliITSgeomSPD425Short)
329 AliITSgeomSPD425Short::AliITSgeomSPD425Short(){
330 ////////////////////////////////////////////////////////////////////////
331 // default constructor, for ITS post TDR geometry. This only consists of
332 // a default constructor to construct the defalut post TDR SPD detector
333 // geometry 256 X 197 425 by 50 micron pixels with interleaved 625 by 50
334 // micron pixels (large detector).
335 ////////////////////////////////////////////////////////////////////////
337 const Float_t kdx=0.6400,kdy=0.015,kdz=3.480; // cm; Standard pixel
338 // detector size is 2dx
339 // wide, 2dz long, and
340 // 2dy thick. Geant 3.12
342 const Float_t kbinx0 = 0.0050; // cm; Standard pixel size in x direction.
343 const Int_t knbinx = 256; // number of pixels along x direction.
344 const Float_t kbinz0 = 0.0425; // cm; Standard pixel size in z direction.
345 const Float_t kbinz1 = 0.0625; // cm; Special pixel size in z direction.
346 const Int_t knbinz = 160; // number of pixels along z direction.
348 Float_t dx,dz,*binSizeX,*binSizeZ;
350 SetNbinX(knbinx); // default number of bins in x.
351 SetNbinZ(knbinz); // default number of bins in z.
353 binSizeX = new Float_t[knbinx]; // array of bin sizes along x.
354 for(i=0;i<knbinx;i++) binSizeX[i] = kbinx0; // default x bin size.
355 binSizeZ = new Float_t[knbinz]; // array of bin sizes along z.
356 for(i=0;i<knbinz;i++) binSizeZ[i] = kbinz0; // default z bin size.
357 binSizeZ[ 31] = kbinz1;
358 binSizeZ[ 32] = kbinz1;
360 binSizeZ[ 63] = kbinz1;
361 binSizeZ[ 64] = kbinz1;
363 binSizeZ[ 95] = kbinz1;
364 binSizeZ[ 96] = kbinz1;
366 binSizeZ[127] = kbinz1;
367 binSizeZ[128] = kbinz1;
369 // correct detector size for bin size.
371 for(i=0;i<knbinx;i++) dx += binSizeX[i];
374 for(i=0;i<knbinz;i++) dz += binSizeZ[i];
377 SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,kdy,dz);
378 if(TMath::Abs(dx-kdx)>1.0E-4 || TMath::Abs(dz-kdz)>1.0E-4)
379 Warning("Default Creator","Detector size may not be write.");
381 InitLowBinEdgeX(); // array of bin sizes along x.
382 InitLowBinEdgeZ(); // array of bin sizes along x.
383 SetLowBinEdgeX(0,-dx);
384 SetLowBinEdgeZ(0,-dz);
385 for(i=0;i<knbinx;i++) SetLowBinEdgeX(i+1,GetBinLowEdgeX(i)+binSizeX[i]);
386 for(i=0;i<knbinz;i++) SetLowBinEdgeZ(i+1,GetBinLowEdgeZ(i)+binSizeZ[i]);
388 //----------------------------------------------------------------------
389 ostream &operator<<(ostream &os,AliITSgeomSPD425Short &p){
390 ////////////////////////////////////////////////////////////////////////
391 // Standard output streaming function.
392 ////////////////////////////////////////////////////////////////////////
397 //----------------------------------------------------------------------
398 istream &operator>>(istream &is,AliITSgeomSPD425Short &r){
399 ////////////////////////////////////////////////////////////////////////
400 // Standard input streaming function.
401 ////////////////////////////////////////////////////////////////////////
406 //======================================================================
410 Revision 1.8 2001/02/03 00:00:30 nilsen
411 New version of AliITSgeom and related files. Now uses automatic streamers,
412 set up for new formatted .det file which includes detector information.
413 Additional smaller modifications are still to come.
415 Revision 1.7 2000/10/02 16:32:35 barbera
416 Forward declaration added
418 Revision 1.1.2.8 2000/10/02 15:52:05 barbera
419 Forward declaration added
421 Revision 1.6 2000/07/10 16:07:18 fca
422 Release version of ITS code
424 Revision 1.4 2000/06/10 20:34:22 nilsen
425 Fixed compilation warning with HP unix.
427 Revision 1.3 2000/06/10 10:42:49 nilsen
428 Fixed bug in copy and operator =.
433 //#include "AliITSgeomSPD425Long.h"
435 ClassImp(AliITSgeomSPD425Long)
437 AliITSgeomSPD425Long::AliITSgeomSPD425Long(){
438 ////////////////////////////////////////////////////////////////////////
439 // default constructor, for ITS post TDR geometry. This only consists of
440 // a default constructor to construct the defalut post TDR SPD detector
441 // geometry 256 X 197 425 by 50 micron pixels with interleaved 625 by 50
442 // micron pixels (large detector).
443 ////////////////////////////////////////////////////////////////////////
445 const Float_t kdx=0.6400,kdy=0.0075,kdz=4.2650; // cm; Standard pixel
446 // detector size is 2dx
447 // wide, 2dz long, and
448 // 2dy thick. Geant 3.12
450 const Float_t kbinx0 = 0.0050; // cm; Standard pixel size in x direction.
451 const Int_t knbinx = 256; // number of pixels along x direction.
452 const Float_t kbinz0 = 0.0425; // cm; Standard pixel size in z direction.
453 const Float_t kbinz1 = 0.0625; // cm; Special pixel size in z direction.
454 const Int_t knbinz = 196; // number of pixels along z direction.
456 Float_t dx,dz,*binSizeX,*binSizeZ;
458 SetNbinX(knbinx); // default number of bins in x.
459 SetNbinZ(knbinz); // default number of bins in z.
461 binSizeX = new Float_t[knbinx]; // array of bin sizes along x.
462 for(i=0;i<knbinx;i++) binSizeX[i] = kbinx0; // default x bin size.
463 binSizeZ = new Float_t[knbinz]; // array of bin sizes along z.
464 for(i=0;i<knbinz;i++) binSizeZ[i] = kbinz0; // default z bin size.
465 binSizeZ[ 31] = kbinz1;
466 binSizeZ[ 32] = kbinz1;
468 binSizeZ[ 64] = kbinz1;
469 binSizeZ[ 65] = kbinz1;
471 binSizeZ[ 97] = kbinz1;
472 binSizeZ[ 98] = kbinz1;
474 binSizeZ[130] = kbinz1;
475 binSizeZ[131] = kbinz1;
477 binSizeZ[163] = kbinz1;
478 binSizeZ[164] = kbinz1;
480 // correct detector size for bin size.
482 for(i=0;i<knbinx;i++) dx += binSizeX[i];
485 for(i=0;i<knbinz;i++) dz += binSizeZ[i];
488 SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,kdy,dz);
489 if(TMath::Abs(dx-kdx)>1.0E-4 || TMath::Abs(dz-kdz)>1.0E-4)
490 Warning("Default Creator","Detector size may not be write.");
492 InitLowBinEdgeX(); // array of bin sizes along x.
493 InitLowBinEdgeZ(); // array of bin sizes along x.
494 SetLowBinEdgeX(0,-dx);
495 SetLowBinEdgeZ(0,-dz);
496 for(i=0;i<knbinx;i++) SetLowBinEdgeX(i+1,GetBinLowEdgeX(i)+binSizeX[i]);
497 for(i=0;i<knbinz;i++) SetLowBinEdgeZ(i+1,GetBinLowEdgeZ(i)+binSizeZ[i]);
499 //----------------------------------------------------------------------
500 ostream &operator<<(ostream &os,AliITSgeomSPD425Long &p){
501 ////////////////////////////////////////////////////////////////////////
502 // Standard output streaming function.
503 ////////////////////////////////////////////////////////////////////////
508 //----------------------------------------------------------------------
509 istream &operator>>(istream &is,AliITSgeomSPD425Long &r){
510 ////////////////////////////////////////////////////////////////////////
511 // Standard input streaming function.
512 ////////////////////////////////////////////////////////////////////////
517 //======================================================================