X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;ds=sidebyside;f=MUON%2FAliMUONSegmentationV01.cxx;h=c22dce0fba10ee62a57c66fa11be1d58606534ff;hb=34225ff3e33060c98ae3113767da46dbbf2c4448;hp=91055bfdc4a15b13f8893acdc10ddf9ca9d8440f;hpb=c3eff6ad79d33ab459a3d9c7fb371dd365d33e2f;p=u%2Fmrichter%2FAliRoot.git diff --git a/MUON/AliMUONSegmentationV01.cxx b/MUON/AliMUONSegmentationV01.cxx index 91055bfdc4a..c22dce0fba1 100644 --- a/MUON/AliMUONSegmentationV01.cxx +++ b/MUON/AliMUONSegmentationV01.cxx @@ -15,6 +15,48 @@ /* $Log$ +Revision 1.20 2001/07/20 10:03:14 morsch +Changes needed to work with Root 3.01 (substitute lhs [] operator). (Jiri Chudoba) + +Revision 1.19 2001/05/16 14:57:17 alibrary +New files for folders and Stack + +Revision 1.18 2001/04/11 12:33:56 morsch +Bug in GetPadC in case of staggered planes corrected. (Thanks to J.P. Cussonneau) + +Revision 1.17 2001/01/30 12:17:04 morsch +Remove obolete print-statement. + +Revision 1.16 2001/01/30 09:23:14 hristov +Streamers removed (R.Brun) + +Revision 1.15 2001/01/26 21:25:48 morsch +Empty default constructors and. + +Revision 1.14 2000/12/21 22:12:41 morsch +Clean-up of coding rule violations, + +Revision 1.13 2000/12/07 10:41:51 hristov +fCorr replaced by fCorrA + +Revision 1.12 2000/12/06 11:55:41 morsch +Introduce SetOffsetY(Float_t off) method as simplified simulation of pad staggering. +fOffset is the staggering offset in y. + +Revision 1.11 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.10 2000/10/18 11:42:06 morsch +- AliMUONRawCluster contains z-position. +- Some clean-up of useless print statements during initialisations. + +Revision 1.9 2000/10/18 08:41:32 morsch +Make NextPad() and MorePads() to iterate until the end. + +Revision 1.8 2000/10/03 21:48:07 morsch +Adopt to const declaration of some of the methods in AliSegmentation. + Revision 1.7 2000/10/02 21:28:09 fca Removal of useless dependecies via forward declarations @@ -51,12 +93,18 @@ AliMUONSegmentationV01 code from AliMUONSegResV01.cxx ///////////////////////////////////////////////////// #include +#include +#include +#include +#include #include #include #include #include "AliMUONSegmentationV01.h" #include "AliMUON.h" +#include "AliMUONChamber.h" +#include "AliRun.h" @@ -67,22 +115,49 @@ AliMUONSegmentationV01::AliMUONSegmentationV01(const AliMUONSegmentationV01& seg { // Dummy copy constructor } + AliMUONSegmentationV01::AliMUONSegmentationV01() { // Default constructor - fNsec=4; + fRSec = 0; + fNDiv = 0; + fDpxD = 0; + fCorrA = 0; +} + +AliMUONSegmentationV01::AliMUONSegmentationV01(Int_t nsec) +{ +// Non default constructor + + fNsec = nsec; fRSec = new TArrayF(fNsec); fNDiv = new TArrayI(fNsec); fDpxD = new TArrayF(fNsec); + + (*fRSec)[0]=(*fRSec)[1]=(*fRSec)[2]=(*fRSec)[3]=0; (*fNDiv)[0]=(*fNDiv)[1]=(*fNDiv)[2]=(*fNDiv)[3]=0; (*fDpxD)[0]=(*fDpxD)[1]=(*fDpxD)[2]=(*fDpxD)[3]=0; - fCorr = new TObjArray(3); - (*fCorr)[0]=0; - (*fCorr)[1]=0; - (*fCorr)[2]=0; + fCorrA = new TObjArray(3); + fCorrA->AddAt(0,0); + fCorrA->AddAt(0,1); + fCorrA->AddAt(0,2); + fOffsetY=0; } +AliMUONSegmentationV01::~AliMUONSegmentationV01() +{ +// Destructor + if (fRSec) delete fRSec; + if (fNDiv) delete fNDiv; + if (fDpxD) delete fDpxD; + if (fCorrA) { + fCorrA->Delete(); + delete fCorrA; + } +} + + Float_t AliMUONSegmentationV01::Dpx(Int_t isec) const { // @@ -104,8 +179,6 @@ void AliMUONSegmentationV01::SetSegRadii(Float_t r[4]) // Set the radii of the segmentation zones for (Int_t i=0; i<4; i++) { (*fRSec)[i]=r[i]; - printf("\n R %d %f \n",i,(*fRSec)[i]); - } } @@ -119,7 +192,6 @@ void AliMUONSegmentationV01::SetPadDivision(Int_t ndiv[4]) // for (Int_t i=0; i<4; i++) { (*fNDiv)[i]=ndiv[i]; - printf("\n Ndiv %d %d \n",i,(*fNDiv)[i]); } ndiv[0]=ndiv[1]; } @@ -134,14 +206,15 @@ void AliMUONSegmentationV01::Init(Int_t chamber) // This version approximates concentric segmentation zones // Int_t isec; - printf("\n Initialise segmentation v01 -- test !!!!!!!!!!!!!! \n"); + //printf("\n Initialise Segmentation V01\n"); + + fNpy=Int_t((*fRSec)[fNsec-1]/fDpy)+1; (*fDpxD)[fNsec-1]=fDpx; if (fNsec > 1) { for (Int_t i=fNsec-2; i>=0; i--){ (*fDpxD)[i]=(*fDpxD)[fNsec-1]/(*fNDiv)[i]; - printf("\n test ---dx %d %f \n",i,(*fDpxD)[i]); } } // @@ -184,6 +257,11 @@ void AliMUONSegmentationV01::Init(Int_t chamber) } } // y-pad loop } // sector loop +// reference to chamber + AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON"); + fChamber=&(pMUON->Chamber(chamber)); + fZ = fChamber->Z(); + fId=chamber; } Int_t AliMUONSegmentationV01::Sector(Int_t ix, Int_t iy) @@ -207,7 +285,11 @@ GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy) { // Returns pad coordinates (ix,iy) for given real coordinates (x,y) // - iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy)-1; + iy = (y-fOffsetY >0)? + Int_t((y-fOffsetY)/fDpy)+1 + : + Int_t((y-fOffsetY)/fDpy)-1; + if (iy > fNpy) iy= fNpy; if (iy < -fNpy) iy=-fNpy; // @@ -237,7 +319,11 @@ GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y) { // Returns real coordinates (x,y) for given pad coordinates (ix,iy) // - y = (iy>0) ? Float_t(iy*fDpy)-fDpy/2. : Float_t(iy*fDpy)+fDpy/2.; + y = (iy>0) ? + Float_t(iy*fDpy)-fDpy/2.+fOffsetY + : + Float_t(iy*fDpy)+fDpy/2.+fOffsetY; + // // Find sector isec Int_t isec=AliMUONSegmentationV01::Sector(ix,iy); @@ -324,7 +410,8 @@ void AliMUONSegmentationV01::NextPad() // get x-pad coordiante for first pad in row (fIx) GetPadI(fXmin,yc,fIx,iyc); } else { - printf("\n Error: Stepping outside integration region\n "); + fIx=-1; + fIy=-1; } GetPadC(fIx,fIy,fX,fY); fSector=Sector(fIx,fIy); @@ -334,15 +421,19 @@ void AliMUONSegmentationV01::NextPad() } Int_t AliMUONSegmentationV01::MorePads() + +{ // Stopping condition for the iterator over pads // // Are there more pads in the integration region -{ + return (fIx != -1 || fIy != -1); +/* if ((fX >= fXmax && fIy >= fIymax) || fY==0) { return 0; } else { return 1; } +*/ } void AliMUONSegmentationV01:: @@ -472,10 +563,69 @@ void AliMUONSegmentationV01::GiveTestPoints(Int_t &n, Float_t *x, Float_t *y) co y[2]=x[2]; } -void AliMUONSegmentationV01::Draw(const char *) const +void AliMUONSegmentationV01::Draw(const char* opt) const { + // Draws the segmentation zones // + if (!strcmp(opt,"eventdisplay")) { + const int kColorMUON = kBlue; + + TRotMatrix* rot000 = new TRotMatrix("Rot000"," ", 90, 0, 90, 90, 0, 0); + TRotMatrix* rot090 = new TRotMatrix("Rot090"," ", 90, 90, 90,180, 0, 0); + TRotMatrix* rot180 = new TRotMatrix("Rot180"," ", 90,180, 90,270, 0, 0); + TRotMatrix* rot270 = new TRotMatrix("Rot270"," ", 90,270, 90, 0, 0, 0); + + char nameChamber[9], nameSense[9], nameFrame[9], nameNode[9]; + char nameSense1[9], nameSense2[9]; + TNode *node, *nodeF; + + sprintf(nameChamber,"C_MUON%d",fId+1); + sprintf(nameSense,"S_MUON%d",fId+1); + sprintf(nameSense1,"S1_MUON%d",fId+1); + sprintf(nameSense2,"S2_MUON%d",fId+1); + sprintf(nameFrame,"F_MUON%d",fId+1); + + TNode* top=gAlice->GetGeometry()->GetNode("alice"); + + Float_t rmin = (*fRSec)[0]-3; + Float_t rmax = (*fRSec)[3]+3; + new TTUBE(nameChamber,"Mother","void",rmin,rmax,0.25,1.); + rmin = (*fRSec)[0]; + rmax = (*fRSec)[3]; + new TTUBE(nameSense,"Sens. region","void",rmin,rmax,0.25, 1.); + Float_t dx=(rmax-rmin)/2; + Float_t dy=3.; + Float_t dz=0.25; + TBRIK* frMUON = new TBRIK(nameFrame,"Frame","void",dx,dy,dz); + top->cd(); + sprintf(nameNode,"MUON%d",100+fId+1); + node = new TNode(nameNode,"ChamberNode",nameChamber,0,0,fChamber->Z(),""); + node->SetLineColor(kColorMUON); + AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON"); + (pMUON->Nodes())->Add(node); + node->cd(); + sprintf(nameNode,"MUON%d",200+fId+1); + node = new TNode(nameNode,"Sens. Region Node",nameSense,0,0,0,""); + node->SetLineColor(kColorMUON); + node->cd(); + Float_t dr=dx+rmin; + sprintf(nameNode,"MUON%d",300+fId+1); + nodeF = new TNode(nameNode,"Frame0",frMUON,dr, 0, 0,rot000,""); + nodeF->SetLineColor(kColorMUON); + node->cd(); + sprintf(nameNode,"MUON%d",400+fId+1); + nodeF = new TNode(nameNode,"Frame1",frMUON,0 ,dr,0,rot090,""); + nodeF->SetLineColor(kColorMUON); + node->cd(); + sprintf(nameNode,"MUON%d",500+fId+1); + nodeF = new TNode(nameNode,"Frame2",frMUON,-dr,0,0,rot180,""); + nodeF->SetLineColor(kColorMUON); + node ->cd(); + sprintf(nameNode,"MUON%d",600+fId+1); + nodeF = new TNode(nameNode,"Frame3",frMUON,0,-dr,0,rot270,""); + nodeF->SetLineColor(kColorMUON); + } else { TBox *box; Float_t dx=0.95/fCx[3][1]/2; @@ -484,44 +634,47 @@ void AliMUONSegmentationV01::Draw(const char *) const Float_t xc=0.5; Float_t yc=0.5; - for (Int_t iy=1; iySetFillColor(isec+1); - box->Draw(); - - box=new TBox(-x1+xc,y0+yc,-x0+xc,y1+yc); - box->SetFillColor(isec+1); - box->Draw(); - - box=new TBox(x0+xc,-y1+yc,x1+xc,-y0+yc); - box->SetFillColor(isec+1); - box->Draw(); - - box=new TBox(-x1+xc,-y1+yc,-x0+xc,-y0+yc); - box->SetFillColor(isec+1); - box->Draw(); + for (Int_t iy=1; iySetFillColor(isec+1); + box->Draw(); + + box=new TBox(-x1+xc,y0+yc,-x0+xc,y1+yc); + box->SetFillColor(isec+1); + box->Draw(); + + box=new TBox(x0+xc,-y1+yc,x1+xc,-y0+yc); + box->SetFillColor(isec+1); + box->Draw(); + + box=new TBox(-x1+xc,-y1+yc,-x0+xc,-y0+yc); + box->SetFillColor(isec+1); + box->Draw(); + } } + } } void AliMUONSegmentationV01::SetCorrFunc(Int_t isec, TF1* func) { - (*fCorr)[isec]=func; +// Set the correction function + fCorrA->AddAt(func,isec); } TF1* AliMUONSegmentationV01::CorrFunc(Int_t isec) const { - return (TF1*) (*fCorr)[isec]; +// Get correction function + //PH return (TF1*) (*fCorrA)[isec]; + return (TF1*) fCorrA->At(isec); } AliMUONSegmentationV01& AliMUONSegmentationV01::operator @@ -530,3 +683,4 @@ AliMUONSegmentationV01& AliMUONSegmentationV01::operator // Dummy assignment operator return *this; } +