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