+ z = 0.0; // Strip center in z.
+ if(iPN<0 || iPN>1){// if error return full detector size in x.
+ x = z = flag;
+ return;
+ } // end if
+ if(ix<0 || ix>=fNstrips) { // if error return full detector size in x.
+ x = z = flag;
+ return;
+ } // end if
+ i = (Double_t) ix; // convert to double
+ dx = 0.5*kconst*Dx(); // half distance in x in cm
+ dz = 0.5*kconst*Dz(); // half distance in z in cm
+ a = kconst*Dpx(ix)*(i+0.5)-dx; // Min x value.
+ if(iPN==0){ //P-side angle defined backwards.
+ th = TMath::Tan(stereoP);
+ b = dz*th;
+ }else if(iPN==1){ // N-side
+ th = TMath::Tan(-stereoN);
+ b = -dz*th;
+ } // end if
+ // compute average/center position of the strip.
+ xb[0] = +dx; if(th!=0.0) zb[0] = (+dx-a-b)/th; else zb[0] = 0.0;
+ xb[1] = -dx; if(th!=0.0) zb[1] = (-dx-a-b)/th; else zb[1] = 0.0;
+ xb[2] = a+b+dz*th; zb[2] = +dz;
+ xb[3] = a+b-dz*th; zb[3] = -dz;
+ x = 0.0; z = 0.0;
+ for(Int_t j=0;j<4;j++){
+ if(xb[j]>=-dx && xb[j]<=dx && zb[j]>=-dz && zb[j]<=dz){
+ x += xb[j];
+ z += zb[j];
+ } // end if
+ } // end for
+ x *= 0.5;
+ z *= 0.5;
+ return;
+}
+//----------------------------------------------------------------------
+Bool_t AliITSsegmentationSSD::GetCrossing(Int_t iP,Int_t iN,
+ Float_t &x,Float_t &z,
+ Float_t c[2][2]){
+ // Given one P side strip and one N side strip, Returns kTRUE if they
+ // cross each other and the location of the two crossing strips and
+ // their correxlation matrix c[2][2].
+ /* _- Z
+ + angle / ^
+ fNstrips v | N-Side ...0
+ \-------/------------|-----------\--------\
+ |\\\\\\/////////////.|\\\\\\\\\\\\\\\\\\\\|
+ |0\\\\/////////////..|.\\\\\\\\\\\\\\\\\\\|
+ |00\\/////////////...|..\\\\\\\\\\\\\\\\\\|
+ X <--|000/////////////... |...\\\\\\\\\\\\\\\\\|
+ |00/////////////... | ...\\\\\\\\\\\\\\\\|
+ |0/////////////... | ...\\\\\\\\\\\\\\\|
+ |//////////////... | ...\\\\\\\\\\\\\\\|
+ /-----\--------------|--------------------/
+ fNstrips-1 P-Side ...0
+ |0\
+ |00\
+ Dead region: |000/
+ |00/
+ |0/
+ c[2][2] is defined as follows
+ /c[0][0] c[0][1]\ /delta iP\ = /delta x\
+ \c[1][0] c[1][1]/ \delta iN/ = \delta z/
+ */
+ const Double_t kconst = 1.0E-04; // convert microns to cm.
+ Double_t thp,thn,th,dx,dz,p,ip,in;
+ Float_t stereoP, stereoN;
+ Angles(stereoP,stereoN);
+
+ thp = TMath::Tan(stereoP);
+ thn = TMath::Tan(-stereoN);
+ th = thp-thn;
+ if(th==0.0) { // parall strips then never cross.
+ x = 0.0;
+ z = 0.0;
+ c[0][0] = c[1][0] = c[0][1] = c[1][1] = 0.0;
+ return kFALSE;
+ } // end if
+ // The strips must cross some place in space.
+ ip = (Double_t) iP; // convert to double now for speed
+ in = (Double_t) iN; // convert to double now for speed
+ dx = 0.5*kconst*Dx(); // half distance in x in cm
+ dz = 0.5*kconst*Dz(); // half distance in z in cm
+ p = kconst*Dpx(iP); // Get strip spacing/pitch now
+ x = 0.5*p+dx + (p*(in*thp-ip*thn)-2.0*dz*thp*thn)/th;
+ z =(p*(in-ip)-dz*(thp+thn))/th;
+ // compute correlations.
+ c[0][0] = -thn*p/th; // dx/diP
+ c[1][1] = p/th; // dz/diN
+ c[0][1] = p*thp/th; // dx/diN
+ c[1][0] = -p/th; // dz/diP
+ if(x<-dx || x>dx || z<-dz || z>dz) return kFALSE; // crossing is outside
+ // of the detector so
+ // these strips don't
+ // cross.
+ return kTRUE;
+}