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