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