X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=MUON%2FAliMUONSegmentationSlat.cxx;h=6986364bb94e7536a3b5ac786b80d503a8f2c2df;hb=e81ffe364e20fd9dffe19b73193988f054a2529e;hp=b56c4c903a0c76e9c4e46037a210d70e3a2b54bb;hpb=3e1872ed16b6ae3e7a9f378c8b108b719c0563de;p=u%2Fmrichter%2FAliRoot.git diff --git a/MUON/AliMUONSegmentationSlat.cxx b/MUON/AliMUONSegmentationSlat.cxx index b56c4c903a0..6986364bb94 100644 --- a/MUON/AliMUONSegmentationSlat.cxx +++ b/MUON/AliMUONSegmentationSlat.cxx @@ -13,15 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -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. - -*/ +/* $Id$ */ #include "AliMUONSegmentationSlat.h" #include "AliMUONSegmentationSlatModule.h" @@ -31,18 +23,70 @@ Segmentation class for chambers built out of slats. #include "TObjArray.h" #include "AliRun.h" #include -#include +#include +#include +#include +#include //___________________________________________ ClassImp(AliMUONSegmentationSlat) AliMUONSegmentationSlat::AliMUONSegmentationSlat() + : AliSegmentation() { // Default constructor + fChamber = 0; + fNDiv = 0; + fSlats = 0; + fCurrentSlat = 0; +} + +AliMUONSegmentationSlat::AliMUONSegmentationSlat(Int_t /*nsec*/) + : AliSegmentation() +{ +// Non default constructor fSlats=0; - fNDiv = new TArrayI(4); + fNDiv = new TArrayI(4); + fChamber = 0; + fCurrentSlat = 0; +} + +AliMUONSegmentationSlat::AliMUONSegmentationSlat(const AliMUONSegmentationSlat& rhs) + : AliSegmentation(rhs) +{ +// Protected copy constructor + + Fatal("AliMUONSegmentationSlatModule", "Not implemented."); } +AliMUONSegmentationSlat::~AliMUONSegmentationSlat(){ + //PH Delete TObjArrays + if (fSlats) { + fSlats->Delete(); + delete fSlats; + } + + if (fNDiv) { + delete fNDiv; + } + +} + +//---------------------------------------------------------------------- +AliMUONSegmentationSlat& +AliMUONSegmentationSlat::operator=(const AliMUONSegmentationSlat& rhs) +{ +// Protected assignement operator + + if (this == &rhs) return *this; + + Fatal("operator=", "Not implemented."); + + return *this; +} + + +//----------------------------------------------------------- void AliMUONSegmentationSlat::SetPadSize(Float_t p1, Float_t p2) { // Sets the pad (strip) size @@ -50,14 +94,28 @@ void AliMUONSegmentationSlat::SetPadSize(Float_t p1, Float_t p2) fDpx=p1; fDpy=p2; } - +//----------------------------------------------------------- Float_t AliMUONSegmentationSlat::GetAnod(Float_t xhit) const { // Returns for a hit position xhit the position of the nearest anode wire Float_t wire= (xhit>0)? Int_t(xhit/fWireD)+0.5:Int_t(xhit/fWireD)-0.5; return fWireD*wire; } - +//----------------------------------------------------------- +void AliMUONSegmentationSlat::GetNParallelAndOffset(Int_t /*iX*/, Int_t /*iY*/, Int_t *Nparallel, Int_t *Offset) +{ + *Nparallel=1; + *Offset=0; +} +//----------------------------------------------------------- +void AliMUONSegmentationSlat::GiveTestPoints(Int_t & /*n*/, Float_t */*x*/, Float_t */*y*/) const +{;} +//----------------------------------------------------------- +Float_t AliMUONSegmentationSlat::Distance2AndOffset(Int_t /*iX*/, Int_t /*iY*/, Float_t /*X*/, Float_t /*Y*/, Int_t * /*dummy*/) +{ + return 0.; +} +//----------------------------------------------------------- Float_t AliMUONSegmentationSlat::Dpx(Int_t isec) const { // @@ -70,7 +128,7 @@ Float_t AliMUONSegmentationSlat::Dpx(Int_t isec) const return Slat(islat)->Dpx(iregion); } -Float_t AliMUONSegmentationSlat::Dpy(Int_t isec) const +Float_t AliMUONSegmentationSlat::Dpy(Int_t /*isec*/) const { // // Returns y-pad (strip) size for given sector isec @@ -98,33 +156,38 @@ void AliMUONSegmentationSlat::GlobalToLocal( Float_t zlocal; Int_t i; Int_t index=-1; + Float_t eps = 1.e-4; + // Transform According to slat plane z-position: negative side is shifted down // 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; + zlocal = (x>0) ? zlocal+2.*fDz : zlocal-2.*fDz; //Change? // 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; -// + // Find slat number - for (i=ifirst; i= fYPosition[i]) && (yabs < fYPosition[i]+fSlatY)) break; + if ((y >= fYPosition[i]-eps) && (y <= fYPosition[i]+fSlatY+eps)) break; } // // Transform to local coordinate system - ylocal = yabs-fYPosition[index]; - xlocal = xabs-fXPosition[index]; - islat = index; - if (i >= fNSlats) {islat = -1; x=-1; y = -1;} + if (index >= fNSlats || index < 0 ) { + islat = -1; xlocal=-1; ylocal = -1; } + else { + ylocal = y -fYPosition[index]; + xlocal = xabs-fXPosition[index]; + islat = index; + } } void AliMUONSegmentationSlat::GlobalToLocal( @@ -133,8 +196,8 @@ void AliMUONSegmentationSlat::GlobalToLocal( // // 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; @@ -151,8 +214,6 @@ void AliMUONSegmentationSlat::GlobalToLocal( ixlocal=TMath::Abs(ix); islat=index; - -// Done ! } void AliMUONSegmentationSlat:: @@ -166,17 +227,13 @@ LocalToGlobal(Int_t islat, Float_t xlocal, Float_t ylocal, Float_t &x, Float_ // 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 ; //Change for new referential + z = (x>0) ? z+2.*fDz : z-2.*fDz ; + z+=fChamber->Z(); } @@ -192,24 +249,21 @@ void AliMUONSegmentationSlat::LocalToGlobal( // Find slat number (index) and iylocal for (i=0; iNpy(); - 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:: @@ -229,10 +283,9 @@ GetPadI(Float_t x, Float_t y, Float_t z, Int_t &ix, Int_t &iy) for (i=0; iNpy(); 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) { @@ -247,18 +300,13 @@ 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 ; //Change for new referential + z = (x>0) ? z+2.*fDz : z-2.*fDz ; + z += fChamber->Z(); } Int_t AliMUONSegmentationSlat::ISector() @@ -272,6 +320,7 @@ 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); @@ -288,7 +337,7 @@ void AliMUONSegmentationSlat::SetPad(Int_t ix, Int_t iy) // outside the tracking program Int_t islat, ixlocal, iylocal; - SetSymmetry(ix,iy); + SetSymmetry(ix); GlobalToLocal(ix,iy,islat,ixlocal,iylocal); fSlatIndex=islat; @@ -321,13 +370,14 @@ FirstPad(Float_t xhit, Float_t yhit, Float_t zhit, Float_t dx, Float_t dy) // - Int_t islat; Float_t xlocal, ylocal; GlobalToLocal(xhit, yhit, zhit, islat, xlocal, ylocal); fSlatIndex=islat; - fCurrentSlat=Slat(islat); - fCurrentSlat->FirstPad(xlocal, ylocal, dx, dy); + if (islat>-1) { + fCurrentSlat=Slat(islat); + fCurrentSlat->FirstPad(xlocal, ylocal, dx, dy); + } } @@ -365,7 +415,7 @@ Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10]) Int_t i, xListLocal[10], yListLocal[10], iXlocal, iYlocal, islat; - SetSymmetry(iX,iY); + SetSymmetry(iX); GlobalToLocal(iX, iY, islat, iXlocal, iYlocal); @@ -435,20 +485,19 @@ void AliMUONSegmentationSlat::Init(Int_t chamber) // 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); @@ -457,7 +506,7 @@ void AliMUONSegmentationSlat::Init(Int_t chamber) fNpx=0; // for each slat in the quadrant (+,+) for (islat=0; islatAddAt(CreateSlatModule(),islat); AliMUONSegmentationSlatModule *slat = Slat(islat); // Configure Slat @@ -473,8 +522,7 @@ void AliMUONSegmentationSlat::Init(Int_t chamber) // 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(); @@ -488,6 +536,7 @@ void AliMUONSegmentationSlat::Init(Int_t chamber) // Set parent chamber number AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON"); fChamber=&(pMUON->Chamber(chamber)); + fId=chamber; } @@ -513,17 +562,72 @@ void AliMUONSegmentationSlat::SetSlatXPositions(Float_t *xpos) } AliMUONSegmentationSlatModule* AliMUONSegmentationSlat::Slat(Int_t index) const -{ return ((AliMUONSegmentationSlatModule*) (*fSlats)[index]);} + //PH { return ((AliMUONSegmentationSlatModule*) (*fSlats)[index]);} +{ return ((AliMUONSegmentationSlatModule*) fSlats->At(index));} AliMUONSegmentationSlatModule* AliMUONSegmentationSlat:: 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; iGetGeometry()->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; jcd(); + 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); + } + } +}