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