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 "AliITSCalibration.h"
23 #include "AliITSCalibrationSDD.h"
24 #include "AliITSresponseSDD.h"
25 //////////////////////////////////////////////////////
26 // Segmentation class for //
29 //////////////////////////////////////////////////////
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;
39 ClassImp(AliITSsegmentationSDD)
40 //----------------------------------------------------------------------
41 AliITSsegmentationSDD::AliITSsegmentationSDD(AliITSgeom* geom,
42 AliITSCalibration *resp):
50 AliITSCalibrationSDD* sp = (AliITSCalibrationSDD*)resp;
51 fDriftSpeed=sp->GetDriftSpeed();
53 SetDetSize(fgkDxDefault,fgkDzDefault,fgkDyDefault);
54 SetPadSize(fgkPitchDefault,fgkClockDefault);
55 SetNPads(fgkHalfNanodesDefault,fgkNsamplesDefault);
58 //______________________________________________________________________
59 AliITSsegmentationSDD::AliITSsegmentationSDD() : AliITSsegmentation(),
65 // Default constructor
67 SetDetSize(fgkDxDefault,fgkDzDefault,fgkDyDefault);
68 SetPadSize(fgkPitchDefault,fgkClockDefault);
69 SetNPads(fgkHalfNanodesDefault,fgkNsamplesDefault);
73 //______________________________________________________________________
74 void AliITSsegmentationSDD::Copy(TObject &obj) const {
75 // protected method. copy this to obj
76 AliITSsegmentation::Copy(obj);
77 ((AliITSsegmentationSDD& ) obj).fNsamples = fNsamples;
78 ((AliITSsegmentationSDD& ) obj).fNanodes = fNanodes;
79 ((AliITSsegmentationSDD& ) obj).fPitch = fPitch;
80 ((AliITSsegmentationSDD& ) obj).fTimeStep = fTimeStep;
81 ((AliITSsegmentationSDD& ) obj).fDriftSpeed = fDriftSpeed;
84 //______________________________________________________________________
85 AliITSsegmentationSDD& AliITSsegmentationSDD::operator=(const AliITSsegmentationSDD &source){
87 if(this==&source) return *this;
92 //____________________________________________________________________________
93 AliITSsegmentationSDD::AliITSsegmentationSDD(const AliITSsegmentationSDD &source) :
94 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 //----------------------------------------------------------------------
162 void AliITSsegmentationSDD::GetPadCxz(Int_t timebin,Int_t anode,
163 Float_t &x ,Float_t &z) const{
164 // Transform from cell to real local coordinates
165 // returns x, z in cm
167 // the +0.5 means that an # and time bin # should start from 0 !!!
168 const Float_t kconv=10000; // um->cm
169 // the +0.5 means that an # and time bin # should start from 0 !!!
171 Int_t na = fNanodes/2;
172 Float_t driftpath=(timebin+0.5)*fTimeStep*fDriftSpeed;
173 if (anode >= na) x=(fDx-driftpath)/kconv;
174 else x = -(fDx-driftpath)/kconv;
175 if (anode >= na) anode-=na;
176 z=((anode+0.5)*fPitch-fDz/2)/kconv;
179 //----------------------------------------------------------------------
180 void AliITSsegmentationSDD::GetPadTxz(Float_t &x,Float_t &z) const{
181 // Get anode and time bucket as floats - numbering from 0
183 // expects x, z in cm
185 const Float_t kconv=10000; // cm->um
188 Int_t na = fNanodes/2;
189 Float_t driftpath=fDx-TMath::Abs(kconv*x);
190 x=driftpath/fDriftSpeed/fTimeStep;
191 z=kconv*z/fPitch + (float)na/2;
195 //----------------------------------------------------------------------
196 void AliITSsegmentationSDD::GetLocal(Int_t module,Float_t *g ,Float_t *l) const {
197 // returns local coordinates from global
199 Fatal("GetLocal","the pointer to the ITS geometry class (AliITSgeom) is null\n");
202 fGeom->GtoL(module,g,l);
204 //----------------------------------------------------------------------
205 void AliITSsegmentationSDD::GetGlobal(Int_t module,Float_t *l ,Float_t *g) const {
206 // return global coordinates from local
208 Fatal("GetGlobal","the pointer to the ITS geometry class (AliITSgeom) is null\n");
211 fGeom->LtoG(module,l,g);
214 //----------------------------------------------------------------------
215 void AliITSsegmentationSDD::Print(Option_t *opt) const {
216 // Print SDD segmentation Parameters
218 cout << "**************************************************" << endl;
219 cout << " Silicon Drift Detector Segmentation Parameters " << opt << endl;
220 cout << "**************************************************" << endl;
221 cout << "Number of Time Samples: " << fNsamples << endl;
222 cout << "Number of Anodes: " << fNanodes << endl;
223 cout << "Time Step (ns): " << fTimeStep << endl;
224 cout << "Anode Pitch (um): " << fPitch << endl;
225 cout << "Full Detector Width (x): " << fDx;
226 cout<<" (Default is "<<fgkDxDefault<<") "<<endl;
227 cout << "Half Detector Length (z): " << fDz;
228 cout<<" (Default is "<<fgkDzDefault<<") "<<endl;
229 cout << "Full Detector Thickness (y): " << fDy;
230 cout<<" (Default is "<<fgkDyDefault<<") "<<endl;
231 cout << "**************************************************" << endl;
235 //----------------------------------------------------------------------
236 void AliITSsegmentationSDD::PrintDefaultParameters() const {
237 // print SDD parameters defined as static const data members
239 cout << "**************************************************" << endl;
240 cout << " Silicon Drift Detector Segmentation Parameters " << endl;
241 cout << " Default values defined as static const data members"<< endl;
242 cout << " Actual values can be set with the relevant setters"<< endl;
243 cout << "**************************************************" << endl;
244 cout<<"fgkDxDefault = "<<fgkDxDefault<<endl;
245 cout<<"fgkDzDefault = "<<fgkDzDefault<<endl;
246 cout<<"fgkDyDefault = "<<fgkDyDefault<<endl;
247 cout<<"fgkPitchDefault = "<<fgkPitchDefault<<endl;
248 cout<<"fgkClockDefault = "<<fgkClockDefault<<endl;
249 cout<<"fgkHalfNanodesDefault = "<<fgkHalfNanodesDefault<<endl;
250 cout<<"fgkNsamplesDefault = "<<fgkNsamplesDefault<<endl;
251 cout << "**************************************************" << endl;
255 //______________________________________________________________________
256 Bool_t AliITSsegmentationSDD::LocalToDet(Float_t x,Float_t z,
257 Int_t &ix,Int_t &iz) const {
258 // Transformation from Geant detector centered local coordinates (cm) to
259 // time bucket numbers ix and anode number iz.
261 // Float_t x detector local coordinate x in cm with respect to the
262 // center of the sensitive volume.
263 // Float_t z detector local coordinate z in cm with respect to the
264 // center of the sensitive volulme.
266 // Int_t ix detector x time coordinate. Has the range 0<=ix<fNsamples.
267 // Int_t iz detector z anode coordinate. Has the range 0<=iz<fNandoes.
268 // A value of -1 for ix or iz indecates that this point is outside of the
269 // detector segmentation as defined.
270 // This segmentation geometry can be discribed as the following:
271 // {assumes 2*Dx()=7.0cm Dz()=7.5264cm, Dpx()=25ns,
272 // res->DeriftSpeed()=7.3mic/ns, Dpz()=512. For other values a only the
273 // specific numbers will change not their layout.}
276 // 0 |----------------------|---------------------| 256
277 // | a time-bins | time-bins a |
279 // | o |___________________o_|__> X
283 // 255 |----------------------|---------------------| 511
288 const Float_t kconv = 1.0E-04; // converts microns to cm.
290 ix = -1; // default values
291 iz = -1; // default values
292 dx = -kconv*Dx(); // lower left edge in cm.
293 dz = -0.5*kconv*Dz(); // lower left edge in cm.
295 Warning("LocalToDet","input argument %f out of range (%f, %f)",x,dx,-dx);
296 return kFALSE; // outside of defined volume.
299 Warning("LocalToDet","input argument %f out of range (%f, %f)",z,dz,-dz);
300 return kFALSE; // outside of defined volume.
302 tb = fDriftSpeed*fTimeStep*kconv; // compute size of time bin.
303 if(x>0) dx = -(dx + x)/tb; // distance from + side in time bin units
304 else dx = (x - dx)/tb; // distance from - side in time bin units
305 dz = (z - dz)/(kconv*fPitch); // distance in z in anode pitch units
306 ix = (Int_t) dx; // time bin
307 iz = (Int_t) dz; // anode
308 if(x>0) iz += Npz()/2; // if x>0 then + side anodes values.
309 return kTRUE; // Found ix and iz, return.
311 //______________________________________________________________________
312 void AliITSsegmentationSDD::DetToLocal(Int_t ix,Int_t iz,Float_t &x,Float_t &z) const
314 // Transformation from Detector time bucket and anode coordiantes to Geant
315 // detector centerd local coordinates (cm).
317 // Int_t ix detector x time coordinate. Has the range 0<=ix<fNsamples.
318 // Int_t iz detector z anode coordinate. Has the range 0<=iz<fNandoes.
320 // Float_t x detector local coordinate x in cm with respect to the
321 // center of the sensitive volume.
322 // Float_t z detector local coordinate z in cm with respect to the
323 // center of the sensitive volulme.
324 // If ix and or iz is outside of the segmentation range a value of -Dx()
325 // or -0.5*Dz() is returned.
326 // This segmentation geometry can be discribed as the following:
327 // {assumes 2*Dx()=7.0cm Dz()=7.5264cm, Dpx()=25ns,
328 // res->DeriftSpeed()=7.3mic/ns, Dpz()=512. For other values a only the
329 // specific numbers will change not their layout.}
332 // 0 |----------------------|---------------------| 256
333 // | a time-bins | time-bins a |
335 // | o |___________________o_|__> X
339 // 255 |----------------------|---------------------| 511
345 const Float_t kconv = 1.0E-04; // converts microns to cm.
347 if(iz>=Npz()/2) x = kconv*Dx(); // default value for +x side.
348 else x = -kconv*Dx(); // default value for -x side.
349 z = -0.5*kconv*Dz(); // default value.
350 if(ix<0 || ix>=Npx()) {
351 Warning("DetToLocal","input argument %d out of range (0, %d)",ix,Npx());
352 return; // outside of detector
354 if(iz<0 || iz>=Npz()) {
355 Warning("DetToLocal","input argument %d out of range (0, %d)",iz,Npz());
356 return; // outside of detctor
358 tb = fDriftSpeed*fTimeStep*kconv; // compute size of time bin.
359 if(iz>=Npz()/2) tb *= -1.0; // for +x side decrement frmo Dx().
360 for(i=0;i<ix;i++) x += tb; // sum up to cell ix-1
361 x += 0.5*tb; // add 1/2 of cell ix for center location.
362 if(iz>=Npz()/2) iz -=Npz()/2;// If +x side don't count anodes from -x side.
363 for(j=0;j<iz;j++) z += kconv*fPitch; // sum up cell iz-1
364 z += 0.5*kconv*fPitch; // add 1/2 of cell iz for center location.
365 return; // Found x and z, return.