]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSsegmentationSSD.cxx
Using a conservative 3% estimate for the K0s signal extraction systematics. Using...
[u/mrichter/AliRoot.git] / ITS / AliITSsegmentationSSD.cxx
index e3aa24cbc05b582cf24bd5dbb7113e1fd981965c..c4101fb39e48fc554e8feb3760eb299e62452f2a 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.;
@@ -35,6 +35,8 @@ const Int_t AliITSsegmentationSSD::fgkNstripsDefault = 768;
 const Int_t AliITSsegmentationSSD::fgkNchipsPerSide = 6;
 const Int_t AliITSsegmentationSSD::fgkNstripsPerChip = 128;
 
+using std::endl;
+using std::cout;
 ClassImp(AliITSsegmentationSSD)
 
 AliITSsegmentationSSD::AliITSsegmentationSSD(Option_t *opt): AliITSsegmentation(),
@@ -42,10 +44,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 +75,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 +97,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,26 +112,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
-    else if (fLayer == 6){
-       aP = fStereoPl6;
-       aN = fStereoNl6;
-    } // end if
-    else {
-      AliWarning("SSD layer not set in segmentation. Setting angles for layer 5");
-      aP = fStereoPl5;
-      aN = fStereoNl5;
-    }
+  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{
@@ -166,8 +145,10 @@ void AliITSsegmentationSSD::GetPadTxz(Float_t &x,Float_t &z) const{
        Dead region: |000/
                      |00/
                      |0/
-    // expects x, z in microns
+    // expects x, z in cm
     */
+
+  /*
     Float_t stereoP, stereoN;
     Angles(stereoP,stereoN);
     Float_t tanP = TMath::Tan(stereoP);
@@ -178,75 +159,57 @@ 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 tP=0;
+  Float_t tN=0;
+  if(fLayer==5) {
+    tP = 105.26*x - 0.7895*z + 382.000; //- 0.79*z + 381.89;
+    tN = tP + 3.684*z - 4; 
+  }
+  else if(fLayer==6) {
+    tP = -105.26*x - 0.7895*z + 385.000; //- 0.79*z + 384.66;
+    tN = tP + 3.684*z + 4;
+  }
+  else AliError("Layer can be 5 or 6");
+
+  x=tP;
+  z=tN;
+
 }
 //----------------------------------------------------------------------
 void AliITSsegmentationSSD::GetPadIxz(Float_t x,Float_t z,Int_t &iP,Int_t &iN) const {
   // returns P and N sided strip numbers for a given location.
-    /*                       _-  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/
-
-    // expects x, z in microns
-  */ 
-
-    Float_t stereoP, stereoN;
-    Angles(stereoP,stereoN);
-    Float_t tanP=TMath::Tan(stereoP);
-    Float_t tanN=TMath::Tan(stereoN);
-    Float_t x1=x,z1=z;
-    x1 += fDx/2;
-    z1 += fDz/2;
-    Float_t  ldX = x1 - z1*tanP;          // distance from left-down edge 
-    iP = (Int_t)(ldX/fPitch);
-    iP = (iP<0)? -1: iP;      
-    iP = (iP>fNstrips)? -1: iP;
-
-    ldX = x1 - tanN*(fDz - z1);
-    iN = (Int_t)(ldX/fPitch);
-    iN = (iN<0)? -1: iN;
-    iN = (iN>fNstrips)? -1: iN;
+  // expects x, z in cm
 
+  GetPadTxz(x,z);
+  iP = Int_t(x+0.5);
+  iN = Int_t(z+0.5);
 }
 //-------------------------------------------------------
-void AliITSsegmentationSSD::GetPadCxz(Int_t iP,Int_t iN,Float_t &x,Float_t &z) const {
+void AliITSsegmentationSSD::GetPadCxz(Float_t iP,Float_t iN,Float_t &x,Float_t &z) const {
     // actually this is the GetCrossing(Float_t &,Float_t &)
-    // returns local x, z  in microns !
+    // returns local x, z  in cm 
+  const Float_t kStartXzero=3.64325;
+  const Float_t kDeltaXzero5or6=0.02239;
+  const Float_t kDeltaZ5to6=7.6/7.0;
 
-    Float_t lDx = fDx; // detector size in x direction, microns
-    Float_t lDz = fDz; // detector size in z direction, microns
-    Float_t xP; // x coordinate in the P side from the first P strip
-    Float_t xN; // x coordinate in the N side from the first N strip
-    Float_t stereoP, stereoN;
-    Angles(stereoP,stereoN);
-    Float_t kP=TMath::Tan(stereoP);
-    Float_t kN=TMath::Tan(stereoN);
+  z = 1.9*(iN-iP)/7.0;
+  x = kStartXzero-(285*iN + 1045*iP)/140000.0;
 
-    xP=iP*fPitch;
-    xN=iN*fPitch; 
-    x = xP + kP*(lDz*kN-xP+xN)/(kP+kN);
-    z = (lDz*kN-xP+xN)/(kP+kN); 
-    x -= lDx/2;
-    z -= lDz/2;
-    //if(TMath::Abs(z) > Dz/2) cout<<"Warning, wrong z local ="<<z<<endl; 
-    // Check that zL is inside the detector for the 
-    // correspondent xP and xN coordinates
-
-    return;   
+  if (fLayer==5){
+    z += kDeltaZ5to6;
+    x = -x + kDeltaXzero5or6;
+  }
+  else if (fLayer==6) {
+    z -= kDeltaZ5to6;
+    x += kDeltaXzero5or6;
+  }
+  else {
+    AliWarning("Layer shoudl be 5 or 6");
+    x = -99999;
+    z = -99999;
+  }
 }
 //______________________________________________________________________
 Bool_t AliITSsegmentationSSD::LocalToDet(Float_t x,Float_t z,
@@ -287,8 +250,8 @@ Bool_t AliITSsegmentationSSD::LocalToDet(Float_t x,Float_t z,
     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
@@ -328,6 +291,7 @@ void AliITSsegmentationSSD::DetToLocal(Int_t ix,Int_t iPN,
     // x = a + b + z*tan(fStereoP); a = Dpx(iP)*(iP+0.5)-dx; b = dz*th;
     // for strips n-side
     // x = a + b + z*tan(fStereoP); a = Dpx(iN)*(iN+0.5)-dx; b = -dz*th;
+    AliWarning("This function has not been verified. Should probably use GetPadCxz");
     const Double_t kconst = 1.0E-04; // convert microns to cm.
     Float_t flag=kconst*Dx(); // error value
     Double_t th=0.0,dx,dz,i,a,b=0.0,xb[4],zb[4];
@@ -370,69 +334,6 @@ void AliITSsegmentationSSD::DetToLocal(Int_t ix,Int_t iPN,
     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;
-}
-
 //----------------------------------------------------------------------
 Int_t AliITSsegmentationSSD::GetChipFromChannel(Int_t ix, Int_t iz) const {
   // returns chip number (in range 0-11) starting from channel number
@@ -472,6 +373,7 @@ 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 {
+  // returns chip number in a given xz window
 
   Int_t nChipInW = 0;