]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSsegmentationSSD.cxx
Bug fix.
[u/mrichter/AliRoot.git] / ITS / AliITSsegmentationSSD.cxx
CommitLineData
b0f5e3fc 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#include <TMath.h>
1ca7869b 17#include <TF1.h>
fd61217e 18#include <iostream.h>
b0f5e3fc 19#include "AliITSsegmentationSSD.h"
20#include "AliITSgeom.h"
fd61217e 21
b0f5e3fc 22
23ClassImp(AliITSsegmentationSSD)
24AliITSsegmentationSSD::AliITSsegmentationSSD(){
25 // default constructor
26 fGeom=0;
27 fCorr=0;
28 SetDetSize();
e8189707 29 SetPadSize();
30 SetNPads();
b0f5e3fc 31 SetAngles();
fd61217e 32 fLayer =5;
b0f5e3fc 33}
34//------------------------------
35AliITSsegmentationSSD::AliITSsegmentationSSD(AliITSgeom *geom){
36 // constuctor
37 fGeom=geom;
38 fCorr=0;
39 SetDetSize();
fd61217e 40 cout<<"Dx="<<fDx<<endl;
e8189707 41 SetPadSize();
42 SetNPads();
b0f5e3fc 43 SetAngles();
44 //Init();
fd61217e 45 fLayer =5;
46 cout<<"segmSSD - geom"<<endl;
47
b0f5e3fc 48}
49//____________________________________________________________________________
50AliITSsegmentationSSD& AliITSsegmentationSSD::operator=(AliITSsegmentationSSD &source){
51// Operator =
52 if(this==&source) return *this;
53 this->fNstrips = source.fNstrips;
54 this->fStereoP = source.fStereoP;
55 this->fStereoN = source.fStereoN;
fd61217e 56 this->fStereoPl5 = source.fStereoPl5;
57 this->fStereoNl5 = source.fStereoNl5;
58 this->fStereoPl6 = source.fStereoPl6;
59 this->fStereoNl6 = source.fStereoNl6;
60 this->fLayer = source.fLayer;
b0f5e3fc 61 this->fPitch = source.fPitch;
62 this->fDz = source.fDz;
63 this->fDx = source.fDx;
64 this->fDy = source.fDy;
fd61217e 65 this->fLayer = source.fLayer;
b0f5e3fc 66 this->fGeom = source.fGeom; // copy only the pointer
67 this->fCorr = new TF1(*(source.fCorr)); // make a proper copy
68 return *this;
69
70}
71//____________________________________________________________________________
72AliITSsegmentationSSD::AliITSsegmentationSSD(AliITSsegmentationSSD &source){
73 // copy constructor
74 *this = source;
75}
76//------------------------------
77void AliITSsegmentationSSD::Init(){
78 // standard initalizer
79
fd61217e 80 //AliITSgeomSSD *gssd = (AliITSgeomSSD *) (fGeom->GetShape(5,1,1));
81 //const Float_t kconv=10000.;
82 /*
b0f5e3fc 83 fDx = 2.*kconv*gssd->GetDx();
84 fDz = 2.*kconv*gssd->GetDz();
85 fDy = 2.*kconv*gssd->GetDy();
fd61217e 86 */
e8189707 87 SetPadSize();
88 SetNPads();
b0f5e3fc 89 SetAngles();
90
91}
fd61217e 92//-------------------------------------------------------
93void AliITSsegmentationSSD::Angles(Float_t &aP,Float_t &aN)
94 {
95 if (fLayer == 5)
96 {
97 aP = fStereoPl5;
98 aN = fStereoNl5;
99 }
100
101 if (fLayer == 6)
102 {
103 aP = fStereoPl6;
104 aN = fStereoNl6;
105 }
106 }
107
108 void AliITSsegmentationSSD::SetLayer(Int_t l)
109 {
110 if (l==5) fLayer =5;
111 if (l==6) fLayer =6;
112 }
113
b0f5e3fc 114//-------------------------------------------------------
e8189707 115void AliITSsegmentationSSD::GetPadIxz(Float_t x,Float_t z,Int_t &iP,Int_t &iN)
b0f5e3fc 116{
117 // returns P and N sided strip numbers for a given location.
118
119 // expects x, z in microns
120
121 Float_t tanP=TMath::Tan(fStereoP);
122 Float_t tanN=TMath::Tan(fStereoN);
fd61217e 123 //cout<<"1 segment::GetPad: xL,zL,fDx,fDz ="<<x<<","<<z<<","<<fDx<<","<<fDz<<endl;
124 //cout<<"2 segment: ? tanP,tanN ="<<tanP<<","<<tanN<<endl;
125 tanP = 0.0075;
126 tanN = 0.0275;
b0f5e3fc 127 Float_t x1=x,z1=z;
128 x1 += fDx/2;
129 z1 += fDz/2;
b0f5e3fc 130 Float_t ldX = x1 - z1*tanP; // distance from left-down edge
131 iP = (Int_t)(ldX/fPitch);
132 iP = (iP<0)? -1: iP;
133 iP = (iP>fNstrips)? -1: iP;
134
fd61217e 135 //cout<<"3 segment::GetPad: x1,tanP,ix1 ="<<ldX<<","<<tanP<<","<<iP<<endl;
b0f5e3fc 136
137 ldX = x1 - tanN*(fDz - z1);
138 iN = (Int_t)(ldX/fPitch);
139 iN = (iN<0)? -1: iN;
140 iN = (iN>fNstrips)? -1: iN;
141
fd61217e 142 //cout<<"4 segment::GetPad: x2,tanN,ix2 ="<<ldX<<","<<tanN<<","<<iN<<endl;
143
b0f5e3fc 144}
145//-------------------------------------------------------
e8189707 146void AliITSsegmentationSSD::GetPadCxz(Int_t iP,Int_t iN,Float_t &x,Float_t &z)
b0f5e3fc 147{
148 // actually this is the GetCrossing(Float_t &,Float_t &)
149
150 // returns x, z in microns !
151
152 Float_t flag=2*fDx;
153
154 Float_t tanP=TMath::Tan(fStereoP);
155 Float_t tanN=TMath::Tan(fStereoN);
156
157 Float_t dx = 0.1;
158 x = iP*fPitch;
159 z = iN*fPitch;
160
161 if(tanP + tanN == 0) {x=z=flag; return ;}
162
163 z = (z - x + tanN * fDz) / (tanP + tanN);
164 x = x + tanP * z;
165
166 x -= fDx/2;
167 z -= fDz/2;
168
169 if ( ( z < -(fDz/2+dx) ) || ( z > (fDz/2+dx) ) ) {x=z=flag; return ;}
170 if ( ( x < -(fDx/2+dx) ) || ( x > (fDx/2+dx) ) ) {x=z=flag; return ;}
171
172 return;
173}