]>
Commit | Line | Data |
---|---|---|
a9e2aefa | 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 | ||
88cb7938 | 16 | /* $Id$ */ |
a9e2aefa | 17 | |
5fd73042 | 18 | #include <TMath.h> |
19 | #include <TBRIK.h> | |
20 | #include <TNode.h> | |
21 | #include <TGeometry.h> | |
22 | ||
23 | #include "AliMUON.h" | |
a9e2aefa | 24 | #include "AliMUONSegmentationTriggerX.h" |
3f2cdba8 | 25 | #include "AliMUONTriggerConstants.h" |
a9e2aefa | 26 | #include "TMath.h" |
27 | #include "TRandom.h" | |
28 | #include "TArc.h" | |
29 | #include "AliMUONChamber.h" | |
5fd73042 | 30 | #include "AliRun.h" // gAlice |
70479d0e | 31 | #include <Riostream.h> |
a9e2aefa | 32 | ClassImp(AliMUONSegmentationTriggerX) |
3f2cdba8 | 33 | |
34 | //------------------------------------------------------------------ | |
d81db581 | 35 | void AliMUONSegmentationTriggerX::Init(Int_t chamber) |
a9e2aefa | 36 | { |
3f2cdba8 | 37 | // intialize X segmentation |
9e1a0ddb | 38 | AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON"); |
ef077202 | 39 | if(pMUON->GetDebug()>1) printf("%s: Initialize Trigger Chamber Geometry X\n",ClassName()); |
d81db581 | 40 | AliMUONSegmentationTrigger::Init(chamber); |
a9e2aefa | 41 | |
42 | // calculate x & y position of X strips | |
3f2cdba8 | 43 | Int_t nModule=AliMUONTriggerConstants::Nmodule(); |
44 | for (Int_t imodule=0; imodule<nModule; imodule++) { | |
45 | Float_t width=StripSizeX(AliMUONTriggerConstants::ModuleId(imodule)); | |
46 | Int_t nStrip=AliMUONTriggerConstants::NstripX(imodule); | |
47 | for (Int_t istrip=0; istrip<nStrip; istrip++){ | |
48 | fXofxsmin[imodule][istrip] = AliMUONTriggerConstants::XcMin(imodule)*fZscale; | |
49 | fXofxsmax[imodule][istrip] = AliMUONTriggerConstants::XcMax(imodule)*fZscale; | |
a9e2aefa | 50 | |
3f2cdba8 | 51 | fYofxsmin[imodule][istrip] = (fYcmin[imodule]+width*(istrip))*fZscale; |
52 | fYofxsmax[imodule][istrip] = (fYcmin[imodule]+width*(istrip+1))*fZscale; | |
a9e2aefa | 53 | } |
54 | } | |
55 | } | |
56 | ||
57 | //------------------------------------------------------------------ | |
c3eff6ad | 58 | void AliMUONSegmentationTriggerX::GetPadI(Float_t x,Float_t y,Int_t &ix,Int_t &iy) |
59 | { | |
a9e2aefa | 60 | // Returns pad coordinates (ix,iy) for given real coordinates (x,y) |
61 | // x,y = real coordinates; ix = module number , iy = strip number | |
62 | ix = 0; | |
63 | iy = 0; | |
3f2cdba8 | 64 | Int_t nModule=AliMUONTriggerConstants::Nmodule(); |
65 | for (Int_t imodule=0; imodule<nModule; imodule++) { | |
66 | Int_t nStrip=AliMUONTriggerConstants::NstripX(imodule); | |
67 | for (Int_t istrip=0; istrip<nStrip; istrip++){ | |
68 | if (x>fXofxsmin[imodule][istrip]&&x<fXofxsmax[imodule][istrip]&& | |
69 | y>fYofxsmin[imodule][istrip]&&y<fYofxsmax[imodule][istrip]){ | |
70 | ix = AliMUONTriggerConstants::ModuleId(imodule); | |
71 | iy = istrip; | |
72 | } | |
a9e2aefa | 73 | } |
a9e2aefa | 74 | } |
75 | } | |
76 | ||
77 | //------------------------------------------------------------------ | |
c3eff6ad | 78 | void AliMUONSegmentationTriggerX::GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y) |
79 | { | |
a9e2aefa | 80 | // Returns real coordinates (x,y) for given pad coordinates (ix,iy) |
81 | // ix = module number , iy = strip number; x,y = center of strip | |
82 | x = 0.; | |
83 | y = 0.; | |
3f2cdba8 | 84 | Int_t nModule=AliMUONTriggerConstants::Nmodule(); |
85 | ||
86 | for (Int_t imodule=0; imodule<nModule; imodule++) { | |
87 | if (AliMUONTriggerConstants::ModuleId(imodule)==ix){ | |
a9e2aefa | 88 | x=fXofxsmin[imodule][iy]+(fXofxsmax[imodule][iy]-fXofxsmin[imodule][iy])/2.; |
89 | y=fYofxsmin[imodule][iy]+(fYofxsmax[imodule][iy]-fYofxsmin[imodule][iy])/2.; | |
90 | } | |
91 | } | |
92 | } | |
93 | ||
94 | //------------------------------------------------------------------ | |
95 | void AliMUONSegmentationTriggerX::SetPadSize(Float_t p1, Float_t p2) | |
96 | { | |
97 | // Sets the padsize | |
98 | // | |
99 | fDpx=p1; | |
100 | fDpy=p2; | |
101 | } | |
102 | ||
103 | //------------------------------------------------------------------ | |
104 | void AliMUONSegmentationTriggerX:: | |
03f221a7 | 105 | Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10]){ |
106 | // Returns list of 10 next neighbours for given X strip (ix, iy) | |
107 | // neighbour number 4 in the list - | |
108 | // neighbour number 3 in the list | | |
109 | // neighbour number 2 in the list |_ Upper part | |
110 | // neighbour number 1 in the list | | |
111 | // neighbour number 0 in the list - | |
112 | // X strip (ix, iy) | |
113 | // neighbour number 5 in the list - | |
114 | // neighbour number 6 in the list | _ Lower part | |
115 | // neighbour number 7 in the list | | |
116 | // neighbour number 8 in the list | | |
117 | // neighbour number 9 in the list - | |
118 | ||
119 | Int_t absiX = TMath::Abs(iX); | |
120 | Int_t numModule = ModuleNumber(absiX); // module number Id. | |
121 | Int_t nStrip = AliMUONTriggerConstants::NstripX(numModule); //numb of strips | |
122 | Int_t iCandidateUp, iCandidateDo; | |
123 | Int_t j; | |
124 | ||
125 | *Nlist = 10; | |
126 | for (Int_t i=0; i<10; i++) Xlist[i]=Ylist[i]=0; | |
127 | ||
128 | if (iY < nStrip) { | |
129 | ||
130 | for (Int_t i=0; i<5; i++) { | |
131 | j = i + 5; | |
132 | iCandidateUp = iY + (i + 1); | |
133 | iCandidateDo = iY - (i + 1); | |
134 | if (iCandidateUp < nStrip) { | |
135 | Xlist[i] = iX; | |
136 | Ylist[i] = iCandidateUp; | |
137 | } | |
138 | if (iCandidateDo >= 0) { | |
139 | Xlist[j] = iX; | |
140 | Ylist[j] = iCandidateDo; | |
141 | } | |
a9e2aefa | 142 | } |
03f221a7 | 143 | |
144 | } // iY < nStrip | |
a9e2aefa | 145 | } |
146 | ||
147 | //------------------------------------------------------------------ | |
148 | void AliMUONSegmentationTriggerX::SetPad(Int_t ix, Int_t iy) | |
149 | { | |
150 | // Sets virtual pad coordinates, needed for evaluating pad response | |
151 | // outside the tracking program | |
ecfa008b | 152 | GetPadC(ix,iy,fX,fY); |
153 | GetPadI(fX,fY,fIx,fIy); | |
a9e2aefa | 154 | fSector=Sector(ix,iy); |
155 | } | |
156 | ||
157 | //------------------------------------------------------------------ | |
c3eff6ad | 158 | Int_t AliMUONSegmentationTriggerX::ISector() |
a9e2aefa | 159 | { return fSector;} |
160 | ||
161 | //------------------------------------------------------------------ | |
162 | Int_t AliMUONSegmentationTriggerX::Ix() | |
ecfa008b | 163 | { return fIx;} |
a9e2aefa | 164 | |
165 | //------------------------------------------------------------------ | |
c3eff6ad | 166 | |
a9e2aefa | 167 | Int_t AliMUONSegmentationTriggerX::Iy() |
ecfa008b | 168 | { return fIy;} |
a9e2aefa | 169 | |
170 | //------------------------------------------------------------------ | |
c3eff6ad | 171 | Float_t AliMUONSegmentationTriggerX::Dpx(Int_t isec) const |
3f2cdba8 | 172 | { |
173 | // returns x size of x strips for sector isec | |
a9e2aefa | 174 | |
175 | if (isec==1) { | |
176 | return 17.0*fZscale; | |
177 | } else if (isec==2) { | |
178 | return 34.0*fZscale; | |
179 | } else if (isec==3) { | |
180 | return 34.0*fZscale; | |
181 | } else if (isec==4) { | |
182 | return 34.0*fZscale; | |
183 | } else if (isec==5) { | |
184 | return 34.0*fZscale; | |
185 | } else if (isec==6) { | |
186 | return 68.0*fZscale; | |
187 | } else { | |
188 | return 0.; | |
189 | } | |
190 | } | |
191 | ||
192 | //------------------------------------------------------------------ | |
c3eff6ad | 193 | Float_t AliMUONSegmentationTriggerX::Dpy(Int_t isec) const |
3f2cdba8 | 194 | { |
195 | // returns y size of x strips for sector isec | |
a9e2aefa | 196 | |
197 | if (isec==1) { | |
198 | return 1.0625*fZscale; | |
199 | } else if (isec==2) { | |
200 | return 1.0625*fZscale; | |
201 | } else if (isec==3) { | |
202 | return 1.0625*fZscale; | |
203 | } else if (isec==4) { | |
204 | return 2.125*fZscale; | |
205 | } else if (isec==5) { | |
206 | return 4.25*fZscale; | |
207 | } else if (isec==6) { | |
208 | return 4.25*fZscale; | |
209 | } else { | |
210 | return 0.; | |
211 | } | |
212 | } | |
213 | ||
e889a146 | 214 | //------------------------------------------------------------------ |
215 | void AliMUONSegmentationTriggerX::GetPadI(Float_t x, Float_t y, Float_t /*z*/, Int_t &ix, Int_t &iy) | |
216 | { | |
217 | GetPadI(x, y, ix, iy); | |
218 | } | |
219 | ||
a9e2aefa | 220 | //------------------------------------------------------------------ |
221 | void AliMUONSegmentationTriggerX::SetHit(Float_t xhit, Float_t yhit) | |
3f2cdba8 | 222 | { |
223 | // set hit during disIntegration | |
224 | AliMUONSegmentationTrigger::SetHit(xhit,yhit); | |
225 | } | |
e889a146 | 226 | //------------------------------------------------------------------ |
227 | void AliMUONSegmentationTriggerX::SetHit(Float_t xhit, Float_t yhit, Float_t /*zhit*/) | |
228 | { | |
229 | SetHit(xhit, yhit); | |
230 | } | |
a9e2aefa | 231 | |
232 | //------------------------------------------------------------------ | |
e889a146 | 233 | Int_t AliMUONSegmentationTriggerX::Sector(Int_t ix, Int_t /*iy*/) |
a9e2aefa | 234 | { |
235 | // Returns sector number for given module | |
236 | // | |
3f2cdba8 | 237 | |
a9e2aefa | 238 | Int_t absix=TMath::Abs(ix); |
239 | Int_t iwidth=Int_t(StripSizeX(absix)); | |
3f2cdba8 | 240 | |
a9e2aefa | 241 | if (absix==52) { |
242 | return 1; | |
243 | } else if (absix==41||absix==61) { | |
244 | return 2; | |
245 | } else if (iwidth==1) { | |
246 | return 3; | |
247 | } else if (iwidth==2) { | |
248 | return 4; | |
249 | } else if ((absix>=11&&absix<17)||(absix>=91&&absix<97)) { | |
250 | return 5; | |
251 | } else if (iwidth==4) { | |
252 | return 6; | |
253 | } else { | |
254 | return 0; | |
255 | } | |
256 | } | |
257 | ||
258 | //------------------------------------------------------------------ | |
259 | void AliMUONSegmentationTriggerX:: | |
03f221a7 | 260 | IntegrationLimits(Float_t& x1, Float_t& x2, Float_t& x3, Float_t& x4) |
3f2cdba8 | 261 | { |
262 | // returns quantities needed to evaluate neighbour strip response | |
263 | ||
a9e2aefa | 264 | Int_t ix,iy; |
265 | Float_t xstrip,ystrip; | |
ecfa008b | 266 | GetPadI(fXhit,fYhit,ix,iy); |
a30a000f | 267 | GetPadC(ix,iy,xstrip,ystrip); |
ecfa008b | 268 | x1=fYhit; // hit y position |
a9e2aefa | 269 | x2=ystrip; // y coordinate of the main strip |
ecfa008b | 270 | x3=fY; // current strip real y coordinate |
03f221a7 | 271 | // width=StripSizeX(ix); // width of the main strip |
272 | ||
273 | // find the position of the 2 borders of the current strip | |
274 | Float_t ymin = fYofxsmin[ModuleNumber(fIx)][fIy]; | |
275 | Float_t ymax = fYofxsmax[ModuleNumber(fIx)][fIy]; | |
276 | ||
277 | // dist. between the hit and the closest border of the current strip | |
278 | x4 = (TMath::Abs(ymax-x1) > TMath::Abs(ymin-x1)) ? | |
279 | TMath::Abs(ymin-x1):TMath::Abs(ymax-x1); | |
280 | ||
a9e2aefa | 281 | } |
282 | ||
5fd73042 | 283 | //------------------------------------------------------------------ |
284 | void AliMUONSegmentationTriggerX::Draw(const char* opt) const | |
285 | { | |
de05461e | 286 | // Draw method for event display |
5fd73042 | 287 | if (!strcmp(opt,"eventdisplay")) { |
288 | TNode *node, *nodeS; | |
5eb14807 | 289 | char nameChamber[10], nameNode[11]; |
5fd73042 | 290 | char nameSense1[10], nameSense2[10], nameSense3[10], nameSense4[10]; |
291 | ||
292 | TNode* top=gAlice->GetGeometry()->GetNode("alice"); | |
293 | sprintf(nameChamber,"C_MUON%d",fId+1); | |
294 | new TBRIK(nameChamber,"Mother","void",340.,340.,0.25); | |
295 | top->cd(); | |
296 | sprintf(nameNode,"MUON%d",100+fId+1); | |
297 | node = new TNode(nameNode,"Chambernode",nameChamber,0,0,fChamber->Z(),""); | |
298 | node->SetLineColor(kBlack); | |
299 | AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON"); | |
300 | (pMUON->Nodes())->Add(node); | |
301 | ||
302 | sprintf(nameSense1,"S1_MUON%d",fId+1); | |
303 | sprintf(nameSense2,"S2_MUON%d",fId+1); | |
304 | sprintf(nameSense3,"S3_MUON%d",fId+1); | |
305 | sprintf(nameSense4,"S4_MUON%d",fId+1); | |
306 | ||
307 | for (Int_t imodule=0; imodule<AliMUONTriggerConstants::Nmodule(); imodule++) { | |
308 | Int_t idModule=AliMUONTriggerConstants::ModuleId(imodule); | |
309 | ||
310 | if (TMath::Abs(idModule)!=51) { | |
311 | ||
312 | Int_t nStripX=AliMUONTriggerConstants::NstripX(imodule); | |
313 | Float_t xmin=fXofxsmin[imodule][0]; | |
314 | Float_t xmax=fXofxsmax[imodule][nStripX-1]; | |
315 | Float_t ymin=fYofxsmin[imodule][0]; | |
316 | Float_t ymax=fYofxsmax[imodule][nStripX-1]; | |
317 | Float_t xpos=xmin+(xmax-xmin)/2.; | |
318 | Float_t ypos=ymin+(ymax-ymin)/2.; | |
319 | Float_t halfx=(xmax-xmin)/2.; | |
320 | Float_t halfy=(ymax-ymin)/2.; | |
321 | ||
322 | if (idModule==11) | |
323 | new TBRIK(nameSense1,"Module","void",halfx,halfy,0.25); | |
324 | if (idModule==17) | |
325 | new TBRIK(nameSense2,"Module","void",halfx,halfy,0.25); | |
326 | if (idModule==41) | |
327 | new TBRIK(nameSense3,"Module","void",halfx,halfy,0.25); | |
328 | if (idModule==52) | |
329 | new TBRIK(nameSense4,"Module","void",halfx,halfy,0.25); | |
330 | node->cd(); | |
331 | sprintf(nameNode,"S_MUON%d",1000*fId+1+imodule); | |
332 | ||
333 | if (TMath::Abs(idModule)==41||TMath::Abs(idModule)==61) { | |
334 | nodeS = new TNode(nameNode,"Module",nameSense3,xpos,ypos,0,""); | |
335 | } else if (TMath::Abs(idModule)==52) { | |
336 | nodeS = new TNode(nameNode,"Module",nameSense4,xpos,ypos,0,""); | |
337 | } else if (TMath::Abs((idModule-Int_t(idModule/10)*10.))!=7) { | |
338 | nodeS = new TNode(nameNode,"Module",nameSense1,xpos,ypos,0,""); | |
339 | } else { | |
340 | // } else if (TMath::Abs((idModule-Int_t(idModule/10)*10.))==7) { | |
341 | nodeS = new TNode(nameNode,"Module",nameSense2,xpos,ypos,0,""); | |
342 | } | |
343 | nodeS->SetLineColor(kBlue); | |
344 | node->cd(); | |
345 | } | |
346 | } | |
347 | } | |
348 | } | |
a9e2aefa | 349 | |
350 | ||
de05461e | 351 | |
352 |