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 **************************************************************************/
18 Revision 1.10 2000/12/21 22:12:41 morsch
19 Clean-up of coding rule violations,
21 Revision 1.9 2000/11/20 21:44:17 pcrochet
22 some modifications to account for the new class AliMUONResponseTriggerV1
24 Revision 1.8 2000/11/12 17:17:03 pcrochet
25 BuildGeometry of AliMUON for trigger chambers delegated to AliMUONSegmentationTriggerX (same strategy as for tracking chambers)
27 Revision 1.7 2000/10/03 21:48:07 morsch
28 Adopt to const declaration of some of the methods in AliSegmentation.
30 Revision 1.6 2000/10/02 16:58:29 egangler
31 Cleaning of the code :
34 -> some useless includes removed or replaced by "class" statement
36 Revision 1.5 2000/07/03 11:54:57 morsch
37 AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
38 The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
40 Revision 1.4 2000/06/29 12:34:09 morsch
41 AliMUONSegmentation class has been made independent of AliMUONChamber. This makes
42 it usable with any other geometry class. The link to the object to which it belongs is
43 established via an index. This assumes that there exists a global geometry manager
44 from which the pointer to the parent object can be obtained (in our case gAlice).
46 Revision 1.3 2000/06/26 10:01:26 pcrochet
47 global variables removed
49 Revision 1.2 2000/06/15 07:58:48 morsch
50 Code from MUON-dev joined
52 Revision 1.1.2.1 2000/06/09 21:51:03 morsch
53 Code from AliMUONSegResTrigger.cxx
61 Revision 1.1.2.4 2000/04/26 12:33:25 morsch
62 Minor changes in some methods (CP)
64 Revision 1.1.2.3 2000/03/20 18:14:16 morsch
67 Revision 1.1.2.2 2000/02/20 07:50:49 morsch
68 Bugs in Dpx, Dpy and ISector methods corrected (P.C.)
70 Revision 1.1.2.1 2000/02/17 14:33:49 morsch
71 Draft version from P. Crochet
78 #include <TGeometry.h>
81 #include "AliMUONSegmentationTriggerX.h"
82 #include "AliMUONTriggerConstants.h"
86 #include "AliMUONChamber.h"
87 #include "AliRun.h" // gAlice
89 ClassImp(AliMUONSegmentationTriggerX)
91 //------------------------------------------------------------------
92 void AliMUONSegmentationTriggerX::Init(Int_t chamber)
94 // intialize X segmentation
95 AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON");
96 if(pMUON->GetDebug()) cout << ClassName() << ": Initialize Trigger Chamber Geometry X " << "\n";
97 AliMUONSegmentationTrigger::Init(chamber);
99 // calculate x & y position of X strips
100 Int_t nModule=AliMUONTriggerConstants::Nmodule();
101 for (Int_t imodule=0; imodule<nModule; imodule++) {
102 Float_t width=StripSizeX(AliMUONTriggerConstants::ModuleId(imodule));
103 Int_t nStrip=AliMUONTriggerConstants::NstripX(imodule);
104 for (Int_t istrip=0; istrip<nStrip; istrip++){
105 fXofxsmin[imodule][istrip] = AliMUONTriggerConstants::XcMin(imodule)*fZscale;
106 fXofxsmax[imodule][istrip] = AliMUONTriggerConstants::XcMax(imodule)*fZscale;
108 fYofxsmin[imodule][istrip] = (fYcmin[imodule]+width*(istrip))*fZscale;
109 fYofxsmax[imodule][istrip] = (fYcmin[imodule]+width*(istrip+1))*fZscale;
114 //------------------------------------------------------------------
115 void AliMUONSegmentationTriggerX::GetPadI(Float_t x,Float_t y,Int_t &ix,Int_t &iy)
117 // Returns pad coordinates (ix,iy) for given real coordinates (x,y)
118 // x,y = real coordinates; ix = module number , iy = strip number
121 Int_t nModule=AliMUONTriggerConstants::Nmodule();
122 for (Int_t imodule=0; imodule<nModule; imodule++) {
123 Int_t nStrip=AliMUONTriggerConstants::NstripX(imodule);
124 for (Int_t istrip=0; istrip<nStrip; istrip++){
125 if (x>fXofxsmin[imodule][istrip]&&x<fXofxsmax[imodule][istrip]&&
126 y>fYofxsmin[imodule][istrip]&&y<fYofxsmax[imodule][istrip]){
127 ix = AliMUONTriggerConstants::ModuleId(imodule);
134 //------------------------------------------------------------------
135 void AliMUONSegmentationTriggerX::GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
137 // Returns real coordinates (x,y) for given pad coordinates (ix,iy)
138 // ix = module number , iy = strip number; x,y = center of strip
141 Int_t nModule=AliMUONTriggerConstants::Nmodule();
143 for (Int_t imodule=0; imodule<nModule; imodule++) {
144 if (AliMUONTriggerConstants::ModuleId(imodule)==ix){
145 x=fXofxsmin[imodule][iy]+(fXofxsmax[imodule][iy]-fXofxsmin[imodule][iy])/2.;
146 y=fYofxsmin[imodule][iy]+(fYofxsmax[imodule][iy]-fYofxsmin[imodule][iy])/2.;
151 //------------------------------------------------------------------
152 void AliMUONSegmentationTriggerX::SetPadSize(Float_t p1, Float_t p2)
160 //------------------------------------------------------------------
161 void AliMUONSegmentationTriggerX::
162 Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10]){
163 // Returns list of 10 next neighbours for given X strip (ix, iy)
164 // neighbour number 4 in the list -
165 // neighbour number 3 in the list |
166 // neighbour number 2 in the list |_ Upper part
167 // neighbour number 1 in the list |
168 // neighbour number 0 in the list -
170 // neighbour number 5 in the list -
171 // neighbour number 6 in the list | _ Lower part
172 // neighbour number 7 in the list |
173 // neighbour number 8 in the list |
174 // neighbour number 9 in the list -
176 Int_t absiX = TMath::Abs(iX);
177 Int_t numModule = ModuleNumber(absiX); // module number Id.
178 Int_t nStrip = AliMUONTriggerConstants::NstripX(numModule); //numb of strips
179 Int_t iCandidateUp, iCandidateDo;
183 for (Int_t i=0; i<10; i++) Xlist[i]=Ylist[i]=0;
187 for (Int_t i=0; i<5; i++) {
189 iCandidateUp = iY + (i + 1);
190 iCandidateDo = iY - (i + 1);
191 if (iCandidateUp < nStrip) {
193 Ylist[i] = iCandidateUp;
195 if (iCandidateDo >= 0) {
197 Ylist[j] = iCandidateDo;
204 //------------------------------------------------------------------
205 void AliMUONSegmentationTriggerX::SetPad(Int_t ix, Int_t iy)
207 // Sets virtual pad coordinates, needed for evaluating pad response
208 // outside the tracking program
209 GetPadC(ix,iy,fX,fY);
210 GetPadI(fX,fY,fIx,fIy);
211 fSector=Sector(ix,iy);
214 //------------------------------------------------------------------
215 Int_t AliMUONSegmentationTriggerX::ISector()
218 //------------------------------------------------------------------
219 Int_t AliMUONSegmentationTriggerX::Ix()
222 //------------------------------------------------------------------
224 Int_t AliMUONSegmentationTriggerX::Iy()
227 //------------------------------------------------------------------
228 Float_t AliMUONSegmentationTriggerX::Dpx(Int_t isec) const
230 // returns x size of x strips for sector isec
234 } else if (isec==2) {
236 } else if (isec==3) {
238 } else if (isec==4) {
240 } else if (isec==5) {
242 } else if (isec==6) {
249 //------------------------------------------------------------------
250 Float_t AliMUONSegmentationTriggerX::Dpy(Int_t isec) const
252 // returns y size of x strips for sector isec
255 return 1.0625*fZscale;
256 } else if (isec==2) {
257 return 1.0625*fZscale;
258 } else if (isec==3) {
259 return 1.0625*fZscale;
260 } else if (isec==4) {
261 return 2.125*fZscale;
262 } else if (isec==5) {
264 } else if (isec==6) {
271 //------------------------------------------------------------------
272 void AliMUONSegmentationTriggerX::SetHit(Float_t xhit, Float_t yhit)
274 // set hit during disIntegration
275 AliMUONSegmentationTrigger::SetHit(xhit,yhit);
278 //------------------------------------------------------------------
279 Int_t AliMUONSegmentationTriggerX::Sector(Int_t ix, Int_t iy)
281 // Returns sector number for given module
284 Int_t absix=TMath::Abs(ix);
285 Int_t iwidth=Int_t(StripSizeX(absix));
289 } else if (absix==41||absix==61) {
291 } else if (iwidth==1) {
293 } else if (iwidth==2) {
295 } else if ((absix>=11&&absix<17)||(absix>=91&&absix<97)) {
297 } else if (iwidth==4) {
304 //------------------------------------------------------------------
305 void AliMUONSegmentationTriggerX::
306 IntegrationLimits(Float_t& x1, Float_t& x2, Float_t& x3, Float_t& x4)
308 // returns quantities needed to evaluate neighbour strip response
311 Float_t xstrip,ystrip;
312 GetPadI(fXhit,fYhit,ix,iy);
313 GetPadC(ix,iy,xstrip,ystrip);
314 x1=fYhit; // hit y position
315 x2=ystrip; // y coordinate of the main strip
316 x3=fY; // current strip real y coordinate
317 // width=StripSizeX(ix); // width of the main strip
319 // find the position of the 2 borders of the current strip
320 Float_t ymin = fYofxsmin[ModuleNumber(fIx)][fIy];
321 Float_t ymax = fYofxsmax[ModuleNumber(fIx)][fIy];
323 // dist. between the hit and the closest border of the current strip
324 x4 = (TMath::Abs(ymax-x1) > TMath::Abs(ymin-x1)) ?
325 TMath::Abs(ymin-x1):TMath::Abs(ymax-x1);
329 //------------------------------------------------------------------
330 void AliMUONSegmentationTriggerX::Draw(const char* opt) const
332 // Draw method for event display
333 if (!strcmp(opt,"eventdisplay")) {
335 char nameChamber[10], nameNode[10];
336 char nameSense1[10], nameSense2[10], nameSense3[10], nameSense4[10];
338 TNode* top=gAlice->GetGeometry()->GetNode("alice");
339 sprintf(nameChamber,"C_MUON%d",fId+1);
340 new TBRIK(nameChamber,"Mother","void",340.,340.,0.25);
342 sprintf(nameNode,"MUON%d",100+fId+1);
343 node = new TNode(nameNode,"Chambernode",nameChamber,0,0,fChamber->Z(),"");
344 node->SetLineColor(kBlack);
345 AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON");
346 (pMUON->Nodes())->Add(node);
348 sprintf(nameSense1,"S1_MUON%d",fId+1);
349 sprintf(nameSense2,"S2_MUON%d",fId+1);
350 sprintf(nameSense3,"S3_MUON%d",fId+1);
351 sprintf(nameSense4,"S4_MUON%d",fId+1);
353 for (Int_t imodule=0; imodule<AliMUONTriggerConstants::Nmodule(); imodule++) {
354 Int_t idModule=AliMUONTriggerConstants::ModuleId(imodule);
356 if (TMath::Abs(idModule)!=51) {
358 Int_t nStripX=AliMUONTriggerConstants::NstripX(imodule);
359 Float_t xmin=fXofxsmin[imodule][0];
360 Float_t xmax=fXofxsmax[imodule][nStripX-1];
361 Float_t ymin=fYofxsmin[imodule][0];
362 Float_t ymax=fYofxsmax[imodule][nStripX-1];
363 Float_t xpos=xmin+(xmax-xmin)/2.;
364 Float_t ypos=ymin+(ymax-ymin)/2.;
365 Float_t halfx=(xmax-xmin)/2.;
366 Float_t halfy=(ymax-ymin)/2.;
369 new TBRIK(nameSense1,"Module","void",halfx,halfy,0.25);
371 new TBRIK(nameSense2,"Module","void",halfx,halfy,0.25);
373 new TBRIK(nameSense3,"Module","void",halfx,halfy,0.25);
375 new TBRIK(nameSense4,"Module","void",halfx,halfy,0.25);
377 sprintf(nameNode,"S_MUON%d",1000*fId+1+imodule);
379 if (TMath::Abs(idModule)==41||TMath::Abs(idModule)==61) {
380 nodeS = new TNode(nameNode,"Module",nameSense3,xpos,ypos,0,"");
381 } else if (TMath::Abs(idModule)==52) {
382 nodeS = new TNode(nameNode,"Module",nameSense4,xpos,ypos,0,"");
383 } else if (TMath::Abs((idModule-Int_t(idModule/10)*10.))!=7) {
384 nodeS = new TNode(nameNode,"Module",nameSense1,xpos,ypos,0,"");
386 // } else if (TMath::Abs((idModule-Int_t(idModule/10)*10.))==7) {
387 nodeS = new TNode(nameNode,"Module",nameSense2,xpos,ypos,0,"");
389 nodeS->SetLineColor(kBlue);