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