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