]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSsegmentationSSD.cxx
Updated version from B. Batyunya with a fix in the recpoint generation
[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 =0;
33 }
34 //------------------------------
35 AliITSsegmentationSSD::AliITSsegmentationSSD(AliITSgeom *geom){
36   // constuctor
37    fGeom=geom;
38    fCorr=0;
39    SetDetSize();
40    SetPadSize();
41    SetNPads();
42    SetAngles();
43    fLayer =0;
44
45 }
46 //____________________________________________________________________________
47 AliITSsegmentationSSD& AliITSsegmentationSSD::operator=(AliITSsegmentationSSD &source){
48 // Operator =
49      if(this==&source) return *this;
50      this->fNstrips = source.fNstrips;
51      this->fStereoP = source.fStereoP;
52      this->fStereoN = source.fStereoN;
53      this->fStereoPl5 = source.fStereoPl5;
54      this->fStereoNl5 = source.fStereoNl5;
55      this->fStereoPl6 = source.fStereoPl6;
56      this->fStereoNl6 = source.fStereoNl6;
57      this->fLayer   = source.fLayer;
58      this->fPitch   = source.fPitch;
59      this->fDz      = source.fDz;
60      this->fDx      = source.fDx;
61      this->fDy      = source.fDy;
62      this->fLayer   = source.fLayer;
63      this->fGeom    = source.fGeom; // copy only the pointer
64      this->fCorr    = new TF1(*(source.fCorr)); // make a proper copy
65      return *this;
66      
67 }
68 //____________________________________________________________________________
69 AliITSsegmentationSSD::AliITSsegmentationSSD(AliITSsegmentationSSD &source){
70   // copy constructor
71   *this = source;
72 }
73 //------------------------------
74 void AliITSsegmentationSSD::Init(){
75   // standard initalizer
76
77     SetPadSize();
78     SetNPads();
79     SetAngles();
80
81 }
82 //-------------------------------------------------------
83 void AliITSsegmentationSSD::Angles(Float_t &aP,Float_t &aN)
84      {
85          if (fLayer == 5)
86          {
87          aP = fStereoPl5;
88          aN = fStereoNl5;
89          }
90    
91          if (fLayer == 6)
92          {
93          aP = fStereoPl6;
94          aN = fStereoNl6;
95          }
96      }
97
98      void AliITSsegmentationSSD::SetLayer(Int_t l)
99      {
100      if (l==5) fLayer =5;
101      if (l==6) fLayer =6;
102      }
103
104 //-------------------------------------------------------
105 void AliITSsegmentationSSD::GetPadIxz(Float_t x,Float_t z,Int_t &iP,Int_t &iN)
106 {
107   // returns P and N sided strip numbers for a given location.
108
109     // expects x, z in microns
110
111     Float_t StereoP, StereoN;
112     Angles(StereoP,StereoN);
113     Float_t tanP=TMath::Tan(StereoP);
114     Float_t tanN=TMath::Tan(StereoN);
115     Float_t x1=x,z1=z;
116     x1 += fDx/2;
117     z1 += fDz/2;
118     Float_t  ldX = x1 - z1*tanP;          // distance from left-down edge 
119     iP = (Int_t)(ldX/fPitch);
120     iP = (iP<0)? -1: iP;      
121     iP = (iP>fNstrips)? -1: iP;
122
123     ldX = x1 - tanN*(fDz - z1);
124     iN = (Int_t)(ldX/fPitch);
125     iN = (iN<0)? -1: iN;
126     iN = (iN>fNstrips)? -1: iN;
127
128 }
129 //-------------------------------------------------------
130 void AliITSsegmentationSSD::GetPadCxz(Int_t iP,Int_t iN,Float_t &x,Float_t &z)
131 {
132     // actually this is the GetCrossing(Float_t &,Float_t &) 
133
134     // returns local x, z  in microns !
135
136   Float_t Dx = fDx; // detector size in x direction, microns
137   Float_t Dz = fDz; // detector size in z direction, microns
138   Float_t xP; // x coordinate in the P side from the first P strip
139   Float_t xN; // x coordinate in the N side from the first N strip
140   Float_t StereoP, StereoN;
141   Angles(StereoP,StereoN);
142   Float_t kP=TMath::Tan(StereoP);
143   Float_t kN=TMath::Tan(StereoN);
144
145     xP=iP*fPitch;
146     xN=iN*fPitch; 
147     x = xP + kP*(Dz*kN-xP+xN)/(kP+kN);
148     z = (Dz*kN-xP+xN)/(kP+kN); 
149     x -= Dx/2;
150     z -= Dz/2;
151     //if(TMath::Abs(z) > Dz/2) cout<<"Warning, wrong z local ="<<z<<endl; 
152     // Check that zL is inside the detector for the 
153     // correspondent xP and xN coordinates
154
155     return;   
156 }
157
158