1 /////////////////////////////////////////////////////////
2 // Manager and hits classes for set:MUON version 0 //
3 /////////////////////////////////////////////////////////
10 #include "AliMUONsegmentv1.h"
15 //___________________________________________
16 ClassImp(AliMUONsegmentationV1)
18 AliMUONsegmentationV1::AliMUONsegmentationV1()
19 // initizalize the class with default settings
24 fDpx=0.0; // forces crash if not initialized by user
30 void AliMUONsegmentationV1::Init(AliMUONchamber* Chamber)
32 // valid only for T5/6
33 frSensMin2 = (Chamber->frMin + 6.)*(Chamber->frMin + 6.);
34 frSensMax2 = (Chamber->frMax - 6.)*(Chamber->frMax - 6.);
35 fNpx=(Int_t) (Chamber->frMax/fDpx) + 1;
36 fNpy=(Int_t) (Chamber->frMax/fDpy) + 1;
41 void AliMUONsegmentationV1::DefaultCut(void)
59 Int_t AliMUONsegmentationV1::GetiAnod(Float_t xhit)
61 Int_t kwire=Int_t((TMath::Abs(xhit)-fSensOffset)/fDAnod)+1;
62 return (xhit>0) ? kwire : -kwire ;
65 Float_t AliMUONsegmentationV1::GetAnod(Float_t xhit)
67 Int_t kwire=Int_t((TMath::Abs(xhit)-fSensOffset)/fDAnod)+1; // to be compatible ...
68 return (xhit>0) ? fDAnod*(kwire-0.5)+fSensOffset : -fDAnod*(kwire-0.5)-fSensOffset ;
71 // For chamber T5/6 p1 and p2 should be same for each zone
72 void AliMUONsegmentationV1::SetPADSIZ(Float_t p1, Float_t p2)
78 void AliMUONsegmentationV1::
79 GetPadIxy(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
81 // returns pad coordinates (ix,iy) for given real coordinates (x,y)
83 ix = (x>0)? Int_t((x-fSensOffset)/fDpx)+1 : Int_t((x+fSensOffset)/fDpx)-1;
84 iy = (y>0)? Int_t((y-fSensOffset)/fDpy)+1 : Int_t((y+fSensOffset)/fDpy)-1;
87 void AliMUONsegmentationV1::
88 GetPadCxy(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
90 // returns real coordinates (x,y) for given pad coordinates (ix,iy)
92 x = (ix>0) ? (Float_t(ix)-0.5)*fDpx+fSensOffset : (Float_t(ix)+0.5)*fDpx-fSensOffset;
93 y = (iy>0) ? (Float_t(iy)-0.5)*fDpy+fSensOffset : (Float_t(iy)+0.5)*fDpy-fSensOffset;
96 void AliMUONsegmentationV1::AddCut(Int_t Zone, Int_t nX, Int_t nY)
97 {// the pad nX,nY is last INSIDE zone Zone
98 if (Zone+1>=fNzone) // no cut for last Zone : it is the natural boundary of the chamber
99 printf("AliMUONsegmentationV1::AddCut ==> Zone %d not allowed !\n",Zone);
100 fZoneX[Zone][fNZoneCut[Zone]] = nX;
101 fZoneY[Zone][fNZoneCut[Zone]] = nY;
105 Int_t AliMUONsegmentationV1::GetZone(Float_t X, Float_t Y)
108 GetPadIxy(X,Y,iX,iY);
109 return GetZone( iX , iY );
112 Int_t AliMUONsegmentationV1::GetZone(Int_t nX, Int_t nY)
113 {// Beware : first pad begins at 1 !!
114 Int_t aX = TMath::Abs(nX);
115 Int_t aY = TMath::Abs(nY);
117 for (Int_t iZone=fNzone-2;iZone>=0;iZone--)
119 for (Int_t iCut=0;iCut<fNZoneCut[iZone];iCut++)
120 if ( aY<=fZoneY[iZone][iCut] && aX<=fZoneX[iZone][iCut] )
130 void AliMUONsegmentationV1::SetPadCoord(Int_t iX, Int_t iY)
132 GetPadCxy(iX,iY,fx,fy);
134 if ( ( (radius2=fx*fx+fy*fy) > frSensMax2 || radius2 < frSensMin2 )
140 void AliMUONsegmentationV1::FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy)
143 // Find the wire position (center of charge distribution)
144 Float_t x0a=GetAnod(xhit);
146 // and take fNsigma*sigma around this center
147 Float_t x01=x0a - dx;
148 Float_t x02=x0a + dx;
149 Float_t y01=yhit - dy;
150 Float_t y02=yhit + dy;
152 // Do not cross over frames...
154 x01 = TMath::Sign(fSensOffset, x0a);
156 x02 = TMath::Sign(fSensOffset, x0a);
158 y01 = TMath::Sign(fSensOffset, yhit);
160 y02 = TMath::Sign(fSensOffset, yhit);
162 // find the pads over which the charge distributes
163 GetPadIxy(x01,y01,fixmin,fiymin);
164 GetPadIxy(x02,y02,fixmax,fiymax);
166 // printf("\n FirstPad called");
167 // printf("\n Hit Position %f %f",xhit,yhit);
168 // printf("\n Integration limits: %i %i %i %i",fixmin,fixmax,fiymin,fiymax);
169 // printf("\n Integration limits: %f %f %f %f \n",x01,x02,y01,y02);
171 // Set current pad to lower left corner
174 SetPadCoord(fix,fiy);
177 void AliMUONsegmentationV1::NextPad()
180 // Step to next pad in integration region
183 } else if (fiy != fiymax) {
187 printf("\n Error: Stepping outside integration region\n ");
188 SetPadCoord(fix,fiy);
191 Int_t AliMUONsegmentationV1::MorePads()
193 // Are there more pads in the integration region
195 if (fix == fixmax && fiy == fiymax) {
202 Int_t AliMUONsegmentationV1::Ix()
203 // returns the X number of pad which has to increment charge
204 // due to parallel read-out
206 Int_t wix = TMath::Abs(fix)-1;
207 Int_t wiy = TMath::Abs(fiy)-1;
208 Int_t zone = GetZone(fix,fiy);
212 if ( wiy%3 !=1 && wix%6>2)
213 return (fix>0)? fix-3 : fix+3 ;
216 if ( (wiy%6 == 1 && wix%2 ==0) || (wiy%6 == 4 && wix%2 ==1))
218 return fix>0? fix - ((wix%12)/4)*4 : fix + ((wix%12)/4)*4;
220 printf("Couille dans AliMUONsegmentationV1::ix\n");
225 Int_t AliMUONsegmentationV1::ISector()
227 Int_t wix = TMath::Abs(fix)-1;
228 Int_t wiy = TMath::Abs(fiy)-1;
229 Int_t zone = GetZone(fix,fiy);
233 if ( wiy%3 !=1 && wix%6>2)
237 if ((wiy%6 == 1 && wix%2 ==0) || (wiy%6 == 4 && wix%2 ==1))
241 printf("Couille dans AliMUONsegmentationV1::ISector\n");
246 void AliMUONsegmentationV1::SigGenInit(Float_t x,Float_t y,Float_t)
249 // Initialises pad and wire position during stepping
252 GetPadIxy(x,y,fixt,fiyt);
257 Int_t AliMUONsegmentationV1::SigGenCond(Float_t x,Float_t y,Float_t)
260 // Signal will be generated if particle crosses pad boundary or
261 // boundary between two wires.
264 GetPadIxy(x,y,ixt,iyt);
265 Int_t iwt= GetiAnod(x);
267 if ((ixt != fixt) || (iyt !=fiyt) || (iwt != fiwt)) {
274 void AliMUONsegmentationV1::
275 IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
283 void AliMUONsegmentationV1::
284 Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[7], Int_t Ylist[7])
286 *Nlist=4;Xlist[0]=Xlist[1]=iX;Xlist[2]=iX-1;Xlist[3]=iX+1;
287 Ylist[0]=iY-1;Ylist[1]=iY+1;Ylist[2]=Ylist[3]=iY;
290 void AliMUONsegmentationV1::
291 FitXY(AliMUONRecCluster* ,TClonesArray* )
292 // Default : Centre of gravity method