]>
Commit | Line | Data |
---|---|---|
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 <TF1.h> | |
17 | #include <TMath.h> | |
18 | ||
19 | #include "AliITSsegmentationSDD.h" | |
20 | #include "AliITS.h" | |
21 | #include "AliITSgeom.h" | |
22 | #include "AliITSgeomSDD.h" | |
23 | #include "AliRun.h" | |
24 | #include "AliITSresponse.h" | |
25 | ||
26 | ClassImp(AliITSsegmentationSDD) | |
27 | //---------------------------------------------------------------------- | |
28 | AliITSsegmentationSDD::AliITSsegmentationSDD(AliITSgeom* geom, | |
29 | AliITSresponse *resp){ | |
30 | // constructor | |
31 | fGeom=geom; | |
32 | fDriftSpeed=resp->DriftSpeed(); | |
33 | fCorr=0; | |
34 | SetDetSize(); | |
35 | SetPadSize(); | |
36 | SetNPads(); | |
37 | ||
38 | } | |
39 | //______________________________________________________________________ | |
40 | AliITSsegmentationSDD::AliITSsegmentationSDD(){ | |
41 | // standard constructor | |
42 | fGeom=0; | |
43 | fDriftSpeed=0; | |
44 | fCorr=0; | |
45 | SetDetSize(); | |
46 | SetPadSize(); | |
47 | SetNPads(); | |
48 | ||
49 | } | |
50 | //---------------------------------------------------------------------- | |
51 | void AliITSsegmentationSDD::Init(){ | |
52 | // Standard initilisation routine | |
53 | ||
54 | if(!fGeom) { | |
55 | return; | |
56 | //fGeom = ((AliITS*)gAlice->GetModule("ITS"))->GetITSgeom(); | |
57 | } | |
58 | AliITSgeomSDD *gsdd = (AliITSgeomSDD *) (fGeom->GetShape(3,1,1)); | |
59 | ||
60 | const Float_t kconv=10000.; | |
61 | fDz = 2.*kconv*gsdd->GetDz(); | |
62 | fDx = kconv*gsdd->GetDx(); | |
63 | fDy = 2.*kconv*gsdd->GetDy(); | |
64 | } | |
65 | ||
66 | //---------------------------------------------------------------------- | |
67 | void AliITSsegmentationSDD:: | |
68 | Neighbours(Int_t iX, Int_t iZ, Int_t* Nlist, Int_t Xlist[8], Int_t Zlist[8]){ | |
69 | // returns neighbours for use in Cluster Finder routines and the like | |
70 | ||
71 | if(iX >= fNanodes) printf("iX > fNanodes %d %d\n",iX,fNanodes); | |
72 | if(iZ >= fNsamples) printf("iZ > fNsamples %d %d\n",iZ,fNsamples); | |
73 | *Nlist=4; | |
74 | Xlist[0]=Xlist[1]=iX; | |
75 | if(iX && (iX != fNanodes/2)) Xlist[2]=iX-1; | |
76 | else Xlist[2]=iX; | |
77 | if ((iX !=fNanodes/2 -1) && (iX != fNanodes)) Xlist[3]=iX+1; | |
78 | else Xlist[3]=iX; | |
79 | if(iZ) Zlist[0]=iZ-1; | |
80 | else Zlist[0]=iZ; | |
81 | if (iZ < fNsamples) Zlist[1]=iZ+1; | |
82 | else Zlist[1]=iZ; | |
83 | Zlist[2]=Zlist[3]=iZ; | |
84 | } | |
85 | //---------------------------------------------------------------------- | |
86 | void AliITSsegmentationSDD::GetPadIxz(Float_t x,Float_t z, | |
87 | Int_t &timebin,Int_t &anode){ | |
88 | // Returns cell coordinates (time sample,anode) incremented by 1 !!!!! | |
89 | // for given real local coordinates (x,z) | |
90 | ||
91 | // expects x, z in cm | |
92 | ||
93 | const Float_t kconv=10000; // cm->um | |
94 | ||
95 | Int_t na = fNanodes/2; | |
96 | Float_t driftpath=fDx-TMath::Abs(kconv*x); | |
97 | timebin=(Int_t)(driftpath/fDriftSpeed/fTimeStep); | |
98 | anode=(Int_t)(kconv*(z/fPitch + na/2)); | |
99 | if (x > 0) anode += na; | |
100 | ||
101 | timebin+=1; | |
102 | anode+=1; | |
103 | ||
104 | } | |
105 | //---------------------------------------------------------------------- | |
106 | void AliITSsegmentationSDD::GetPadCxz(Int_t timebin,Int_t anode, | |
107 | Float_t &x ,Float_t &z){ | |
108 | // Transform from cell to real local coordinates | |
109 | // returns x, z in cm | |
110 | ||
111 | // the +0.5 means that an # and time bin # should start from 0 !!! | |
112 | const Float_t kconv=10000; // um->cm | |
113 | // the +0.5 means that an # and time bin # should start from 0 !!! | |
114 | ||
115 | Int_t na = fNanodes/2; | |
116 | Float_t driftpath=(timebin+0.5)*fTimeStep*fDriftSpeed; | |
117 | if (anode >= na) x=(fDx-driftpath)/kconv; | |
118 | else x = -(fDx-driftpath)/kconv; | |
119 | if (anode >= na) anode-=na; | |
120 | z=((anode+0.5)*fPitch-fDz/2)/kconv; | |
121 | ||
122 | } | |
123 | //---------------------------------------------------------------------- | |
124 | void AliITSsegmentationSDD::GetPadTxz(Float_t &x,Float_t &z){ | |
125 | // Get anode and time bucket as floats - numbering from 0 | |
126 | ||
127 | // expects x, z in cm | |
128 | ||
129 | const Float_t kconv=10000; // cm->um | |
130 | ||
131 | Float_t x0=x; | |
132 | Int_t na = fNanodes/2; | |
133 | Float_t driftpath=fDx-TMath::Abs(kconv*x); | |
134 | x=driftpath/fDriftSpeed/fTimeStep; | |
135 | z=kconv*z/fPitch + (float)na/2; | |
136 | if (x0 < 0) x = -x; | |
137 | ||
138 | } | |
139 | //---------------------------------------------------------------------- | |
140 | void AliITSsegmentationSDD::GetLocal(Int_t module,Float_t *g ,Float_t *l){ | |
141 | // returns local coordinates from global | |
142 | if(!fGeom) { | |
143 | return; | |
144 | //fGeom = ((AliITS*)gAlice->GetModule("ITS"))->GetITSgeom(); | |
145 | } | |
146 | fGeom->GtoL(module,g,l); | |
147 | } | |
148 | //---------------------------------------------------------------------- | |
149 | void AliITSsegmentationSDD::GetGlobal(Int_t module,Float_t *l ,Float_t *g){ | |
150 | // return global coordinates from local | |
151 | if(!fGeom) { | |
152 | return; | |
153 | //fGeom = ((AliITS*)gAlice->GetModule("ITS"))->GetITSgeom(); | |
154 | } | |
155 | ||
156 | fGeom->LtoG(module,l,g); | |
157 | ||
158 | } | |
159 | //---------------------------------------------------------------------- | |
160 | void AliITSsegmentationSDD::Print(){ | |
161 | // Print SDD segmentation Parameters | |
162 | ||
163 | cout << "**************************************************" << endl; | |
164 | cout << " Silicon Drift Detector Segmentation Parameters " << endl; | |
165 | cout << "**************************************************" << endl; | |
166 | cout << "Number of Time Samples: " << fNsamples << endl; | |
167 | cout << "Number of Anodes: " << fNanodes << endl; | |
168 | cout << "Time Step (ns): " << fTimeStep << endl; | |
169 | cout << "Anode Pitch (um): " << fPitch << endl; | |
170 | cout << "Full Detector Width (x): " << fDx << endl; | |
171 | cout << "Half Detector Length (z): " << fDz << endl; | |
172 | cout << "Full Detector Thickness (y): " << fDy << endl; | |
173 | cout << "**************************************************" << endl; | |
174 | ||
175 | } | |
176 | //______________________________________________________________________ | |
177 | ||
178 | //______________________________________________________________________ | |
179 | void AliITSsegmentationSDD::LocalToDet(Float_t x,Float_t z,Int_t &ix,Int_t &iz){ | |
180 | // Transformation from Geant detector centered local coordinates (cm) to | |
181 | // time bucket numbers ix and anode number iz. | |
182 | // Input: | |
183 | // Float_t x detector local coordinate x in cm with respect to the | |
184 | // center of the sensitive volume. | |
185 | // Float_t z detector local coordinate z in cm with respect to the | |
186 | // center of the sensitive volulme. | |
187 | // Output: | |
188 | // Int_t ix detector x time coordinate. Has the range 0<=ix<fNsamples. | |
189 | // Int_t iz detector z anode coordinate. Has the range 0<=iz<fNandoes. | |
190 | // A value of -1 for ix or iz indecates that this point is outside of the | |
191 | // detector segmentation as defined. | |
192 | // This segmentation geometry can be discribed as the following: | |
193 | // {assumes 2*Dx()=7.0cm Dz()=7.5264cm, Dpx()=25ns, | |
194 | // res->DeriftSpeed()=7.3mic/ns, Dpz()=512. For other values a only the | |
195 | // specific numbers will change not their layout.} | |
196 | // | |
197 | // 0 191 0 | |
198 | // 0 |----------------------|---------------------| 256 | |
199 | // | a time-bins | time-bins a | | |
200 | // | n | n | | |
201 | // | o |___________________o_|__> X | |
202 | // | d | d | | |
203 | // | e | e | | |
204 | // | s | s | | |
205 | // 255 |----------------------|---------------------| 511 | |
206 | // | | |
207 | // V | |
208 | // Z | |
209 | Float_t dx,dz,tb; | |
210 | const Float_t kconv = 1.0E-04; // converts microns to cm. | |
211 | ||
212 | ix = -1; // default values | |
213 | iz = -1; // default values | |
214 | dx = -kconv*Dx(); // lower left edge in cm. | |
215 | dz = -0.5*kconv*Dz(); // lower left edge in cm. | |
216 | if(x<dx || x>-dx) return; // outside of defined volume. | |
217 | if(z<dz || z>-dz) return; // outside of defined volume. | |
218 | tb = fDriftSpeed*fTimeStep*kconv; // compute size of time bin. | |
219 | if(x>0) dx = -(dx + x)/tb; // distance from + side in time bin units | |
220 | else dx = (x - dx)/tb; // distance from - side in time bin units | |
221 | dz = (z - dz)/(kconv*fPitch); // distance in z in anode pitch units | |
222 | ix = (Int_t) dx; // time bin | |
223 | iz = (Int_t) dz; // anode | |
224 | if(x>0) iz += Npz()/2; // if x>0 then + side anodes values. | |
225 | return; // Found ix and iz, return. | |
226 | } | |
227 | //______________________________________________________________________ | |
228 | void AliITSsegmentationSDD::DetToLocal(Int_t ix,Int_t iz,Float_t &x,Float_t &z) | |
229 | { | |
230 | // Transformation from Detector time bucket and anode coordiantes to Geant | |
231 | // detector centerd local coordinates (cm). | |
232 | // Input: | |
233 | // Int_t ix detector x time coordinate. Has the range 0<=ix<fNsamples. | |
234 | // Int_t iz detector z anode coordinate. Has the range 0<=iz<fNandoes. | |
235 | // Output: | |
236 | // Float_t x detector local coordinate x in cm with respect to the | |
237 | // center of the sensitive volume. | |
238 | // Float_t z detector local coordinate z in cm with respect to the | |
239 | // center of the sensitive volulme. | |
240 | // If ix and or iz is outside of the segmentation range a value of -Dx() | |
241 | // or -0.5*Dz() is returned. | |
242 | // This segmentation geometry can be discribed as the following: | |
243 | // {assumes 2*Dx()=7.0cm Dz()=7.5264cm, Dpx()=25ns, | |
244 | // res->DeriftSpeed()=7.3mic/ns, Dpz()=512. For other values a only the | |
245 | // specific numbers will change not their layout.} | |
246 | // | |
247 | // 0 191 0 | |
248 | // 0 |----------------------|---------------------| 256 | |
249 | // | a time-bins | time-bins a | | |
250 | // | n | n | | |
251 | // | o |___________________o_|__> X | |
252 | // | d | d | | |
253 | // | e | e | | |
254 | // | s | s | | |
255 | // 255 |----------------------|---------------------| 511 | |
256 | // | | |
257 | // V | |
258 | // Z | |
259 | Int_t i,j; | |
260 | Float_t tb; | |
261 | const Float_t kconv = 1.0E-04; // converts microns to cm. | |
262 | ||
263 | if(iz>=Npz()/2) x = kconv*Dx(); // default value for +x side. | |
264 | else x = -kconv*Dx(); // default value for -x side. | |
265 | z = -0.5*kconv*Dz(); // default value. | |
266 | if(ix<0 || ix>=Npx()) return; // outside of detector | |
267 | if(iz<0 || iz>=Npz()) return; // outside of detctor | |
268 | tb = fDriftSpeed*fTimeStep*kconv; // compute size of time bin. | |
269 | if(iz>=Npz()/2) tb *= -1.0; // for +x side decrement frmo Dx(). | |
270 | for(i=0;i<ix;i++) x += tb; // sum up to cell ix-1 | |
271 | x += 0.5*tb; // add 1/2 of cell ix for center location. | |
272 | if(iz>=Npz()/2) iz -=Npz()/2;// If +x side don't count anodes from -x side. | |
273 | for(j=0;j<iz;j++) z += kconv*fPitch; // sum up cell iz-1 | |
274 | z += 0.5*kconv*fPitch; // add 1/2 of cell iz for center location. | |
275 | return; // Found x and z, return. | |
276 | } |