1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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>
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 //
27 //////////////////////////////////////////////////////
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;
37 ClassImp(AliITSsegmentationSDD)
38 //----------------------------------------------------------------------
39 AliITSsegmentationSDD::AliITSsegmentationSDD(AliITSgeom* geom):
48 fDriftSpeed=AliITSresponseSDD::DefaultDriftSpeed();
50 SetDetSize(fgkDxDefault,fgkDzDefault,fgkDyDefault);
51 SetPadSize(fgkPitchDefault,fgkClockDefault);
52 SetNPads(fgkHalfNanodesDefault,fgkNsamplesDefault);
55 //______________________________________________________________________
56 AliITSsegmentationSDD::AliITSsegmentationSDD() : AliITSsegmentation(),
63 // Default constructor
65 SetDetSize(fgkDxDefault,fgkDzDefault,fgkDyDefault);
66 SetPadSize(fgkPitchDefault,fgkClockDefault);
67 SetNPads(fgkHalfNanodesDefault,fgkNsamplesDefault);
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;
83 //______________________________________________________________________
84 AliITSsegmentationSDD& AliITSsegmentationSDD::operator=(const AliITSsegmentationSDD &source){
86 if(this==&source) return *this;
91 //____________________________________________________________________________
92 AliITSsegmentationSDD::AliITSsegmentationSDD(const AliITSsegmentationSDD &source) :
93 AliITSsegmentation(source),
104 //----------------------------------------------------------------------
105 void AliITSsegmentationSDD::Init(){
106 // Standard initilisation routine
109 Fatal("Init","the pointer to the ITS geometry class (AliITSgeom) is null\n");
112 AliITSgeomSDD *gsdd = (AliITSgeomSDD *) (fGeom->GetShape(3,1,1));
114 const Float_t kconv=10000.;
115 fDz = 2.*kconv*gsdd->GetDz();
116 fDx = kconv*gsdd->GetDx();
117 fDy = 2.*kconv*gsdd->GetDy();
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
125 if(iX >= fNanodes) printf("iX > fNanodes %d %d\n",iX,fNanodes);
126 if(iZ >= fNsamples) printf("iZ > fNsamples %d %d\n",iZ,fNsamples);
128 Xlist[0]=Xlist[1]=iX;
129 if(iX && (iX != fNanodes/2)) Xlist[2]=iX-1;
131 if ((iX !=fNanodes/2 -1) && (iX != fNanodes)) Xlist[3]=iX+1;
133 if(iZ) Zlist[0]=iZ-1;
135 if (iZ < fNsamples) Zlist[1]=iZ+1;
137 Zlist[2]=Zlist[3]=iZ;
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)
145 // expects x, z in cm
147 const Float_t kconv=10000; // cm->um
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;
161 Warning("GetPadIxz","Drift speed not set: timebin is dummy");
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
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 !!!
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;
183 Warning("GetPadCxz","Drift speed not set: x coord. is dummy");
187 //----------------------------------------------------------------------
188 void AliITSsegmentationSDD::GetPadTxz(Float_t &x,Float_t &z) const{
189 // Get anode and time bucket as floats - numbering from 0
191 // expects x, z in cm
193 const Float_t kconv=10000; // cm->um
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;
203 Warning("GetPadTxz","Drift speed not set: x coord. is dummy");
206 //----------------------------------------------------------------------
207 void AliITSsegmentationSDD::GetLocal(Int_t module,Float_t *g ,Float_t *l) const {
208 // returns local coordinates from global
210 Fatal("GetLocal","the pointer to the ITS geometry class (AliITSgeom) is null\n");
213 fGeom->GtoL(module,g,l);
215 //----------------------------------------------------------------------
216 void AliITSsegmentationSDD::GetGlobal(Int_t module,Float_t *l ,Float_t *g) const {
217 // return global coordinates from local
219 Fatal("GetGlobal","the pointer to the ITS geometry class (AliITSgeom) is null\n");
222 fGeom->LtoG(module,l,g);
225 //----------------------------------------------------------------------
226 void AliITSsegmentationSDD::Print(Option_t *opt) const {
227 // Print SDD segmentation Parameters
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;
246 //----------------------------------------------------------------------
247 void AliITSsegmentationSDD::PrintDefaultParameters() const {
248 // print SDD parameters defined as static const data members
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;
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.
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.
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.}
287 // 0 |----------------------|---------------------| 256
288 // | a time-bins | time-bins a |
290 // | o |___________________o_|__> X
294 // 255 |----------------------|---------------------| 511
299 const Float_t kconv = 1.0E-04; // converts microns to cm.
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.
306 Warning("LocalToDet","input argument %f out of range (%f, %f)",x,dx,-dx);
307 return kFALSE; // outside of defined volume.
310 Warning("LocalToDet","input argument %f out of range (%f, %f)",z,dz,-dz);
311 return kFALSE; // outside of defined volume.
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.
322 Warning("LocalToDet","Drift speed not set: timebin is dummy");
325 return kTRUE; // Found ix and iz, return.
327 //______________________________________________________________________
328 void AliITSsegmentationSDD::DetToLocal(Int_t ix,Int_t iz,Float_t &x,Float_t &z) const
330 // Transformation from Detector time bucket and anode coordiantes to Geant
331 // detector centerd local coordinates (cm).
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.
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.}
348 // 0 |----------------------|---------------------| 256
349 // | a time-bins | time-bins a |
351 // | o |___________________o_|__> X
355 // 255 |----------------------|---------------------| 511
361 const Float_t kconv = 1.0E-04; // converts microns to cm.
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
370 if(iz<0 || iz>=Npz()) {
371 Warning("DetToLocal","input argument %d out of range (0, %d)",iz,Npz());
372 return; // outside of detctor
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.
383 Warning("LocalToDet","Drift speed not set: x coord. is dummy");
385 return; // Found x and z, return.