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