]>
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 | ||
16 | /* | |
17 | $Log$ | |
03f221a7 | 18 | Revision 1.8 2000/11/12 17:17:03 pcrochet |
19 | BuildGeometry of AliMUON for trigger chambers delegated to AliMUONSegmentationTriggerX (same strategy as for tracking chambers) | |
20 | ||
5fd73042 | 21 | Revision 1.7 2000/10/03 21:48:07 morsch |
22 | Adopt to const declaration of some of the methods in AliSegmentation. | |
23 | ||
c3eff6ad | 24 | Revision 1.6 2000/10/02 16:58:29 egangler |
25 | Cleaning of the code : | |
26 | -> coding conventions | |
27 | -> void Streamers | |
28 | -> some useless includes removed or replaced by "class" statement | |
29 | ||
ecfa008b | 30 | Revision 1.5 2000/07/03 11:54:57 morsch |
31 | AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER | |
32 | The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC. | |
33 | ||
a30a000f | 34 | Revision 1.4 2000/06/29 12:34:09 morsch |
35 | AliMUONSegmentation class has been made independent of AliMUONChamber. This makes | |
36 | it usable with any other geometry class. The link to the object to which it belongs is | |
37 | established via an index. This assumes that there exists a global geometry manager | |
38 | from which the pointer to the parent object can be obtained (in our case gAlice). | |
39 | ||
d81db581 | 40 | Revision 1.3 2000/06/26 10:01:26 pcrochet |
41 | global variables removed | |
42 | ||
3f2cdba8 | 43 | Revision 1.2 2000/06/15 07:58:48 morsch |
44 | Code from MUON-dev joined | |
45 | ||
a9e2aefa | 46 | Revision 1.1.2.1 2000/06/09 21:51:03 morsch |
47 | Code from AliMUONSegResTrigger.cxx | |
48 | ||
49 | */ | |
50 | ||
51 | ||
3f2cdba8 | 52 | |
a9e2aefa | 53 | /* |
54 | Old Log: | |
55 | Revision 1.1.2.4 2000/04/26 12:33:25 morsch | |
56 | Minor changes in some methods (CP) | |
57 | ||
58 | Revision 1.1.2.3 2000/03/20 18:14:16 morsch | |
59 | Missing sector added. | |
60 | ||
61 | Revision 1.1.2.2 2000/02/20 07:50:49 morsch | |
62 | Bugs in Dpx, Dpy and ISector methods corrected (P.C.) | |
63 | ||
64 | Revision 1.1.2.1 2000/02/17 14:33:49 morsch | |
65 | Draft version from P. Crochet | |
66 | ||
67 | */ | |
68 | ||
5fd73042 | 69 | #include <TMath.h> |
70 | #include <TBRIK.h> | |
71 | #include <TNode.h> | |
72 | #include <TGeometry.h> | |
73 | ||
74 | #include "AliMUON.h" | |
a9e2aefa | 75 | #include "AliMUONSegmentationTriggerX.h" |
3f2cdba8 | 76 | #include "AliMUONTriggerConstants.h" |
a9e2aefa | 77 | #include "TMath.h" |
78 | #include "TRandom.h" | |
79 | #include "TArc.h" | |
80 | #include "AliMUONChamber.h" | |
5fd73042 | 81 | #include "AliRun.h" // gAlice |
a9e2aefa | 82 | #include <iostream.h> |
83 | ClassImp(AliMUONSegmentationTriggerX) | |
3f2cdba8 | 84 | |
85 | //------------------------------------------------------------------ | |
d81db581 | 86 | void AliMUONSegmentationTriggerX::Init(Int_t chamber) |
a9e2aefa | 87 | { |
3f2cdba8 | 88 | // intialize X segmentation |
a9e2aefa | 89 | cout << "Initialize Trigger Chamber Geometry X " << "\n"; |
d81db581 | 90 | AliMUONSegmentationTrigger::Init(chamber); |
a9e2aefa | 91 | |
92 | // calculate x & y position of X strips | |
3f2cdba8 | 93 | Int_t nModule=AliMUONTriggerConstants::Nmodule(); |
94 | for (Int_t imodule=0; imodule<nModule; imodule++) { | |
95 | Float_t width=StripSizeX(AliMUONTriggerConstants::ModuleId(imodule)); | |
96 | Int_t nStrip=AliMUONTriggerConstants::NstripX(imodule); | |
97 | for (Int_t istrip=0; istrip<nStrip; istrip++){ | |
98 | fXofxsmin[imodule][istrip] = AliMUONTriggerConstants::XcMin(imodule)*fZscale; | |
99 | fXofxsmax[imodule][istrip] = AliMUONTriggerConstants::XcMax(imodule)*fZscale; | |
a9e2aefa | 100 | |
3f2cdba8 | 101 | fYofxsmin[imodule][istrip] = (fYcmin[imodule]+width*(istrip))*fZscale; |
102 | fYofxsmax[imodule][istrip] = (fYcmin[imodule]+width*(istrip+1))*fZscale; | |
a9e2aefa | 103 | } |
104 | } | |
105 | } | |
106 | ||
107 | //------------------------------------------------------------------ | |
c3eff6ad | 108 | void AliMUONSegmentationTriggerX::GetPadI(Float_t x,Float_t y,Int_t &ix,Int_t &iy) |
109 | { | |
a9e2aefa | 110 | // Returns pad coordinates (ix,iy) for given real coordinates (x,y) |
111 | // x,y = real coordinates; ix = module number , iy = strip number | |
112 | ix = 0; | |
113 | iy = 0; | |
3f2cdba8 | 114 | Int_t nModule=AliMUONTriggerConstants::Nmodule(); |
115 | for (Int_t imodule=0; imodule<nModule; imodule++) { | |
116 | Int_t nStrip=AliMUONTriggerConstants::NstripX(imodule); | |
117 | for (Int_t istrip=0; istrip<nStrip; istrip++){ | |
118 | if (x>fXofxsmin[imodule][istrip]&&x<fXofxsmax[imodule][istrip]&& | |
119 | y>fYofxsmin[imodule][istrip]&&y<fYofxsmax[imodule][istrip]){ | |
120 | ix = AliMUONTriggerConstants::ModuleId(imodule); | |
121 | iy = istrip; | |
122 | } | |
a9e2aefa | 123 | } |
a9e2aefa | 124 | } |
125 | } | |
126 | ||
127 | //------------------------------------------------------------------ | |
c3eff6ad | 128 | void AliMUONSegmentationTriggerX::GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y) |
129 | { | |
a9e2aefa | 130 | // Returns real coordinates (x,y) for given pad coordinates (ix,iy) |
131 | // ix = module number , iy = strip number; x,y = center of strip | |
132 | x = 0.; | |
133 | y = 0.; | |
3f2cdba8 | 134 | Int_t nModule=AliMUONTriggerConstants::Nmodule(); |
135 | ||
136 | for (Int_t imodule=0; imodule<nModule; imodule++) { | |
137 | if (AliMUONTriggerConstants::ModuleId(imodule)==ix){ | |
a9e2aefa | 138 | x=fXofxsmin[imodule][iy]+(fXofxsmax[imodule][iy]-fXofxsmin[imodule][iy])/2.; |
139 | y=fYofxsmin[imodule][iy]+(fYofxsmax[imodule][iy]-fYofxsmin[imodule][iy])/2.; | |
140 | } | |
141 | } | |
142 | } | |
143 | ||
144 | //------------------------------------------------------------------ | |
145 | void AliMUONSegmentationTriggerX::SetPadSize(Float_t p1, Float_t p2) | |
146 | { | |
147 | // Sets the padsize | |
148 | // | |
149 | fDpx=p1; | |
150 | fDpy=p2; | |
151 | } | |
152 | ||
153 | //------------------------------------------------------------------ | |
154 | void AliMUONSegmentationTriggerX:: | |
03f221a7 | 155 | Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10]){ |
156 | // Returns list of 10 next neighbours for given X strip (ix, iy) | |
157 | // neighbour number 4 in the list - | |
158 | // neighbour number 3 in the list | | |
159 | // neighbour number 2 in the list |_ Upper part | |
160 | // neighbour number 1 in the list | | |
161 | // neighbour number 0 in the list - | |
162 | // X strip (ix, iy) | |
163 | // neighbour number 5 in the list - | |
164 | // neighbour number 6 in the list | _ Lower part | |
165 | // neighbour number 7 in the list | | |
166 | // neighbour number 8 in the list | | |
167 | // neighbour number 9 in the list - | |
168 | ||
169 | Int_t absiX = TMath::Abs(iX); | |
170 | Int_t numModule = ModuleNumber(absiX); // module number Id. | |
171 | Int_t nStrip = AliMUONTriggerConstants::NstripX(numModule); //numb of strips | |
172 | Int_t iCandidateUp, iCandidateDo; | |
173 | Int_t j; | |
174 | ||
175 | *Nlist = 10; | |
176 | for (Int_t i=0; i<10; i++) Xlist[i]=Ylist[i]=0; | |
177 | ||
178 | if (iY < nStrip) { | |
179 | ||
180 | for (Int_t i=0; i<5; i++) { | |
181 | j = i + 5; | |
182 | iCandidateUp = iY + (i + 1); | |
183 | iCandidateDo = iY - (i + 1); | |
184 | if (iCandidateUp < nStrip) { | |
185 | Xlist[i] = iX; | |
186 | Ylist[i] = iCandidateUp; | |
187 | } | |
188 | if (iCandidateDo >= 0) { | |
189 | Xlist[j] = iX; | |
190 | Ylist[j] = iCandidateDo; | |
191 | } | |
a9e2aefa | 192 | } |
03f221a7 | 193 | |
194 | } // iY < nStrip | |
a9e2aefa | 195 | } |
196 | ||
197 | //------------------------------------------------------------------ | |
198 | void AliMUONSegmentationTriggerX::SetPad(Int_t ix, Int_t iy) | |
199 | { | |
200 | // Sets virtual pad coordinates, needed for evaluating pad response | |
201 | // outside the tracking program | |
ecfa008b | 202 | GetPadC(ix,iy,fX,fY); |
203 | GetPadI(fX,fY,fIx,fIy); | |
a9e2aefa | 204 | fSector=Sector(ix,iy); |
205 | } | |
206 | ||
207 | //------------------------------------------------------------------ | |
c3eff6ad | 208 | Int_t AliMUONSegmentationTriggerX::ISector() |
a9e2aefa | 209 | { return fSector;} |
210 | ||
211 | //------------------------------------------------------------------ | |
212 | Int_t AliMUONSegmentationTriggerX::Ix() | |
ecfa008b | 213 | { return fIx;} |
a9e2aefa | 214 | |
215 | //------------------------------------------------------------------ | |
c3eff6ad | 216 | |
a9e2aefa | 217 | Int_t AliMUONSegmentationTriggerX::Iy() |
ecfa008b | 218 | { return fIy;} |
a9e2aefa | 219 | |
220 | //------------------------------------------------------------------ | |
c3eff6ad | 221 | Float_t AliMUONSegmentationTriggerX::Dpx(Int_t isec) const |
3f2cdba8 | 222 | { |
223 | // returns x size of x strips for sector isec | |
a9e2aefa | 224 | |
225 | if (isec==1) { | |
226 | return 17.0*fZscale; | |
227 | } else if (isec==2) { | |
228 | return 34.0*fZscale; | |
229 | } else if (isec==3) { | |
230 | return 34.0*fZscale; | |
231 | } else if (isec==4) { | |
232 | return 34.0*fZscale; | |
233 | } else if (isec==5) { | |
234 | return 34.0*fZscale; | |
235 | } else if (isec==6) { | |
236 | return 68.0*fZscale; | |
237 | } else { | |
238 | return 0.; | |
239 | } | |
240 | } | |
241 | ||
242 | //------------------------------------------------------------------ | |
c3eff6ad | 243 | Float_t AliMUONSegmentationTriggerX::Dpy(Int_t isec) const |
3f2cdba8 | 244 | { |
245 | // returns y size of x strips for sector isec | |
a9e2aefa | 246 | |
247 | if (isec==1) { | |
248 | return 1.0625*fZscale; | |
249 | } else if (isec==2) { | |
250 | return 1.0625*fZscale; | |
251 | } else if (isec==3) { | |
252 | return 1.0625*fZscale; | |
253 | } else if (isec==4) { | |
254 | return 2.125*fZscale; | |
255 | } else if (isec==5) { | |
256 | return 4.25*fZscale; | |
257 | } else if (isec==6) { | |
258 | return 4.25*fZscale; | |
259 | } else { | |
260 | return 0.; | |
261 | } | |
262 | } | |
263 | ||
264 | //------------------------------------------------------------------ | |
265 | void AliMUONSegmentationTriggerX::SetHit(Float_t xhit, Float_t yhit) | |
3f2cdba8 | 266 | { |
267 | // set hit during disIntegration | |
268 | AliMUONSegmentationTrigger::SetHit(xhit,yhit); | |
269 | } | |
a9e2aefa | 270 | |
271 | //------------------------------------------------------------------ | |
c3eff6ad | 272 | Int_t AliMUONSegmentationTriggerX::Sector(Int_t ix, Int_t iy) |
a9e2aefa | 273 | { |
274 | // Returns sector number for given module | |
275 | // | |
3f2cdba8 | 276 | |
a9e2aefa | 277 | Int_t absix=TMath::Abs(ix); |
278 | Int_t iwidth=Int_t(StripSizeX(absix)); | |
3f2cdba8 | 279 | |
a9e2aefa | 280 | if (absix==52) { |
281 | return 1; | |
282 | } else if (absix==41||absix==61) { | |
283 | return 2; | |
284 | } else if (iwidth==1) { | |
285 | return 3; | |
286 | } else if (iwidth==2) { | |
287 | return 4; | |
288 | } else if ((absix>=11&&absix<17)||(absix>=91&&absix<97)) { | |
289 | return 5; | |
290 | } else if (iwidth==4) { | |
291 | return 6; | |
292 | } else { | |
293 | return 0; | |
294 | } | |
295 | } | |
296 | ||
297 | //------------------------------------------------------------------ | |
298 | void AliMUONSegmentationTriggerX:: | |
03f221a7 | 299 | IntegrationLimits(Float_t& x1, Float_t& x2, Float_t& x3, Float_t& x4) |
3f2cdba8 | 300 | { |
301 | // returns quantities needed to evaluate neighbour strip response | |
302 | ||
a9e2aefa | 303 | Int_t ix,iy; |
304 | Float_t xstrip,ystrip; | |
ecfa008b | 305 | GetPadI(fXhit,fYhit,ix,iy); |
a30a000f | 306 | GetPadC(ix,iy,xstrip,ystrip); |
ecfa008b | 307 | x1=fYhit; // hit y position |
a9e2aefa | 308 | x2=ystrip; // y coordinate of the main strip |
ecfa008b | 309 | x3=fY; // current strip real y coordinate |
03f221a7 | 310 | // width=StripSizeX(ix); // width of the main strip |
311 | ||
312 | // find the position of the 2 borders of the current strip | |
313 | Float_t ymin = fYofxsmin[ModuleNumber(fIx)][fIy]; | |
314 | Float_t ymax = fYofxsmax[ModuleNumber(fIx)][fIy]; | |
315 | ||
316 | // dist. between the hit and the closest border of the current strip | |
317 | x4 = (TMath::Abs(ymax-x1) > TMath::Abs(ymin-x1)) ? | |
318 | TMath::Abs(ymin-x1):TMath::Abs(ymax-x1); | |
319 | ||
a9e2aefa | 320 | } |
321 | ||
5fd73042 | 322 | //------------------------------------------------------------------ |
323 | void AliMUONSegmentationTriggerX::Draw(const char* opt) const | |
324 | { | |
325 | ||
326 | if (!strcmp(opt,"eventdisplay")) { | |
327 | TNode *node, *nodeS; | |
328 | char nameChamber[10], nameNode[10]; | |
329 | char nameSense1[10], nameSense2[10], nameSense3[10], nameSense4[10]; | |
330 | ||
331 | TNode* top=gAlice->GetGeometry()->GetNode("alice"); | |
332 | sprintf(nameChamber,"C_MUON%d",fId+1); | |
333 | new TBRIK(nameChamber,"Mother","void",340.,340.,0.25); | |
334 | top->cd(); | |
335 | sprintf(nameNode,"MUON%d",100+fId+1); | |
336 | node = new TNode(nameNode,"Chambernode",nameChamber,0,0,fChamber->Z(),""); | |
337 | node->SetLineColor(kBlack); | |
338 | AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON"); | |
339 | (pMUON->Nodes())->Add(node); | |
340 | ||
341 | sprintf(nameSense1,"S1_MUON%d",fId+1); | |
342 | sprintf(nameSense2,"S2_MUON%d",fId+1); | |
343 | sprintf(nameSense3,"S3_MUON%d",fId+1); | |
344 | sprintf(nameSense4,"S4_MUON%d",fId+1); | |
345 | ||
346 | for (Int_t imodule=0; imodule<AliMUONTriggerConstants::Nmodule(); imodule++) { | |
347 | Int_t idModule=AliMUONTriggerConstants::ModuleId(imodule); | |
348 | ||
349 | if (TMath::Abs(idModule)!=51) { | |
350 | ||
351 | Int_t nStripX=AliMUONTriggerConstants::NstripX(imodule); | |
352 | Float_t xmin=fXofxsmin[imodule][0]; | |
353 | Float_t xmax=fXofxsmax[imodule][nStripX-1]; | |
354 | Float_t ymin=fYofxsmin[imodule][0]; | |
355 | Float_t ymax=fYofxsmax[imodule][nStripX-1]; | |
356 | Float_t xpos=xmin+(xmax-xmin)/2.; | |
357 | Float_t ypos=ymin+(ymax-ymin)/2.; | |
358 | Float_t halfx=(xmax-xmin)/2.; | |
359 | Float_t halfy=(ymax-ymin)/2.; | |
360 | ||
361 | if (idModule==11) | |
362 | new TBRIK(nameSense1,"Module","void",halfx,halfy,0.25); | |
363 | if (idModule==17) | |
364 | new TBRIK(nameSense2,"Module","void",halfx,halfy,0.25); | |
365 | if (idModule==41) | |
366 | new TBRIK(nameSense3,"Module","void",halfx,halfy,0.25); | |
367 | if (idModule==52) | |
368 | new TBRIK(nameSense4,"Module","void",halfx,halfy,0.25); | |
369 | node->cd(); | |
370 | sprintf(nameNode,"S_MUON%d",1000*fId+1+imodule); | |
371 | ||
372 | if (TMath::Abs(idModule)==41||TMath::Abs(idModule)==61) { | |
373 | nodeS = new TNode(nameNode,"Module",nameSense3,xpos,ypos,0,""); | |
374 | } else if (TMath::Abs(idModule)==52) { | |
375 | nodeS = new TNode(nameNode,"Module",nameSense4,xpos,ypos,0,""); | |
376 | } else if (TMath::Abs((idModule-Int_t(idModule/10)*10.))!=7) { | |
377 | nodeS = new TNode(nameNode,"Module",nameSense1,xpos,ypos,0,""); | |
378 | } else { | |
379 | // } else if (TMath::Abs((idModule-Int_t(idModule/10)*10.))==7) { | |
380 | nodeS = new TNode(nameNode,"Module",nameSense2,xpos,ypos,0,""); | |
381 | } | |
382 | nodeS->SetLineColor(kBlue); | |
383 | node->cd(); | |
384 | } | |
385 | } | |
386 | } | |
387 | } | |
a9e2aefa | 388 | |
389 |