BuildGeometry of AliMUON for trigger chambers delegated to AliMUONSegmentationTrigger...
authorpcrochet <pcrochet@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 12 Nov 2000 17:17:03 +0000 (17:17 +0000)
committerpcrochet <pcrochet@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 12 Nov 2000 17:17:03 +0000 (17:17 +0000)
MUON/AliMUON.cxx
MUON/AliMUONSegmentationTrigger.cxx
MUON/AliMUONSegmentationTrigger.h
MUON/AliMUONSegmentationTriggerX.cxx
MUON/AliMUONSegmentationTriggerX.h

index 4fca192fc1556be66405955fde5d935ad26633ea..b870e57bef557a65c5dff1ed05c45e6fcc8e931e 100644 (file)
  **************************************************************************/
 /*
 $Log$
  **************************************************************************/
 /*
 $Log$
+Revision 1.38  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.37  2000/10/26 09:53:37  pcrochet
 put back trigger chambers in the display (there was a problem in buildgeometry)
 
 Revision 1.37  2000/10/26 09:53:37  pcrochet
 put back trigger chambers in the display (there was a problem in buildgeometry)
 
@@ -436,134 +440,14 @@ void AliMUON::AddLocalTrigger(Int_t *localtr)
 //___________________________________________
 void AliMUON::BuildGeometry()
 {
 //___________________________________________
 void AliMUON::BuildGeometry()
 {
-    TNode *node, *top, *nodeS;
-    const int kColorMUON2 = kYellow;
-
-//
-    top=gAlice->GetGeometry()->GetNode("alice");
-// MUON
-//
-//  z-Positions of Chambers
-    const Float_t kCz[7]={511., 686., 971., 1245., 1445., 1600, 1700.};
-//  inner diameter (Xlenght for trigger chamber -> active area)
-    const Float_t kDmin[7]={ 35.,  47.,  67.,   86.,  100., 544., 544.};
-//  outer diameter (Ylenght for trigger chamber -> active area)
-    const Float_t kDmax[7]={183., 245., 346.,  520.,  520., 612., 612.};
-
-    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 zscale;            // scaling parameter trigger chambers
-    Float_t halfx, halfy;   
-    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;
-             }
-           } else {
-             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);
-           if (i <= 4) {
-             this->Chamber(id-1).SegmentationModel(1)->Draw("eventdisplay");           
-           } else { 
-               zscale=zpos/kCz[5];
-               Float_t xsize=kDmin[i]*zscale;
-               Float_t ysize=kDmax[i]*zscale;
-               Float_t holeScaled=hole*zscale;
-               
-               halfx=xsize/2.+3.;
-               halfy=ysize/2.+3.;          
-               new TBRIK(nameChamber,"Mother","void",halfx,halfy,0.25);
-               top->cd();
-               sprintf(nameNode,"MUON%d",100+id);
-               node = new TNode(nameNode,"Chambernode",nameChamber,0,0,zpos,"");
-               node->SetLineColor(kColorMUON2);
-               fNodes->Add(node);
-               
-// up/down of beam pipe
-               halfx=xsize/2.;
-               halfy=(ysize/2.-holeScaled/2.)/2.;          
-               new TBRIK(nameSense,"Sens. region","void",halfx,halfy,0.25);
-               
-               node->cd();
-               ypos=holeScaled/2.+((ysize/2.-holeScaled/2.)/2.);
-               sprintf(nameNode,"MUON%d",200+id);
-               nodeS = new TNode(nameNode,"Sens. Region Node",nameSense,0,ypos,0,"");
-               nodeS->SetLineColor(kColorMUON2);
-               
-               node->cd();
-               ypos=-1.*ypos;
-               sprintf(nameNode,"MUON%d",300+id);
-               nodeS = new TNode(nameNode,"Sens. Region Node",nameSense,0,ypos,0,"");
-               nodeS->SetLineColor(kColorMUON2);
-               
-// left/right of beam pipe
-               halfx=(xsize/2.-holeScaled/2.)/2.;
-               halfy=holeScaled/2.;    
-               new TBRIK(nameSense1,"Sens. region","void",halfx,halfy,0.25);
-               
-               node->cd();
-               xpos=holeScaled/2.+((xsize/2.-holeScaled/2.)/2.);           
-               sprintf(nameNode,"MUON%d",400+id);
-               nodeS = new TNode(nameNode,"Sens. Region Node",nameSense1,xpos,0,0,"");
-               nodeS->SetLineColor(kColorMUON2);
-               
-               node->cd();
-               xpos=-1.*xpos;
-               sprintf(nameNode,"MUON%d",500+id);
-               nodeS = new TNode(nameNode,"Sens. Region Node",nameSense1,xpos,0,0,"");
-               nodeS->SetLineColor(kColorMUON2);
-               
-// missing corners
-               halfx=17.*zscale/2.;
-               halfy=halfx;
-               new TBRIK(nameSense2,"Sens. region","void",halfx,halfy,0.25);
-               
-               node->cd();
-               xpos=holeScaled/2.-halfx;
-               ypos=xpos;
-               sprintf(nameNode,"MUON%d",600+id);
-               nodeS = new TNode(nameNode,"Sens. Region Node",nameSense2,xpos,ypos,0,"");
-               nodeS->SetLineColor(kColorMUON2);
-               
-               node->cd();
-               ypos=-1.*xpos;
-               sprintf(nameNode,"MUON%d",700+id);
-               nodeS = new TNode(nameNode,"Sens. Region Node",nameSense2,xpos,ypos,0,"");
-               nodeS->SetLineColor(kColorMUON2);
-               
-               node->cd();
-               xpos=-1.*xpos;
-               sprintf(nameNode,"MUON%d",800+id);
-               nodeS = new TNode(nameNode,"Sens. Region Node",nameSense2,xpos,ypos,0,"");
-               nodeS->SetLineColor(kColorMUON2);
-               
-               node->cd();
-               ypos=-1.*xpos;
-               sprintf(nameNode,"MUON%d",900+id);
-               nodeS = new TNode(nameNode,"Sens. Region Node",nameSense2,xpos,ypos,0,"");
-               nodeS->SetLineColor(kColorMUON2);
-           } 
-       }
+  for (Int_t i=0; i<7; i++) {
+    for (Int_t j=0; j<2; j++) {
+      Int_t id=2*i+j+1;
+      this->Chamber(id-1).SegmentationModel(1)->Draw("eventdisplay");
     }
     }
+  }
 }
 
 }
 
-
 //___________________________________________
 Int_t AliMUON::DistancetoPrimitive(Int_t , Int_t )
 {
 //___________________________________________
 Int_t AliMUON::DistancetoPrimitive(Int_t , Int_t )
 {
index 274c97908025ead28739e4b793547863590f23f3..49f78bf2ab9cf9a94444175697d7611a0338ade3 100644 (file)
 
 /*
 $Log$
 
 /*
 $Log$
+Revision 1.5  2000/10/02 16:58:29  egangler
+Cleaning of the code :
+-> coding conventions
+-> void Streamers
+-> some useless includes removed or replaced by "class" statement
+
 Revision 1.4  2000/06/29 12:34:09  morsch
 AliMUONSegmentation class has been made independent of AliMUONChamber. This makes
 it usable with any other geometry class. The link to the object to which it belongs is
 Revision 1.4  2000/06/29 12:34:09  morsch
 AliMUONSegmentation class has been made independent of AliMUONChamber. This makes
 it usable with any other geometry class. The link to the object to which it belongs is
@@ -57,7 +63,7 @@ Draft version from P. Crochet
 #include <TArc.h>
 #include "AliMUONChamber.h"
 #include <iostream.h>
 #include <TArc.h>
 #include "AliMUONChamber.h"
 #include <iostream.h>
+
 ClassImp(AliMUONSegmentationTrigger)
 
 //------------------------------------------------------------------
 ClassImp(AliMUONSegmentationTrigger)
 
 //------------------------------------------------------------------
@@ -182,6 +188,10 @@ void AliMUONSegmentationTrigger::Init(Int_t chamber)
   fNpx=124;
   fNpy=64;  
 
   fNpx=124;
   fNpy=64;  
 
+// Set parent chamber number
+  fChamber=&(pMUON->Chamber(chamber));
+  fId=chamber;
+
   cout << "---------------------------------------------------- \n";   
 
 }
   cout << "---------------------------------------------------- \n";   
 
 }
index d6056f7fe8fde04ef68a4654adedbf9c686efdaf..5074c54a529bdbd759351346267b09c4ab7d9330 100644 (file)
@@ -25,17 +25,20 @@ public AliMUONSegmentationV0 {
     virtual void     SetHit(Float_t xhit, Float_t yhit);
     virtual void     SetHit(Float_t xhit, Float_t yhit, Float_t zhit)
        {SetHit(xhit, yhit);}
     virtual void     SetHit(Float_t xhit, Float_t yhit);
     virtual void     SetHit(Float_t xhit, Float_t yhit, Float_t zhit)
        {SetHit(xhit, yhit);}
-    
+    // Draw the segmentation zones
     virtual void Draw(const char *opt="") const {}
     virtual void Draw(const char *opt="") const {}
-  
+  protected:
+    AliMUONChamber*      fChamber;               // Parent Chamber
+    Int_t                fId;                    // Identifier
 
  protected:
     Float_t StripSizeX(Int_t imodule);
     Float_t StripSizeY(Int_t imodule);    
  protected:
 
  protected:
     Float_t StripSizeX(Int_t imodule);
     Float_t StripSizeY(Int_t imodule);    
  protected:
-  Float_t fYcmin[126];       // y min position of modules
-  Float_t fYcmax[126];       // y max position of modules
-  Float_t fZscale;            // scaling factor (Zx/Z1, x=1,2,3,4)
+    Float_t fYcmin[126];       // y min position of modules
+    Float_t fYcmax[126];       // y max position of modules
+    Float_t fZscale;            // scaling factor (Zx/Z1, x=1,2,3,4)
   
 // Current pad during integration (cursor for disintegration)
   Int_t fIx;  // pad coord.  x 
   
 // Current pad during integration (cursor for disintegration)
   Int_t fIx;  // pad coord.  x 
index e0ed5de8a7d352f0888cbce7e92b7a28ee861ae4..8c1815ee0a7a0d33ea5170feb27c27d070c89940 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
 
 /*
 $Log$
+Revision 1.7  2000/10/03 21:48:07  morsch
+Adopt to const declaration of some of the methods in AliSegmentation.
+
 Revision 1.6  2000/10/02 16:58:29  egangler
 Cleaning of the code :
 -> coding conventions
 Revision 1.6  2000/10/02 16:58:29  egangler
 Cleaning of the code :
 -> coding conventions
@@ -60,12 +63,19 @@ Draft version from P. Crochet
 
 */
 
 
 */
 
+#include <TMath.h>
+#include <TBRIK.h>
+#include <TNode.h>
+#include <TGeometry.h>
+
+#include "AliMUON.h"
 #include "AliMUONSegmentationTriggerX.h"
 #include "AliMUONTriggerConstants.h"
 #include "TMath.h"
 #include "TRandom.h"
 #include "TArc.h"
 #include "AliMUONChamber.h"
 #include "AliMUONSegmentationTriggerX.h"
 #include "AliMUONTriggerConstants.h"
 #include "TMath.h"
 #include "TRandom.h"
 #include "TArc.h"
 #include "AliMUONChamber.h"
+#include "AliRun.h"  // gAlice
 #include <iostream.h> 
 ClassImp(AliMUONSegmentationTriggerX)
 
 #include <iostream.h> 
 ClassImp(AliMUONSegmentationTriggerX)
 
@@ -283,10 +293,71 @@ IntegrationLimits(Float_t& x1, Float_t& x2, Float_t& x3, Float_t& width)
   width=StripSizeX(ix);   // width of the main strip 
 }
 
   width=StripSizeX(ix);   // width of the main strip 
 }
 
-
-
-
-
-
+//------------------------------------------------------------------   
+void AliMUONSegmentationTriggerX::Draw(const char* opt) const
+{
+  
+  if (!strcmp(opt,"eventdisplay")) { 
+    TNode *node, *nodeS;
+    char nameChamber[10], nameNode[10];
+    char nameSense1[10], nameSense2[10], nameSense3[10], nameSense4[10];
+    
+    TNode* top=gAlice->GetGeometry()->GetNode("alice"); 
+    sprintf(nameChamber,"C_MUON%d",fId+1);
+    new TBRIK(nameChamber,"Mother","void",340.,340.,0.25);
+    top->cd();
+    sprintf(nameNode,"MUON%d",100+fId+1);
+    node = new TNode(nameNode,"Chambernode",nameChamber,0,0,fChamber->Z(),"");
+    node->SetLineColor(kBlack);    
+    AliMUON *pMUON  = (AliMUON *) gAlice->GetModule("MUON");
+    (pMUON->Nodes())->Add(node);
+    
+    sprintf(nameSense1,"S1_MUON%d",fId+1);
+    sprintf(nameSense2,"S2_MUON%d",fId+1);
+    sprintf(nameSense3,"S3_MUON%d",fId+1);
+    sprintf(nameSense4,"S4_MUON%d",fId+1);
+    
+    for (Int_t imodule=0; imodule<AliMUONTriggerConstants::Nmodule(); imodule++) {    
+      Int_t idModule=AliMUONTriggerConstants::ModuleId(imodule);
+      
+      if (TMath::Abs(idModule)!=51) {   
+       
+       Int_t nStripX=AliMUONTriggerConstants::NstripX(imodule);
+       Float_t xmin=fXofxsmin[imodule][0];
+       Float_t xmax=fXofxsmax[imodule][nStripX-1];
+       Float_t ymin=fYofxsmin[imodule][0];
+       Float_t ymax=fYofxsmax[imodule][nStripX-1];
+       Float_t xpos=xmin+(xmax-xmin)/2.;
+       Float_t ypos=ymin+(ymax-ymin)/2.;
+       Float_t halfx=(xmax-xmin)/2.;
+       Float_t halfy=(ymax-ymin)/2.;
+       
+       if (idModule==11) 
+         new TBRIK(nameSense1,"Module","void",halfx,halfy,0.25);   
+       if (idModule==17) 
+         new TBRIK(nameSense2,"Module","void",halfx,halfy,0.25);   
+       if (idModule==41) 
+         new TBRIK(nameSense3,"Module","void",halfx,halfy,0.25);   
+       if (idModule==52) 
+         new TBRIK(nameSense4,"Module","void",halfx,halfy,0.25); 
+       node->cd();
+       sprintf(nameNode,"S_MUON%d",1000*fId+1+imodule);
+       
+       if (TMath::Abs(idModule)==41||TMath::Abs(idModule)==61) {
+         nodeS = new TNode(nameNode,"Module",nameSense3,xpos,ypos,0,"");
+       } else if (TMath::Abs(idModule)==52) {
+         nodeS = new TNode(nameNode,"Module",nameSense4,xpos,ypos,0,"");
+       } else if (TMath::Abs((idModule-Int_t(idModule/10)*10.))!=7) {
+         nodeS = new TNode(nameNode,"Module",nameSense1,xpos,ypos,0,"");
+       } else {
+         //    } else if (TMath::Abs((idModule-Int_t(idModule/10)*10.))==7) {
+         nodeS = new TNode(nameNode,"Module",nameSense2,xpos,ypos,0,"");
+       }
+       nodeS->SetLineColor(kBlue);
+       node->cd();
+      }
+    }
+  }
+}
 
 
 
 
index 00c01b8ee6ec3ea2ce35186d16a22acca352af75..eca60149eda10e486ccbf258e7d2dc66d9dbac22 100644 (file)
@@ -26,8 +26,8 @@ public AliMUONSegmentationTrigger {
   virtual void    GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y);
   virtual void    GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y, Float_t &z) 
       {z=0; GetPadC(ix, iy, x , y);}
   virtual void    GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y);
   virtual void    GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y, Float_t &z) 
       {z=0; GetPadC(ix, iy, x , y);}
-
-  virtual void Draw(const char *opt="") const {}
+  // Draw the segmentation zones
+  virtual void Draw(const char *opt = "") const;
 
   // Pad size Dx*Dy 
   virtual void SetPadSize(Float_t dp1, Float_t dp2);
 
   // Pad size Dx*Dy 
   virtual void SetPadSize(Float_t dp1, Float_t dp2);