+//----------------------------------------------------------------------
+void AliITSsegmentationSDD::Print(Option_t *opt) const {
+ // Print SDD segmentation Parameters
+
+ cout << "**************************************************" << endl;
+ cout << " Silicon Drift Detector Segmentation Parameters " << opt << endl;
+ cout << "**************************************************" << endl;
+ cout << "Number of Time Samples: " << fNsamples << endl;
+ cout << "Number of Anodes: " << fNanodes << endl;
+ cout << "Time Step (ns): " << fTimeStep << endl;
+ cout << "Anode Pitch (um): " << fPitch << endl;
+ cout << "Full Detector Width (x): " << fDx;
+ cout<<" (Default is "<<fgkDxDefault<<") "<<endl;
+ cout << "Half Detector Length (z): " << fDz;
+ cout<<" (Default is "<<fgkDzDefault<<") "<<endl;
+ cout << "Full Detector Thickness (y): " << fDy;
+ cout<<" (Default is "<<fgkDyDefault<<") "<<endl;
+ cout << "**************************************************" << endl;
+
+}
+
+//----------------------------------------------------------------------
+void AliITSsegmentationSDD::PrintDefaultParameters() const {
+ // print SDD parameters defined as static const data members
+
+ cout << "**************************************************" << endl;
+ cout << " Silicon Drift Detector Segmentation Parameters " << endl;
+ cout << " Default values defined as static const data members"<< endl;
+ cout << " Actual values can be set with the relevant setters"<< endl;
+ cout << "**************************************************" << endl;
+ cout<<"fgkDxDefault = "<<fgkDxDefault<<endl;
+ cout<<"fgkDzDefault = "<<fgkDzDefault<<endl;
+ cout<<"fgkDyDefault = "<<fgkDyDefault<<endl;
+ cout<<"fgkPitchDefault = "<<fgkPitchDefault<<endl;
+ cout<<"fgkClockDefault = "<<fgkClockDefault<<endl;
+ cout<<"fgkHalfNanodesDefault = "<<fgkHalfNanodesDefault<<endl;
+ cout<<"fgkNsamplesDefault = "<<fgkNsamplesDefault<<endl;
+ cout << "**************************************************" << endl;
+
+}
+
+//______________________________________________________________________
+Bool_t AliITSsegmentationSDD::LocalToDet(Float_t x,Float_t z,
+ Int_t &ix,Int_t &iz) const {
+// Transformation from Geant detector centered local coordinates (cm) to
+// time bucket numbers ix and anode number iz.
+// Input:
+// Float_t x detector local coordinate x in cm with respect to the
+// center of the sensitive volume.
+// Float_t z detector local coordinate z in cm with respect to the
+// center of the sensitive volulme.
+// Output:
+// Int_t ix detector x time coordinate. Has the range 0<=ix<fNsamples.
+// Int_t iz detector z anode coordinate. Has the range 0<=iz<fNandoes.
+// A value of -1 for ix or iz indecates that this point is outside of the
+// detector segmentation as defined.
+// This segmentation geometry can be discribed as the following:
+// {assumes 2*Dx()=7.0cm Dz()=7.5264cm, Dpx()=25ns,
+// res->DeriftSpeed()=7.3mic/ns, Dpz()=512. For other values a only the
+// specific numbers will change not their layout.}
+//
+// 0 191 0
+// 0 |----------------------|---------------------| 256
+// | a time-bins | time-bins a |
+// | n | n |
+// | o |___________________o_|__> X
+// | d | d |
+// | e | e |
+// | s | s |
+// 255 |----------------------|---------------------| 511
+// |
+// V
+// Z
+ Float_t dx,dz,tb;
+ const Float_t kconv = 1.0E-04; // converts microns to cm.
+
+ ix = -1; // default values
+ iz = -1; // default values
+ dx = -kconv*Dx(); // lower left edge in cm.
+ dz = -0.5*kconv*Dz(); // lower left edge in cm.
+ if(x<dx || x>-dx) {
+ Warning("LocalToDet","input argument %f out of range (%f, %f)",x,dx,-dx);
+ return kFALSE; // outside of defined volume.
+ }
+ if(z<dz || z>-dz) {
+ Warning("LocalToDet","input argument %f out of range (%f, %f)",z,dz,-dz);
+ return kFALSE; // outside of defined volume.
+ }
+ tb = fDriftSpeed*fTimeStep*kconv; // compute size of time bin.
+ if(x>0) dx = -(dx + x)/tb; // distance from + side in time bin units
+ else dx = (x - dx)/tb; // distance from - side in time bin units
+ dz = (z - dz)/(kconv*fPitch); // distance in z in anode pitch units
+ ix = (Int_t) dx; // time bin
+ iz = (Int_t) dz; // anode
+ if(x>0) iz += Npz()/2; // if x>0 then + side anodes values.
+ return kTRUE; // Found ix and iz, return.
+}
+//______________________________________________________________________
+void AliITSsegmentationSDD::DetToLocal(Int_t ix,Int_t iz,Float_t &x,Float_t &z) const
+{
+// Transformation from Detector time bucket and anode coordiantes to Geant
+// detector centerd local coordinates (cm).
+// Input:
+// Int_t ix detector x time coordinate. Has the range 0<=ix<fNsamples.
+// Int_t iz detector z anode coordinate. Has the range 0<=iz<fNandoes.
+// Output:
+// Float_t x detector local coordinate x in cm with respect to the
+// center of the sensitive volume.
+// Float_t z detector local coordinate z in cm with respect to the
+// center of the sensitive volulme.
+// If ix and or iz is outside of the segmentation range a value of -Dx()
+// or -0.5*Dz() is returned.
+// This segmentation geometry can be discribed as the following:
+// {assumes 2*Dx()=7.0cm Dz()=7.5264cm, Dpx()=25ns,
+// res->DeriftSpeed()=7.3mic/ns, Dpz()=512. For other values a only the
+// specific numbers will change not their layout.}
+//
+// 0 191 0
+// 0 |----------------------|---------------------| 256
+// | a time-bins | time-bins a |
+// | n | n |
+// | o |___________________o_|__> X
+// | d | d |
+// | e | e |
+// | s | s |
+// 255 |----------------------|---------------------| 511
+// |
+// V
+// Z
+ Int_t i,j;
+ Float_t tb;
+ const Float_t kconv = 1.0E-04; // converts microns to cm.
+
+ if(iz>=Npz()/2) x = kconv*Dx(); // default value for +x side.
+ else x = -kconv*Dx(); // default value for -x side.
+ z = -0.5*kconv*Dz(); // default value.
+ if(ix<0 || ix>=Npx()) {
+ Warning("DetToLocal","input argument %d out of range (0, %d)",ix,Npx());
+ return; // outside of detector
+ }
+ if(iz<0 || iz>=Npz()) {
+ Warning("DetToLocal","input argument %d out of range (0, %d)",iz,Npz());
+ return; // outside of detctor
+ }
+ tb = fDriftSpeed*fTimeStep*kconv; // compute size of time bin.
+ if(iz>=Npz()/2) tb *= -1.0; // for +x side decrement frmo Dx().
+ for(i=0;i<ix;i++) x += tb; // sum up to cell ix-1
+ x += 0.5*tb; // add 1/2 of cell ix for center location.
+ if(iz>=Npz()/2) iz -=Npz()/2;// If +x side don't count anodes from -x side.
+ for(j=0;j<iz;j++) z += kconv*fPitch; // sum up cell iz-1
+ z += 0.5*kconv*fPitch; // add 1/2 of cell iz for center location.
+ return; // Found x and z, return.
+}