]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSsegmentationSSD.cxx
Updated with the new SSD reconstruction code
[u/mrichter/AliRoot.git] / ITS / AliITSsegmentationSSD.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 #include <TMath.h>
17 #include <TF1.h>
18 #include <iostream.h>
19 #include "AliITSsegmentationSSD.h"
20 #include "AliITSgeom.h"
21
22
23 ClassImp(AliITSsegmentationSSD)
24 AliITSsegmentationSSD::AliITSsegmentationSSD(){
25   // default constructor
26    fGeom=0;
27    fCorr=0;
28    SetDetSize();
29    SetPadSize();
30    SetNPads();
31    SetAngles();
32    fLayer =5;
33 }
34 //------------------------------
35 AliITSsegmentationSSD::AliITSsegmentationSSD(AliITSgeom *geom){
36   // constuctor
37    fGeom=geom;
38    fCorr=0;
39    SetDetSize();
40    cout<<"Dx="<<fDx<<endl;
41    SetPadSize();
42    SetNPads();
43    SetAngles();
44    //Init(); 
45    fLayer =5;
46    cout<<"segmSSD - geom"<<endl;
47
48 }
49 //____________________________________________________________________________
50 AliITSsegmentationSSD& AliITSsegmentationSSD::operator=(AliITSsegmentationSSD &source){
51 // Operator =
52      if(this==&source) return *this;
53      this->fNstrips = source.fNstrips;
54      this->fStereoP = source.fStereoP;
55      this->fStereoN = source.fStereoN;
56      this->fStereoPl5 = source.fStereoPl5;
57      this->fStereoNl5 = source.fStereoNl5;
58      this->fStereoPl6 = source.fStereoPl6;
59      this->fStereoNl6 = source.fStereoNl6;
60      this->fLayer   = source.fLayer;
61      this->fPitch   = source.fPitch;
62      this->fDz      = source.fDz;
63      this->fDx      = source.fDx;
64      this->fDy      = source.fDy;
65      this->fLayer   = source.fLayer;
66      this->fGeom    = source.fGeom; // copy only the pointer
67      this->fCorr    = new TF1(*(source.fCorr)); // make a proper copy
68      return *this;
69      
70 }
71 //____________________________________________________________________________
72 AliITSsegmentationSSD::AliITSsegmentationSSD(AliITSsegmentationSSD &source){
73   // copy constructor
74   *this = source;
75 }
76 //------------------------------
77 void AliITSsegmentationSSD::Init(){
78   // standard initalizer
79
80   //AliITSgeomSSD *gssd = (AliITSgeomSSD *) (fGeom->GetShape(5,1,1));
81   //const Float_t kconv=10000.;
82     /*
83     fDx = 2.*kconv*gssd->GetDx();
84     fDz = 2.*kconv*gssd->GetDz();
85     fDy = 2.*kconv*gssd->GetDy();
86     */
87     SetPadSize();
88     SetNPads();
89     SetAngles();
90
91 }
92 //-------------------------------------------------------
93 void AliITSsegmentationSSD::Angles(Float_t &aP,Float_t &aN)
94      {
95          if (fLayer == 5)
96          {
97          aP = fStereoPl5;
98          aN = fStereoNl5;
99          }
100    
101          if (fLayer == 6)
102          {
103          aP = fStereoPl6;
104          aN = fStereoNl6;
105          }
106      }
107
108      void AliITSsegmentationSSD::SetLayer(Int_t l)
109      {
110      if (l==5) fLayer =5;
111      if (l==6) fLayer =6;
112      }
113
114 //-------------------------------------------------------
115 void AliITSsegmentationSSD::GetPadIxz(Float_t x,Float_t z,Int_t &iP,Int_t &iN)
116 {
117   // returns P and N sided strip numbers for a given location.
118
119     // expects x, z in microns
120
121     Float_t tanP=TMath::Tan(fStereoP);
122     Float_t tanN=TMath::Tan(fStereoN);
123     //cout<<"1 segment::GetPad: xL,zL,fDx,fDz ="<<x<<","<<z<<","<<fDx<<","<<fDz<<endl;
124     //cout<<"2 segment: ? tanP,tanN ="<<tanP<<","<<tanN<<endl;
125    tanP = 0.0075;
126    tanN = 0.0275;
127     Float_t x1=x,z1=z;
128     x1 += fDx/2;
129     z1 += fDz/2;
130     Float_t  ldX = x1 - z1*tanP;          // distance from left-down edge 
131     iP = (Int_t)(ldX/fPitch);
132     iP = (iP<0)? -1: iP;      
133     iP = (iP>fNstrips)? -1: iP;
134
135     //cout<<"3 segment::GetPad: x1,tanP,ix1 ="<<ldX<<","<<tanP<<","<<iP<<endl;
136
137     ldX = x1 - tanN*(fDz - z1);
138     iN = (Int_t)(ldX/fPitch);
139     iN = (iN<0)? -1: iN;
140     iN = (iN>fNstrips)? -1: iN;
141
142     //cout<<"4 segment::GetPad: x2,tanN,ix2 ="<<ldX<<","<<tanN<<","<<iN<<endl;
143
144 }
145 //-------------------------------------------------------
146 void AliITSsegmentationSSD::GetPadCxz(Int_t iP,Int_t iN,Float_t &x,Float_t &z)
147 {
148     // actually this is the GetCrossing(Float_t &,Float_t &) 
149
150     // returns x, z  in microns !
151
152     Float_t flag=2*fDx;
153
154     Float_t tanP=TMath::Tan(fStereoP);
155     Float_t tanN=TMath::Tan(fStereoN);
156
157     Float_t dx = 0.1;
158     x = iP*fPitch;
159     z = iN*fPitch; 
160
161     if(tanP + tanN  == 0) {x=z=flag; return ;}
162
163     z = (z - x + tanN * fDz) / (tanP + tanN);    
164     x = x + tanP * z;                         
165
166     x -= fDx/2;
167     z -= fDz/2;
168
169     if ( ( z < -(fDz/2+dx) ) || ( z > (fDz/2+dx) ) ) {x=z=flag; return ;}
170     if ( ( x < -(fDx/2+dx) ) || ( x > (fDx/2+dx) ) ) {x=z=flag; return ;}
171
172     return;   
173 }