* provided "as is" without express or implied warranty. *
**************************************************************************/
-/*
-$Log$
-Revision 1.4 2000/10/22 16:55:43 morsch
-Use only x-symmetry in global to local transformations and delegation.
+/* $Id$ */
-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 <TArrayI.h>
+#include <TObjArray.h>
+#include <TMath.h>
+#include <TBRIK.h>
+#include <TNode.h>
+#include <TGeometry.h>
#include "AliMUONSegmentationSlat.h"
#include "AliMUONSegmentationSlatModule.h"
#include "AliMUON.h"
#include "AliMUONChamber.h"
-#include "TArrayI.h"
-#include "TObjArray.h"
#include "AliRun.h"
-#include <TMath.h>
-#include <iostream.h>
//___________________________________________
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
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
{
//
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
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();
+
+// 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);
Float_t xabs=TMath::Abs(x);
- Int_t ifirst = (zlocal < Float_t(0))? 0:1;
-//
+
// Find slat number
- for (i=ifirst; i<fNSlats; i+=2) {
+ for (i=0; i<fNSlats; i+=1) { //Loop on all slats (longuer but more secure)
index=i;
- if ((y >= fYPosition[i]) && (y < fYPosition[i]+fSlatY)) break;
+ if ((y >= fYPosition[i]-eps) && (y <= fYPosition[i]+fSlatY+eps)) break;
}
//
// Transform to local coordinate system
- ylocal = y -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(
- Int_t ix, Int_t iy, Int_t &islat, Int_t &ixlocal, Int_t &iylocal)
+ Int_t ix, Int_t iy, Int_t &islat, Int_t &ixlocal, Int_t &iylocal) const
{
//
// Perform global to local transformation for pad coordinates
for (Int_t i=0; i<fNSlats; i++) {
iytemp-=Slat(i)->Npy();
-
if (iytemp <= 0) break;
iylocal = iytemp;
index=i+1;
}
-
ixlocal=TMath::Abs(ix);
islat=index;
}
void AliMUONSegmentationSlat::
-LocalToGlobal(Int_t islat, Float_t xlocal, Float_t ylocal, Float_t &x, Float_t &y, Float_t &z)
+LocalToGlobal(Int_t islat, Float_t xlocal, Float_t ylocal, Float_t &x, Float_t &y, Float_t &z) const
{
// Transform from local to global space coordinates
//
x = (xlocal+fXPosition[islat])*fSym;
y=(ylocal+fYPosition[islat]);
- z = (TMath::Even(islat)) ? -fDz : fDz ;
+ z = (TMath::Even(islat)) ? fDz : -fDz ; //Change for new referential
+ z = (x>0) ? z+2.*fDz : z-2.*fDz ;
+
z+=fChamber->Z();
}
-void AliMUONSegmentationSlat::LocalToGlobal(
- Int_t islat, Int_t ixlocal, Int_t iylocal, Int_t &ix, Int_t &iy)
+void AliMUONSegmentationSlat::LocalToGlobal (
+ Int_t islat, Int_t ixlocal, Int_t iylocal, Int_t &ix, Int_t &iy) const
{
// Transform from local to global pad coordinates
//
x=x*TMath::Sign(1,ix);
// z-position
- z = (TMath::Even(islat)) ? -fDz : fDz ;
+ 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::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);
//
-
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);
+ }
}
Int_t ixl,iyl,ix,iy;
ixl=fCurrentSlat->Ix();
iyl=fCurrentSlat->Iy();
-
LocalToGlobal(fSlatIndex, ixl, iyl, ix, iy);
+
Int_t ixc, iyc, isc;
Float_t xc, yc;
GlobalToLocal(ix, iy, isc, ixc, iyc);
+
Slat(isc)->GetPadC(ixc,iyc,xc,yc);
return ix;
}
// 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
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
// Set parent chamber number
AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON");
fChamber=&(pMUON->Chamber(chamber));
+ fId=chamber;
}
}
AliMUONSegmentationSlatModule* AliMUONSegmentationSlat::Slat(Int_t index) const
-{ return ((AliMUONSegmentationSlatModule*) (*fSlats)[index]);}
+ //PH { return ((AliMUONSegmentationSlatModule*) (*fSlats)[index]);}
+{ return ((AliMUONSegmentationSlatModule*) fSlats->At(index));}
AliMUONSegmentationSlatModule* AliMUONSegmentationSlat::
-CreateSlatModule()
+CreateSlatModule() const
{
// Factory method for slat module
- return new AliMUONSegmentationSlatModule();
+ return new AliMUONSegmentationSlatModule(4);
}
+void AliMUONSegmentationSlat::Draw(const char* opt)
+{
+// 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);
+ }
+ }
+}