/*
$Log$
+Revision 1.12 2001/05/16 14:57:17 alibrary
+New files for folders and Stack
+
+Revision 1.11 2001/01/26 21:25:48 morsch
+Empty default constructors and.
+
+Revision 1.10 2001/01/23 18:58:19 hristov
+Initialisation of some pointers
+
+Revision 1.9 2001/01/17 20:53:40 hristov
+Destructors corrected to avoid memory leaks
+
+Revision 1.8 2000/12/21 22:12:41 morsch
+Clean-up of coding rule violations,
+
+Revision 1.7 2000/11/08 13:01:40 morsch
+Chamber half-planes of stations 3-5 at different z-positions.
+
+Revision 1.6 2000/11/06 09:20:43 morsch
+AliMUON delegates part of BuildGeometry() to AliMUONSegmentation using the
+Draw() method. This avoids code and parameter replication.
+
+Revision 1.5 2000/10/23 13:37:40 morsch
+Correct z-position of slat planes.
+
+Revision 1.4 2000/10/22 16:55:43 morsch
+Use only x-symmetry in global to local transformations and delegation.
+
+Revision 1.3 2000/10/18 11:42:06 morsch
+- AliMUONRawCluster contains z-position.
+- Some clean-up of useless print statements during initialisations.
+
+Revision 1.2 2000/10/09 14:06:18 morsch
+Some type cast problems of type (TMath::Sign((Float_t)1.,x)) corrected (P.H.)
+
Revision 1.1 2000/10/06 09:00:47 morsch
Segmentation class for chambers built out of slats.
#include "TObjArray.h"
#include "AliRun.h"
#include <TMath.h>
+#include <TBRIK.h>
+#include <TNode.h>
+#include <TGeometry.h>
#include <iostream.h>
//___________________________________________
AliMUONSegmentationSlat::AliMUONSegmentationSlat()
{
// Default constructor
+}
+
+AliMUONSegmentationSlat::AliMUONSegmentationSlat(Int_t nsec)
+{
+// Non default constructor
fSlats=0;
- fNDiv = new TArrayI(4);
+ fNDiv = new TArrayI(4);
+ fChamber = 0;
+ fCurrentSlat = 0;
+}
+
+AliMUONSegmentationSlat::~AliMUONSegmentationSlat(){
+ //PH Delete TObjArrays
+ if (fSlats) {
+ fSlats->Delete();
+ delete fSlats;
+ }
+
+ if (fNDiv) {
+ delete fNDiv;
+ }
+
}
void AliMUONSegmentationSlat::SetPadSize(Float_t p1, Float_t p2)
// positive side is shifted up
// by half the overlap
zlocal = z-fChamber->Z();
- Float_t ys = y-TMath::Sign(fShift,zlocal);
-
+ zlocal = (x>0) ? zlocal-2.*fDz : zlocal+2.*fDz;
// Set the signs for the symmetry transformation and transform to first quadrant
- SetSymmetry(x,ys);
- Float_t yabs=TMath::Abs(ys);
+ SetSymmetry(x);
Float_t xabs=TMath::Abs(x);
- Int_t ifirst = (zlocal*ys < Float_t(0))? 0:1;
+ Int_t ifirst = (zlocal < Float_t(0))? 0:1;
//
// Find slat number
for (i=ifirst; i<fNSlats; i+=2) {
index=i;
- if ((yabs >= fYPosition[i]) && (yabs < fYPosition[i]+fSlatY)) break;
+ if ((y >= fYPosition[i]) && (y < fYPosition[i]+fSlatY)) break;
}
//
// Transform to local coordinate system
- ylocal = yabs-fYPosition[index];
+ ylocal = y -fYPosition[index];
xlocal = xabs-fXPosition[index];
islat = index;
if (i >= fNSlats) {islat = -1; x=-1; y = -1;}
//
// Perform global to local transformation for pad coordinates
//
- Int_t iytemp = TMath::Abs(iy);
- Int_t index = 0;
+ Int_t iytemp = iy;
+ Int_t index = 0;
iylocal = iytemp;
ixlocal=TMath::Abs(ix);
islat=index;
-
-// Done !
}
void AliMUONSegmentationSlat::
// lower plane (y<0) odd slat number is shifted down
//
- x = (xlocal+fXPosition[islat])*fSym[0];
- if ((TMath::Even(islat) && fSym[1]>0) || (TMath::Odd(islat)&&fSym[1]<0)) {
- y=(ylocal+fYPosition[islat])*fSym[1]-fShift;
- z=-fDz;
- } else {
- y=(ylocal+fYPosition[islat])*fSym[1]+fShift;
- z=fDz;
- }
+ x = (xlocal+fXPosition[islat])*fSym;
+ y=(ylocal+fYPosition[islat]);
- z+=fChamber->Z();
+ z = (TMath::Even(islat)) ? -fDz : fDz ;
+ z = (x>0) ? z+2.*fDz : z-2.*fDz ;
+ z+=fChamber->Z();
}
// Find slat number (index) and iylocal
for (i=0; i<islat; i++) iy+=Slat(islat)->Npy();
- ix=ixlocal*fSym[0];
- iy=iy*fSym[1];
+ ix=ixlocal*fSym;
+ iy=iy;
}
-void AliMUONSegmentationSlat::SetSymmetry(Int_t ix, Int_t iy)
+void AliMUONSegmentationSlat::SetSymmetry(Int_t ix)
{
// Set set signs for symmetry transformation
- fSym[0]=TMath::Sign(1,ix);
- fSym[1]=TMath::Sign(1,iy);
-
+ fSym=TMath::Sign(1,ix);
}
-void AliMUONSegmentationSlat::SetSymmetry(Float_t x, Float_t y)
+void AliMUONSegmentationSlat::SetSymmetry(Float_t x)
{
// Set set signs for symmetry transformation
- fSym[0]=Int_t (TMath::Sign((Float_t)1.,x));
- fSym[1]=Int_t (TMath::Sign((Float_t)1.,y));
+ fSym=Int_t (TMath::Sign((Float_t)1.,x));
}
void AliMUONSegmentationSlat::
for (i=0; i<islat; i++) iy+=Slat(islat)->Npy();
ix=ix*Int_t(TMath::Sign((Float_t)1.,x));
-// Transform y
- iy=iy*Int_t(TMath::Sign((Float_t)1.,y));
}
+
void AliMUONSegmentationSlat::
GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y, Float_t &z)
{
x+=fXPosition[islat];
y+=fYPosition[islat];
-// Symmetry transformation of quadrants
+// Symmetry transformation of half planes
x=x*TMath::Sign(1,ix);
- y=y*TMath::Sign(1,iy);
-
-// Shift of slat planes
- if ((TMath::Even(islat)&&iy>0) || (TMath::Odd(islat)&&iy<0)) {
- y-=fShift;
- z=-fDz+fChamber->Z();
- } else {
- y+=fShift;
- z=fDz+fChamber->Z();
- }
+
+// z-position
+ z = (TMath::Even(islat)) ? -fDz : fDz ;
+ z = (x>0) ? z+2.*fDz : z-2.*fDz ;
+ z += fChamber->Z();
}
Int_t AliMUONSegmentationSlat::ISector()
Int_t AliMUONSegmentationSlat::Sector(Int_t ix, Int_t iy)
{
+// Returns sector for pad coordiantes (ix,iy)
Int_t ixlocal, iylocal, iregion, islat;
GlobalToLocal(ix,iy,islat,ixlocal,iylocal);
// outside the tracking program
Int_t islat, ixlocal, iylocal;
- SetSymmetry(ix,iy);
+ SetSymmetry(ix);
GlobalToLocal(ix,iy,islat,ixlocal,iylocal);
fSlatIndex=islat;
Int_t i, xListLocal[10], yListLocal[10], iXlocal, iYlocal, islat;
- SetSymmetry(iX,iY);
+ SetSymmetry(iX);
GlobalToLocal(iX, iY, islat, iXlocal, iYlocal);
// Initialize slat modules of quadrant +/+
// The other three quadrants are handled through symmetry transformations
//
- printf("\n Initialise segmentation Slat \n");
+ //printf("\n Initialise Segmentation Slat \n");
//
-// Initialize Slat modules
+// Initialize Slat modules
Int_t islat, i;
Int_t ndiv[4];
// Pad division
for (i=0; i<4; i++) ndiv[i]=(*fNDiv)[i];
-// Half distance between slat planes
- fDz=1.76;
+//
+ fDz=0.813;
// Slat height
fSlatY=40.;
- for (i=0; i<10; i++) fSlatX[i]=0.;
-
+ for (i=0; i<15; i++) fSlatX[i]=0.;
// Initialize array of slats
fSlats = new TObjArray(fNSlats);
fNpx=0;
// for each slat in the quadrant (+,+)
for (islat=0; islat<fNSlats; islat++) {
- (*fSlats)[islat] = CreateSlatModule();
+ fSlats->AddAt(CreateSlatModule(),islat);
AliMUONSegmentationSlatModule *slat = Slat(islat);
// Configure Slat
// Initialize slat module
slat->Init(chamber);
// y-position of slat module relative to the first (closest to the beam)
- fYPosition[islat]=islat*(fSlatY-2.*fShift);
- if (TMath::Odd(islat)) fYPosition[islat] -= 2*fShift;
+ fYPosition[islat]= fYPosOrigin+islat*(fSlatY-2.*fShift);
//
fNpy+=slat->Npy();
if (slat->Npx() > fNpx) fNpx=slat->Npx();
// Set parent chamber number
AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON");
fChamber=&(pMUON->Chamber(chamber));
+ fId=chamber;
}
CreateSlatModule()
{
// Factory method for slat module
- return new AliMUONSegmentationSlatModule();
+ return new AliMUONSegmentationSlatModule(4);
}
+void AliMUONSegmentationSlat::Draw(const char* opt) const
+{
+// Draw method for event display
+//
+ if (!strcmp(opt,"eventdisplay")) {
+ const int kColorMUON1 = kYellow;
+ const int kColorMUON2 = kBlue;
+ //
+ // Drawing Routines for example for Event Display
+ Int_t i,j;
+ Int_t npcb[15];
+ char nameChamber[9], nameSlat[9], nameNode[9];
+
+ //
+ // Number of modules per slat
+ for (i=0; i<fNSlats; i++) {
+ npcb[i]=0;
+ for (j=0; j<4; j++) npcb[i]+=fPcb[i][j];
+ }
+ //
+ TNode* top=gAlice->GetGeometry()->GetNode("alice");
+ sprintf(nameChamber,"C_MUON%d",fId+1);
+ new TBRIK(nameChamber,"Mother","void",340,340,5.);
+ top->cd();
+ sprintf(nameNode,"MUON%d",100+fId+1);
+ TNode* node = new TNode(nameNode,"Chambernode",nameChamber,0,0,fChamber->Z(),"");
+
+ node->SetLineColor(kBlack);
+ AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON");
+ (pMUON->Nodes())->Add(node);
+ TNode* nodeSlat;
+ Int_t color;
+
+ for (j=0; j<fNSlats; j++)
+ {
+ sprintf(nameSlat,"SLAT%d",100*fId+1+j);
+ Float_t dx = 20.*npcb[j];
+ Float_t dy = 20;
+ new TBRIK(nameSlat,"Slat Module","void",dx,20.,0.25);
+ node->cd();
+ color = TMath::Even(j) ? kColorMUON1 : kColorMUON2;
+
+ sprintf(nameNode,"SLAT%d",100*fId+1+j);
+ nodeSlat =
+ new TNode(nameNode,"Slat Module",nameSlat, dx+fXPosition[j],fYPosition[j]+dy,0,"");
+ nodeSlat->SetLineColor(color);
+ node->cd();
+ sprintf(nameNode,"SLAT%d",100*fId+1+j+fNSlats);
+ nodeSlat =
+ new TNode(nameNode,"Slat Module",nameSlat,-dx-fXPosition[j],fYPosition[j]+dy,0,"");
+ nodeSlat->SetLineColor(color);
+ }
+ }
+}