1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 #include "AliRICHSegmentationV0.h"
20 ClassImp(AliRICHSegmentationV0)
22 //________________________________________________________________________________
23 AliRICHSegmentationV0::AliRICHSegmentationV0()
26 // Default constructor for AliRICHSegmentationV0 (no dead zones)
35 void AliRICHSegmentationV0::Init(Int_t id)
38 // Initialisation of chambers
39 id++;//to remove warning
40 Float_t csi_length = fNpy*fDpy + fDeadZone;
41 Float_t csi_width = fNpx*fDpx + 2*fDeadZone;
43 fPadPlane_Width = (csi_width - 2*fDeadZone)/3;
44 fPadPlane_Length = (csi_length - fDeadZone)/2;
48 Float_t AliRICHSegmentationV0::GetAnod(Float_t xhit) const
51 // Get anod wire closer to hit
53 Float_t wire= (xhit>0)? Int_t(xhit/fWireD)+0.5:Int_t(xhit/fWireD)-0.5;
57 void AliRICHSegmentationV0::SetPadSize(Float_t p1, Float_t p2)
65 void AliRICHSegmentationV0::GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
66 {// returns pad coordinates (ix,iy) for given real coordinates (x,y)
67 ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx);
68 iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy);
69 if (iy > fNpy) iy= fNpy;
70 if (iy < -fNpy) iy=-fNpy;
71 if (ix > fNpx) ix= fNpx;
72 if (ix < -fNpx) ix=-fNpx;
74 void AliRICHSegmentationV0::GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
75 {// returns real coordinates (x,y) for given pad coordinates (ix,iy)
76 x = (ix>0) ? Float_t(ix*fDpx)-fDpx/2. : Float_t(ix*fDpx)-fDpx/2.;
77 y = (iy>0) ? Float_t(iy*fDpy)-fDpy/2. : Float_t(iy*fDpy)-fDpy/2.;
80 void AliRICHSegmentationV0::SetHit(Float_t xhit, Float_t yhit)
81 {// Find the wire position (center of charge distribution)
86 void AliRICHSegmentationV0::SetPad(Int_t ix, Int_t iy)
87 {// Move to pad ix, iy
94 void AliRICHSegmentationV0::FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy)
97 // Find the wire position (center of charge distribution)
98 Float_t x0a=GetAnod(xhit);
101 // and take fNsigma*sigma around this center
102 Float_t x01=x0a - dx;
103 Float_t x02=x0a + dx;
104 Float_t y01=yhit - dy;
105 Float_t y02=yhit + dy;
106 // find the pads over which the charge distributes
107 GetPadI(x01,y01,fIxmin,fIymin);
108 GetPadI(x02,y02,fIxmax,fIymax);
109 // Set current pad to lower left corner
112 GetPadC(fIx,fIy,fX,fY);
115 void AliRICHSegmentationV0::NextPad()
117 // Step to next pad in integration region
120 } else if (fIy <= fIymax) {
124 printf("\n Error: Stepping outside integration region\n ");
126 GetPadC(fIx,fIy,fX,fY);
129 Int_t AliRICHSegmentationV0::MorePads()
130 {// Are there more pads in the integration region
131 if (fIx >= fIxmax && fIy >= fIymax) {
137 //__________________________________________________________________________________________________
138 void AliRICHSegmentationV0::SigGenInit(Float_t x,Float_t y,Float_t)
139 {// Initialises pad and wire position during stepping
142 GetPadI(x,y,fIxt,fIyt);
143 fIwt= (x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1 ;
146 Int_t AliRICHSegmentationV0::SigGenCond(Float_t x,Float_t y,Float_t)
147 {// Signal will be generated if particle crosses pad boundary or
148 // boundary between two wires.
150 GetPadI(x,y,ixt,iyt);
151 Int_t iwt=(x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1;
153 if ((ixt != fIxt) || (iyt !=fIyt) || (iwt != fIwt)) {
159 void AliRICHSegmentationV0::IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
160 {// Calculate the integration limits
167 void AliRICHSegmentationV0::Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[7], Int_t Ylist[7])
169 //Is used for the cluster finder, include diagonal elements
171 *Nlist=4;Xlist[0]=Xlist[1]=iX;Xlist[2]=iX-1;Xlist[3]=iX+1;
172 Ylist[0]=iY-1;Ylist[1]=iY+1;Ylist[2]=Ylist[3]=iY;
175 Float_t AliRICHSegmentationV0::Distance2AndOffset(Int_t iX, Int_t iY, Float_t X, Float_t Y,Int_t *dummy)
176 {// Returns the square of the distance between 1 pad labelled by its Channel numbers and a coordinate
180 return (x-X)*(x-X) + (y-Y)*(y-Y);
183 void AliRICHSegmentationV0::GiveTestPoints(Int_t &n, Float_t *x, Float_t *y) const
193 void AliRICHSegmentationV0::Draw(const char* opt) const
195 Info("Draw","%s",opt);