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