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 **************************************************************************/
20 #include "AliITSsegmentationSDD.h"
22 #include "AliITSgeom.h"
23 #include "AliITSgeomSDD.h"
25 #include "AliITSresponse.h"
27 ClassImp(AliITSsegmentationSDD)
28 //----------------------------------------------------------------------
29 AliITSsegmentationSDD::AliITSsegmentationSDD(AliITSgeom* geom,
30 AliITSresponse *resp){
33 fDriftSpeed=resp->DriftSpeed();
40 //______________________________________________________________________
41 AliITSsegmentationSDD::AliITSsegmentationSDD(){
42 // standard constructor
51 //----------------------------------------------------------------------
52 void AliITSsegmentationSDD::Init(){
53 // Standard initilisation routine
57 //fGeom = ((AliITS*)gAlice->GetModule("ITS"))->GetITSgeom();
59 AliITSgeomSDD *gsdd = (AliITSgeomSDD *) (fGeom->GetShape(3,1,1));
61 const Float_t kconv=10000.;
62 fDz = 2.*kconv*gsdd->GetDz();
63 fDx = kconv*gsdd->GetDx();
64 fDy = 2.*kconv*gsdd->GetDy();
67 //----------------------------------------------------------------------
68 void AliITSsegmentationSDD::
69 Neighbours(Int_t iX, Int_t iZ, Int_t* Nlist, Int_t Xlist[8], Int_t Zlist[8]){
70 // returns neighbours for use in Cluster Finder routines and the like
72 if(iX >= fNanodes) printf("iX > fNanodes %d %d\n",iX,fNanodes);
73 if(iZ >= fNsamples) printf("iZ > fNsamples %d %d\n",iZ,fNsamples);
76 if(iX && (iX != fNanodes/2)) Xlist[2]=iX-1;
78 if ((iX !=fNanodes/2 -1) && (iX != fNanodes)) Xlist[3]=iX+1;
82 if (iZ < fNsamples) Zlist[1]=iZ+1;
86 //----------------------------------------------------------------------
87 void AliITSsegmentationSDD::GetPadIxz(Float_t x,Float_t z,
88 Int_t &timebin,Int_t &anode){
89 // Returns cell coordinates (time sample,anode) incremented by 1 !!!!!
90 // for given real local coordinates (x,z)
94 const Float_t kconv=10000; // cm->um
96 Int_t na = fNanodes/2;
97 Float_t driftpath=fDx-TMath::Abs(kconv*x);
98 timebin=(Int_t)(driftpath/fDriftSpeed/fTimeStep);
99 anode=(Int_t)(kconv*(z/fPitch + na/2));
100 if (x > 0) anode += na;
106 //----------------------------------------------------------------------
107 void AliITSsegmentationSDD::GetPadCxz(Int_t timebin,Int_t anode,
108 Float_t &x ,Float_t &z){
109 // Transform from cell to real local coordinates
110 // returns x, z in cm
112 // the +0.5 means that an # and time bin # should start from 0 !!!
113 const Float_t kconv=10000; // um->cm
114 // the +0.5 means that an # and time bin # should start from 0 !!!
116 Int_t na = fNanodes/2;
117 Float_t driftpath=(timebin+0.5)*fTimeStep*fDriftSpeed;
118 if (anode >= na) x=(fDx-driftpath)/kconv;
119 else x = -(fDx-driftpath)/kconv;
120 if (anode >= na) anode-=na;
121 z=((anode+0.5)*fPitch-fDz/2)/kconv;
124 //----------------------------------------------------------------------
125 void AliITSsegmentationSDD::GetPadTxz(Float_t &x,Float_t &z){
126 // Get anode and time bucket as floats - numbering from 0
128 // expects x, z in cm
130 const Float_t kconv=10000; // cm->um
133 Int_t na = fNanodes/2;
134 Float_t driftpath=fDx-TMath::Abs(kconv*x);
135 x=driftpath/fDriftSpeed/fTimeStep;
136 z=kconv*z/fPitch + (float)na/2;
140 //----------------------------------------------------------------------
141 void AliITSsegmentationSDD::GetLocal(Int_t module,Float_t *g ,Float_t *l){
142 // returns local coordinates from global
145 //fGeom = ((AliITS*)gAlice->GetModule("ITS"))->GetITSgeom();
147 fGeom->GtoL(module,g,l);
149 //----------------------------------------------------------------------
150 void AliITSsegmentationSDD::GetGlobal(Int_t module,Float_t *l ,Float_t *g){
151 // return global coordinates from local
154 //fGeom = ((AliITS*)gAlice->GetModule("ITS"))->GetITSgeom();
157 fGeom->LtoG(module,l,g);
160 //----------------------------------------------------------------------
161 void AliITSsegmentationSDD::Print(Option_t *opt) const {
162 // Print SDD segmentation Parameters
164 cout << "**************************************************" << endl;
165 cout << " Silicon Drift Detector Segmentation Parameters " << endl;
166 cout << "**************************************************" << endl;
167 cout << "Number of Time Samples: " << fNsamples << endl;
168 cout << "Number of Anodes: " << fNanodes << endl;
169 cout << "Time Step (ns): " << fTimeStep << endl;
170 cout << "Anode Pitch (um): " << fPitch << endl;
171 cout << "Full Detector Width (x): " << fDx << endl;
172 cout << "Half Detector Length (z): " << fDz << endl;
173 cout << "Full Detector Thickness (y): " << fDy << endl;
174 cout << "**************************************************" << endl;
177 //______________________________________________________________________
179 //______________________________________________________________________
180 void AliITSsegmentationSDD::LocalToDet(Float_t x,Float_t z,Int_t &ix,Int_t &iz){
181 // Transformation from Geant detector centered local coordinates (cm) to
182 // time bucket numbers ix and anode number iz.
184 // Float_t x detector local coordinate x in cm with respect to the
185 // center of the sensitive volume.
186 // Float_t z detector local coordinate z in cm with respect to the
187 // center of the sensitive volulme.
189 // Int_t ix detector x time coordinate. Has the range 0<=ix<fNsamples.
190 // Int_t iz detector z anode coordinate. Has the range 0<=iz<fNandoes.
191 // A value of -1 for ix or iz indecates that this point is outside of the
192 // detector segmentation as defined.
193 // This segmentation geometry can be discribed as the following:
194 // {assumes 2*Dx()=7.0cm Dz()=7.5264cm, Dpx()=25ns,
195 // res->DeriftSpeed()=7.3mic/ns, Dpz()=512. For other values a only the
196 // specific numbers will change not their layout.}
199 // 0 |----------------------|---------------------| 256
200 // | a time-bins | time-bins a |
202 // | o |___________________o_|__> X
206 // 255 |----------------------|---------------------| 511
211 const Float_t kconv = 1.0E-04; // converts microns to cm.
213 ix = -1; // default values
214 iz = -1; // default values
215 dx = -kconv*Dx(); // lower left edge in cm.
216 dz = -0.5*kconv*Dz(); // lower left edge in cm.
217 if(x<dx || x>-dx) return; // outside of defined volume.
218 if(z<dz || z>-dz) return; // outside of defined volume.
219 tb = fDriftSpeed*fTimeStep*kconv; // compute size of time bin.
220 if(x>0) dx = -(dx + x)/tb; // distance from + side in time bin units
221 else dx = (x - dx)/tb; // distance from - side in time bin units
222 dz = (z - dz)/(kconv*fPitch); // distance in z in anode pitch units
223 ix = (Int_t) dx; // time bin
224 iz = (Int_t) dz; // anode
225 if(x>0) iz += Npz()/2; // if x>0 then + side anodes values.
226 return; // Found ix and iz, return.
228 //______________________________________________________________________
229 void AliITSsegmentationSDD::DetToLocal(Int_t ix,Int_t iz,Float_t &x,Float_t &z)
231 // Transformation from Detector time bucket and anode coordiantes to Geant
232 // detector centerd local coordinates (cm).
234 // Int_t ix detector x time coordinate. Has the range 0<=ix<fNsamples.
235 // Int_t iz detector z anode coordinate. Has the range 0<=iz<fNandoes.
237 // Float_t x detector local coordinate x in cm with respect to the
238 // center of the sensitive volume.
239 // Float_t z detector local coordinate z in cm with respect to the
240 // center of the sensitive volulme.
241 // If ix and or iz is outside of the segmentation range a value of -Dx()
242 // or -0.5*Dz() is returned.
243 // This segmentation geometry can be discribed as the following:
244 // {assumes 2*Dx()=7.0cm Dz()=7.5264cm, Dpx()=25ns,
245 // res->DeriftSpeed()=7.3mic/ns, Dpz()=512. For other values a only the
246 // specific numbers will change not their layout.}
249 // 0 |----------------------|---------------------| 256
250 // | a time-bins | time-bins a |
252 // | o |___________________o_|__> X
256 // 255 |----------------------|---------------------| 511
262 const Float_t kconv = 1.0E-04; // converts microns to cm.
264 if(iz>=Npz()/2) x = kconv*Dx(); // default value for +x side.
265 else x = -kconv*Dx(); // default value for -x side.
266 z = -0.5*kconv*Dz(); // default value.
267 if(ix<0 || ix>=Npx()) return; // outside of detector
268 if(iz<0 || iz>=Npz()) return; // outside of detctor
269 tb = fDriftSpeed*fTimeStep*kconv; // compute size of time bin.
270 if(iz>=Npz()/2) tb *= -1.0; // for +x side decrement frmo Dx().
271 for(i=0;i<ix;i++) x += tb; // sum up to cell ix-1
272 x += 0.5*tb; // add 1/2 of cell ix for center location.
273 if(iz>=Npz()/2) iz -=Npz()/2;// If +x side don't count anodes from -x side.
274 for(j=0;j<iz;j++) z += kconv*fPitch; // sum up cell iz-1
275 z += 0.5*kconv*fPitch; // add 1/2 of cell iz for center location.
276 return; // Found x and z, return.