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