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