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.7 2000/10/03 21:48:07 morsch
19 Adopt to const declaration of some of the methods in AliSegmentation.
21 Revision 1.6 2000/10/02 16:58:29 egangler
22 Cleaning of the code :
25 -> some useless includes removed or replaced by "class" statement
27 Revision 1.5 2000/07/03 11:54:57 morsch
28 AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
29 The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
31 Revision 1.4 2000/06/29 12:34:09 morsch
32 AliMUONSegmentation class has been made independent of AliMUONChamber. This makes
33 it usable with any other geometry class. The link to the object to which it belongs is
34 established via an index. This assumes that there exists a global geometry manager
35 from which the pointer to the parent object can be obtained (in our case gAlice).
37 Revision 1.3 2000/06/26 10:01:26 pcrochet
38 global variables removed
40 Revision 1.2 2000/06/15 07:58:48 morsch
41 Code from MUON-dev joined
43 Revision 1.1.2.1 2000/06/09 21:51:03 morsch
44 Code from AliMUONSegResTrigger.cxx
52 Revision 1.1.2.4 2000/04/26 12:33:25 morsch
53 Minor changes in some methods (CP)
55 Revision 1.1.2.3 2000/03/20 18:14:16 morsch
58 Revision 1.1.2.2 2000/02/20 07:50:49 morsch
59 Bugs in Dpx, Dpy and ISector methods corrected (P.C.)
61 Revision 1.1.2.1 2000/02/17 14:33:49 morsch
62 Draft version from P. Crochet
69 #include <TGeometry.h>
72 #include "AliMUONSegmentationTriggerX.h"
73 #include "AliMUONTriggerConstants.h"
77 #include "AliMUONChamber.h"
78 #include "AliRun.h" // gAlice
80 ClassImp(AliMUONSegmentationTriggerX)
82 //------------------------------------------------------------------
83 void AliMUONSegmentationTriggerX::Init(Int_t chamber)
85 // intialize X segmentation
86 cout << "Initialize Trigger Chamber Geometry X " << "\n";
87 AliMUONSegmentationTrigger::Init(chamber);
89 // calculate x & y position of X strips
90 Int_t nModule=AliMUONTriggerConstants::Nmodule();
91 for (Int_t imodule=0; imodule<nModule; imodule++) {
92 Float_t width=StripSizeX(AliMUONTriggerConstants::ModuleId(imodule));
93 Int_t nStrip=AliMUONTriggerConstants::NstripX(imodule);
94 for (Int_t istrip=0; istrip<nStrip; istrip++){
95 fXofxsmin[imodule][istrip] = AliMUONTriggerConstants::XcMin(imodule)*fZscale;
96 fXofxsmax[imodule][istrip] = AliMUONTriggerConstants::XcMax(imodule)*fZscale;
98 fYofxsmin[imodule][istrip] = (fYcmin[imodule]+width*(istrip))*fZscale;
99 fYofxsmax[imodule][istrip] = (fYcmin[imodule]+width*(istrip+1))*fZscale;
104 //------------------------------------------------------------------
105 void AliMUONSegmentationTriggerX::GetPadI(Float_t x,Float_t y,Int_t &ix,Int_t &iy)
107 // Returns pad coordinates (ix,iy) for given real coordinates (x,y)
108 // x,y = real coordinates; ix = module number , iy = strip number
111 Int_t nModule=AliMUONTriggerConstants::Nmodule();
112 for (Int_t imodule=0; imodule<nModule; imodule++) {
113 Int_t nStrip=AliMUONTriggerConstants::NstripX(imodule);
114 for (Int_t istrip=0; istrip<nStrip; istrip++){
115 if (x>fXofxsmin[imodule][istrip]&&x<fXofxsmax[imodule][istrip]&&
116 y>fYofxsmin[imodule][istrip]&&y<fYofxsmax[imodule][istrip]){
117 ix = AliMUONTriggerConstants::ModuleId(imodule);
124 //------------------------------------------------------------------
125 void AliMUONSegmentationTriggerX::GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
127 // Returns real coordinates (x,y) for given pad coordinates (ix,iy)
128 // ix = module number , iy = strip number; x,y = center of strip
131 Int_t nModule=AliMUONTriggerConstants::Nmodule();
133 for (Int_t imodule=0; imodule<nModule; imodule++) {
134 if (AliMUONTriggerConstants::ModuleId(imodule)==ix){
135 x=fXofxsmin[imodule][iy]+(fXofxsmax[imodule][iy]-fXofxsmin[imodule][iy])/2.;
136 y=fYofxsmin[imodule][iy]+(fYofxsmax[imodule][iy]-fYofxsmin[imodule][iy])/2.;
141 //------------------------------------------------------------------
142 void AliMUONSegmentationTriggerX::SetPadSize(Float_t p1, Float_t p2)
150 //------------------------------------------------------------------
151 void AliMUONSegmentationTriggerX::
152 Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[2], Int_t Ylist[2])
154 // Returns list of next neighbours for given Pad (ix, iy)
156 Int_t absiX=TMath::Abs(iX);
160 Int_t numModule=ModuleNumber(absiX);
162 if (iY<AliMUONTriggerConstants::NstripX(numModule)-1) { // strip up in same module
168 if (iY>0) { // strip down in same module
170 Xlist[*Nlist-1]=absiX;
171 Ylist[*Nlist-1]=iY-1;
174 if (iX<0) { // left side of chamber
175 for (Int_t i=0; i<*Nlist; i++) {Xlist[i]=-Xlist[i];}
180 //------------------------------------------------------------------
181 void AliMUONSegmentationTriggerX::SetPad(Int_t ix, Int_t iy)
183 // Sets virtual pad coordinates, needed for evaluating pad response
184 // outside the tracking program
185 GetPadC(ix,iy,fX,fY);
186 GetPadI(fX,fY,fIx,fIy);
187 fSector=Sector(ix,iy);
190 //------------------------------------------------------------------
191 Int_t AliMUONSegmentationTriggerX::ISector()
194 //------------------------------------------------------------------
195 Int_t AliMUONSegmentationTriggerX::Ix()
198 //------------------------------------------------------------------
200 Int_t AliMUONSegmentationTriggerX::Iy()
203 //------------------------------------------------------------------
204 Float_t AliMUONSegmentationTriggerX::Dpx(Int_t isec) const
206 // returns x size of x strips for sector isec
210 } else if (isec==2) {
212 } else if (isec==3) {
214 } else if (isec==4) {
216 } else if (isec==5) {
218 } else if (isec==6) {
225 //------------------------------------------------------------------
226 Float_t AliMUONSegmentationTriggerX::Dpy(Int_t isec) const
228 // returns y size of x strips for sector isec
231 return 1.0625*fZscale;
232 } else if (isec==2) {
233 return 1.0625*fZscale;
234 } else if (isec==3) {
235 return 1.0625*fZscale;
236 } else if (isec==4) {
237 return 2.125*fZscale;
238 } else if (isec==5) {
240 } else if (isec==6) {
247 //------------------------------------------------------------------
248 void AliMUONSegmentationTriggerX::SetHit(Float_t xhit, Float_t yhit)
250 // set hit during disIntegration
251 AliMUONSegmentationTrigger::SetHit(xhit,yhit);
254 //------------------------------------------------------------------
255 Int_t AliMUONSegmentationTriggerX::Sector(Int_t ix, Int_t iy)
257 // Returns sector number for given module
260 Int_t absix=TMath::Abs(ix);
261 Int_t iwidth=Int_t(StripSizeX(absix));
265 } else if (absix==41||absix==61) {
267 } else if (iwidth==1) {
269 } else if (iwidth==2) {
271 } else if ((absix>=11&&absix<17)||(absix>=91&&absix<97)) {
273 } else if (iwidth==4) {
280 //------------------------------------------------------------------
281 void AliMUONSegmentationTriggerX::
282 IntegrationLimits(Float_t& x1, Float_t& x2, Float_t& x3, Float_t& width)
284 // returns quantities needed to evaluate neighbour strip response
287 Float_t xstrip,ystrip;
288 GetPadI(fXhit,fYhit,ix,iy);
289 GetPadC(ix,iy,xstrip,ystrip);
290 x1=fYhit; // hit y position
291 x2=ystrip; // y coordinate of the main strip
292 x3=fY; // current strip real y coordinate
293 width=StripSizeX(ix); // width of the main strip
296 //------------------------------------------------------------------
297 void AliMUONSegmentationTriggerX::Draw(const char* opt) const
300 if (!strcmp(opt,"eventdisplay")) {
302 char nameChamber[10], nameNode[10];
303 char nameSense1[10], nameSense2[10], nameSense3[10], nameSense4[10];
305 TNode* top=gAlice->GetGeometry()->GetNode("alice");
306 sprintf(nameChamber,"C_MUON%d",fId+1);
307 new TBRIK(nameChamber,"Mother","void",340.,340.,0.25);
309 sprintf(nameNode,"MUON%d",100+fId+1);
310 node = new TNode(nameNode,"Chambernode",nameChamber,0,0,fChamber->Z(),"");
311 node->SetLineColor(kBlack);
312 AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON");
313 (pMUON->Nodes())->Add(node);
315 sprintf(nameSense1,"S1_MUON%d",fId+1);
316 sprintf(nameSense2,"S2_MUON%d",fId+1);
317 sprintf(nameSense3,"S3_MUON%d",fId+1);
318 sprintf(nameSense4,"S4_MUON%d",fId+1);
320 for (Int_t imodule=0; imodule<AliMUONTriggerConstants::Nmodule(); imodule++) {
321 Int_t idModule=AliMUONTriggerConstants::ModuleId(imodule);
323 if (TMath::Abs(idModule)!=51) {
325 Int_t nStripX=AliMUONTriggerConstants::NstripX(imodule);
326 Float_t xmin=fXofxsmin[imodule][0];
327 Float_t xmax=fXofxsmax[imodule][nStripX-1];
328 Float_t ymin=fYofxsmin[imodule][0];
329 Float_t ymax=fYofxsmax[imodule][nStripX-1];
330 Float_t xpos=xmin+(xmax-xmin)/2.;
331 Float_t ypos=ymin+(ymax-ymin)/2.;
332 Float_t halfx=(xmax-xmin)/2.;
333 Float_t halfy=(ymax-ymin)/2.;
336 new TBRIK(nameSense1,"Module","void",halfx,halfy,0.25);
338 new TBRIK(nameSense2,"Module","void",halfx,halfy,0.25);
340 new TBRIK(nameSense3,"Module","void",halfx,halfy,0.25);
342 new TBRIK(nameSense4,"Module","void",halfx,halfy,0.25);
344 sprintf(nameNode,"S_MUON%d",1000*fId+1+imodule);
346 if (TMath::Abs(idModule)==41||TMath::Abs(idModule)==61) {
347 nodeS = new TNode(nameNode,"Module",nameSense3,xpos,ypos,0,"");
348 } else if (TMath::Abs(idModule)==52) {
349 nodeS = new TNode(nameNode,"Module",nameSense4,xpos,ypos,0,"");
350 } else if (TMath::Abs((idModule-Int_t(idModule/10)*10.))!=7) {
351 nodeS = new TNode(nameNode,"Module",nameSense1,xpos,ypos,0,"");
353 // } else if (TMath::Abs((idModule-Int_t(idModule/10)*10.))==7) {
354 nodeS = new TNode(nameNode,"Module",nameSense2,xpos,ypos,0,"");
356 nodeS->SetLineColor(kBlue);