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