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