From aaf4addd7229d586bebdb011b810f59c9a44bbc8 Mon Sep 17 00:00:00 2001 From: morsch Date: Mon, 6 Nov 2000 09:20:43 +0000 Subject: [PATCH] AliMUON delegates part of BuildGeometry() to AliMUONSegmentation using the Draw() method. This avoids code and parameter replication. --- MUON/AliMUON.cxx | 163 ++++--------------------- MUON/AliMUONSegmentationSlat.cxx | 61 ++++++++- MUON/AliMUONSegmentationSlat.h | 13 +- MUON/AliMUONSegmentationSlatModule.cxx | 7 +- MUON/AliMUONSegmentationSlatModule.h | 1 - MUON/AliMUONSegmentationV0.cxx | 5 + MUON/AliMUONSegmentationV0.h | 5 +- MUON/AliMUONSegmentationV01.cxx | 124 ++++++++++++++----- 8 files changed, 198 insertions(+), 181 deletions(-) diff --git a/MUON/AliMUON.cxx b/MUON/AliMUON.cxx index 55b7aefc15b..4fca192fc15 100644 --- a/MUON/AliMUON.cxx +++ b/MUON/AliMUON.cxx @@ -14,6 +14,9 @@ **************************************************************************/ /* $Log$ +Revision 1.37 2000/10/26 09:53:37 pcrochet +put back trigger chambers in the display (there was a problem in buildgeometry) + Revision 1.36 2000/10/25 19:51:18 morsch Correct x-position of chambers. @@ -433,11 +436,10 @@ void AliMUON::AddLocalTrigger(Int_t *localtr) //___________________________________________ void AliMUON::BuildGeometry() { - TNode *node, *nodeF, *top, *nodeS; - const int kColorMUON = kBlue; + TNode *node, *top, *nodeS; const int kColorMUON2 = kYellow; - const int kColorMUON3 = kBlue; - // + +// top=gAlice->GetGeometry()->GetNode("alice"); // MUON // @@ -448,159 +450,36 @@ void AliMUON::BuildGeometry() // outer diameter (Ylenght for trigger chamber -> active area) const Float_t kDmax[7]={183., 245., 346., 520., 520., 612., 612.}; - 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); - - Float_t rmin, rmax, dx, dy, dz, dr, xpos, ypos, zpos; + Float_t xpos, ypos, zpos; Float_t dzc1=4.; // tracking chambers Float_t dzc2=15.; // trigger chambers - Float_t hole=102.; // x-y hole around beam pipe for trig. chambers + Float_t hole=102.; // x-y hole around beam pipe for trig. chambers Float_t zscale; // scaling parameter trigger chambers Float_t halfx, halfy; - char nameChamber[9], nameSense[9], nameFrame[9], nameNode[9]; + char nameChamber[9], nameSense[9], nameNode[9]; char nameSense1[9], nameSense2[9]; for (Int_t i=0; i<7; i++) { for (Int_t j=0; j<2; j++) { Int_t id=2*i+j+1; if (i<5) { // tracking chambers - if (j==0) { - zpos=kCz[i]-dzc1; - } else { - zpos=kCz[i]+dzc1; - } + if (j==0) { + zpos=kCz[i]-dzc1; + } else { + zpos=kCz[i]+dzc1; + } } else { - if (j==0) { - zpos=kCz[i]; - } else { - zpos=kCz[i]+dzc2; - } + if (j==0) { + zpos=kCz[i]; + } else { + zpos=kCz[i]+dzc2; + } } sprintf(nameChamber,"C_MUON%d",id); sprintf(nameSense,"S_MUON%d",id); sprintf(nameSense1,"S1_MUON%d",id); sprintf(nameSense2,"S2_MUON%d",id); - sprintf(nameFrame,"F_MUON%d",id); - if (i<2) { // tracking chambers - rmin = kDmin[i]/2.-3; - rmax = kDmax[i]/2.+3; - new TTUBE(nameChamber,"Mother","void",rmin,rmax,0.25,1.); - rmin = kDmin[i]/2.; - rmax = kDmax[i]/2.; - new TTUBE(nameSense,"Sens. region","void",rmin,rmax,0.25, 1.); - dx=(rmax-rmin)/2; - dy=3.; - dz=0.25; - TBRIK* frMUON = new TBRIK(nameFrame,"Frame","void",dx,dy,dz); - top->cd(); - sprintf(nameNode,"MUON%d",100+id); - node = new TNode(nameNode,"ChamberNode",nameChamber,0,0,zpos,""); - node->SetLineColor(kColorMUON); - fNodes->Add(node); - node->cd(); - sprintf(nameNode,"MUON%d",200+id); - node = new TNode(nameNode,"Sens. Region Node",nameSense,0,0,0,""); - node->SetLineColor(kColorMUON); - node->cd(); - dr=dx+rmin; - sprintf(nameNode,"MUON%d",300+id); - nodeF = new TNode(nameNode,"Frame0",frMUON,dr, 0, 0,rot000,""); - nodeF->SetLineColor(kColorMUON); - node->cd(); - sprintf(nameNode,"MUON%d",400+id); - nodeF = new TNode(nameNode,"Frame1",frMUON,0 ,dr,0,rot090,""); - nodeF->SetLineColor(kColorMUON); - node->cd(); - sprintf(nameNode,"MUON%d",500+id); - nodeF = new TNode(nameNode,"Frame2",frMUON,-dr,0,0,rot180,""); - nodeF->SetLineColor(kColorMUON); - node ->cd(); - sprintf(nameNode,"MUON%d",600+id); - nodeF = new TNode(nameNode,"Frame3",frMUON,0,-dr,0,rot270,""); - nodeF->SetLineColor(kColorMUON); - } else if (i >= 2 && i <= 4) { - Int_t nslats; - Int_t npcb[7]={0, 0, 0, 0, 0, 0, 0}; - if (i==2) { - nslats = 4; - npcb[0] = 3; npcb[1] = 4; npcb[2] = 3; npcb[3] = 2; - } else if (i==3) { - nslats = 6; - npcb[0] = 4; npcb[1] = 5; npcb[2] = 5; npcb[3] = 4; - npcb[4] = 3; npcb[5] = 2; - } else { - nslats = 7; - npcb[0] = 7; npcb[1] = 7; npcb[2] = 6; npcb[3] = 6; - npcb[4] = 5; npcb[5] = 4; npcb[6] = 2; - } - - char nameSlat[9]; - - Float_t xpos=2.; - Float_t ypos1=-0.75+20.; - Float_t ypos2= 0.75-20.; - if (i!=2) { - ypos1=ypos2=0.; - } - - new TBRIK(nameChamber,"Mother","void",340,340,5.); - top->cd(); - sprintf(nameNode,"MUON%d",100+id); - node = new TNode(nameNode,"Chambernode",nameChamber,0,0,zpos,""); - node->SetLineColor(kBlack); - fNodes->Add(node); - TNode* nodeSlat; - Int_t color; - - for (Int_t j=0; jcd(); - xpos=20.*npcb[j]+2; - - if (j==0 && i!=2) xpos+=37.5; - if (j==0 && i==2) xpos+=40; - - color = TMath::Even(j) ? kColorMUON2 : kColorMUON3; - - sprintf(nameNode,"SLAT%d",100*id+j); - nodeSlat = - new TNode(nameNode,"Slat Module",nameSlat,xpos,ypos1,0,""); - nodeSlat->SetLineColor(color); - - node->cd(); - sprintf(nameNode,"SLAT%d",100*id+j+7); - nodeSlat = - new TNode(nameNode,"Slat Module",nameSlat,-xpos,ypos1,0,""); - nodeSlat->SetLineColor(color); - - if (i==2 || (i!=2 && j!=0)) { - - if (i==2) { - color = TMath::Even(j) ? kColorMUON3 : kColorMUON2; - } else { - color = TMath::Even(j) ? kColorMUON2 : kColorMUON3; - } - - - sprintf(nameNode,"SLAT%d",100*id+j+14); - nodeSlat = - new TNode(nameNode,"Slat Module",nameSlat,xpos,ypos2,0,""); - nodeSlat->SetLineColor(color); - - node->cd(); - sprintf(nameNode,"SLAT%d",100*id+j+21); - nodeSlat = - new TNode(nameNode,"Slat Module",nameSlat,-xpos,ypos2,0,""); - nodeSlat->SetLineColor(color); - } - - ypos1+=38.5; - ypos2-=38.5; - } - + if (i <= 4) { + this->Chamber(id-1).SegmentationModel(1)->Draw("eventdisplay"); } else { zscale=zpos/kCz[5]; Float_t xsize=kDmin[i]*zscale; diff --git a/MUON/AliMUONSegmentationSlat.cxx b/MUON/AliMUONSegmentationSlat.cxx index 2a53407baba..e4681d2a729 100644 --- a/MUON/AliMUONSegmentationSlat.cxx +++ b/MUON/AliMUONSegmentationSlat.cxx @@ -15,6 +15,9 @@ /* $Log$ +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. @@ -38,6 +41,9 @@ Segmentation class for chambers built out of slats. #include "TObjArray.h" #include "AliRun.h" #include +#include +#include +#include #include //___________________________________________ @@ -424,7 +430,7 @@ void AliMUONSegmentationSlat::Init(Int_t chamber) printf("\n Initialise Segmentation Slat \n"); // -// Initialize Slat modules +// Initialize Slat modules Int_t islat, i; Int_t ndiv[4]; // Pad division @@ -472,6 +478,7 @@ void AliMUONSegmentationSlat::Init(Int_t chamber) // Set parent chamber number AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON"); fChamber=&(pMUON->Chamber(chamber)); + fId=chamber; } @@ -508,6 +515,58 @@ CreateSlatModule() } +void AliMUONSegmentationSlat::Draw(const char* opt) const +{ + 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); + } + } +} diff --git a/MUON/AliMUONSegmentationSlat.h b/MUON/AliMUONSegmentationSlat.h index 5cca149c426..298027dbac4 100644 --- a/MUON/AliMUONSegmentationSlat.h +++ b/MUON/AliMUONSegmentationSlat.h @@ -111,7 +111,8 @@ public AliSegmentation { // Test points for auto calibration virtual void GiveTestPoints(Int_t &n, Float_t *x, Float_t *y) const {;} // Draw the segmentation zones - virtual void Draw(const char *opt = "") const {;} + virtual void Draw(const char *opt = "") const; + // Function for systematic corrections // Set the correction function @@ -138,7 +139,7 @@ public AliSegmentation { protected: AliMUONChamber* fChamber; // Parent Chamber - + Int_t fId; // Identifier // // Geometry // @@ -160,11 +161,11 @@ public AliSegmentation { TArrayI* fNDiv; // Pad size division // Slats - TObjArray* fSlats; // Array of Slats + TObjArray* fSlats; // Array of Slats // Proxy data - AliMUONSegmentationSlatModule* fCurrentSlat; // Pointer to current slat - Int_t fSlatIndex; // Current slat index - ClassDef(AliMUONSegmentationSlat,1) // Segmentation for Muon Chamber built from Slat Modules + AliMUONSegmentationSlatModule* fCurrentSlat; // Pointer to current slat + Int_t fSlatIndex; // Current slat index + ClassDef(AliMUONSegmentationSlat,1) // Segmentation for Muon Chamber built from Slat Modules }; diff --git a/MUON/AliMUONSegmentationSlatModule.cxx b/MUON/AliMUONSegmentationSlatModule.cxx index b26f9b65e18..e0f1752e893 100644 --- a/MUON/AliMUONSegmentationSlatModule.cxx +++ b/MUON/AliMUONSegmentationSlatModule.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.5 2000/10/26 19:32:04 morsch +Problem with iteration over y-pads for 2nd cathode corrected. + Revision 1.4 2000/10/25 19:56:55 morsch Handle correctly slats with less than 3 segmentation zones. @@ -37,6 +40,8 @@ Segmentation classes for bending and non bending plane slat modules (A. de Falco #include "AliMUONSegmentationSlatModule.h" +#include "AliRun.h" +#include "AliMUON.h" #include #include @@ -384,8 +389,8 @@ void AliMUONSegmentationSlatModule::Init(Int_t chamber) fNpy=nPyPCB; fNpx=fNpxS[3]; // + AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON"); fId = chamber; - } diff --git a/MUON/AliMUONSegmentationSlatModule.h b/MUON/AliMUONSegmentationSlatModule.h index cf2329668a4..4da95ecfd5e 100644 --- a/MUON/AliMUONSegmentationSlatModule.h +++ b/MUON/AliMUONSegmentationSlatModule.h @@ -80,7 +80,6 @@ public AliMUONSegmentationV0 { // // Geometry // - Int_t fId; // Id of this module Int_t fNsec; // Number of sectors TArrayI* fNDiv; // Pad size division TArrayF* fDpxD; // y pad width per sector diff --git a/MUON/AliMUONSegmentationV0.cxx b/MUON/AliMUONSegmentationV0.cxx index d958c1f15d9..d189acbf919 100644 --- a/MUON/AliMUONSegmentationV0.cxx +++ b/MUON/AliMUONSegmentationV0.cxx @@ -14,6 +14,10 @@ **************************************************************************/ /* $Log$ +Revision 1.8 2000/10/18 11:42:06 morsch +- AliMUONRawCluster contains z-position. +- Some clean-up of useless print statements during initialisations. + Revision 1.7 2000/10/03 21:48:07 morsch Adopt to const declaration of some of the methods in AliSegmentation. @@ -76,6 +80,7 @@ ClassImp(AliMUONSegmentationV0) fRmax=fChamber->ROuter(); fCorr=0; fZ=fChamber->Z(); + fId=chamber; } diff --git a/MUON/AliMUONSegmentationV0.h b/MUON/AliMUONSegmentationV0.h index 13c699dfa12..6c6c422bea4 100644 --- a/MUON/AliMUONSegmentationV0.h +++ b/MUON/AliMUONSegmentationV0.h @@ -155,9 +155,10 @@ dummy); Int_t fIwt; // wire number Float_t fXt; // x Float_t fYt; // y - TF1* fCorr; // correction function + TF1* fCorr; // !correction function // - AliMUONChamber* fChamber; // Reference to mother chamber + AliMUONChamber* fChamber; // ! Reference to mother chamber + Int_t fId; // Identifier Float_t fZ; // z-position of chamber }; #endif diff --git a/MUON/AliMUONSegmentationV01.cxx b/MUON/AliMUONSegmentationV01.cxx index e34de2a07c0..b4164b20330 100644 --- a/MUON/AliMUONSegmentationV01.cxx +++ b/MUON/AliMUONSegmentationV01.cxx @@ -15,6 +15,10 @@ /* $Log$ +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. @@ -57,6 +61,10 @@ AliMUONSegmentationV01 code from AliMUONSegResV01.cxx ///////////////////////////////////////////////////// #include +#include +#include +#include +#include #include #include #include @@ -192,6 +200,7 @@ void AliMUONSegmentationV01::Init(Int_t 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) @@ -484,10 +493,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; @@ -496,35 +564,35 @@ 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) { -- 2.43.0