]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSsegmentationSSD.cxx
Release version of ITS 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
18 #include "AliITSsegmentationSSD.h"
19 #include "AliITSgeom.h"
20
21
22 ClassImp(AliITSsegmentationSSD)
23 AliITSsegmentationSSD::AliITSsegmentationSSD(){
24   // default constructor
25    fGeom=0;
26    fCorr=0;
27    SetDetSize();
28    SetPadSize();
29    SetNPads();
30    SetAngles();
31 }
32 //------------------------------
33 AliITSsegmentationSSD::AliITSsegmentationSSD(AliITSgeom *geom){
34   // constuctor
35    fGeom=geom;
36    fCorr=0;
37    SetDetSize();
38    SetPadSize();
39    SetNPads();
40    SetAngles();
41    //Init(); 
42 }
43 //____________________________________________________________________________
44 AliITSsegmentationSSD& AliITSsegmentationSSD::operator=(AliITSsegmentationSSD &source){
45 // Operator =
46      if(this==&source) return *this;
47      this->fNstrips = source.fNstrips;
48      this->fStereoP = source.fStereoP;
49      this->fStereoN = source.fStereoN;
50      this->fPitch   = source.fPitch;
51      this->fDz      = source.fDz;
52      this->fDx      = source.fDx;
53      this->fDy      = source.fDy;
54      this->fGeom    = source.fGeom; // copy only the pointer
55      this->fCorr    = new TF1(*(source.fCorr)); // make a proper copy
56      return *this;
57      
58 }
59 //____________________________________________________________________________
60 AliITSsegmentationSSD::AliITSsegmentationSSD(AliITSsegmentationSSD &source){
61   // copy constructor
62   *this = source;
63 }
64 //------------------------------
65 void AliITSsegmentationSSD::Init(){
66   // standard initalizer
67
68     AliITSgeomSSD *gssd = (AliITSgeomSSD *) (fGeom->GetShape(5,1,1));
69     const Float_t kconv=10000.;
70     fDx = 2.*kconv*gssd->GetDx();
71     fDz = 2.*kconv*gssd->GetDz();
72     fDy = 2.*kconv*gssd->GetDy();
73     SetPadSize();
74     SetNPads();
75     SetAngles();
76
77 }
78 //-------------------------------------------------------
79 void AliITSsegmentationSSD::GetPadIxz(Float_t x,Float_t z,Int_t &iP,Int_t &iN)
80 {
81   // returns P and N sided strip numbers for a given location.
82
83     // expects x, z in microns
84
85     Float_t tanP=TMath::Tan(fStereoP);
86     Float_t tanN=TMath::Tan(fStereoN);
87
88     Float_t x1=x,z1=z;
89     x1 += fDx/2;
90     z1 += fDz/2;
91     
92     Float_t  ldX = x1 - z1*tanP;          // distance from left-down edge 
93     iP = (Int_t)(ldX/fPitch);
94     iP = (iP<0)? -1: iP;      
95     iP = (iP>fNstrips)? -1: iP;
96
97
98     ldX = x1 - tanN*(fDz - z1);
99     iN = (Int_t)(ldX/fPitch);
100     iN = (iN<0)? -1: iN;
101     iN = (iN>fNstrips)? -1: iN;
102
103 }
104 //-------------------------------------------------------
105 void AliITSsegmentationSSD::GetPadCxz(Int_t iP,Int_t iN,Float_t &x,Float_t &z)
106 {
107     // actually this is the GetCrossing(Float_t &,Float_t &) 
108
109     // returns x, z  in microns !
110
111     Float_t flag=2*fDx;
112
113     Float_t tanP=TMath::Tan(fStereoP);
114     Float_t tanN=TMath::Tan(fStereoN);
115
116     Float_t dx = 0.1;
117     x = iP*fPitch;
118     z = iN*fPitch; 
119
120     if(tanP + tanN  == 0) {x=z=flag; return ;}
121
122     z = (z - x + tanN * fDz) / (tanP + tanN);    
123     x = x + tanP * z;                         
124
125     x -= fDx/2;
126     z -= fDz/2;
127
128     if ( ( z < -(fDz/2+dx) ) || ( z > (fDz/2+dx) ) ) {x=z=flag; return ;}
129     if ( ( x < -(fDx/2+dx) ) || ( x > (fDx/2+dx) ) ) {x=z=flag; return ;}
130
131     return;   
132 }