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