]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - ITS/AliITSgeomSSD.cxx
AliGenSTRANGElib.cxx first commit.
[u/mrichter/AliRoot.git] / ITS / AliITSgeomSSD.cxx
... / ...
CommitLineData
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$
18Revision 1.13 2001/10/12 22:07:20 nilsen
19A patch for C++ io manipulation functions so that they will work both
20with GNU gcc 2.96 and GNU gcc 3.01 compilers. Needs to be tested with
21other platforms.
22
23Revision 1.12 2001/08/24 21:06:37 nilsen
24Added more documentation, fixed up some coding violations, and some
25forward declorations.
26
27Revision 1.11 2001/05/16 08:17:49 hristov
28Bug fixed in the StepManager to account for the difference in the geometry tree for the ITS pixels. This fixes both the funny distribution of pixel coordinates and the missing hits/digits/points in many sectors of the ITS pixel barrel. Also included is a patch to properly get and use the detector dimensions through out the ITS code. (B.Nilsen)
29
30Revision 1.10 2001/02/09 00:00:57 nilsen
31Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed
32bugs in iostream based streamers used to read and write .det files. Fixed
33some detector sizes. Fixed bugs in some default-special constructors.
34
35Revision 1.9 2001/02/03 00:00:30 nilsen
36New version of AliITSgeom and related files. Now uses automatic streamers,
37set up for new formatted .det file which includes detector information.
38Additional smaller modifications are still to come.
39
40Revision 1.8 2000/10/02 16:32:43 barbera
41Forward declaration added
42
43Revision 1.2.4.8 2000/10/02 15:53:49 barbera
44Forward declaration added
45
46Revision 1.7 2000/07/10 16:07:18 fca
47Release version of ITS code
48
49Revision 1.2.4.2 2000/03/04 23:55:59 nilsen
50Fixed up the comments/documentation
51
52Revision 1.2.4.1 2000/01/12 19:03:32 nilsen
53This is the version of the files after the merging done in December 1999.
54See the ReadMe110100.txt file for details
55
56Revision 1.2 1999/09/29 09:24:20 fca
57Introduction of the Copyright and cvs Log
58
59*/
60
61////////////////////////////////////////////////////////////////////////
62// This class is for the Silicon Strip Detector, SSD, specific geometry.
63// It is being replaced by AliITSsegmentationSSD class. This file also
64// constains classes derived from AliITSgeomSSD which do nothing but
65// initilize this one with predefined values.
66////////////////////////////////////////////////////////////////////////
67
68#include <iostream.h>
69#include <iomanip.h>
70#include <stdlib.h>
71#include <TShape.h>
72#include <TBRIK.h>
73
74#include "AliITSgeomSSD.h"
75
76ClassImp(AliITSgeomSSD)
77
78
79AliITSgeomSSD::AliITSgeomSSD(){
80// Default constructor
81 fShapeSSD = 0;
82 fNp = 0;
83 fNn = 0;
84 fLowEdgeP = 0;
85 fLowEdgeN = 0;
86 fAngleP = 0.0;
87 fAngleN = 0.0;
88}
89//----------------------------------------------------------------------
90AliITSgeomSSD::AliITSgeomSSD(const Float_t *box,Float_t ap,Float_t an,
91 Int_t np,Float_t *p,Int_t nn,Float_t *n){
92////////////////////////////////////////////////////////////////////////
93// Standard Constructor. *box={dx,dy,dz}, ap=anode angle, an=cathode angle,
94// nn= number of cathodes+1,*n= array of cathode low edges+highest edge,
95// np= number of anodes+1, *p= array of anode low edges+lighest edge.
96///////////////////////////////////////////////////////////////////////
97 fShapeSSD = 0;
98 fNp = 0;
99 fNn = 0;
100 fLowEdgeP = 0;
101 fLowEdgeN = 0;
102 fAngleP = 0.0;
103 fAngleN = 0.0;
104 ResetSSD(box,ap,an,np,p,nn,n);
105}
106//----------------------------------------------------------------------
107void AliITSgeomSSD::ResetSSD(const Float_t *box,Float_t ap,Float_t an,
108 Int_t np,Float_t *p,Int_t nn,Float_t *n){
109////////////////////////////////////////////////////////////////////////
110// Standard Filler. *box={dx,dy,dz}, ap=anode angle, an=cathode angle,
111// nn= number of cathodes+1,*n= array of cathode low edges+highest edge,
112// np= number of anodes+1, *p= array of anode low edges+lighest edge.
113///////////////////////////////////////////////////////////////////////
114 Int_t i;
115
116 fShapeSSD = new TBRIK("ActiveSSD","Active volume of SSD","SSD SI DET",
117 box[0],box[1],box[2]);
118// if(fLowEdgeP!=0) delete fLowEdgeP;
119// if(fLowEdgeN!=0) delete fLowEdgeN;
120 fNp = np;
121 fNn = nn;
122 fAngleP = ap;
123 fAngleN = an;
124 fLowEdgeP = new Float_t[fNp];
125 fLowEdgeN = new Float_t[fNn];
126 for(i=0;i<fNp;i++) fLowEdgeP[i] = p[i];
127 for(i=0;i<fNn;i++) fLowEdgeN[i] = n[i];
128}
129//______________________________________________________________________
130AliITSgeomSSD::~AliITSgeomSSD(){
131 // Destructor.
132
133 if(fLowEdgeP) delete [] fLowEdgeP; fLowEdgeP = 0;
134 if(fLowEdgeN) delete [] fLowEdgeN; fLowEdgeN = 0;
135 if(fShapeSSD) delete fShapeSSD; fShapeSSD = 0;
136 fNp = 0;
137 fNn = 0;
138 fAngleP = 0.0;
139 fAngleN = 0.0;
140}
141AliITSgeomSSD::AliITSgeomSSD(const AliITSgeomSSD &source){
142////////////////////////////////////////////////////////////////////////
143// copy constructor
144////////////////////////////////////////////////////////////////////////
145 Int_t i;
146
147 if(this == &source) return;
148 this->fShapeSSD = new TBRIK(*(source.fShapeSSD));
149 this->fNp = source.fNp;
150 this->fNn = source.fNn;
151 delete fLowEdgeP;
152 delete fLowEdgeN;
153 this->fAngleP = source.fAngleP;
154 this->fAngleN = source.fAngleN;
155 fLowEdgeP = new Float_t[fNp];
156 fLowEdgeN = new Float_t[fNn];
157 for(i=0;i<fNp;i++) this->fLowEdgeP[i] = source.fLowEdgeP[i];
158 for(i=0;i<fNn;i++) this->fLowEdgeN[i] = source.fLowEdgeN[i];
159 return;
160}
161
162AliITSgeomSSD& AliITSgeomSSD::operator=(const AliITSgeomSSD &source) {
163////////////////////////////////////////////////////////////////////////
164// assignment operator
165////////////////////////////////////////////////////////////////////////
166 Int_t i;
167
168 if(this == &source) return *this;
169 this->fShapeSSD = new TBRIK(*(source.fShapeSSD));
170 this->fNp = source.fNp;
171 this->fNn = source.fNn;
172 delete fLowEdgeP;
173 delete fLowEdgeN;
174 this->fAngleP = source.fAngleP;
175 this->fAngleN = source.fAngleN;
176 fLowEdgeP = new Float_t[fNp];
177 fLowEdgeN = new Float_t[fNn];
178 for(i=0;i<fNp;i++) this->fLowEdgeP[i] = source.fLowEdgeP[i];
179 for(i=0;i<fNn;i++) this->fLowEdgeN[i] = source.fLowEdgeN[i];
180 return *this;
181}
182//______________________________________________________________________
183void AliITSgeomSSD::Local2Det(Float_t x,Float_t z,Int_t &a,Int_t &c){
184 // Given a GEANT detector local coordinate, cm, this function returns
185 // the detector specific P and N side strip numbers.
186 // Inputs are:
187 // Float_t x Geant detector local x coordinate in cm
188 // Float_t z Geant detector local z coordinate in cm
189 // outputs are:
190 // Int_t &a Detector anode strip number (P side)
191 // Int_t &c Detector cathode strip number (N side)
192 Float_t d,b;
193 Int_t i;
194
195 // project on to bonding edges.
196 d = x*TMath::Cos(fAngleP)+z*TMath::Sin(fAngleP);
197 b = x*TMath::Cos(fAngleN)+z*TMath::Sin(fAngleN);
198 if(d<fLowEdgeP[0]) i=-1;
199 else for(i=0;i<fNp;i++){
200 if(fLowEdgeP[i]<d) break;
201 } // end for i
202 a = i;
203 if(b<fLowEdgeN[0]) i=-1;
204 else for(i=0;i<fNn;i++){
205 if(fLowEdgeN[i]<b) break;
206 } // end for i
207 c = i;
208 return;
209}
210//______________________________________________________________________
211void AliITSgeomSSD::Det2Local(Int_t a,Int_t c,Float_t &x,Float_t &z){
212// Float_t d,b;
213// Int_t i;
214
215 return;
216}
217//______________________________________________________________________
218void AliITSgeomSSD::Print(ostream *os) const {
219////////////////////////////////////////////////////////////////////////
220// Standard output format for this class.
221////////////////////////////////////////////////////////////////////////
222 Int_t i;
223#if defined __GNUC__
224#if __GNUC__ > 2
225 ios::fmtflags fmt;
226#else
227 Int_t fmt;
228#endif
229#else
230 Int_t fmt;
231#endif
232
233 fmt = os->setf(ios::scientific); // set scientific floating point output
234 *os << "TBRIK" << " ";
235 *os << setprecision(16) << GetDx() << " ";
236 *os << setprecision(16) << GetDy() << " ";
237 *os << setprecision(16) << GetDz() << " ";
238 *os << fNp << " " << fNn << " ";
239 *os << setprecision(16) << fAngleP << " ";
240 *os << setprecision(16) << fAngleN << " ";
241 for(i=0;i<fNp;i++) *os << setprecision(16) << fLowEdgeP[i] << " ";
242 for(i=0;i<fNn;i++) *os << setprecision(16) << fLowEdgeN[i] << " ";
243 *os << endl;
244 os->flags(fmt); // reset back to old formating.
245 return;
246}
247//______________________________________________________________________
248void AliITSgeomSSD::Read(istream *is){
249////////////////////////////////////////////////////////////////////////
250// Standard input format for this class.
251////////////////////////////////////////////////////////////////////////
252 Float_t dx,dy,dz;
253 Int_t i;
254 char shp[20];
255
256 *is >> shp;
257 *is >> dx >> dy >> dz;
258 if(fShapeSSD!=0) delete fShapeSSD;
259 fShapeSSD = new TBRIK("ActiveSSD","Active volume of SSD","SSD SI DET",
260 dx,dy,dz);
261 *is >> fNp >> fNn;
262 *is >> fAngleP >> fAngleN;
263 if(fLowEdgeP !=0) delete fLowEdgeP;
264 if(fLowEdgeN !=0) delete fLowEdgeN;
265 fLowEdgeP = new Float_t[fNp];
266 fLowEdgeN = new Float_t[fNn];
267 for(i=0;i<fNp;i++) *is >> fLowEdgeP[i];
268 for(i=0;i<fNn;i++) *is >> fLowEdgeN[i];
269 return;
270}
271//----------------------------------------------------------------------
272ostream &operator<<(ostream &os,AliITSgeomSSD &p){
273////////////////////////////////////////////////////////////////////////
274// Standard output streaming function.
275////////////////////////////////////////////////////////////////////////
276
277 p.Print(&os);
278 return os;
279}
280//----------------------------------------------------------------------
281istream &operator>>(istream &is,AliITSgeomSSD &r){
282////////////////////////////////////////////////////////////////////////
283// Standard input streaming function.
284////////////////////////////////////////////////////////////////////////
285
286 r.Read(&is);
287 return is;
288}
289//======================================================================
290/*
291$Log$
292Revision 1.13 2001/10/12 22:07:20 nilsen
293A patch for C++ io manipulation functions so that they will work both
294with GNU gcc 2.96 and GNU gcc 3.01 compilers. Needs to be tested with
295other platforms.
296
297Revision 1.12 2001/08/24 21:06:37 nilsen
298Added more documentation, fixed up some coding violations, and some
299forward declorations.
300
301Revision 1.11 2001/05/16 08:17:49 hristov
302Bug fixed in the StepManager to account for the difference in the geometry tree for the ITS pixels. This fixes both the funny distribution of pixel coordinates and the missing hits/digits/points in many sectors of the ITS pixel barrel. Also included is a patch to properly get and use the detector dimensions through out the ITS code. (B.Nilsen)
303
304Revision 1.10 2001/02/09 00:00:57 nilsen
305Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed
306bugs in iostream based streamers used to read and write .det files. Fixed
307some detector sizes. Fixed bugs in some default-special constructors.
308
309Revision 1.9 2001/02/03 00:00:30 nilsen
310New version of AliITSgeom and related files. Now uses automatic streamers,
311set up for new formatted .det file which includes detector information.
312Additional smaller modifications are still to come.
313
314*/
315
316//#include "AliITSgeomSSD175.h"
317
318ClassImp(AliITSgeomSSD175)
319
320AliITSgeomSSD175::AliITSgeomSSD175() : AliITSgeomSSD(){
321////////////////////////////////////////////////////////////////////////
322// default constructor
323////////////////////////////////////////////////////////////////////////
324 const Float_t kDxyz[] ={3.6500,0.0150,2.000};//cm. (Geant 3.12 units)
325 // Size of sensitive detector area x,y(thickness),z
326 const Float_t kangle = 0.0175; // angle in rad. of anode and cathodes
327 const Float_t kpitch = 0.0095;// cm anode separation.
328 const Int_t kNstrips = 768; // number of anode or cathode strips.
329 Float_t *leA,*leC; // array of low edges anode and cathorde.
330 Int_t i;
331
332 leA = new Float_t[kNstrips+1];
333 leC = new Float_t[kNstrips+1];
334 leA[0] = -kDxyz[0];
335 leA[1] = -kpitch*(0.5*kNstrips-1);
336 leC[0] = kDxyz[0];
337 leC[1] = kpitch*(0.5*kNstrips-1);
338 for(i=1;i<kNstrips;i++){
339 leA[i+1] = leA[i] + kpitch;
340 leC[i+1] = leC[i] - kpitch;
341 } // end for i
342 leA[kNstrips] = kDxyz[0];
343 leC[kNstrips] = -kDxyz[0];
344// cout << "AliITSgeomSSD175 default creator called: start" << endl;
345 AliITSgeomSSD::ResetSSD(kDxyz,kangle,-kangle,
346 kNstrips+1,leA,kNstrips+1,leC);
347 delete leA;
348 delete leC;
349// cout << "AliITSgeomSSD175 default creator called: end" << endl;
350}
351//________________________________________________________________________
352ostream &operator<<(ostream &os,AliITSgeomSSD175 &p){
353////////////////////////////////////////////////////////////////////////
354// Standard output streaming function.
355////////////////////////////////////////////////////////////////////////
356
357 p.Print(&os);
358 return os;
359}
360//----------------------------------------------------------------------
361istream &operator>>(istream &is,AliITSgeomSSD175 &r){
362////////////////////////////////////////////////////////////////////////
363// Standard input streaming function.
364////////////////////////////////////////////////////////////////////////
365
366 r.Read(&is);
367 return is;
368}
369//======================================================================
370/*
371$Log$
372Revision 1.13 2001/10/12 22:07:20 nilsen
373A patch for C++ io manipulation functions so that they will work both
374with GNU gcc 2.96 and GNU gcc 3.01 compilers. Needs to be tested with
375other platforms.
376
377Revision 1.12 2001/08/24 21:06:37 nilsen
378Added more documentation, fixed up some coding violations, and some
379forward declorations.
380
381Revision 1.11 2001/05/16 08:17:49 hristov
382Bug fixed in the StepManager to account for the difference in the geometry tree for the ITS pixels. This fixes both the funny distribution of pixel coordinates and the missing hits/digits/points in many sectors of the ITS pixel barrel. Also included is a patch to properly get and use the detector dimensions through out the ITS code. (B.Nilsen)
383
384Revision 1.10 2001/02/09 00:00:57 nilsen
385Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed
386bugs in iostream based streamers used to read and write .det files. Fixed
387some detector sizes. Fixed bugs in some default-special constructors.
388
389Revision 1.9 2001/02/03 00:00:30 nilsen
390New version of AliITSgeom and related files. Now uses automatic streamers,
391set up for new formatted .det file which includes detector information.
392Additional smaller modifications are still to come.
393
394*/
395
396//#include "AliITSgeomSSD275and75.h"
397
398ClassImp(AliITSgeomSSD275and75)
399
400AliITSgeomSSD275and75::AliITSgeomSSD275and75() : AliITSgeomSSD(){
401////////////////////////////////////////////////////////////////////////
402// default constructor
403////////////////////////////////////////////////////////////////////////
404}
405//----------------------------------------------------------------------
406AliITSgeomSSD275and75::AliITSgeomSSD275and75(Int_t npar,Float_t *par) :
407 AliITSgeomSSD(){
408 // Default constructor for AliITSgeomSSD with strip angles of
409 // 275 miliradians and 75 miliradians. This constructor initlizes
410 // AliITSgeomSSD with the correct values. This is the miror image
411 // of the AliITSgeomSSD75and275 class.
412 const Float_t kDxyz[] ={3.6500,0.0150,2.000};//cm. (Geant 3.12 units)
413 // Size of sensitive detector area x,y(thickness),z
414 const Float_t kangleA = 0.0275; // angle in rad. of anode and cathodes
415 const Float_t kangleC = 0.0075; // angle in rad. of anode and cathodes
416 const Float_t kpitch = 0.0095;// cm anode separation.
417 const Int_t kNstrips = 768; // number of anode or cathode strips.
418 Float_t *leA,*leC; // array of low edges anode and cathorde.
419 Int_t i;
420
421 leA = new Float_t[kNstrips+1];
422 leC = new Float_t[kNstrips+1];
423 leA[0] = -kDxyz[0];
424 leA[1] = -kpitch*(0.5*kNstrips-1);
425 leC[0] = kDxyz[0];
426 leC[1] = kpitch*(0.5*kNstrips-1);
427 for(i=1;i<kNstrips;i++){
428 leA[i+1] = leA[i] + kpitch;
429 leC[i+1] = leC[i] - kpitch;
430 } // end for i
431 leA[kNstrips] = kDxyz[0];
432 leC[kNstrips] = -kDxyz[0];
433// cout << "AliITSgeomSSD275and75 default creator called: start" << endl;
434 AliITSgeomSSD::ResetSSD(par,kangleA,kangleC,
435 kNstrips+1,leA,kNstrips+1,leC);
436 delete leA;
437 delete leC;
438// cout << "AliITSgeomSSD275and75 default creator called: end" << endl;
439}
440//________________________________________________________________________
441ostream &operator<<(ostream &os,AliITSgeomSSD275and75 &p){
442////////////////////////////////////////////////////////////////////////
443// Standard output streaming function.
444////////////////////////////////////////////////////////////////////////
445
446 p.Print(&os);
447 return os;
448}
449//----------------------------------------------------------------------
450istream &operator>>(istream &is,AliITSgeomSSD275and75 &r){
451////////////////////////////////////////////////////////////////////////
452// Standard input streaming function.
453////////////////////////////////////////////////////////////////////////
454
455 r.Read(&is);
456 return is;
457}
458//======================================================================
459/*
460$Log$
461Revision 1.13 2001/10/12 22:07:20 nilsen
462A patch for C++ io manipulation functions so that they will work both
463with GNU gcc 2.96 and GNU gcc 3.01 compilers. Needs to be tested with
464other platforms.
465
466Revision 1.12 2001/08/24 21:06:37 nilsen
467Added more documentation, fixed up some coding violations, and some
468forward declorations.
469
470Revision 1.11 2001/05/16 08:17:49 hristov
471Bug fixed in the StepManager to account for the difference in the geometry tree for the ITS pixels. This fixes both the funny distribution of pixel coordinates and the missing hits/digits/points in many sectors of the ITS pixel barrel. Also included is a patch to properly get and use the detector dimensions through out the ITS code. (B.Nilsen)
472
473Revision 1.10 2001/02/09 00:00:57 nilsen
474Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed
475bugs in iostream based streamers used to read and write .det files. Fixed
476some detector sizes. Fixed bugs in some default-special constructors.
477
478Revision 1.9 2001/02/03 00:00:30 nilsen
479New version of AliITSgeom and related files. Now uses automatic streamers,
480set up for new formatted .det file which includes detector information.
481Additional smaller modifications are still to come.
482
483*/
484//#include "AliITSgeomSSD75and275.h"
485
486ClassImp(AliITSgeomSSD75and275)
487
488AliITSgeomSSD75and275::AliITSgeomSSD75and275() : AliITSgeomSSD(){
489////////////////////////////////////////////////////////////////////////
490// default constructor
491////////////////////////////////////////////////////////////////////////
492}
493AliITSgeomSSD75and275::AliITSgeomSSD75and275(Int_t npar,Float_t *par) :
494 AliITSgeomSSD(){
495 // Default constructor for AliITSgeomSSD with strip angles of
496 // 75 miliradians and 275 miliradians. This constructor initlizes
497 // AliITSgeomSSD with the correct values. This is the miror image
498 // of the AliITSgeomSSD275and75 class.
499 const Float_t kDxyz[] ={3.6500,0.0150,2.000};//cm. (Geant 3.12 units)
500 // Size of sensitive detector area x,y(thickness),z
501 const Float_t kangleA = 0.0075; // angle in rad. of anode and cathodes
502 const Float_t kangleC = 0.0275; // angle in rad. of anode and cathodes
503 const Float_t kpitch = 0.0095;// cm anode separation.
504 const Int_t kNstrips = 768; // number of anode or cathode strips.
505 Float_t *leA,*leC; // array of low edges anode and cathorde.
506 Int_t i;
507
508 leA = new Float_t[kNstrips+1];
509 leC = new Float_t[kNstrips+1];
510 leA[0] = -kDxyz[0];
511 leA[1] = -kpitch*(0.5*kNstrips-1);
512 leC[0] = kDxyz[0];
513 leC[1] = kpitch*(0.5*kNstrips-1);
514 for(i=1;i<kNstrips;i++){
515 leA[i+1] = leA[i] + kpitch;
516 leC[i+1] = leC[i] - kpitch;
517 } // end for i
518 leA[kNstrips] = kDxyz[0];
519 leC[kNstrips] = -kDxyz[0];
520// cout << "AliITSgeomSSD275and75 default creator called: start" << endl;
521 AliITSgeomSSD::ResetSSD(par,kangleA,kangleC,
522 kNstrips+1,leA,kNstrips+1,leC);
523 delete leA;
524 delete leC;
525// cout << "AliITSgeomSSD275and75 default creator called: end" << endl;
526}
527//________________________________________________________________________
528ostream &operator<<(ostream &os,AliITSgeomSSD75and275 &p){
529////////////////////////////////////////////////////////////////////////
530// Standard output streaming function.
531////////////////////////////////////////////////////////////////////////
532
533 p.Print(&os);
534 return os;
535}
536//----------------------------------------------------------------------
537istream &operator>>(istream &is,AliITSgeomSSD75and275 &r){
538////////////////////////////////////////////////////////////////////////
539// Standard input streaming function.
540////////////////////////////////////////////////////////////////////////
541
542 r.Read(&is);
543 return is;
544}
545//======================================================================