* provided "as is" without express or implied warranty. *
**************************************************************************/
-/*
-$Log$
-Revision 1.1.2.1 2000/06/09 21:51:03 morsch
-Code from AliMUONSegResTrigger.cxx
-
-*/
-
-
-/*
-Old Log:
-Revision 1.1.2.4 2000/04/26 12:33:25 morsch
-Minor changes in some methods (CP)
-
-Revision 1.1.2.3 2000/03/20 18:14:16 morsch
-Missing sector added.
-
-Revision 1.1.2.2 2000/02/20 07:50:49 morsch
-Bugs in Dpx, Dpy and ISector methods corrected (P.C.)
+/* $Id$ */
-Revision 1.1.2.1 2000/02/17 14:33:49 morsch
-Draft version from P. Crochet
-
-*/
+#include <TMath.h>
+#include <TBRIK.h>
+#include <TNode.h>
+#include <TGeometry.h>
+#include "AliMUON.h"
#include "AliMUONSegmentationTriggerX.h"
-#include "TMath.h"
-#include "TRandom.h"
-#include "TArc.h"
+#include "AliMUONTriggerConstants.h"
#include "AliMUONChamber.h"
-#include <iostream.h>
+#include "AliRun.h" // gAlice
+#include "AliLog.h"
+
ClassImp(AliMUONSegmentationTriggerX)
-
-void AliMUONSegmentationTriggerX::Init(AliMUONChamber* Chamber)
+
+//------------------------------------------------------------------
+void AliMUONSegmentationTriggerX::Init(Int_t chamber)
{
- cout << "Initialize Trigger Chamber Geometry X " << "\n";
- AliMUONSegmentationTrigger::Init(Chamber);
+// intialize X segmentation
+ AliDebug(2,"Initialize Trigger Chamber Geometry X");
+ AliMUONSegmentationTrigger::Init(chamber);
// calculate x & y position of X strips
- for (Int_t imodule=0; imodule<fgNmodule; imodule++) {
- Float_t width=StripSizeX(fgNum[imodule]);
- for (Int_t istrip=0; istrip<fgNstripx[imodule]; istrip++){
- fXofxsmin[imodule][istrip] = fgXcmin[imodule]*fZscale;
- fXofxsmax[imodule][istrip] = fgXcmax[imodule]*fZscale;
+ Int_t nModule=AliMUONTriggerConstants::Nmodule();
+ for (Int_t imodule=0; imodule<nModule; imodule++) {
+ Float_t width=StripSizeX(AliMUONTriggerConstants::ModuleId(imodule));
+ Int_t nStrip=AliMUONTriggerConstants::NstripX(imodule);
+ for (Int_t istrip=0; istrip<nStrip; istrip++){
+ fXofxsmin[imodule][istrip] = AliMUONTriggerConstants::XcMin(imodule)*fZscale;
+ fXofxsmax[imodule][istrip] = AliMUONTriggerConstants::XcMax(imodule)*fZscale;
- fYofxsmin[imodule][istrip] = (fgYcmin[imodule]+width*(istrip))*fZscale;
- fYofxsmax[imodule][istrip] = (fgYcmin[imodule]+width*(istrip+1))*fZscale;
- }
+ fYofxsmin[imodule][istrip] = (fYcmin[imodule]+width*(istrip))*fZscale;
+ fYofxsmax[imodule][istrip] = (fYcmin[imodule]+width*(istrip+1))*fZscale;
+/*
+ if (TMath::Abs(AliMUONTriggerConstants::ModuleId(imodule))==11) {
+ printf("module Id istrip fXofxsmin fXofxsmax fYofxsmin fYofxsmax %d %d %f %f %f %f \n",
+ AliMUONTriggerConstants::ModuleId(imodule),
+ istrip,
+ fXofxsmin[imodule][istrip],
+ fXofxsmax[imodule][istrip],
+ fYofxsmin[imodule][istrip],
+ fYofxsmax[imodule][istrip]);
+ }
+*/
+ }
}
}
//------------------------------------------------------------------
-void AliMUONSegmentationTriggerX::GetPadIxy(Float_t x,Float_t y,Int_t &ix,Int_t &iy){
+void AliMUONSegmentationTriggerX::GetPadI(Float_t x,Float_t y,Int_t &ix,Int_t &iy)
+{
// Returns pad coordinates (ix,iy) for given real coordinates (x,y)
// x,y = real coordinates; ix = module number , iy = strip number
ix = 0;
iy = 0;
- for (Int_t imodule=0; imodule<fgNmodule; imodule++) {
- for (Int_t istrip=0; istrip<fgNstripx[imodule]; istrip++){
- if (x>fXofxsmin[imodule][istrip]&&x<fXofxsmax[imodule][istrip]&&
- y>fYofxsmin[imodule][istrip]&&y<fYofxsmax[imodule][istrip]){
- ix = fgNum[imodule];
- iy = istrip;
+ Int_t nModule=AliMUONTriggerConstants::Nmodule();
+ for (Int_t imodule=0; imodule<nModule; imodule++) {
+ Int_t nStrip=AliMUONTriggerConstants::NstripX(imodule);
+ for (Int_t istrip=0; istrip<nStrip; istrip++){
+ if (x>fXofxsmin[imodule][istrip]&&x<fXofxsmax[imodule][istrip]&&
+ y>fYofxsmin[imodule][istrip]&&y<fYofxsmax[imodule][istrip]){
+ ix = AliMUONTriggerConstants::ModuleId(imodule);
+ iy = istrip;
+ }
}
- }
}
}
//------------------------------------------------------------------
-void AliMUONSegmentationTriggerX::GetPadCxy(Int_t ix, Int_t iy, Float_t &x, Float_t &y){
+void AliMUONSegmentationTriggerX::GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
+{
// Returns real coordinates (x,y) for given pad coordinates (ix,iy)
// ix = module number , iy = strip number; x,y = center of strip
x = 0.;
y = 0.;
-
- for (Int_t imodule=0; imodule<fgNmodule; imodule++) {
- if (fgNum[imodule]==ix){
+ Int_t nModule=AliMUONTriggerConstants::Nmodule();
+
+ for (Int_t imodule=0; imodule<nModule; imodule++) {
+ if (AliMUONTriggerConstants::ModuleId(imodule)==ix){
x=fXofxsmin[imodule][iy]+(fXofxsmax[imodule][iy]-fXofxsmin[imodule][iy])/2.;
y=fYofxsmin[imodule][iy]+(fYofxsmax[imodule][iy]-fYofxsmin[imodule][iy])/2.;
}
//------------------------------------------------------------------
void AliMUONSegmentationTriggerX::
-Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[2], Int_t Ylist[2]){
-// Returns list of next neighbours for given Pad (ix, iy)
-
- Int_t absiX=TMath::Abs(iX);
- *Nlist = 0;
-
- if (absiX!=0) {
- Int_t numModule=ModuleNumber(absiX);
-
- if (iY<fgNstripx[numModule]-1) { // strip up in same module
- *Nlist=1;
- Xlist[0]=absiX;
- Ylist[0]=iY+1;
- }
-
- if (iY>0) { // strip down in same module
- *Nlist=*Nlist+1;
- Xlist[*Nlist-1]=absiX;
- Ylist[*Nlist-1]=iY-1;
- }
-
- if (iX<0) { // left side of chamber
- for (Int_t i=0; i<*Nlist; i++) {Xlist[i]=-Xlist[i];}
+Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10]){
+// Returns list of 10 next neighbours for given X strip (ix, iy)
+// neighbour number 4 in the list -
+// neighbour number 3 in the list |
+// neighbour number 2 in the list |_ Upper part
+// neighbour number 1 in the list |
+// neighbour number 0 in the list -
+// X strip (ix, iy)
+// neighbour number 5 in the list -
+// neighbour number 6 in the list | _ Lower part
+// neighbour number 7 in the list |
+// neighbour number 8 in the list |
+// neighbour number 9 in the list -
+
+ Int_t absiX = TMath::Abs(iX);
+ Int_t numModule = ModuleNumber(absiX); // module number Id.
+ Int_t nStrip = AliMUONTriggerConstants::NstripX(numModule); //numb of strips
+ Int_t iCandidateUp, iCandidateDo;
+ Int_t j;
+
+ *Nlist = 10;
+ for (Int_t i=0; i<10; i++) Xlist[i]=Ylist[i]=0;
+
+ if (iY < nStrip) {
+
+ for (Int_t i=0; i<5; i++) {
+ j = i + 5;
+ iCandidateUp = iY + (i + 1);
+ iCandidateDo = iY - (i + 1);
+ if (iCandidateUp < nStrip) {
+ Xlist[i] = iX;
+ Ylist[i] = iCandidateUp;
+ }
+ if (iCandidateDo >= 0) {
+ Xlist[j] = iX;
+ Ylist[j] = iCandidateDo;
+ }
}
- }
+
+ } // iY < nStrip
}
//------------------------------------------------------------------
{
// Sets virtual pad coordinates, needed for evaluating pad response
// outside the tracking program
- GetPadCxy(ix,iy,fx,fy);
- GetPadIxy(fx,fy,fix,fiy);
+ GetPadC(ix,iy,fX,fY);
+ GetPadI(fX,fY,fIx,fIy);
fSector=Sector(ix,iy);
}
//------------------------------------------------------------------
-Int_t AliMUONSegmentationTriggerX::ISector()
+Int_t AliMUONSegmentationTriggerX::ISector()
{ return fSector;}
//------------------------------------------------------------------
Int_t AliMUONSegmentationTriggerX::Ix()
-{ return fix;}
+{ return fIx;}
//------------------------------------------------------------------
+
Int_t AliMUONSegmentationTriggerX::Iy()
-{ return fiy;}
+{ return fIy;}
//------------------------------------------------------------------
-Float_t AliMUONSegmentationTriggerX::Dpx(Int_t isec)
-{ // returns x size of x strips for sector isec
+Float_t AliMUONSegmentationTriggerX::Dpx(Int_t isec) const
+{
+// returns x size of x strips for sector isec
if (isec==1) {
- return 17.0*fZscale;
+ return AliMUONTriggerConstants::StripLength(0)*fZscale;
} else if (isec==2) {
- return 34.0*fZscale;
+ return AliMUONTriggerConstants::StripLength(1)*fZscale;
} else if (isec==3) {
- return 34.0*fZscale;
+ return AliMUONTriggerConstants::StripLength(1)*fZscale;
} else if (isec==4) {
- return 34.0*fZscale;
+ return AliMUONTriggerConstants::StripLength(1)*fZscale;
} else if (isec==5) {
- return 34.0*fZscale;
+ return AliMUONTriggerConstants::StripLength(1)*fZscale;
} else if (isec==6) {
- return 68.0*fZscale;
+ return AliMUONTriggerConstants::StripLength(2)*fZscale;
} else {
return 0.;
}
}
//------------------------------------------------------------------
-Float_t AliMUONSegmentationTriggerX::Dpy(Int_t isec)
-{ // returns y size of x strips for sector isec
- // cout << " In AliMUONSegmentationTriggerX::Dpx" << "\n";
+Float_t AliMUONSegmentationTriggerX::Dpy(Int_t isec) const
+{
+// returns y size of x strips for sector isec
if (isec==1) {
- return 1.0625*fZscale;
+ return AliMUONTriggerConstants::StripWidth(0)*fZscale;
} else if (isec==2) {
- return 1.0625*fZscale;
+ return AliMUONTriggerConstants::StripWidth(0)*fZscale;
} else if (isec==3) {
- return 1.0625*fZscale;
+ return AliMUONTriggerConstants::StripWidth(0)*fZscale;
} else if (isec==4) {
- return 2.125*fZscale;
+ return AliMUONTriggerConstants::StripWidth(1)*fZscale;
} else if (isec==5) {
- return 4.25*fZscale;
+ return AliMUONTriggerConstants::StripWidth(2)*fZscale;
} else if (isec==6) {
- return 4.25*fZscale;
+ return AliMUONTriggerConstants::StripWidth(2)*fZscale;
} else {
return 0.;
}
}
+//------------------------------------------------------------------
+void AliMUONSegmentationTriggerX::GetPadI(Float_t x, Float_t y, Float_t /*z*/, Int_t &ix, Int_t &iy)
+{
+ GetPadI(x, y, ix, iy);
+}
+
//------------------------------------------------------------------
void AliMUONSegmentationTriggerX::SetHit(Float_t xhit, Float_t yhit)
-{ AliMUONSegmentationTrigger::SetHit(xhit,yhit);}
+{
+// set hit during disIntegration
+AliMUONSegmentationTrigger::SetHit(xhit,yhit);
+}
+//------------------------------------------------------------------
+void AliMUONSegmentationTriggerX::SetHit(Float_t xhit, Float_t yhit, Float_t /*zhit*/)
+{
+ SetHit(xhit, yhit);
+}
//------------------------------------------------------------------
-Int_t AliMUONSegmentationTriggerX::Sector(Int_t ix, Int_t iy)
+Int_t AliMUONSegmentationTriggerX::Sector(Int_t ix, Int_t /*iy*/)
{
// Returns sector number for given module
//
+
Int_t absix=TMath::Abs(ix);
Int_t iwidth=Int_t(StripSizeX(absix));
-
+
if (absix==52) {
return 1;
} else if (absix==41||absix==61) {
//------------------------------------------------------------------
void AliMUONSegmentationTriggerX::
-IntegrationLimits(Float_t& x1, Float_t& x2, Float_t& x3, Float_t& width)
-{ // returns quantities needed to evaluate neighbour strip response
-// cout << " In AliMUONSegmentationTriggerX::IntegrationLimits" << "\n";
+IntegrationLimits(Float_t& x1, Float_t& x2, Float_t& x3, Float_t& x4)
+{
+// returns quantities needed to evaluate neighbour strip response
+
Int_t ix,iy;
Float_t xstrip,ystrip;
- GetPadIxy(fxhit,fyhit,ix,iy);
- GetPadCxy(ix,iy,xstrip,ystrip);
- x1=fyhit; // hit y position
+ GetPadI(fXhit,fYhit,ix,iy);
+ GetPadC(ix,iy,xstrip,ystrip);
+ x1=fYhit; // hit y position
x2=ystrip; // y coordinate of the main strip
- x3=fy; // current strip real y coordinate
- width=StripSizeX(ix); // width of the main strip
-}
-
+ x3=fY; // current strip real y coordinate
+ // width=StripSizeX(ix); // width of the main strip
+ // find the position of the 2 borders of the current strip
+ Float_t ymin = fYofxsmin[ModuleNumber(fIx)][fIy];
+ Float_t ymax = fYofxsmax[ModuleNumber(fIx)][fIy];
+
+ // dist. between the hit and the closest border of the current strip
+ x4 = (TMath::Abs(ymax-x1) > TMath::Abs(ymin-x1)) ?
+ TMath::Abs(ymin-x1):TMath::Abs(ymax-x1);
+}
+//------------------------------------------------------------------
+void AliMUONSegmentationTriggerX::Draw(const char* opt)
+{
+// Draw method for event display
+ if (!strcmp(opt,"eventdisplay")) {
+
+ TNode *node, *nodeS;
+ char nameChamber[10], nameNode[11];
+ char nameSense1[10], nameSense2[10], nameSense3[10], nameSense4[10];
+
+ TNode* top=gAlice->GetGeometry()->GetNode("alice");
+ sprintf(nameChamber,"C_MUON%d",fId+1);
+ new TBRIK(nameChamber,"Mother","void",340.,340.,0.25);
+ top->cd();
+ sprintf(nameNode,"MUON%d",100+fId+1);
+ node = new TNode(nameNode,"Chambernode",nameChamber,0,0,fChamber->Z(),"");
+ node->SetLineColor(kBlack);
+ AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON");
+ (pMUON->Nodes())->Add(node);
+
+ sprintf(nameSense1,"S1_MUON%d",fId+1);
+ sprintf(nameSense2,"S2_MUON%d",fId+1);
+ sprintf(nameSense3,"S3_MUON%d",fId+1);
+ sprintf(nameSense4,"S4_MUON%d",fId+1);
+
+ for (Int_t imodule=0; imodule<AliMUONTriggerConstants::Nmodule(); imodule++) {
+ Int_t idModule=AliMUONTriggerConstants::ModuleId(imodule);
+
+ if (TMath::Abs(idModule)!=51) {
+
+ Int_t nStripX=AliMUONTriggerConstants::NstripX(imodule);
+ Float_t xmin=fXofxsmin[imodule][0];
+ Float_t xmax=fXofxsmax[imodule][nStripX-1];
+ Float_t ymin=fYofxsmin[imodule][0];
+ Float_t ymax=fYofxsmax[imodule][nStripX-1];
+ Float_t xpos=xmin+(xmax-xmin)/2.;
+ Float_t ypos=ymin+(ymax-ymin)/2.;
+ Float_t halfx=(xmax-xmin)/2.;
+ Float_t halfy=(ymax-ymin)/2.;
+
+ if (idModule==11)
+ new TBRIK(nameSense1,"Module","void",halfx,halfy,0.25);
+ if (idModule==17)
+ new TBRIK(nameSense2,"Module","void",halfx,halfy,0.25);
+ if (idModule==41)
+ new TBRIK(nameSense3,"Module","void",halfx,halfy,0.25);
+ if (idModule==52)
+ new TBRIK(nameSense4,"Module","void",halfx,halfy,0.25);
+ node->cd();
+ sprintf(nameNode,"S_MUON%d",1000*fId+1+imodule);
+
+ if (TMath::Abs(idModule)==41||TMath::Abs(idModule)==61) {
+ nodeS = new TNode(nameNode,"Module",nameSense3,xpos,ypos,0,"");
+ } else if (TMath::Abs(idModule)==52) {
+ nodeS = new TNode(nameNode,"Module",nameSense4,xpos,ypos,0,"");
+ } else if (TMath::Abs((idModule-Int_t(idModule/10)*10.))!=7) {
+ nodeS = new TNode(nameNode,"Module",nameSense1,xpos,ypos,0,"");
+ } else {
+ // } else if (TMath::Abs((idModule-Int_t(idModule/10)*10.))==7) {
+ nodeS = new TNode(nameNode,"Module",nameSense2,xpos,ypos,0,"");
+ }
+ nodeS->SetLineColor(kBlue);
+ node->cd();
+ }
+ }
+ }
+}