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