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