]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSsegmentationSSD.cxx
Changes in SSD segmentation and simulation classes in order to take into account...
[u/mrichter/AliRoot.git] / ITS / AliITSsegmentationSSD.cxx
index 58d8426db4ef413ae4168f8b924f9b3e25e6ec33..8ee73e2b2a4fac770ebbad04690aaa1fea4f6583 100644 (file)
@@ -27,7 +27,7 @@
 // silicon strips                                   //
 //                                                  //
 //////////////////////////////////////////////////////
-const Float_t AliITSsegmentationSSD::fgkDxDefault = 72960.;
+const Float_t AliITSsegmentationSSD::fgkDxDefault = 73000.;
 const Float_t AliITSsegmentationSSD::fgkDzDefault = 40000.;
 const Float_t AliITSsegmentationSSD::fgkDyDefault = 300.;
 const Float_t AliITSsegmentationSSD::fgkPitchDefault = 95.;
@@ -42,10 +42,6 @@ fNstrips(0),
 fStereoP(0),
 fStereoN(0),
 fPitch(0),
-fStereoPl5(0),
-fStereoNl5(0),
-fStereoPl6(0),
-fStereoNl6(0),
 fLayer(0){
     // default constructor
   SetDetSize(fgkDxDefault,fgkDzDefault,fgkDyDefault);
@@ -77,10 +73,6 @@ void AliITSsegmentationSSD::Copy(TObject &obj) const {
   ((AliITSsegmentationSSD& ) obj).fNstrips = fNstrips;
   ((AliITSsegmentationSSD& ) obj).fStereoP = fStereoP;
   ((AliITSsegmentationSSD& ) obj).fStereoN = fStereoN;
-  ((AliITSsegmentationSSD& ) obj).fStereoPl5 = fStereoPl5;
-  ((AliITSsegmentationSSD& ) obj).fStereoNl5 = fStereoNl5;
-  ((AliITSsegmentationSSD& ) obj).fStereoPl6 = fStereoPl6;
-  ((AliITSsegmentationSSD& ) obj).fStereoNl6 = fStereoNl6;
   ((AliITSsegmentationSSD& ) obj).fLayer   = fLayer;
   ((AliITSsegmentationSSD& ) obj).fPitch   = fPitch;
   ((AliITSsegmentationSSD& ) obj).fLayer   = fLayer;
@@ -103,10 +95,6 @@ fNstrips(0),
 fStereoP(0),
 fStereoN(0),
 fPitch(0),
-fStereoPl5(0),
-fStereoNl5(0),
-fStereoPl6(0),
-fStereoNl6(0),
 fLayer(0){
     // copy constructor
   source.Copy(*this);
@@ -122,21 +110,15 @@ void AliITSsegmentationSSD::Init(){
 //----------------------------------------------------------------------
 void AliITSsegmentationSSD::Angles(Float_t &aP,Float_t &aN) const{
   // P and N side stereo angles
-    if (fLayer == 5){
-       aP = fStereoPl5;
-       aN = fStereoNl5;
-    } // end if
-    if (fLayer == 6){
-       aP = fStereoPl6;
-       aN = fStereoNl6;
-    } // end if
+  aP = fStereoP;
+  aN = fStereoN;
 }
 //----------------------------------------------------------------------
 void AliITSsegmentationSSD::SetLayer(Int_t l){
   //set fLayer data member (only 5 or 6 are allowed)
     if (l==5) fLayer =5;
-    if (l==6) fLayer =6;
-    if((l!=5) && (l!=6))AliError(Form("Layer can be 5 or 6, not %d",l));
+    else if (l==6) fLayer =6;
+    else AliError(Form("Layer can be 5 or 6, not %d",l));
 }
 //----------------------------------------------------------------------
 void AliITSsegmentationSSD::GetPadTxz(Float_t &x,Float_t &z) const{
@@ -163,6 +145,8 @@ void AliITSsegmentationSSD::GetPadTxz(Float_t &x,Float_t &z) const{
                      |0/
     // expects x, z in microns
     */
+
+  /*
     Float_t stereoP, stereoN;
     Angles(stereoP,stereoN);
     Float_t tanP = TMath::Tan(stereoP);
@@ -173,6 +157,23 @@ void AliITSsegmentationSSD::GetPadTxz(Float_t &x,Float_t &z) const{
     z1 += fDz/2;
     x   = (x1 - z1*tanP)/fPitch;
     z   = (x1 - tanN*(z1 - fDz))/fPitch;
+  */
+
+  Float_t P=0;
+  Float_t N=0;
+  if(fLayer==5) {
+    P = 105.26*x - 0.79*z + 381.89;
+    N = P + 3.68*z - 4; 
+  }
+  else if(fLayer==6) {
+    P = -105.26*x - 0.79*z + 384.66;
+    N = P + 3.68*z + 4;
+  }
+  else AliError("Layer can be 5 or 6");
+
+  x=P;
+  z=N;
+
 }
 //----------------------------------------------------------------------
 void AliITSsegmentationSSD::GetPadIxz(Float_t x,Float_t z,Int_t &iP,Int_t &iN) const {
@@ -271,11 +272,19 @@ Bool_t AliITSsegmentationSSD::LocalToDet(Float_t x,Float_t z,
   const Double_t kconst = 1.0E-04; // convert microns to cm.
   dx = 0.5*kconst*Dx();
   dz = 0.5*kconst*Dz();
-  if( (x<-dx) || (x>dx) ) { iP=-1; return kTRUE; } // outside x range.
-  if( (z<-dz) || (z>dz) ) { iN=-1; return kTRUE; } // outside z range.
+  if( (x<-dx) || (x>dx) ) { 
+    iP=-1; 
+    AliWarning(Form("Input argument %f out of range (%f, %f)",x,dx,-dx));
+    return kFALSE; // outside of defined volume.
+  } // outside x range.
+  if( (z<-dz) || (z>dz) ) { 
+    iN=-1; 
+    AliWarning(Form("Input argument %f out of range (%f, %f)",z,dz,-dz));
+    return kFALSE; // outside of defined volume.
+  }
   
-  x /= kconst;  // convert to microns
-  z /= kconst;  // convert to microns
+  //x /= kconst;  // convert to microns
+  //z /= kconst;  // convert to microns
   this->GetPadTxz(x,z);
   
   // first for P side
@@ -445,7 +454,7 @@ Int_t AliITSsegmentationSSD::GetChipFromLocal(Float_t xloc, Float_t zloc) const
   Int_t iN=0;
   if (!LocalToDet(xloc,zloc,iP,iN) || 
       (iP<0) || (iP>=fNstrips) || (iN<0) || (iN>=fNstrips) ) {
-    AliWarning("Bad local coordinate");
+    //AliWarning("Bad local coordinate");
     return -1;
   }
 
@@ -457,6 +466,67 @@ Int_t AliITSsegmentationSSD::GetChipFromLocal(Float_t xloc, Float_t zloc) const
 }
 //
 
+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;
+
+}
+
 //----------------------------------------------------------------------
 void AliITSsegmentationSSD::PrintDefaultParameters() const {
 // Print default values for parameters.