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 **************************************************************************/
21 #include <TGeometry.h>
24 #include "AliMUONSegmentationTriggerX.h"
25 #include "AliMUONTriggerConstants.h"
26 #include "AliMUONChamber.h"
27 #include "AliRun.h" // gAlice
29 ClassImp(AliMUONSegmentationTriggerX)
31 //------------------------------------------------------------------
32 void AliMUONSegmentationTriggerX::Init(Int_t chamber)
34 // intialize X segmentation
35 AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON");
36 if(pMUON->GetDebug()>1) printf("%s: Initialize Trigger Chamber Geometry X\n",ClassName());
37 AliMUONSegmentationTrigger::Init(chamber);
39 // calculate x & y position of X strips
40 Int_t nModule=AliMUONTriggerConstants::Nmodule();
41 for (Int_t imodule=0; imodule<nModule; imodule++) {
42 Float_t width=StripSizeX(AliMUONTriggerConstants::ModuleId(imodule));
43 Int_t nStrip=AliMUONTriggerConstants::NstripX(imodule);
44 for (Int_t istrip=0; istrip<nStrip; istrip++){
45 fXofxsmin[imodule][istrip] = AliMUONTriggerConstants::XcMin(imodule)*fZscale;
46 fXofxsmax[imodule][istrip] = AliMUONTriggerConstants::XcMax(imodule)*fZscale;
48 fYofxsmin[imodule][istrip] = (fYcmin[imodule]+width*(istrip))*fZscale;
49 fYofxsmax[imodule][istrip] = (fYcmin[imodule]+width*(istrip+1))*fZscale;
54 //------------------------------------------------------------------
55 void AliMUONSegmentationTriggerX::GetPadI(Float_t x,Float_t y,Int_t &ix,Int_t &iy)
57 // Returns pad coordinates (ix,iy) for given real coordinates (x,y)
58 // x,y = real coordinates; ix = module number , iy = strip number
61 Int_t nModule=AliMUONTriggerConstants::Nmodule();
62 for (Int_t imodule=0; imodule<nModule; imodule++) {
63 Int_t nStrip=AliMUONTriggerConstants::NstripX(imodule);
64 for (Int_t istrip=0; istrip<nStrip; istrip++){
65 if (x>fXofxsmin[imodule][istrip]&&x<fXofxsmax[imodule][istrip]&&
66 y>fYofxsmin[imodule][istrip]&&y<fYofxsmax[imodule][istrip]){
67 ix = AliMUONTriggerConstants::ModuleId(imodule);
74 //------------------------------------------------------------------
75 void AliMUONSegmentationTriggerX::GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
77 // Returns real coordinates (x,y) for given pad coordinates (ix,iy)
78 // ix = module number , iy = strip number; x,y = center of strip
81 Int_t nModule=AliMUONTriggerConstants::Nmodule();
83 for (Int_t imodule=0; imodule<nModule; imodule++) {
84 if (AliMUONTriggerConstants::ModuleId(imodule)==ix){
85 x=fXofxsmin[imodule][iy]+(fXofxsmax[imodule][iy]-fXofxsmin[imodule][iy])/2.;
86 y=fYofxsmin[imodule][iy]+(fYofxsmax[imodule][iy]-fYofxsmin[imodule][iy])/2.;
91 //------------------------------------------------------------------
92 void AliMUONSegmentationTriggerX::SetPadSize(Float_t p1, Float_t p2)
100 //------------------------------------------------------------------
101 void AliMUONSegmentationTriggerX::
102 Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10]){
103 // Returns list of 10 next neighbours for given X strip (ix, iy)
104 // neighbour number 4 in the list -
105 // neighbour number 3 in the list |
106 // neighbour number 2 in the list |_ Upper part
107 // neighbour number 1 in the list |
108 // neighbour number 0 in the list -
110 // neighbour number 5 in the list -
111 // neighbour number 6 in the list | _ Lower part
112 // neighbour number 7 in the list |
113 // neighbour number 8 in the list |
114 // neighbour number 9 in the list -
116 Int_t absiX = TMath::Abs(iX);
117 Int_t numModule = ModuleNumber(absiX); // module number Id.
118 Int_t nStrip = AliMUONTriggerConstants::NstripX(numModule); //numb of strips
119 Int_t iCandidateUp, iCandidateDo;
123 for (Int_t i=0; i<10; i++) Xlist[i]=Ylist[i]=0;
127 for (Int_t i=0; i<5; i++) {
129 iCandidateUp = iY + (i + 1);
130 iCandidateDo = iY - (i + 1);
131 if (iCandidateUp < nStrip) {
133 Ylist[i] = iCandidateUp;
135 if (iCandidateDo >= 0) {
137 Ylist[j] = iCandidateDo;
144 //------------------------------------------------------------------
145 void AliMUONSegmentationTriggerX::SetPad(Int_t ix, Int_t iy)
147 // Sets virtual pad coordinates, needed for evaluating pad response
148 // outside the tracking program
149 GetPadC(ix,iy,fX,fY);
150 GetPadI(fX,fY,fIx,fIy);
151 fSector=Sector(ix,iy);
154 //------------------------------------------------------------------
155 Int_t AliMUONSegmentationTriggerX::ISector()
158 //------------------------------------------------------------------
159 Int_t AliMUONSegmentationTriggerX::Ix()
162 //------------------------------------------------------------------
164 Int_t AliMUONSegmentationTriggerX::Iy()
167 //------------------------------------------------------------------
168 Float_t AliMUONSegmentationTriggerX::Dpx(Int_t isec) const
170 // returns x size of x strips for sector isec
174 } else if (isec==2) {
176 } else if (isec==3) {
178 } else if (isec==4) {
180 } else if (isec==5) {
182 } else if (isec==6) {
189 //------------------------------------------------------------------
190 Float_t AliMUONSegmentationTriggerX::Dpy(Int_t isec) const
192 // returns y size of x strips for sector isec
195 return 1.0625*fZscale;
196 } else if (isec==2) {
197 return 1.0625*fZscale;
198 } else if (isec==3) {
199 return 1.0625*fZscale;
200 } else if (isec==4) {
201 return 2.125*fZscale;
202 } else if (isec==5) {
204 } else if (isec==6) {
211 //------------------------------------------------------------------
212 void AliMUONSegmentationTriggerX::GetPadI(Float_t x, Float_t y, Float_t /*z*/, Int_t &ix, Int_t &iy)
214 GetPadI(x, y, ix, iy);
217 //------------------------------------------------------------------
218 void AliMUONSegmentationTriggerX::SetHit(Float_t xhit, Float_t yhit)
220 // set hit during disIntegration
221 AliMUONSegmentationTrigger::SetHit(xhit,yhit);
223 //------------------------------------------------------------------
224 void AliMUONSegmentationTriggerX::SetHit(Float_t xhit, Float_t yhit, Float_t /*zhit*/)
229 //------------------------------------------------------------------
230 Int_t AliMUONSegmentationTriggerX::Sector(Int_t ix, Int_t /*iy*/)
232 // Returns sector number for given module
235 Int_t absix=TMath::Abs(ix);
236 Int_t iwidth=Int_t(StripSizeX(absix));
240 } else if (absix==41||absix==61) {
242 } else if (iwidth==1) {
244 } else if (iwidth==2) {
246 } else if ((absix>=11&&absix<17)||(absix>=91&&absix<97)) {
248 } else if (iwidth==4) {
255 //------------------------------------------------------------------
256 void AliMUONSegmentationTriggerX::
257 IntegrationLimits(Float_t& x1, Float_t& x2, Float_t& x3, Float_t& x4)
259 // returns quantities needed to evaluate neighbour strip response
262 Float_t xstrip,ystrip;
263 GetPadI(fXhit,fYhit,ix,iy);
264 GetPadC(ix,iy,xstrip,ystrip);
265 x1=fYhit; // hit y position
266 x2=ystrip; // y coordinate of the main strip
267 x3=fY; // current strip real y coordinate
268 // width=StripSizeX(ix); // width of the main strip
270 // find the position of the 2 borders of the current strip
271 Float_t ymin = fYofxsmin[ModuleNumber(fIx)][fIy];
272 Float_t ymax = fYofxsmax[ModuleNumber(fIx)][fIy];
274 // dist. between the hit and the closest border of the current strip
275 x4 = (TMath::Abs(ymax-x1) > TMath::Abs(ymin-x1)) ?
276 TMath::Abs(ymin-x1):TMath::Abs(ymax-x1);
280 //------------------------------------------------------------------
281 void AliMUONSegmentationTriggerX::Draw(const char* opt) const
283 // Draw method for event display
284 if (!strcmp(opt,"eventdisplay")) {
286 char nameChamber[10], nameNode[11];
287 char nameSense1[10], nameSense2[10], nameSense3[10], nameSense4[10];
289 TNode* top=gAlice->GetGeometry()->GetNode("alice");
290 sprintf(nameChamber,"C_MUON%d",fId+1);
291 new TBRIK(nameChamber,"Mother","void",340.,340.,0.25);
293 sprintf(nameNode,"MUON%d",100+fId+1);
294 node = new TNode(nameNode,"Chambernode",nameChamber,0,0,fChamber->Z(),"");
295 node->SetLineColor(kBlack);
296 AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON");
297 (pMUON->Nodes())->Add(node);
299 sprintf(nameSense1,"S1_MUON%d",fId+1);
300 sprintf(nameSense2,"S2_MUON%d",fId+1);
301 sprintf(nameSense3,"S3_MUON%d",fId+1);
302 sprintf(nameSense4,"S4_MUON%d",fId+1);
304 for (Int_t imodule=0; imodule<AliMUONTriggerConstants::Nmodule(); imodule++) {
305 Int_t idModule=AliMUONTriggerConstants::ModuleId(imodule);
307 if (TMath::Abs(idModule)!=51) {
309 Int_t nStripX=AliMUONTriggerConstants::NstripX(imodule);
310 Float_t xmin=fXofxsmin[imodule][0];
311 Float_t xmax=fXofxsmax[imodule][nStripX-1];
312 Float_t ymin=fYofxsmin[imodule][0];
313 Float_t ymax=fYofxsmax[imodule][nStripX-1];
314 Float_t xpos=xmin+(xmax-xmin)/2.;
315 Float_t ypos=ymin+(ymax-ymin)/2.;
316 Float_t halfx=(xmax-xmin)/2.;
317 Float_t halfy=(ymax-ymin)/2.;
320 new TBRIK(nameSense1,"Module","void",halfx,halfy,0.25);
322 new TBRIK(nameSense2,"Module","void",halfx,halfy,0.25);
324 new TBRIK(nameSense3,"Module","void",halfx,halfy,0.25);
326 new TBRIK(nameSense4,"Module","void",halfx,halfy,0.25);
328 sprintf(nameNode,"S_MUON%d",1000*fId+1+imodule);
330 if (TMath::Abs(idModule)==41||TMath::Abs(idModule)==61) {
331 nodeS = new TNode(nameNode,"Module",nameSense3,xpos,ypos,0,"");
332 } else if (TMath::Abs(idModule)==52) {
333 nodeS = new TNode(nameNode,"Module",nameSense4,xpos,ypos,0,"");
334 } else if (TMath::Abs((idModule-Int_t(idModule/10)*10.))!=7) {
335 nodeS = new TNode(nameNode,"Module",nameSense1,xpos,ypos,0,"");
337 // } else if (TMath::Abs((idModule-Int_t(idModule/10)*10.))==7) {
338 nodeS = new TNode(nameNode,"Module",nameSense2,xpos,ypos,0,"");
340 nodeS->SetLineColor(kBlue);