-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;
+Int_t AliITSsegmentationSSD::GetChipFromChannel(Int_t ix, Int_t iz) const {
+ // returns chip number (in range 0-11) starting from channel number
+
+ if( (iz>=fgkNstripsDefault) || (iz<0) || (ix<0) || (ix>1) ) {
+ AliError("Bad cell number");
+ return -1;
+ }
+
+ if(ix==1) iz = 1535-iz;
+ Int_t theChip =iz/fgkNstripsPerChip;
+ return theChip;
+
+}
+//----------------------------------------------------------------------
+Int_t AliITSsegmentationSSD::GetChipFromLocal(Float_t xloc, Float_t zloc) const
+{
+ // returns chip numbers starting from local coordinates
+ // The two Nside chip number and Pside chip number are
+ // coded as chip=Nchip*10+Pchip
+
+ Int_t iP=0;
+ Int_t iN=0;
+ if (!LocalToDet(xloc,zloc,iP,iN) ||
+ (iP<0) || (iP>=fNstrips) || (iN<0) || (iN>=fNstrips) ) {
+ //AliWarning("Bad local coordinate");
+ return -1;
+ }
+
+ Int_t iChip = GetChipFromChannel(0,iP);
+ iChip += 10*GetChipFromChannel(1,iN); // add Nside
+
+ return iChip;
+
+}
+//
+
+Int_t AliITSsegmentationSSD::GetChipsInLocalWindow(Int_t* array, Float_t zmin, Float_t zmax,
+ Float_t xmin, Float_t xmax) const {
+
+ Int_t nChipInW = 0;
+
+ Float_t zminDet=-fDz*1.0E-04/2.;
+ Float_t zmaxDet=fDz*1.0E-04/2.;
+ if(zmin<zminDet) zmin=zminDet;
+ if(zmax>zmaxDet) zmax=zmaxDet;
+
+ Float_t xminDet=-fDx*1.0E-04/2;
+ Float_t xmaxDet=fDx*1.0E-04/2;
+ if(xmin<xminDet) xmin=xminDet;
+ if(xmax>xmaxDet) xmax=xmaxDet;
+
+ Int_t n1N=-1;
+ Int_t n1P=-1;
+ Int_t n1=GetChipFromLocal(xmin,zmin);
+ if(n1!=-1) { // Note! Recpoint can be on the sensor but in the dead area not covered by strips!
+ n1N = (Int_t) (n1/10); // N-side chip coded as 10*chip_index
+ n1P = n1 - 10 * n1N; // P-side chip coded 0-5
+ array[nChipInW]=n1P;
+ nChipInW++;
+ array[nChipInW]=n1N;
+ nChipInW++;
+ }
+
+ Int_t n2N=-1;
+ Int_t n2P=-1;
+ Int_t n2=GetChipFromLocal(xmin,zmax);
+ if(n2!=-1) { // Note! Recpoint can be on the sensor but in the dead area not covered by strips!
+ n2N = (Int_t) (n2/10); // N-side chip coded as 10*chip_index
+ n2P = n2 - 10 * n2N; // P-side chip coded 0-5
+ if(n2P!=n1P) { array[nChipInW]=n2P; nChipInW++;}
+ if(n2N!=n1N) { array[nChipInW]=n2N; nChipInW++;}
+ }
+
+ Int_t n3N=-1;
+ Int_t n3P=-1;
+ Int_t n3=GetChipFromLocal(xmax,zmin);
+ if(n3!=-1) {
+ n3N=(Int_t) (n3/10); // N-side chip coded as 10*chip_index
+ n3P=n3 - 10 * n3N; // P-side chip coded 0-5
+ if((n3P!=n1P)&&(n3P!=n2P)) { array[nChipInW]=n3P; nChipInW++;}
+ if((n3N!=n1N)&&(n3N!=n2N)) { array[nChipInW]=n3N; nChipInW++;}
+ }
+
+ Int_t n4N=-1;
+ Int_t n4P=-1;
+ Int_t n4=GetChipFromLocal(xmax,zmax);
+ if(n4!=-1) {
+ n4N=(Int_t) (n4/10); // N-side chip coded as 10*chip_index
+ n4P=n4 - 10 * n4N; // P-side chip coded 0-5
+ if((n4P!=n1P)&&(n4P!=n2P)&&(n4P!=n3P)) { array[nChipInW]=n4P; nChipInW++;}
+ if((n4N!=n1N)&&(n4N!=n2N)&&(n4N!=n3N)) { array[nChipInW]=n4N; nChipInW++;}
+ }
+
+ return nChipInW;
+