]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSgeomSSD.cxx
85101470c1ac1378afb87d02f9aa29a3f4d0b059
[u/mrichter/AliRoot.git] / ITS / AliITSgeomSSD.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
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  **************************************************************************/
15
16 /*
17 $Log$
18 Revision 1.12  2001/08/24 21:06:37  nilsen
19 Added more documentation, fixed up some coding violations, and some
20 forward declorations.
21
22 Revision 1.11  2001/05/16 08:17:49  hristov
23 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)
24
25 Revision 1.10  2001/02/09 00:00:57  nilsen
26 Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed
27 bugs in iostream based streamers used to read and write .det files. Fixed
28 some detector sizes. Fixed bugs in some default-special constructors.
29
30 Revision 1.9  2001/02/03 00:00:30  nilsen
31 New version of AliITSgeom and related files. Now uses automatic streamers,
32 set up for new formatted .det file which includes detector information.
33 Additional smaller modifications are still to come.
34
35 Revision 1.8  2000/10/02 16:32:43  barbera
36 Forward declaration added
37
38 Revision 1.2.4.8  2000/10/02 15:53:49  barbera
39 Forward declaration added
40
41 Revision 1.7  2000/07/10 16:07:18  fca
42 Release version of ITS code
43
44 Revision 1.2.4.2  2000/03/04 23:55:59  nilsen
45 Fixed up the comments/documentation
46
47 Revision 1.2.4.1  2000/01/12 19:03:32  nilsen
48 This is the version of the files after the merging done in December 1999.
49 See the ReadMe110100.txt file for details
50
51 Revision 1.2  1999/09/29 09:24:20  fca
52 Introduction of the Copyright and cvs Log
53
54 */
55
56 ////////////////////////////////////////////////////////////////////////
57 // This class is for the Silicon Strip Detector, SSD, specific geometry.
58 // It is being replaced by AliITSsegmentationSSD class. This file also
59 // constains classes derived from AliITSgeomSSD which do nothing but
60 // initilize this one with predefined values.
61 ////////////////////////////////////////////////////////////////////////
62
63 #include <iostream.h>
64 #include <iomanip.h>
65 #include <stdlib.h>
66 #include <TShape.h>
67 #include <TBRIK.h>
68
69 #include "AliITSgeomSSD.h"
70
71 ClassImp(AliITSgeomSSD)
72
73
74 AliITSgeomSSD::AliITSgeomSSD(){
75 // Default constructor
76     fShapeSSD = 0;
77     fNp       = 0;
78     fNn       = 0;
79     fLowEdgeP = 0;
80     fLowEdgeN = 0;
81     fAngleP   = 0.0;
82     fAngleN   = 0.0;
83 }
84 //----------------------------------------------------------------------
85 AliITSgeomSSD::AliITSgeomSSD(const Float_t *box,Float_t ap,Float_t an,
86                              Int_t np,Float_t *p,Int_t nn,Float_t *n){
87 ////////////////////////////////////////////////////////////////////////
88 //    Standard Constructor. *box={dx,dy,dz}, ap=anode angle, an=cathode angle,
89 // nn= number of cathodes+1,*n= array of cathode low edges+highest edge,
90 // np= number of anodes+1, *p= array of anode low edges+lighest edge.
91 ///////////////////////////////////////////////////////////////////////
92     fShapeSSD = 0;
93     fNp       = 0;
94     fNn       = 0;
95     fLowEdgeP = 0;
96     fLowEdgeN = 0;
97     fAngleP   = 0.0;
98     fAngleN   = 0.0;
99     ResetSSD(box,ap,an,np,p,nn,n);
100 }
101 //----------------------------------------------------------------------
102 void AliITSgeomSSD::ResetSSD(const Float_t *box,Float_t ap,Float_t an,
103                              Int_t np,Float_t *p,Int_t nn,Float_t *n){
104 ////////////////////////////////////////////////////////////////////////
105 //    Standard Filler. *box={dx,dy,dz}, ap=anode angle, an=cathode angle,
106 // nn= number of cathodes+1,*n= array of cathode low edges+highest edge,
107 // np= number of anodes+1, *p= array of anode low edges+lighest edge.
108 ///////////////////////////////////////////////////////////////////////
109     Int_t i;
110
111     fShapeSSD = new TBRIK("ActiveSSD","Active volume of SSD","SSD SI DET",
112                           box[0],box[1],box[2]);
113 //    if(fLowEdgeP!=0) delete fLowEdgeP;
114 //    if(fLowEdgeN!=0) delete fLowEdgeN;
115     fNp = np;
116     fNn = nn;
117     fAngleP = ap;
118     fAngleN = an;
119     fLowEdgeP = new Float_t[fNp];
120     fLowEdgeN = new Float_t[fNn];
121     for(i=0;i<fNp;i++) fLowEdgeP[i] = p[i];
122     for(i=0;i<fNn;i++) fLowEdgeN[i] = n[i];
123 }
124 //______________________________________________________________________
125 AliITSgeomSSD::~AliITSgeomSSD(){
126     // Destructor.
127
128     delete fLowEdgeP; fLowEdgeP = 0;
129     delete fLowEdgeN; fLowEdgeN = 0;
130     delete fShapeSSD; fShapeSSD = 0;
131     fNp = 0;
132     fNn = 0;
133     fAngleP = 0.0;
134     fAngleN = 0.0;
135 }
136 AliITSgeomSSD::AliITSgeomSSD(const AliITSgeomSSD &source){
137 ////////////////////////////////////////////////////////////////////////
138 //    copy  constructor
139 ////////////////////////////////////////////////////////////////////////
140     Int_t i;
141
142     if(this == &source) return;
143     this->fShapeSSD = new TBRIK(*(source.fShapeSSD));
144     this->fNp = source.fNp;
145     this->fNn = source.fNn;
146     delete fLowEdgeP;
147     delete fLowEdgeN;
148     this->fAngleP = source.fAngleP;
149     this->fAngleN = source.fAngleN;
150     fLowEdgeP = new Float_t[fNp];
151     fLowEdgeN = new Float_t[fNn];
152     for(i=0;i<fNp;i++) this->fLowEdgeP[i] = source.fLowEdgeP[i];
153     for(i=0;i<fNn;i++) this->fLowEdgeN[i] = source.fLowEdgeN[i];
154     return;
155 }  
156
157 AliITSgeomSSD& AliITSgeomSSD::operator=(const AliITSgeomSSD &source) {
158 ////////////////////////////////////////////////////////////////////////
159 //    assignment operator
160 ////////////////////////////////////////////////////////////////////////
161     Int_t i;
162
163     if(this == &source) return *this;
164     this->fShapeSSD = new TBRIK(*(source.fShapeSSD));
165     this->fNp = source.fNp;
166     this->fNn = source.fNn;
167     delete fLowEdgeP;
168     delete fLowEdgeN;
169     this->fAngleP = source.fAngleP;
170     this->fAngleN = source.fAngleN;
171     fLowEdgeP = new Float_t[fNp];
172     fLowEdgeN = new Float_t[fNn];
173     for(i=0;i<fNp;i++) this->fLowEdgeP[i] = source.fLowEdgeP[i];
174     for(i=0;i<fNn;i++) this->fLowEdgeN[i] = source.fLowEdgeN[i];
175     return *this;
176 }
177 //______________________________________________________________________
178 void AliITSgeomSSD::Local2Det(Float_t x,Float_t z,Int_t &a,Int_t &c){
179     // Given a GEANT detector local coordinate, cm, this function returns
180     // the detector specific P and N side strip numbers.
181     // Inputs are:
182     // Float_t x   Geant detector local x coordinate in cm
183     // Float_t z   Geant detector local z coordinate in cm
184     // outputs are:
185     // Int_t &a    Detector anode strip number (P side)
186     // Int_t &c    Detector cathode strip number (N side)
187     Float_t d,b;
188     Int_t i;
189
190     // project on to bonding edges.
191     d = x*TMath::Cos(fAngleP)+z*TMath::Sin(fAngleP);
192     b = x*TMath::Cos(fAngleN)+z*TMath::Sin(fAngleN);
193     if(d<fLowEdgeP[0]) i=-1;
194     else for(i=0;i<fNp;i++){
195         if(fLowEdgeP[i]<d) break;
196     } // end for i
197     a = i;
198     if(b<fLowEdgeN[0]) i=-1;
199     else for(i=0;i<fNn;i++){
200         if(fLowEdgeN[i]<b) break;
201     } // end for i
202     c = i;
203     return;
204 }
205 //______________________________________________________________________
206 void AliITSgeomSSD::Det2Local(Int_t a,Int_t c,Float_t &x,Float_t &z){
207 //    Float_t d,b;
208 //    Int_t i;
209
210     return;
211 }
212 //______________________________________________________________________
213 void AliITSgeomSSD::Print(ostream *os) const {
214 ////////////////////////////////////////////////////////////////////////
215 // Standard output format for this class.
216 ////////////////////////////////////////////////////////////////////////
217     Int_t i;
218 #if defined __GNUC__
219 #if __GNUC__ > 2
220     ios::fmtflags fmt;
221 #else
222     Int_t fmt;
223 #endif
224 #else
225     Int_t fmt;
226 #endif
227
228     fmt = os->setf(ios::scientific);  // set scientific floating point output
229     *os << "TBRIK" << " ";
230     *os << setprecision(16) << GetDx() << " ";
231     *os << setprecision(16) << GetDy() << " ";
232     *os << setprecision(16) << GetDz() << " ";
233     *os << fNp << " " << fNn << " ";
234     *os << setprecision(16) << fAngleP << " ";
235     *os << setprecision(16) << fAngleN << " ";
236     for(i=0;i<fNp;i++) *os << setprecision(16) << fLowEdgeP[i] << " ";
237     for(i=0;i<fNn;i++) *os << setprecision(16) << fLowEdgeN[i] << " ";
238     *os << endl;
239     os->flags(fmt); // reset back to old formating.
240     return;
241 }
242 //______________________________________________________________________
243 void AliITSgeomSSD::Read(istream *is){
244 ////////////////////////////////////////////////////////////////////////
245 // Standard input format for this class.
246 ////////////////////////////////////////////////////////////////////////
247     Float_t dx,dy,dz;
248     Int_t i;
249     char shp[20];
250
251     *is >> shp;
252     *is >> dx >> dy >> dz;
253     if(fShapeSSD!=0) delete fShapeSSD;
254     fShapeSSD = new TBRIK("ActiveSSD","Active volume of SSD","SSD SI DET",
255                             dx,dy,dz);
256     *is >> fNp >> fNn;
257     *is >> fAngleP >> fAngleN;
258     if(fLowEdgeP !=0) delete fLowEdgeP;
259     if(fLowEdgeN !=0) delete fLowEdgeN;
260     fLowEdgeP = new Float_t[fNp];
261     fLowEdgeN = new Float_t[fNn];
262     for(i=0;i<fNp;i++) *is >> fLowEdgeP[i];
263     for(i=0;i<fNn;i++) *is >> fLowEdgeN[i];
264     return;
265 }
266 //----------------------------------------------------------------------
267 ostream &operator<<(ostream &os,AliITSgeomSSD &p){
268 ////////////////////////////////////////////////////////////////////////
269 // Standard output streaming function.
270 ////////////////////////////////////////////////////////////////////////
271
272     p.Print(&os);
273     return os;
274 }
275 //----------------------------------------------------------------------
276 istream &operator>>(istream &is,AliITSgeomSSD &r){
277 ////////////////////////////////////////////////////////////////////////
278 // Standard input streaming function.
279 ////////////////////////////////////////////////////////////////////////
280
281     r.Read(&is);
282     return is;
283 }
284 //======================================================================
285 /*
286 $Log$
287 Revision 1.12  2001/08/24 21:06:37  nilsen
288 Added more documentation, fixed up some coding violations, and some
289 forward declorations.
290
291 Revision 1.11  2001/05/16 08:17:49  hristov
292 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)
293
294 Revision 1.10  2001/02/09 00:00:57  nilsen
295 Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed
296 bugs in iostream based streamers used to read and write .det files. Fixed
297 some detector sizes. Fixed bugs in some default-special constructors.
298
299 Revision 1.9  2001/02/03 00:00:30  nilsen
300 New version of AliITSgeom and related files. Now uses automatic streamers,
301 set up for new formatted .det file which includes detector information.
302 Additional smaller modifications are still to come.
303
304 */
305
306 //#include "AliITSgeomSSD175.h"
307
308 ClassImp(AliITSgeomSSD175)
309
310 AliITSgeomSSD175::AliITSgeomSSD175() : AliITSgeomSSD(){
311 ////////////////////////////////////////////////////////////////////////
312 //    default constructor
313 ////////////////////////////////////////////////////////////////////////
314     const Float_t kDxyz[] ={3.6500,0.0150,2.000};//cm. (Geant 3.12 units)
315     // Size of sensitive detector area x,y(thickness),z
316     const Float_t kangle   = 0.0175; // angle in rad. of anode and cathodes
317     const Float_t kpitch   = 0.0095;// cm anode separation.
318     const Int_t   kNstrips = 768; // number of anode or cathode strips.
319     Float_t *leA,*leC; // array of low edges anode and cathorde.
320     Int_t i;
321
322     leA = new Float_t[kNstrips+1];
323     leC = new Float_t[kNstrips+1];
324     leA[0] = -kDxyz[0];
325     leA[1] = -kpitch*(0.5*kNstrips-1);
326     leC[0] =  kDxyz[0];
327     leC[1] =  kpitch*(0.5*kNstrips-1);
328     for(i=1;i<kNstrips;i++){
329         leA[i+1] = leA[i] + kpitch;
330         leC[i+1] = leC[i] - kpitch;
331     } // end for i
332     leA[kNstrips] =  kDxyz[0];
333     leC[kNstrips] = -kDxyz[0];
334 //    cout << "AliITSgeomSSD175 default creator called: start" << endl;
335     AliITSgeomSSD::ResetSSD(kDxyz,kangle,-kangle,
336                                  kNstrips+1,leA,kNstrips+1,leC);
337     delete leA;
338     delete leC;
339 //    cout << "AliITSgeomSSD175 default creator called: end" << endl;
340 }
341 //________________________________________________________________________
342 ostream &operator<<(ostream &os,AliITSgeomSSD175 &p){
343 ////////////////////////////////////////////////////////////////////////
344 // Standard output streaming function.
345 ////////////////////////////////////////////////////////////////////////
346
347     p.Print(&os);
348     return os;
349 }
350 //----------------------------------------------------------------------
351 istream &operator>>(istream &is,AliITSgeomSSD175 &r){
352 ////////////////////////////////////////////////////////////////////////
353 // Standard input streaming function.
354 ////////////////////////////////////////////////////////////////////////
355
356     r.Read(&is);
357     return is;
358 }
359 //======================================================================
360 /*
361 $Log$
362 Revision 1.12  2001/08/24 21:06:37  nilsen
363 Added more documentation, fixed up some coding violations, and some
364 forward declorations.
365
366 Revision 1.11  2001/05/16 08:17:49  hristov
367 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)
368
369 Revision 1.10  2001/02/09 00:00:57  nilsen
370 Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed
371 bugs in iostream based streamers used to read and write .det files. Fixed
372 some detector sizes. Fixed bugs in some default-special constructors.
373
374 Revision 1.9  2001/02/03 00:00:30  nilsen
375 New version of AliITSgeom and related files. Now uses automatic streamers,
376 set up for new formatted .det file which includes detector information.
377 Additional smaller modifications are still to come.
378
379 */
380
381 //#include "AliITSgeomSSD275and75.h"
382
383 ClassImp(AliITSgeomSSD275and75)
384
385 AliITSgeomSSD275and75::AliITSgeomSSD275and75() : AliITSgeomSSD(){
386 ////////////////////////////////////////////////////////////////////////
387 //    default constructor
388 ////////////////////////////////////////////////////////////////////////
389 }
390 //----------------------------------------------------------------------
391 AliITSgeomSSD275and75::AliITSgeomSSD275and75(Int_t npar,Float_t *par) : 
392                                                             AliITSgeomSSD(){
393     // Default constructor for AliITSgeomSSD with strip angles of
394     // 275 miliradians and 75 miliradians. This constructor initlizes
395     // AliITSgeomSSD with the correct values. This is the miror image
396     // of the AliITSgeomSSD75and275 class.
397     const Float_t kDxyz[] ={3.6500,0.0150,2.000};//cm. (Geant 3.12 units)
398     // Size of sensitive detector area x,y(thickness),z
399     const Float_t kangleA  = 0.0275; // angle in rad. of anode and cathodes
400     const Float_t kangleC  = 0.0075; // angle in rad. of anode and cathodes
401     const Float_t kpitch   = 0.0095;// cm anode separation.
402     const Int_t   kNstrips = 768; // number of anode or cathode strips.
403     Float_t *leA,*leC; // array of low edges anode and cathorde.
404     Int_t i;
405
406     leA = new Float_t[kNstrips+1];
407     leC = new Float_t[kNstrips+1];
408     leA[0] = -kDxyz[0];
409     leA[1] = -kpitch*(0.5*kNstrips-1);
410     leC[0] =  kDxyz[0];
411     leC[1] =  kpitch*(0.5*kNstrips-1);
412     for(i=1;i<kNstrips;i++){
413         leA[i+1] = leA[i] + kpitch;
414         leC[i+1] = leC[i] - kpitch;
415     } // end for i
416     leA[kNstrips] =  kDxyz[0];
417     leC[kNstrips] = -kDxyz[0];
418 //    cout << "AliITSgeomSSD275and75 default creator called: start" << endl;
419     AliITSgeomSSD::ResetSSD(par,kangleA,kangleC,
420                                  kNstrips+1,leA,kNstrips+1,leC);
421     delete leA;
422     delete leC;
423 //    cout << "AliITSgeomSSD275and75 default creator called: end" << endl;
424 }
425 //________________________________________________________________________
426 ostream &operator<<(ostream &os,AliITSgeomSSD275and75 &p){
427 ////////////////////////////////////////////////////////////////////////
428 // Standard output streaming function.
429 ////////////////////////////////////////////////////////////////////////
430
431     p.Print(&os);
432     return os;
433 }
434 //----------------------------------------------------------------------
435 istream &operator>>(istream &is,AliITSgeomSSD275and75 &r){
436 ////////////////////////////////////////////////////////////////////////
437 // Standard input streaming function.
438 ////////////////////////////////////////////////////////////////////////
439
440     r.Read(&is);
441     return is;
442 }
443 //======================================================================
444 /*
445 $Log$
446 Revision 1.12  2001/08/24 21:06:37  nilsen
447 Added more documentation, fixed up some coding violations, and some
448 forward declorations.
449
450 Revision 1.11  2001/05/16 08:17:49  hristov
451 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)
452
453 Revision 1.10  2001/02/09 00:00:57  nilsen
454 Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed
455 bugs in iostream based streamers used to read and write .det files. Fixed
456 some detector sizes. Fixed bugs in some default-special constructors.
457
458 Revision 1.9  2001/02/03 00:00:30  nilsen
459 New version of AliITSgeom and related files. Now uses automatic streamers,
460 set up for new formatted .det file which includes detector information.
461 Additional smaller modifications are still to come.
462
463 */
464 //#include "AliITSgeomSSD75and275.h"
465
466 ClassImp(AliITSgeomSSD75and275)
467
468 AliITSgeomSSD75and275::AliITSgeomSSD75and275() : AliITSgeomSSD(){
469 ////////////////////////////////////////////////////////////////////////
470 //    default constructor
471 ////////////////////////////////////////////////////////////////////////
472 }
473 AliITSgeomSSD75and275::AliITSgeomSSD75and275(Int_t npar,Float_t *par) : 
474                                                             AliITSgeomSSD(){
475     // Default constructor for AliITSgeomSSD with strip angles of
476     // 75 miliradians and 275 miliradians. This constructor initlizes
477     // AliITSgeomSSD with the correct values. This is the miror image
478     // of the AliITSgeomSSD275and75 class.
479     const Float_t kDxyz[] ={3.6500,0.0150,2.000};//cm. (Geant 3.12 units)
480     // Size of sensitive detector area x,y(thickness),z
481     const Float_t kangleA  = 0.0075; // angle in rad. of anode and cathodes
482     const Float_t kangleC  = 0.0275; // angle in rad. of anode and cathodes
483     const Float_t kpitch   = 0.0095;// cm anode separation.
484     const Int_t   kNstrips = 768; // number of anode or cathode strips.
485     Float_t *leA,*leC; // array of low edges anode and cathorde.
486     Int_t i;
487
488     leA = new Float_t[kNstrips+1];
489     leC = new Float_t[kNstrips+1];
490     leA[0] = -kDxyz[0];
491     leA[1] = -kpitch*(0.5*kNstrips-1);
492     leC[0] =  kDxyz[0];
493     leC[1] =  kpitch*(0.5*kNstrips-1);
494     for(i=1;i<kNstrips;i++){
495         leA[i+1] = leA[i] + kpitch;
496         leC[i+1] = leC[i] - kpitch;
497     } // end for i
498     leA[kNstrips] =  kDxyz[0];
499     leC[kNstrips] = -kDxyz[0];
500 //    cout << "AliITSgeomSSD275and75 default creator called: start" << endl;
501     AliITSgeomSSD::ResetSSD(par,kangleA,kangleC,
502                                  kNstrips+1,leA,kNstrips+1,leC);
503     delete leA;
504     delete leC;
505 //    cout << "AliITSgeomSSD275and75 default creator called: end" << endl;
506 }
507 //________________________________________________________________________
508 ostream &operator<<(ostream &os,AliITSgeomSSD75and275 &p){
509 ////////////////////////////////////////////////////////////////////////
510 // Standard output streaming function.
511 ////////////////////////////////////////////////////////////////////////
512
513     p.Print(&os);
514     return os;
515 }
516 //----------------------------------------------------------------------
517 istream &operator>>(istream &is,AliITSgeomSSD75and275 &r){
518 ////////////////////////////////////////////////////////////////////////
519 // Standard input streaming function.
520 ////////////////////////////////////////////////////////////////////////
521
522     r.Read(&is);
523     return is;
524 }
525 //======================================================================