+//----------------------------------------------------------------------
+Float_t AliITSsegmentationSDD::GetLocalZFromAnode(Float_t zAnode) const{
+ // returns local Z coordinate from anode number (float)
+ Float_t zloc=0.;
+ if(zAnode<fNanodes/2){ // left side
+ zloc=(zAnode*fPitch-fDz/2)*fgkMicron2Cm;
+ }else{ // right side
+ zAnode-=fNanodes/2;
+ zloc=-(zAnode*fPitch-fDz/2)*fgkMicron2Cm;
+ }
+ return zloc;
+}
+//----------------------------------------------------------------------
+Int_t AliITSsegmentationSDD::GetChipFromChannel(Int_t ix, Int_t iz) const {
+ // returns chip number (in range 0-7) starting from channel number
+ if(iz>=fNanodes || iz<0 || ix>fNsamples){
+ AliError("Bad cell number");
+ return -1;
+ }
+ Int_t theChip=iz/fgkNanodesPerChip;
+ return theChip;
+}
+//----------------------------------------------------------------------
+Int_t AliITSsegmentationSDD::GetChipFromLocal(Float_t xloc, Float_t zloc) const {
+ // returns chip number (in range 0-7) starting from local coordinates
+ Float_t detsize=fDz*fgkMicron2Cm;
+ Float_t chipsize=detsize/(Float_t)fgkNchipsPerHybrid;
+ zloc+=detsize/2.;
+ if(zloc<-0.01 || zloc>detsize+0.01){ // 100 micron tolerance around edges
+ AliError("Z local value out of sensitive SDD area");
+ return -1;
+ }
+ Int_t iChip=int(zloc/chipsize);
+ if(zloc<0.) iChip=0;
+ if(zloc>=detsize) iChip=fgkNchipsPerHybrid-1;
+ if(iChip>=fgkNchipsPerHybrid || iChip<0){
+ AliError(Form("Bad chip number %d",iChip));
+ return -1;
+ }
+ Int_t iSide=GetSideFromLocalX(xloc);
+ if(iSide==1) iChip=fgkNchipsPerHybrid-iChip+3; // i.e. 7-iChip
+ return iChip;
+}
+//----------------------------------------------------------------------
+Int_t AliITSsegmentationSDD::GetChipsInLocalWindow(Int_t* array, Float_t zmin, Float_t zmax, Float_t xmin, Float_t xmax) const {
+ // returns the numbers of the chips that read channels in a given region
+ // of the module defined in local coordinates by zmin-zmax, xmin-max