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 **************************************************************************/
24 #include "AliITSgeomSPD.h"
26 ClassImp(AliITSgeomSPD)
28 AliITSgeomSPD::AliITSgeomSPD(){
29 // Default Constructor. Set everthing to null.
37 //______________________________________________________________________
38 AliITSgeomSPD::AliITSgeomSPD(Float_t dy,Int_t nx,Float_t *bx,
39 Int_t nz,Float_t *bz){
40 // Standard Constructor. Set everthing to null.
47 ReSetBins(dy,nx,bx,nz,bz);
50 //______________________________________________________________________
51 void AliITSgeomSPD::ReSetBins(Float_t dy,Int_t nx,Float_t *bx,
52 Int_t nz,Float_t *bz){
53 // delets the contents of this and replaces it with the given values.
55 Float_t dx = 0.0, dz = 0.0;
57 // Compute size in x and z (based on bins).
58 for(i=0;i<nx;i++) dx += bx[i];
59 for(i=0;i<nz;i++) dz += bz[i];
63 delete fShapeSPD; // delete existing shape
64 if(this->fLowBinEdgeX) delete[] this->fLowBinEdgeX; // delete existing
65 if(this->fLowBinEdgeZ) delete[] this->fLowBinEdgeZ; // delete existing
71 fLowBinEdgeX[0] = -dx;
72 fLowBinEdgeZ[0] = -dz;
73 for(i=0;i<nx;i++) fLowBinEdgeX[i+1] = fLowBinEdgeX[i] + bx[i];
74 for(i=0;i<nz;i++) fLowBinEdgeZ[i+1] = fLowBinEdgeZ[i] + bz[i];
75 SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,dy,dz);
78 //______________________________________________________________________
79 AliITSgeomSPD::AliITSgeomSPD(AliITSgeomSPD &source){
82 *this = source; // just use the = operator for now.
85 //______________________________________________________________________
86 AliITSgeomSPD& AliITSgeomSPD::operator=(AliITSgeomSPD &source){
90 if(&source == this) return *this;
91 this->fShapeSPD = new TBRIK(*(source.fShapeSPD));
92 if(this->fLowBinEdgeX) delete[] this->fLowBinEdgeX;
93 if(this->fLowBinEdgeZ) delete[] this->fLowBinEdgeZ;
94 this->fNbinx = source.fNbinx;
95 this->fNbinz = source.fNbinz;
96 this->InitLowBinEdgeX();
97 this->InitLowBinEdgeZ();
98 for(i=0;i<fNbinx;i++) this->fLowBinEdgeX[i] = source.fLowBinEdgeX[i];
99 for(i=0;i<fNbinz;i++) this->fLowBinEdgeZ[i] = source.fLowBinEdgeZ[i];
102 //______________________________________________________________________
103 AliITSgeomSPD::~AliITSgeomSPD(){
107 if(this->fLowBinEdgeX) delete[] this->fLowBinEdgeX;
108 if(this->fLowBinEdgeZ) delete[] this->fLowBinEdgeZ;
115 //______________________________________________________________________
116 void AliITSgeomSPD::LToDet(Float_t xl,Float_t zl,Int_t &row,Int_t &col){
117 // Returns the row and column pixel numbers for a given local coordinate
118 // system. If they are outside then it will return -1 or fNbinx/z.
121 if(xl<fLowBinEdgeX[0]) row = -1;
123 for(i=0;i<fNbinx;i++) if(xl<=fLowBinEdgeX[i]) break;
126 if(zl<fLowBinEdgeX[0]) col = -1;
128 for(i=0;i<fNbinz;i++) if(zl<=fLowBinEdgeZ[i]) break;
133 //______________________________________________________________________
134 void AliITSgeomSPD::DetToL(Int_t row,Int_t col,Float_t &xl,Float_t &zl){
135 // returns the pixel center local coordinate system location for a given
136 // row and column number. It the row or column number is outside of the
137 // defined range then it will return the nearest detector edge.
139 if(row>=0||row<fNbinx-1) xl = 0.5*(fLowBinEdgeX[row]+fLowBinEdgeX[row+1]);
140 else if(row<0) xl = fLowBinEdgeX[0];else xl = fLowBinEdgeX[fNbinx-1];
141 if(col>=0||col<fNbinz-1) zl = 0.5*(fLowBinEdgeZ[col]+fLowBinEdgeZ[col+1]);
142 else if(col<0) zl = fLowBinEdgeZ[0];else zl = fLowBinEdgeZ[fNbinz-1];
145 //______________________________________________________________________
146 void AliITSgeomSPD::Print(ostream *os){
147 // Standard output format for this class
151 fmt = os->setf(ios::scientific); // set scientific floating point output
152 *os << "TBRIK" << " ";
153 *os << setprecision(16) << GetDx() << " ";
154 *os << setprecision(16) << GetDy() << " ";
155 *os << setprecision(16) << GetDz() << " ";
156 *os << fNbinx-1 << " " << fNbinz-1 << " ";
157 for(i=0;i<fNbinx;i++) *os << setprecision(16) << fLowBinEdgeX[i] << " ";
158 for(i=0;i<fNbinx;i++) *os << setprecision(16) << fLowBinEdgeZ[i] << " ";
163 //______________________________________________________________________
164 void AliITSgeomSPD::Read(istream *is){
165 // Standard input format for this class
170 for(i=0;i<20;i++) shape[i]='\0';
172 if(strcmp(shape,"TBRIK")) Warning("::Read","Shape not a TBRIK");
173 *is >> dx >> dy >> dz;
174 if(fShapeSPD!=0) delete fShapeSPD;
175 SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,dy,dz);
181 for(i=0;i<fNbinx;i++) *is >> fLowBinEdgeX[i];
182 for(i=0;i<fNbinz;i++) *is >> fLowBinEdgeZ[i];
185 //----------------------------------------------------------------------
186 ostream &operator<<(ostream &os,AliITSgeomSPD &p){
187 ////////////////////////////////////////////////////////////////////////
188 // Standard output streaming function.
189 ////////////////////////////////////////////////////////////////////////
194 //----------------------------------------------------------------------
195 istream &operator>>(istream &is,AliITSgeomSPD &r){
196 ////////////////////////////////////////////////////////////////////////
197 // Standard input streaming function.
198 ////////////////////////////////////////////////////////////////////////
203 //=====================================================================
207 Revision 1.7 2000/10/02 16:32:35 barbera
208 Forward declaration added
210 Revision 1.1.2.8 2000/10/02 15:52:05 barbera
211 Forward declaration added
213 Revision 1.6 2000/07/10 16:07:18 fca
214 Release version of ITS code
216 Revision 1.4 2000/06/10 20:34:37 nilsen
217 Fixed compilation warning with HP unix.
219 Revision 1.3 2000/06/10 10:43:04 nilsen
220 Fixed bug in copy and operator =.
224 //#include "AliITSgeomSPD300.h"
226 ClassImp(AliITSgeomSPD300)
228 AliITSgeomSPD300::AliITSgeomSPD300() : AliITSgeomSPD(){
229 ////////////////////////////////////////////////////////////////////////
230 // default constructor, for ITS TDR geometry. This only consists of
231 // a default constructor to construct the defalut TDR SPD detector geometry
232 // 256 X 279 300 by 50 micron pixels.
233 ////////////////////////////////////////////////////////////////////////
234 const Float_t kdx=0.6400,kdy=0.0075,kdz=4.1900; // cm; Standard pixel detector
235 // size is 2dx wide, 2dz long,
236 // and 2dy thick. Geant 3.12
238 const Float_t kbinx0 = 0.0050; // cm; Standard pixel size in x direction.
239 const Int_t knbinx = 256; // number of pixels along x direction.
240 const Float_t kbinz0 = 0.0300; // cm; Standard pixel size in z direction.
241 const Float_t kbinz1 = 0.0350; // cm; Edge pixel size in z direction.
242 const Int_t knbinz = 279; // number of pixels along z direction.
244 Float_t dx=0.0,dz=0.0;
246 // cout << "AliITSgeomSPD300 default creator called: start" << endl;
248 SetNbinX(knbinx); // default number of bins in x.
249 SetNbinZ(knbinz); // default number of bins in z.
251 for(i=0;i<knbinx;i++) dx += kbinx0; // Compute size x.
253 for(i=0;i<knbinz;i++) dz += kbinz0; // Compute size z.
254 dz += 2.0*(kbinz1-kbinz0);
258 SetLowBinEdgeX(0,-dx); // Starting position X
259 for(i=0;i<knbinx;i++) SetLowBinEdgeX(i+1,GetBinLowEdgeX(i)+kbinx0);
260 SetLowBinEdgeZ(0,-dz); // Starting position z
261 SetLowBinEdgeZ(1,GetBinLowEdgeZ(0)+kbinz1);
262 for(i=1;i<knbinz;i++) SetLowBinEdgeZ(i+1,GetBinLowEdgeZ(i)+kbinz0);
263 SetLowBinEdgeZ(knbinz,GetBinLowEdgeZ(knbinz-1)+kbinz1);
265 if(dx!=kdx || dz!=kdz) Warning("::Default Creator",
266 "Detector size may not be write.");
267 SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,kdy,dz);
268 // cout << "AliITSgeomSPD300 default creator called: end" << endl;
270 //----------------------------------------------------------------------
271 ostream &operator<<(ostream &os,AliITSgeomSPD300 &p){
272 ////////////////////////////////////////////////////////////////////////
273 // Standard output streaming function.
274 ////////////////////////////////////////////////////////////////////////
279 //----------------------------------------------------------------------
280 istream &operator>>(istream &is,AliITSgeomSPD300 &r){
281 ////////////////////////////////////////////////////////////////////////
282 // Standard input streaming function.
283 ////////////////////////////////////////////////////////////////////////
288 //=====================================================================
291 Revision 1.7 2000/10/02 16:32:35 barbera
292 Forward declaration added
294 Revision 1.1.2.8 2000/10/02 15:52:05 barbera
295 Forward declaration added
297 Revision 1.6 2000/07/10 16:07:18 fca
298 Release version of ITS code
300 Revision 1.4 2000/06/10 20:34:22 nilsen
301 Fixed compilation warning with HP unix.
303 Revision 1.3 2000/06/10 10:42:49 nilsen
304 Fixed bug in copy and operator =.
309 //#include "AliITSgeomSPD425Short.h"
311 ClassImp(AliITSgeomSPD425Short)
313 AliITSgeomSPD425Short::AliITSgeomSPD425Short(){
314 ////////////////////////////////////////////////////////////////////////
315 // default constructor, for ITS post TDR geometry. This only consists of
316 // a default constructor to construct the defalut post TDR SPD detector
317 // geometry 256 X 197 425 by 50 micron pixels with interleaved 625 by 50
318 // micron pixels (large detector).
319 ////////////////////////////////////////////////////////////////////////
321 const Float_t kdx=0.6400,kdy=0.0075,kdz=4.2650; // cm; Standard pixel
322 // detector size is 2dx
323 // wide, 2dz long, and
324 // 2dy thick. Geant 3.12
326 const Float_t kbinx0 = 0.0050; // cm; Standard pixel size in x direction.
327 const Int_t knbinx = 256; // number of pixels along x direction.
328 const Float_t kbinz0 = 0.0425; // cm; Standard pixel size in z direction.
329 const Float_t kbinz1 = 0.0625; // cm; Special pixel size in z direction.
330 const Int_t knbinz = 163; // number of pixels along z direction.
332 Float_t dx,dz,*binSizeX,*binSizeZ;
334 SetNbinX(knbinx); // default number of bins in x.
335 SetNbinZ(knbinz); // default number of bins in z.
337 binSizeX = new Float_t[knbinx]; // array of bin sizes along x.
338 for(i=0;i<knbinx;i++) binSizeX[i] = kbinx0; // default x bin size.
339 binSizeZ = new Float_t[knbinz]; // array of bin sizes along z.
340 for(i=0;i<knbinz;i++) binSizeZ[i] = kbinz0; // default z bin size.
341 binSizeZ[ 31] = kbinz1;
342 binSizeZ[ 32] = kbinz1;
344 binSizeZ[ 64] = kbinz1;
345 binSizeZ[ 65] = kbinz1;
347 binSizeZ[ 97] = kbinz1;
348 binSizeZ[ 98] = kbinz1;
350 binSizeZ[130] = kbinz1;
351 binSizeZ[131] = kbinz1;
353 // correct detector size for bin size.
355 for(i=0;i<knbinx;i++) dx += binSizeX[i];
358 for(i=0;i<knbinz;i++) dz += binSizeZ[i];
361 SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,kdy,dz);
362 if(dx!=kdx || dz!=kdz) Warning("AliITSgeomSPD425Short::Default Creator",
363 "Detector size may not be write.");
365 InitLowBinEdgeX(); // array of bin sizes along x.
366 InitLowBinEdgeZ(); // array of bin sizes along x.
367 SetLowBinEdgeX(0,-dx);
368 SetLowBinEdgeZ(0,-dz);
369 for(i=0;i<knbinx;i++) SetLowBinEdgeX(i+1,GetBinLowEdgeX(i)+binSizeX[i]);
370 for(i=0;i<knbinz;i++) SetLowBinEdgeZ(i+1,GetBinLowEdgeZ(i)+binSizeZ[i]);
372 //----------------------------------------------------------------------
373 ostream &operator<<(ostream &os,AliITSgeomSPD425Short &p){
374 ////////////////////////////////////////////////////////////////////////
375 // Standard output streaming function.
376 ////////////////////////////////////////////////////////////////////////
381 //----------------------------------------------------------------------
382 istream &operator>>(istream &is,AliITSgeomSPD425Short &r){
383 ////////////////////////////////////////////////////////////////////////
384 // Standard input streaming function.
385 ////////////////////////////////////////////////////////////////////////
390 //======================================================================
394 Revision 1.7 2000/10/02 16:32:35 barbera
395 Forward declaration added
397 Revision 1.1.2.8 2000/10/02 15:52:05 barbera
398 Forward declaration added
400 Revision 1.6 2000/07/10 16:07:18 fca
401 Release version of ITS code
403 Revision 1.4 2000/06/10 20:34:22 nilsen
404 Fixed compilation warning with HP unix.
406 Revision 1.3 2000/06/10 10:42:49 nilsen
407 Fixed bug in copy and operator =.
412 //#include "AliITSgeomSPD425Long.h"
414 ClassImp(AliITSgeomSPD425Long)
416 AliITSgeomSPD425Long::AliITSgeomSPD425Long(){
417 ////////////////////////////////////////////////////////////////////////
418 // default constructor, for ITS post TDR geometry. This only consists of
419 // a default constructor to construct the defalut post TDR SPD detector
420 // geometry 256 X 197 425 by 50 micron pixels with interleaved 625 by 50
421 // micron pixels (large detector).
422 ////////////////////////////////////////////////////////////////////////
424 const Float_t kdx=0.6400,kdy=0.0075,kdz=4.2650; // cm; Standard pixel
425 // detector size is 2dx
426 // wide, 2dz long, and
427 // 2dy thick. Geant 3.12
429 const Float_t kbinx0 = 0.0050; // cm; Standard pixel size in x direction.
430 const Int_t knbinx = 256; // number of pixels along x direction.
431 const Float_t kbinz0 = 0.0425; // cm; Standard pixel size in z direction.
432 const Float_t kbinz1 = 0.0625; // cm; Special pixel size in z direction.
433 const Int_t knbinz = 196; // number of pixels along z direction.
435 Float_t dx,dz,*binSizeX,*binSizeZ;
437 SetNbinX(knbinx); // default number of bins in x.
438 SetNbinZ(knbinz); // default number of bins in z.
440 binSizeX = new Float_t[knbinx]; // array of bin sizes along x.
441 for(i=0;i<knbinx;i++) binSizeX[i] = kbinx0; // default x bin size.
442 binSizeZ = new Float_t[knbinz]; // array of bin sizes along z.
443 for(i=0;i<knbinz;i++) binSizeZ[i] = kbinz0; // default z bin size.
444 binSizeZ[ 31] = kbinz1;
445 binSizeZ[ 32] = kbinz1;
447 binSizeZ[ 64] = kbinz1;
448 binSizeZ[ 65] = kbinz1;
450 binSizeZ[ 97] = kbinz1;
451 binSizeZ[ 98] = kbinz1;
453 binSizeZ[130] = kbinz1;
454 binSizeZ[131] = kbinz1;
456 binSizeZ[163] = kbinz1;
457 binSizeZ[164] = kbinz1;
459 // correct detector size for bin size.
461 for(i=0;i<knbinx;i++) dx += binSizeX[i];
464 for(i=0;i<knbinz;i++) dz += binSizeZ[i];
467 SetShape("ActiveSPD","Active volume of SPD","SPD SI DET",dx,kdy,dz);
468 if(dx!=kdx || dz!=kdz) Warning("AliITSgeomSPD425Long::Default Creator",
469 "Detector size may not be write.");
471 InitLowBinEdgeX(); // array of bin sizes along x.
472 InitLowBinEdgeZ(); // array of bin sizes along x.
473 SetLowBinEdgeX(0,-dx);
474 SetLowBinEdgeZ(0,-dz);
475 for(i=0;i<knbinx;i++) SetLowBinEdgeX(i+1,GetBinLowEdgeX(i)+binSizeX[i]);
476 for(i=0;i<knbinz;i++) SetLowBinEdgeZ(i+1,GetBinLowEdgeZ(i)+binSizeZ[i]);
478 //----------------------------------------------------------------------
479 ostream &operator<<(ostream &os,AliITSgeomSPD425Long &p){
480 ////////////////////////////////////////////////////////////////////////
481 // Standard output streaming function.
482 ////////////////////////////////////////////////////////////////////////
487 //----------------------------------------------------------------------
488 istream &operator>>(istream &is,AliITSgeomSPD425Long &r){
489 ////////////////////////////////////////////////////////////////////////
490 // Standard input streaming function.
491 ////////////////////////////////////////////////////////////////////////
496 //======================================================================