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