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