]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/AliRICHSegmentationV1.cxx
AliCRTModule added
[u/mrichter/AliRoot.git] / RICH / AliRICHSegmentationV1.cxx
CommitLineData
237c933d 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
237c933d 16#include "AliRICHSegmentationV1.h"
17
237c933d 18ClassImp(AliRICHSegmentationV1)
c712cb2f 19//__________________________________________________________________________________________________
237c933d 20AliRICHSegmentationV1::AliRICHSegmentationV1()
c712cb2f 21{// Default constructor for AliRICHSegmantionV1 (with dead zones)
237c933d 22
ad185d05 23 fNpx=144; // number of pads along X direction
24 fNpy=160; // number of pads along Y direction
25 fDeadZone=3.0; // space between CsI photocathods in cm
26 fDpx=0.84; // pad width in cm
27 fDpy=0.80; // pad heights in cm
28 fWireD=0.84/2;
29 fSector=-1;
9da0c825 30 Init(0); // ??? remove 0
237c933d 31}
c712cb2f 32//__________________________________________________________________________________________________
cc23c5c6 33void AliRICHSegmentationV1::Init(Int_t /*id*/)
34{//Recalculates all the values after some of them have been changed
35
9da0c825 36 Float_t csi_length = fNpy*fDpy + fDeadZone;
37 Float_t csi_width = fNpx*fDpx + 2*fDeadZone;
9350cdcb 38
9da0c825 39 fPadPlane_Width = (csi_width - 2*fDeadZone)/3;
40 fPadPlane_Length = (csi_length - fDeadZone)/2;
9350cdcb 41}
c712cb2f 42//__________________________________________________________________________________________________
9350cdcb 43Int_t AliRICHSegmentationV1::Sector(Float_t x, Float_t y)
c712cb2f 44{// Calculate in which sector is the hit
6d4af9e4 45
237c933d 46 fSector=-1;
47
9350cdcb 48 //Parametrized definition
6d4af9e4 49
9350cdcb 50 if (y<-fDeadZone/2)
6d4af9e4 51 {
9350cdcb 52 if (x> fPadPlane_Width/2 +fDeadZone)
6d4af9e4 53 {
9350cdcb 54 if ( x<fPadPlane_Width/2 +fDeadZone + fPadPlane_Width)
6d4af9e4 55 fSector=0;
56 }
9350cdcb 57 if (x< fPadPlane_Width/2)
6d4af9e4 58 {
9350cdcb 59 if (x> -( fPadPlane_Width/2))
6d4af9e4 60 fSector=2;
61 }
9350cdcb 62 if (x< -( fPadPlane_Width/2 +fDeadZone))
6d4af9e4 63 {
9350cdcb 64 if (x> -( fPadPlane_Width/2 +fDeadZone + fPadPlane_Width))
6d4af9e4 65 fSector=4;
66 }
67 }
9350cdcb 68 else if (y>fDeadZone/2)
6d4af9e4 69 {
9350cdcb 70 if (x> fPadPlane_Width/2 +fDeadZone)
6d4af9e4 71 {
9350cdcb 72 if (x< fPadPlane_Width/2 +fDeadZone + fPadPlane_Width)
73 fSector=1;
6d4af9e4 74 }
9350cdcb 75 if (x< fPadPlane_Width/2)
6d4af9e4 76 {
9350cdcb 77 if (x> -( fPadPlane_Width/2))
78 fSector=3;
6d4af9e4 79 }
9350cdcb 80 if (x< -( fPadPlane_Width/2 +fDeadZone))
6d4af9e4 81 {
9350cdcb 82 if (x> -( fPadPlane_Width/2 +fDeadZone + fPadPlane_Width))
83 fSector=5;
6d4af9e4 84 }
237c933d 85 }
9350cdcb 86
237c933d 87 return fSector;
c712cb2f 88}//Sector()
89//__________________________________________________________________________________________________
a2f7eaf6 90void AliRICHSegmentationV1::GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
237c933d 91{
237c933d 92
2cc4f1ad 93 ix=9999; //PH Fake values which should not be returned
94 iy=9999;
95
237c933d 96 Int_t sector=Sector(x,y);
97
237c933d 98
237c933d 99 if (sector==0)
100 {
9350cdcb 101 ix = Int_t ((x-fDeadZone)/fDpx);
102 iy = Int_t ((y+fDeadZone/2)/fDpy)-1;
237c933d 103 }
104 if (sector==1)
105 {
9350cdcb 106 ix = Int_t ((x-fDeadZone)/fDpx);
107 iy = Int_t ((y-fDeadZone/2)/fDpy);
237c933d 108 }
109 if (sector==2)
110 {
9350cdcb 111 ix = (x>=0)? ix = Int_t (x/fDpx) : ix = Int_t (x/fDpx)-1;
112 iy = Int_t ((y+fDeadZone/2)/fDpy)-1;
237c933d 113 }
114 if (sector==3)
115 {
9350cdcb 116 ix = (x>=0)? ix = Int_t (x/fDpx) : ix = Int_t (x/fDpx)-1;
117 iy = Int_t ((y-fDeadZone/2)/fDpy);
237c933d 118 }
119 if (sector==4)
120 {
9350cdcb 121 ix = Int_t ((x+fDeadZone)/fDpx)-1;
122 iy = Int_t ((y+fDeadZone/2)/fDpy)-1;
237c933d 123 }
124 if (sector==5)
125 {
9350cdcb 126 ix = Int_t ((x+fDeadZone)/fDpx)-1;
127 iy = Int_t ((y-fDeadZone/2)/fDpy);
237c933d 128 }
9350cdcb 129
237c933d 130
131 if (sector==-1)
132 {
72e468a5 133 ix = fIxmax;
134 iy = fIymax;
237c933d 135 }
136
137 if (iy > fNpy) iy= fNpy;
138 if (iy < -fNpy) iy=-fNpy;
139 if (ix > fNpx) ix= fNpx;
140 if (ix < -fNpx) ix=-fNpx;
c712cb2f 141}//GetPadI()
142//__________________________________________________________________________________________________
143void AliRICHSegmentationV1::GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
144{// returns real coordinates (x,y) for given pad coordinates (ix,iy)
237c933d 145 Int_t sector=-1;
146
6d4af9e4 147
9350cdcb 148 Float_t padplane_width = fNpx/3;
6d4af9e4 149
9350cdcb 150 if (iy<0)
6d4af9e4 151 {
9350cdcb 152 if (ix < fNpx/2)
6d4af9e4 153 {
9350cdcb 154 if (ix >= padplane_width/2)
6d4af9e4 155 sector=0;
156 }
9350cdcb 157 if (ix< padplane_width/2)
6d4af9e4 158 {
9350cdcb 159 if (ix >= -(padplane_width/2))
6d4af9e4 160 sector=2;
161 }
9350cdcb 162 if (ix >= -(fNpx/2))
6d4af9e4 163 {
9350cdcb 164 if (ix < -(padplane_width/2))
6d4af9e4 165 sector=4;
166 }
167 }
9350cdcb 168 if (iy>=0)
6d4af9e4 169 {
9350cdcb 170 if (ix < fNpx/2)
6d4af9e4 171 {
9350cdcb 172 if (ix >= padplane_width/2)
173 sector=1;
6d4af9e4 174 }
9350cdcb 175 if (ix< padplane_width/2)
6d4af9e4 176 {
9350cdcb 177 if (ix >= -(padplane_width/2))
178 sector=3;
6d4af9e4 179 }
9350cdcb 180 if (ix >= -(fNpx/2))
6d4af9e4 181 {
9350cdcb 182 if (ix < -(padplane_width/2))
183 sector=5;
6d4af9e4 184 }
185 }
237c933d 186
187 if (sector==0)
188 {
189 //x = (ix>0) ? Float_t(ix*fDpx)-fDpx/2. : Float_t(ix*fDpx)-fDpx/2.;
190 //y = (iy>0) ? Float_t(iy*fDpy)-fDpy/2. : Float_t(iy*fDpy)-fDpy/2.;
9350cdcb 191 x = Float_t(ix)*fDpx+fDpx/2+fDeadZone;
192 y = Float_t(iy)*fDpy+fDpy/2-fDeadZone/2;
237c933d 193 }
194 if (sector==1)
195 {
9350cdcb 196 x = Float_t(ix)*fDpx+fDpx/2+fDeadZone;
197 y = Float_t(iy)*fDpy+fDpy/2+fDeadZone/2;
237c933d 198 }
199 if (sector==2)
200 {
9350cdcb 201 x = (ix>=0) ? x = Float_t(ix)*fDpx+fDpx/2 : x = Float_t(ix)*fDpx+fDpx/2;
202 y = Float_t(iy)*fDpy+fDpy/2-fDeadZone/2;
237c933d 203 }
204 if (sector==3)
205 {
9350cdcb 206 x = (ix>=0) ? x = Float_t(ix)*fDpx+fDpx/2 : x = Float_t(ix)*fDpx+fDpx/2;
207 y = Float_t(iy)*fDpy+fDpy/2+fDeadZone/2;
237c933d 208 }
209 if (sector==4)
210 {
9350cdcb 211 x = Float_t(ix)*fDpx+fDpx/2-fDeadZone;
212 y = Float_t(iy)*fDpy+fDpy/2-fDeadZone/2;
237c933d 213 }
214 if (sector==5)
215 {
9350cdcb 216 x = Float_t(ix)*fDpx+fDpx/2-fDeadZone;
217 y = Float_t(iy)*fDpy+fDpy/2+fDeadZone/2;
237c933d 218 }
c712cb2f 219}//GetPadC
220//__________________________________________________________________________________________________
221void AliRICHSegmentationV1::IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
237c933d 222{
72e468a5 223 x1=fXhit-fX-fDpx/2.;
237c933d 224 x2=x1+fDpx;
72e468a5 225 y1=fYhit-fY-fDpy/2.;
237c933d 226 y2=y1+fDpy;
227}