+ if(bint>=fNDriftPts){
+ AliError("Wrong bin number along drift direction!");
+ bint=fNDriftPts-1;
+ }
+ fXt1=stept*bint;
+ fXm1=fXt1-GetCellContent(bina,bint)*kMicronTocm;
+ if((bint+1)<fNDriftPts){
+ fXt2=stept*(bint+1);
+ fXm2=fXt2-GetCellContent(bina,bint+1)*kMicronTocm;
+ }else{
+ fXt2=stept*(bint-1);
+ fXm2=fXt2-GetCellContent(bina,bint-1)*kMicronTocm;
+ }
+ if(isReco){
+ if(fXm1<fDrLen && fXm2>fDrLen) return;
+ if(bint==0 || bint==(fNDriftPts-1)) return;
+ if(fXm1>fDrLen){
+ for(Int_t itry=1; itry<=10; itry++){
+ Float_t xmtest=(bint-itry)*stept-GetCellContent(bina,bint-itry)*kMicronTocm;
+ if(xmtest<fDrLen){
+ fXt1=stept*(bint-itry);
+ fXt2=fXt1+stept;
+ fXm1=fXt1-GetCellContent(bina,bint-itry)*kMicronTocm;
+ fXm2=fXt2-GetCellContent(bina,bint+1-itry)*kMicronTocm;
+ return;
+ }
+ }
+ }
+ if(fXm2<fDrLen){
+ for(Int_t itry=1; itry<=10; itry++){
+ Float_t xmtest=(bint+1+itry)*stept-GetCellContent(bina,bint+1+itry)*kMicronTocm;
+ if(xmtest>fDrLen){
+ fXt1=stept*(bint+itry);
+ fXt2=fXt1+stept;
+ fXm1=fXt1-GetCellContent(bina,bint+itry)*kMicronTocm;
+ fXm2=fXt2-GetCellContent(bina,bint+1+itry)*kMicronTocm;
+ return;
+ }
+ }
+ }
+ }
+}
+//______________________________________________________________________
+Float_t AliITSCorrMapSDD::GetCorrection(Float_t z, Float_t x, AliITSsegmentationSDD *seg){
+ // returns correction in cm starting from local coordinates on the module
+ ComputeGridPoints(z,x,seg,kTRUE);
+ Float_t m=(fXt2-fXt1)/(fXm2-fXm1);
+ Float_t q=fXt1-m*fXm1;
+ Float_t xcorr=m*fDrLen+q;
+ // fDrLen is the measured drift distance, xcorr is the corresponding true
+ return (xcorr-fDrLen);
+}
+//______________________________________________________________________
+Float_t AliITSCorrMapSDD::GetShiftForSimulation(Float_t z, Float_t x, AliITSsegmentationSDD *seg){
+ // returns shift to be appiled in digitizarion (in cm) starting from local coordinates on the module
+ ComputeGridPoints(z,x,seg,kFALSE);
+ Float_t m=(fXm2-fXm1)/(fXt2-fXt1);
+ Float_t q=fXm1-m*fXt1;
+ Float_t xshifted=m*fDrLen+q;
+ // fDrLen is the true drift distance, xshifted is the one with map shift
+ return (fDrLen-xshifted);