/* $Id$ */
-//*********************************************************
+//**********************************************************************
// Segmentation classe for trigger chambers.
-// The present version is a bit messy because, although the
-// x,y positions are local, most of the methods use global
-// strip numbering. The conversion is made via GetPadLoc2Glo.
+// In the present version the method use global strip coordinates except
+// HasPad. The conversion is made via GetPadLoc2Glo.
// To be improved in the future.
-//*********************************************************
+//**********************************************************************
-#include <TArrayI.h>
-#include <TArrayF.h>
#include "AliMUONTriggerSegmentation.h"
#include "AliLog.h"
fBending(0),
fId(0),
fNsec(7),
- fNDiv(0),
- fDpxD(0),
- fDpyD(0),
- fDpx(0),
- fDpy(0),
fNpx(999999),
fNpy(999999),
- fWireD(0.25),
fXhit(0.),
fYhit(0.),
fIx(0),
fIy(0),
fX(0.),
fY(0.),
- fIxmin(0),
- fIxmax(0),
- fIymin(0),
- fIymax(0),
// add to St345SlatSegmentation
fLineNumber(0),
fRpcHalfXsize(0),
: AliMUONVGeometryDESegmentation(),
fBending(bending),
fId(0),
- fDpx(0),
- fDpy(0),
fNpx(999999),
fNpy(999999),
- fWireD(0.25),
fXhit(0.),
fYhit(0.),
fIx(0),
fIy(0),
fX(0.),
fY(0.),
- fIxmin(0),
- fIxmax(0),
- fIymin(0),
- fIymax(0),
// add to St345SlatSegmentation
fLineNumber(0),
fRpcHalfXsize(0),
fRpcHalfYsize(0)
{
// Non default constructor
- fNsec = 7; // 4 sector densities at most per slat
- fNDiv = new TArrayI(fNsec);
- fDpxD = new TArrayF(fNsec);
- fDpyD = new TArrayF(fNsec);
- (*fNDiv)[0]=(*fNDiv)[1]=(*fNDiv)[2]=(*fNDiv)[3]=0;
- (*fDpxD)[0]=(*fDpxD)[1]=(*fDpxD)[2]=(*fDpxD)[3]=0;
- (*fDpyD)[0]=(*fDpyD)[1]=(*fDpyD)[2]=(*fDpyD)[3]=0;
+ fNsec = 7;
// add to St345SlatSegmentation
for (Int_t i=0; i<7; i++) {
fNstrip[i]=0;
AliMUONTriggerSegmentation::~AliMUONTriggerSegmentation()
{
// Destructor
- if (fNDiv) delete fNDiv;
- if (fDpxD) delete fDpxD;
- if (fDpyD) delete fDpyD;
+ ;
}
//----------------------------------------------------------------------
AliMUONTriggerSegmentation& AliMUONTriggerSegmentation::operator=(const AliMUONTriggerSegmentation& rhs)
return *this;
}
//----------------------------------------------------------------------
-Int_t AliMUONTriggerSegmentation::ModuleColNum(Int_t ixGlo)
+Int_t AliMUONTriggerSegmentation::ModuleColNum(Int_t ix)
{
// returns column number (from 0 to 6) in which the (global) module
-// ixGlo is sitting (could return 7 if ixGlow=isec)
- return TMath::Abs(ixGlo)-Int_t(TMath::Abs(ixGlo)/10)*10-1;
+// ix is sitting (could return 7 if ix=isec)
+ return TMath::Abs(ix)-Int_t(TMath::Abs(ix)/10)*10-1;
}
//----------------------------------------------------------------------
Bool_t AliMUONTriggerSegmentation::HasPad(Int_t ix, Int_t iy)
{
-// check if steping outside the limits (iy=1,2... iyGlo=0,1...)
+// check if steping outside the limits (iy=1,2... iy=0,1...)
Bool_t hasPad = true;
Int_t ixGlo = 0;
Int_t iyGlo = 0;
}
}
}
-// printf(" in GetPadLoc2Glo ixLoc iyLoc ixGlo iyGlo %i %i %i %i \n",ixLoc,iyLoc,ixGlo,iyGlo);
-
+// printf(" in GetPadLoc2Glo fbending ixLoc iyLoc ixGlo iyGlo %i %i %i %i \n",fBending,ixLoc,iyLoc,ixGlo,iyGlo);
}
+
+//----------------------------------------------------------------------------
+void AliMUONTriggerSegmentation::GetPadGlo2Loc(Int_t ixGlo, Int_t iyGlo,
+ Int_t &ixLoc, Int_t &iyLoc)
+{
+// converts ixGlo & iyGlo into ixLoc & iyLoc
+ ixLoc = 0;
+ iyLoc = 0;
+ if (fBending) {
+ ixLoc = ModuleColNum(ixGlo) + 1;
+ iyLoc = iyGlo + 1;
+ } else if (!fBending) {
+ Int_t iCountStrip = 1;
+ for (Int_t iModule=0; iModule<fNsec; iModule++) {
+ for (Int_t iStrip=0; iStrip<fNstrip[iModule]; iStrip++) {
+ if ((iModule==ModuleColNum(ixGlo))&&(iStrip==iyGlo)) {
+ ixLoc = 1;
+ iyLoc = iCountStrip;
+ }
+ iCountStrip++;
+ }
+ }
+ }
+// printf(" in GetPadGlo2Loc fBending ixGlo iyGlo ixLoc iyLoc %i %i %i %i %i \n",fBending,ixGlo,iyGlo,ixLoc,iyLoc);
+}
+
//----------------------------------------------------------------------------
void AliMUONTriggerSegmentation::GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
{
- Int_t ixGlo = 0;
- Int_t iyGlo = 0;
- GetPadLoc2Glo(ix, iy, ixGlo, iyGlo);
-// ix = ixGlo;
-// iy = iyGlo;
-
-// Returns real coordinates (x,y) for given pad coordinates (ix,iy)
+// Returns local real coordinates (x,y) for local pad coordinates (ix,iy)
+
x = 0.;
y = 0.;
- Int_t iModule = ModuleColNum(ixGlo); // find column number (0-6)
+ Int_t iModule = ModuleColNum(ix); // find column number (0-6)
if (fBending) {
if (iModule==0) {
x = fStripXsize[iModule]/ 2.;
x = fModuleXmax[iModule-1] + fStripXsize[iModule]/2.;
}
y = fModuleYmin[iModule] +
- iyGlo*fStripYsize[iModule] + fStripYsize[iModule]/2.;
+ iy*fStripYsize[iModule] + fStripYsize[iModule]/2.;
} else if (!fBending) {
- if (ModuleColNum(ixGlo)==6 && iyGlo>7) {
+ if (ModuleColNum(ix)==6 && iy>7) {
x = fModuleXmin[iModule] + 8*fStripXsize[iModule] +
- (iyGlo-8)*fStripXsize[iModule]/2. + fStripXsize[iModule]/4.;
+ (iy-8)*fStripXsize[iModule]/2. + fStripXsize[iModule]/4.;
} else {
x = fModuleXmin[iModule] +
- iyGlo*fStripXsize[iModule] + fStripXsize[iModule]/2.;
+ iy*fStripXsize[iModule] + fStripXsize[iModule]/2.;
}
y = fModuleYmin[iModule] + fStripYsize[iModule] / 2.;
}
x = x - fRpcHalfXsize;
y = y - fRpcHalfYsize;
-// printf(" in GetPadC iModule ixGlo iyGlo ix iy x y %i %i %i %i %i %f %f \n",iModule,ixGlo,iyGlo,ix,iy,x,y);
+// printf(" in GetPadC fBending ix iy x y %i %i %i %f %f \n",fBending,ix,iy,x,y);
}
//_____________________________________________________________________________
void AliMUONTriggerSegmentation::GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
{
-// Returns pad coordinates (ix,iy) for given real coordinates (x,y)
-
+// Returns global pad coordinates (ix,iy) for local real coordinates (x,y)
x = x + fRpcHalfXsize;
y = y + fRpcHalfYsize;
// find module number
} //
} // loop on strips
} // if ix!=0
-// printf("in GetPadI ix iy x y %i %i %f %f \n",ix,iy,x,y);
+// printf("in GetPadI fBending x y ix iy %i %f %f %i %i \n",fBending,x,y,ix,iy);
}
//-------------------------------------------------------------------------
void AliMUONTriggerSegmentation::GetPadI(Float_t x, Float_t y , Float_t /*z*/, Int_t &ix, Int_t &iy)
{
GetPadI(x, y, ix, iy);
}
-//____________________________________________________________________________
-void AliMUONTriggerSegmentation::SetPadSize(Float_t p1, Float_t p2)
-{
-// Sets the padsize
- fDpx=p1;
- fDpy=p2;
-}
+
//-------------------------------------------------------------------------
void AliMUONTriggerSegmentation::SetLineNumber(Int_t iLineNumber){
fLineNumber = iLineNumber;
//-------------------------------------------------------------------------
void AliMUONTriggerSegmentation::SetPad(Int_t ix, Int_t iy)
{
- //
// Sets virtual pad coordinates, needed for evaluating pad response
// outside the tracking program
GetPadC(ix,iy,fX,fY);
+ fIx = ix; // used in IntegrationLimits
+ fIy = iy;
fSector=Sector(ix,iy);
}
//---------------------------------------------------------------------------
void AliMUONTriggerSegmentation::SetHit(Float_t x, Float_t y)
{
// Set current hit
- //
fXhit = x;
fYhit = y;
}
Int_t AliMUONTriggerSegmentation::Sector(Int_t ix, Int_t iy)
{
// determine segmentation zone from pad coordinates (from 1 to 8)
- Int_t ixGlo = 0;
- Int_t iyGlo = 0;
- GetPadLoc2Glo(ix, iy, ixGlo, iyGlo);
- if (!fBending && ModuleColNum(ixGlo)==6 && iyGlo>7) {
+ if (!fBending && ModuleColNum(ix)==6 && iy>7) {
return 8; // sector 8: diff. strip width within same module
} else {
- return ModuleColNum(ixGlo)+1;
+ return ModuleColNum(ix)+1;
}
}
//-----------------------------------------------------------------------------
void AliMUONTriggerSegmentation::
-IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
+IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& x3, Float_t& x4)
{
-/*
// need to return (only) x4 = dist. betwwen the hit and the closest border of
// the current strip
+
Int_t ix,iy;
Float_t xstrip,ystrip;
- 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
-
- // find the position of the 2 borders of the current strip
- Float_t ymin = ystrip - fStripXsize[ModuleColNum(ixGlo)
+ GetPadI(fXhit,fYhit,ix,iy);
+ GetPadC(ix,iy,xstrip,ystrip);
+ x1= (fBending) ? fYhit : fXhit; // hit y (bending) / x (!bending) position
+ x2= (fBending) ? ystrip : xstrip; // y or x coord. of the main strip
+ x3= (fBending) ? fY : fX; // current strip real y or x coord.
+ Int_t modNum = ModuleColNum(fIx);
-fYofxsmin[ModuleNumber(fIx)][fIy];
- Float_t ymax = fYofxsmax[ModuleNumber(fIx)][fIy];
-
+ // find the position of the 2 borders of the current strip
+ Float_t min = 0.;
+ Float_t max = 0.;
+ if (fBending) {
+ min = x3 - fStripYsize[modNum]/2.;
+ max = x3 + fStripYsize[modNum]/2.;
+ } else {
+ if (modNum==6 && fIy>7) { // equivalent to fSector == 8
+ min = x3 - fStripXsize[modNum]/4.;
+ max = x3 + fStripXsize[modNum]/4.;
+ } else
+ min = x3 - fStripXsize[modNum]/2.;
+ max = x3 + fStripXsize[modNum]/2.;
+ }
// 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);
-*/
- // Returns integration limits for current pad
- //
- x1=fXhit-fX-Dpx(fSector)/2.;
- x2=x1+Dpx(fSector);
- y1=fYhit-fY-Dpy(fSector)/2.;
- y2=y1+Dpy(fSector);
- // printf("\n Integration Limits %f %f %f %f %d %f", x1, x2, y1, y2, fSector, Dpx(fSector));
+ x4 = (TMath::Abs(max-x1) > TMath::Abs(min-x1)) ?
+ TMath::Abs(min-x1):TMath::Abs(max-x1);
+// printf("fBending x1 x3 min max x4 %i %f %f %f %f %f\n",fBending,x1,x3,min,max,x4);
}
void AliMUONTriggerSegmentation::
Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10])
{
- // Returns list of next neighbours for given Pad (iX, iY)
- Int_t i=0;
- // step right
- if (iX+1 <= fNpx) {
- Xlist[i]=iX+1;
- Ylist[i++]=iY;
- }
- // step left
- if (iX-1 > 0) {
- Xlist[i]=iX-1;
- Ylist[i++]=iY;
- }
- Int_t sector = Sector(iX,iY);
- // step up
- if (iY+1 <= fNpyS[sector]) {
- Xlist[i]=iX;
- Ylist[i++]=iY+1;
- }
- // step down
- if (iY-1 > 0) {
- Xlist[i]=iX;
- Ylist[i++]=iY-1;
- }
- *Nlist=i;
+//-----------------BENDING-----------------------------------------
+// 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 -
+
+//-----------------NON-BENDING-------------------------------------
+// Returns list of 10 next neighbours for given Y strip (ix, iy)
+// neighbour number 9 8 7 6 5 (Y strip (ix, iy)) 0 1 2 3 4 in the list
+// \_______/ \_______/
+// left right
+
+ Int_t absiX = TMath::Abs(iX);
+ Int_t modNum = ModuleColNum(absiX); // from 0 to 6
+ Int_t nStrip = fNstrip[modNum];
+
+ if (fBending) {
+ 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
+
+ } else { // non-bending
+
+ Int_t iCandidateLeft, iCandidateRight;
+ Int_t iNewCandidateRight=0;
+ Int_t iNewCandidateLeft=0;
+// first strip number on the right of the left module
+ if ( modNum!=0 && absiX!=52 )
+ iNewCandidateLeft = fNstrip[modNum-1]-1;
+ 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;
+ iCandidateRight = iY + (i + 1);
+ iCandidateLeft = iY - (i + 1);
+ if (iCandidateRight < nStrip) { // strip in same module
+ Xlist[i] = absiX;
+ Ylist[i] = iCandidateRight;
+ } else if (modNum!=6) { // need to scan the module on the right
+ Xlist[i] = absiX+1;
+ Ylist[i] = iNewCandidateRight;
+ iNewCandidateRight++;
+ }
+
+ if (iCandidateLeft >=0 ) { // strip in same module
+ Xlist[j] = absiX;
+ Ylist[j] = iCandidateLeft;
+ } else if ( iNewCandidateLeft !=0) {
+ Xlist[j] = absiX-1;
+ Ylist[j] = iNewCandidateLeft;
+ iNewCandidateLeft--;
+ }
+ }
+
+ if (iX<0) { // left side of chamber
+ for (Int_t i=0; i<10; i++) {
+ if (Xlist[i]!=0) Xlist[i]=-Xlist[i];
+ }
+ }
+
+ } // iY < nStrip
+ } // non-bending
+
+// for (Int_t i=0; i<10; i++) {
+// printf("AliMUONTriggerSegmentation LOC fBending i ix iy = %i %i %i %i \n",fBending,i,Xlist[i],Ylist[i]);
+// }
}
//--------------------------------------------------------------------------
}
*/
-
-
-// printf("npad = %i",npad);
-
fId = detectionElementId;
}
#include "AliMUONVGeometryDESegmentation.h"
-class TArrayF;
-class TArrayI;
-
class AliMUONTriggerSegmentation : public AliMUONVGeometryDESegmentation
{
public:
virtual Bool_t HasPad(Int_t ix, Int_t iy);
virtual AliMUONGeometryDirection GetDirection() { return kDirUndefined; }
- virtual Float_t GetAnod(Float_t /*xhit*/) const {return 0; } // Anod wire coordinate closest to xhit
+ virtual Float_t GetAnod(Float_t /*xhit*/) const {return 0; } // Anod wire coordinate closest to xhit
virtual void GetPadI(Float_t x ,Float_t y ,Int_t &ix,Int_t &iy); // Transform from pad to real coordinates
virtual void GetPadI(Float_t x, Float_t y , Float_t z, Int_t &ix, Int_t &iy);
virtual void GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y);
virtual void GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y, Float_t &z) {z=0; GetPadC(ix, iy, x , y);}
virtual void GetPadLoc2Glo(Int_t ixLoc, Int_t iyLoc, Int_t &ixGlo, Int_t &iyGlo);
-
+ virtual void GetPadGlo2Loc(Int_t ixLoc, Int_t iyLoc, Int_t &ixGlo, Int_t &iyGlo);
virtual void IntegrationLimits(Float_t& x1, Float_t& x2, Float_t& y1, Float_t& y2); //Current integration limits
virtual Int_t ISector() {return fSector;} // Current Pad during Integration (current sector)
virtual Int_t Ix() {return fIx;} // x-coordinate
virtual void SetId(Int_t id) {fId=id;} // Setting detection element
virtual void SetPad(Int_t ix, Int_t iy); // Set pad position
virtual void SetPadDivision(Int_t /*ndiv[4]*/){} // Set Slat Segmentation Parameters
- virtual void SetPadSize(Float_t p1, Float_t p2); // Pad size Dx*Dy
+ virtual void SetPadSize(Float_t /*p1*/, Float_t /*p2*/){;}; // Pad size Dx*Dy
virtual void SetPcbBoards(Int_t /*n[4]*/){} // Set Segmentation Zones (PCB Boards)
// add to St345SlatSegmentation
virtual void SetLineNumber(Int_t iLineNumber);
virtual Int_t ModuleColNum(Int_t ixGlo);
+// add to St345SlatSegmentation
// The following function could be obsolet for this class, but they are pure virtual in AliSegmentation
virtual void GetNParallelAndOffset(Int_t /*iX*/, Int_t /*iY*/, Int_t */*Nparallel*/, Int_t */*Offset*/){};
Float_t stripYsize[7],
Float_t stripXsize[7],
Float_t offset); // Initialisation
- // Current integration limits
protected:
AliMUONTriggerSegmentation(const AliMUONTriggerSegmentation& rhs);
AliMUONTriggerSegmentation& operator=(const AliMUONTriggerSegmentation& rhs);
- // Internal geometry of the slat
+ // Internal geometry
Bool_t fBending; // 0: Bending or 1:Non Bending segmentation
Int_t fId; // Identifier of detection element
- Int_t fNsec; // Number of density sectors (should be 4, if not not warranty about the output
- TArrayI* fNDiv; // Densities (d1, d2, d3, d4). It should be (4, 4, 2, 1) which goes from beam to out-beam
- TArrayF* fDpxD; // x pad width per density sector
- TArrayF* fDpyD; // x pad width per density sector
- Float_t fDpx; // x pad base width
- Float_t fDpy; // y pad base width
+ Int_t fNsec; // Number of density sectors
Int_t fNpx; // Number of pads in x
Int_t fNpy; // Number of pads in y
- Float_t fWireD; // wire pitch
- //
Int_t fSector; // Current density sector
- Float_t fDxPCB; // x-size of PCB board
- Float_t fDyPCB; // y-size of PCB board
- Int_t fPcbBoards[4]; // number of PCB boards per density sector n1,n2,n3,n4
- // n1 PcbBoard with density d1, n2 PcbBoards with density d2, etc ....
-
- // Segmentation map
- Int_t fNpxS[10]; // Number of pads per sector in x
- Int_t fNpyS[10]; // Number of pads per sector in y
- Float_t fCx[10]; // pad-sector contour x vs y
- Float_t fCy; // y offset
// Current pad and wire during tracking (cursor at hit centre)
Float_t fXhit; // ! x-position of hit
Float_t fX; // ! real coord. x
Float_t fY; // ! real ccord. y
- // Chamber region consideres during disintegration
- Int_t fIxmin; // ! lower left x
- Int_t fIxmax; // ! lower left y
- Int_t fIymin; // ! upper right x
- Int_t fIymax; // ! upper right y
// add to St345SlatSegmentation
Int_t fLineNumber; // line number of the RPC (1:9 - top:bottom)
Int_t fNstrip[7]; // number of strips per module in RPC
Float_t fRpcHalfYsize; // RPC half size in y
// add to St345SlatSegmentation
- // Chamber region consideres during disintegration (lower left and upper right corner)
- Float_t fXmin; // lower left x
- Float_t fXmax; // lower left y
- Float_t fYmin; // upper right x
- Float_t fYmax; // upper right y
-
ClassDef(AliMUONTriggerSegmentation,1)
};
#endif