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