1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 Revision 1.9 2001/04/27 14:16:50 nilsen
18 Remove dead and/or unused code and printout lines. i.e. cleaned it up a bit.
25 #include "AliITSsegmentationSSD.h"
26 #include "AliITSgeom.h"
28 ClassImp(AliITSsegmentationSSD)
29 AliITSsegmentationSSD::AliITSsegmentationSSD(){
30 // default constructor
35 //----------------------------------------------------------------------
36 AliITSsegmentationSSD::AliITSsegmentationSSD(AliITSgeom *geom){
46 //______________________________________________________________________
47 AliITSsegmentationSSD& AliITSsegmentationSSD::operator=(
48 AliITSsegmentationSSD &source){
50 if(this==&source) return *this;
51 this->fNstrips = source.fNstrips;
52 this->fStereoP = source.fStereoP;
53 this->fStereoN = source.fStereoN;
54 this->fStereoPl5 = source.fStereoPl5;
55 this->fStereoNl5 = source.fStereoNl5;
56 this->fStereoPl6 = source.fStereoPl6;
57 this->fStereoNl6 = source.fStereoNl6;
58 this->fLayer = source.fLayer;
59 this->fPitch = source.fPitch;
60 this->fDz = source.fDz;
61 this->fDx = source.fDx;
62 this->fDy = source.fDy;
63 this->fLayer = source.fLayer;
64 this->fGeom = source.fGeom; // copy only the pointer
65 this->fCorr = new TF1(*(source.fCorr)); // make a proper copy
68 //______________________________________________________________________
69 AliITSsegmentationSSD::AliITSsegmentationSSD(AliITSsegmentationSSD &source){
73 //----------------------------------------------------------------------
74 void AliITSsegmentationSSD::Init(){
75 // standard initalizer
81 //----------------------------------------------------------------------
82 void AliITSsegmentationSSD::Angles(Float_t &aP,Float_t &aN){
93 //----------------------------------------------------------------------
94 void AliITSsegmentationSSD::SetLayer(Int_t l){
99 //----------------------------------------------------------------------
100 void AliITSsegmentationSSD::GetPadTxz(Float_t &x,Float_t &z){
101 // returns P and N sided strip numbers for a given location.
102 // Transformation from microns detector center local coordinates
103 // to detector P and N side strip numbers..
106 fNstrips v | N-Side ...0
107 \-------/------------|-----------\--------\
108 |\\\\\\/////////////.|\\\\\\\\\\\\\\\\\\\\|
109 |0\\\\/////////////..|.\\\\\\\\\\\\\\\\\\\|
110 |00\\/////////////...|..\\\\\\\\\\\\\\\\\\|
111 X <--|000/////////////... |...\\\\\\\\\\\\\\\\\|
112 |00/////////////... | ...\\\\\\\\\\\\\\\\|
113 |0/////////////... | ...\\\\\\\\\\\\\\\|
114 |//////////////... | ...\\\\\\\\\\\\\\\|
115 /-----\--------------|--------------------/
116 fNstrips-1 P-Side ...0
122 // expects x, z in microns
124 Float_t tanP = TMath::Tan(fStereoP);
125 Float_t tanN = TMath::Tan(-fStereoN);
130 x = (x1 - z1*tanP)/fPitch;
131 z = (x1 - tanN*(z1 - fDz))/fPitch;
133 //----------------------------------------------------------------------
134 void AliITSsegmentationSSD::GetPadIxz(Float_t x,Float_t z,Int_t &iP,Int_t &iN){
135 // returns P and N sided strip numbers for a given location.
138 fNstrips v | N-Side ...0
139 \-------/------------|-----------\--------\
140 |\\\\\\/////////////.|\\\\\\\\\\\\\\\\\\\\|
141 |0\\\\/////////////..|.\\\\\\\\\\\\\\\\\\\|
142 |00\\/////////////...|..\\\\\\\\\\\\\\\\\\|
143 X <--|000/////////////... |...\\\\\\\\\\\\\\\\\|
144 |00/////////////... | ...\\\\\\\\\\\\\\\\|
145 |0/////////////... | ...\\\\\\\\\\\\\\\|
146 |//////////////... | ...\\\\\\\\\\\\\\\|
147 /-----\--------------|--------------------/
148 fNstrips-1 P-Side ...0
155 // expects x, z in microns
158 Float_t StereoP, StereoN;
159 Angles(StereoP,StereoN);
160 Float_t tanP=TMath::Tan(StereoP);
161 Float_t tanN=TMath::Tan(StereoN);
165 Float_t ldX = x1 - z1*tanP; // distance from left-down edge
166 iP = (Int_t)(ldX/fPitch);
168 iP = (iP>fNstrips)? -1: iP;
170 ldX = x1 - tanN*(fDz - z1);
171 iN = (Int_t)(ldX/fPitch);
173 iN = (iN>fNstrips)? -1: iN;
176 //-------------------------------------------------------
177 void AliITSsegmentationSSD::GetPadCxz(Int_t iP,Int_t iN,Float_t &x,Float_t &z){
178 // actually this is the GetCrossing(Float_t &,Float_t &)
179 // returns local x, z in microns !
181 Float_t Dx = fDx; // detector size in x direction, microns
182 Float_t Dz = fDz; // detector size in z direction, microns
183 Float_t xP; // x coordinate in the P side from the first P strip
184 Float_t xN; // x coordinate in the N side from the first N strip
185 Float_t StereoP, StereoN;
186 Angles(StereoP,StereoN);
187 Float_t kP=TMath::Tan(StereoP);
188 Float_t kN=TMath::Tan(StereoN);
192 x = xP + kP*(Dz*kN-xP+xN)/(kP+kN);
193 z = (Dz*kN-xP+xN)/(kP+kN);
196 if(TMath::Abs(z) > Dz/2) cout<<"Warning, wrong z local ="<<z<<endl;
197 // Check that zL is inside the detector for the
198 // correspondent xP and xN coordinates
202 //______________________________________________________________________
203 void AliITSsegmentationSSD::LocalToDet(Float_t x,Float_t z,
204 Int_t &iP,Int_t &iN){
205 // Transformation from Geant cm detector center local coordinates
206 // to detector P and N side strip numbers..
209 fNstrips v | N-Side ...0
210 \-------/------------|-----------\--------\
211 |\\\\\\/////////////.|\\\\\\\\\\\\\\\\\\\\|
212 |0\\\\/////////////..|.\\\\\\\\\\\\\\\\\\\|
213 |00\\/////////////...|..\\\\\\\\\\\\\\\\\\|
214 X <--|000/////////////... |...\\\\\\\\\\\\\\\\\|
215 |00/////////////... | ...\\\\\\\\\\\\\\\\|
216 |0/////////////... | ...\\\\\\\\\\\\\\\|
217 |//////////////... | ...\\\\\\\\\\\\\\\|
218 /-----\--------------|--------------------/
219 fNstrips-1 P-Side ...0
226 const Double_t kconst = 1.0E-04; // convert microns to cm.
228 x /= kconst; // convert to microns
229 z /= kconst; // convert to microns
230 this->GetPadTxz(x,z);
234 if(iP<0 || iP>=fNstrips) iP=-1; // strip number must be in range.
237 if(iN<0 || iN>=fNstrips) iN=-1; // strip number must be in range.
240 //----------------------------------------------------------------------
241 void AliITSsegmentationSSD::DetToLocal(Int_t ix,Int_t iPN,
242 Float_t &x,Float_t &z){
243 // Transformation from detector segmentation/cell coordiantes starting
244 // from 0. iPN=0 for P side and 1 for N side strip. Returned is z=0.0
245 // and the corresponding x value..
248 fNstrips v | N-Side ...0
249 \-------/------------|-----------\--------\
250 |\\\\\\/////////////.|\\\\\\\\\\\\\\\\\\\\|
251 |0\\\\/////////////..|.\\\\\\\\\\\\\\\\\\\|
252 |00\\/////////////...|..\\\\\\\\\\\\\\\\\\|
253 X <--|000/////////////... |...\\\\\\\\\\\\\\\\\|
254 |00/////////////... | ...\\\\\\\\\\\\\\\\|
255 |0/////////////... | ...\\\\\\\\\\\\\\\|
256 |//////////////... | ...\\\\\\\\\\\\\\\|
257 /-----\--------------|--------------------/
258 fNstrips-1 P-Side ...0
266 // x = a + b + z*tan(fStereoP); a = Dpx(iP)*(iP+0.5)-dx; b = dz*th;
268 // x = a + b + z*tan(fStereoP); a = Dpx(iN)*(iN+0.5)-dx; b = -dz*th;
269 const Double_t kconst = 1.0E-04; // convert microns to cm.
270 Float_t flag=kconst*Dx(); // error value
271 Double_t th=0.0,dx,dz,i,a,b=0.0,xb[4],zb[4];
273 z = 0.0; // Strip center in z.
274 if(iPN<0 || iPN>1){// if error return full detector size in x.
278 if(ix<0 || ix>=fNstrips) { // if error return full detector size in x.
282 i = (Double_t) ix; // convert to double
283 dx = 0.5*kconst*Dx(); // half distance in x in cm
284 dz = 0.5*kconst*Dz(); // half distance in z in cm
285 a = kconst*Dpx(ix)*(i+0.5)-dx; // Min x value.
286 if(iPN==0){ //P-side angle defined backwards.
287 th = TMath::Tan(fStereoP);
289 }else if(iPN==1){ // N-side
290 th = TMath::Tan(-fStereoN);
293 // compute average/center position of the strip.
294 xb[0] = +dx; if(th!=0.0) zb[0] = (+dx-a-b)/th; else zb[0] = 0.0;
295 xb[1] = -dx; if(th!=0.0) zb[1] = (-dx-a-b)/th; else zb[1] = 0.0;
296 xb[2] = a+b+dz*th; zb[2] = +dz;
297 xb[3] = a+b-dz*th; zb[3] = -dz;
299 for(Int_t j=0;j<4;j++){
300 if(xb[j]>=-dx && xb[j]<=dx && zb[j]>=-dz && zb[j]<=dz){
309 //----------------------------------------------------------------------
310 Bool_t AliITSsegmentationSSD::GetCrossing(Int_t iP,Int_t iN,
311 Float_t &x,Float_t &z,
313 // Given one P side strip and one N side strip, Returns kTRUE if they
314 // cross each other and the location of the two crossing strips and
315 // their correxlation matrix c[2][2].
318 fNstrips v | N-Side ...0
319 \-------/------------|-----------\--------\
320 |\\\\\\/////////////.|\\\\\\\\\\\\\\\\\\\\|
321 |0\\\\/////////////..|.\\\\\\\\\\\\\\\\\\\|
322 |00\\/////////////...|..\\\\\\\\\\\\\\\\\\|
323 X <--|000/////////////... |...\\\\\\\\\\\\\\\\\|
324 |00/////////////... | ...\\\\\\\\\\\\\\\\|
325 |0/////////////... | ...\\\\\\\\\\\\\\\|
326 |//////////////... | ...\\\\\\\\\\\\\\\|
327 /-----\--------------|--------------------/
328 fNstrips-1 P-Side ...0
334 c[2][2] is defined as follows
335 /c[0][0] c[0][1]\ /delta iP\ = /delta x\
336 \c[1][0] c[1][1]/ \delta iN/ = \delta z/
338 const Double_t kconst = 1.0E-04; // convert microns to cm.
339 Double_t thp,thn,th,dx,dz,p,ip,in;
341 thp = TMath::Tan(fStereoP);
342 thn = TMath::Tan(-fStereoN);
344 if(th==0.0) { // parall strips then never cross.
347 c[0][0] = c[1][0] = c[0][1] = c[1][1] = 0.0;
350 // The strips must cross some place in space.
351 ip = (Double_t) iP; // convert to double now for speed
352 in = (Double_t) iN; // convert to double now for speed
353 dx = 0.5*kconst*Dx(); // half distance in x in cm
354 dz = 0.5*kconst*Dz(); // half distance in z in cm
355 p = kconst*Dpx(iP); // Get strip spacing/pitch now
356 x = 0.5*p+dx + (p*(in*thp-ip*thn)-2.0*dz*thp*thn)/th;
357 z =(p*(in-ip)-dz*(thp+thn))/th;
358 // compute correlations.
359 c[0][0] = -thn*p/th; // dx/diP
360 c[1][1] = p/th; // dz/diN
361 c[0][1] = p*thp/th; // dx/diN
362 c[1][0] = -p/th; // dz/diP
363 if(x<-dx || x>dx || z<-dz || z>dz) return kFALSE; // crossing is outside
364 // of the detector so
365 // these strips don't