]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONDisplay.cxx
Adding fDetElemId data member and its setter/getter,
[u/mrichter/AliRoot.git] / MUON / AliMUONDisplay.cxx
index 6c3f3fc870f20b350e869457968bd07ba15e5ade..72a468419bf6d35e7c224f1143ee82691b7e38d2 100644 (file)
 #include "AliMUONTrack.h"
 #include "AliMUONTrackParam.h"
 
-#include "AliMUONSegmentationManager.h"
+#include "AliMUONGeometryTransformer.h"
 #include "AliMUONGeometryModule.h"
 #include "AliMpSlatSegmentation.h"
 #include "AliMpSlat.h"
+#include "AliMpSectorSegmentation.h"
+#include "AliMpSector.h"
  
+#include "AliMpTriggerSegmentation.h"
+#include "AliMpTrigger.h"
 
+#include "AliMUONSegmentation.h"
 #include "AliMUONGeometrySegmentation.h"
-#include "AliMUONChamber.h"
+#include "AliMUONSegmentationManager.h"
 #include "AliMUONConstants.h"
 #include "AliMC.h"
 #include "AliLog.h"
@@ -780,10 +785,16 @@ void AliMUONDisplay::DrawView(Float_t theta, Float_t phi, Float_t psi)
        fZoomY1[0] =  1;
        fZooms = 0;
     }
+
+    Float_t xg1, xg2, yg1, yg2, zg1, zg2;
+
     // Recovering the chamber 
     AliMUON *pMUON  = (AliMUON*)gAlice->GetModule("MUON");
-    AliMUONChamber*  iChamber;
-    iChamber = &(pMUON->Chamber(fChamber-1));
+
+    const AliMUONGeometryTransformer* kGeomTransformer 
+      = pMUON->GetGeometryTransformer();
+
+    AliMUONSegmentation* segmentation = pMUON->GetSegmentation();
 
 // Display MUON Chamber Geometry
     char nodeName[7];
@@ -791,47 +802,122 @@ void AliMUONDisplay::DrawView(Float_t theta, Float_t phi, Float_t psi)
     printf(">>>> chamber is %d\n",fChamber);
 
     if(fChamber < 5) {
-      // drawing inner circle
-      TPolyLine3D* poly1 = new  TPolyLine3D();
-      Int_t nPoint = 0;
-      for (Float_t d = 0; d < 6.3; d+= 0.1) {
-       Double_t x = AliMUONConstants::Dmin((fChamber-1)/2) * TMath::Cos(d)/2.;
-       Double_t y = AliMUONConstants::Dmin((fChamber-1)/2) * TMath::Sin(d)/2.;
-       poly1->SetPoint(nPoint++, x, y, 0.);
-      }
-      poly1->SetLineColor(2);
-      poly1->Draw("s");
-
-      // drawing outer circle
-      TPolyLine3D* poly2 = new  TPolyLine3D();
-      nPoint = 0;
-      for (Float_t d = 0; d < 6.3; d+= 0.1) {
-       Double_t x = AliMUONConstants::Dmax((fChamber-1)/2) * TMath::Cos(d)/2.;
-       Double_t y = AliMUONConstants::Dmax((fChamber-1)/2) * TMath::Sin(d)/2.;
-       poly2->SetPoint(nPoint++, x, y, 0.);
+      for(Int_t id = 0; id < 4; id++) {
+
+       Int_t detElemId = fChamber*100+id;
+       AliMpSectorSegmentation * seg =   
+         (AliMpSectorSegmentation *) segmentation->GetMpSegmentation(detElemId, 0);
+       const AliMpSector * sector = seg->GetSector();
+
+       // get sector measurements
+       TVector2 position  = sector->Position(); 
+       TVector2 dimension = sector->Dimensions(); // half length
+       
+       Float_t xlocal1 =  position.Px(); // mm to cm
+       Float_t ylocal1 =  position.Py();
+       Float_t xlocal2 =  dimension.Px() * 2.;
+       Float_t ylocal2 =  dimension.Px() * 2.;
+
+       kGeomTransformer->Local2Global(detElemId, xlocal1, ylocal1, 0, xg1, yg1, zg1);
+       kGeomTransformer->Local2Global(detElemId, xlocal2, ylocal2, 0, xg2, yg2, zg2);
+
+       // drawing 
+       TPolyLine3D* poly = new  TPolyLine3D();
+       Int_t nPoint = 0;
+
+       poly->SetPoint(nPoint++, xg1, yg1, 0.);
+       for (Float_t d = 0; d < TMath::Pi()/2.; d+= 0.01) {
+         Float_t x = xg1 + xg2 * TMath::Cos(d);
+         Float_t y = yg1 + yg2 * TMath::Sin(d);
+         poly->SetPoint(nPoint++, x, y, 0.);
+       }
+       poly->SetPoint(nPoint++, xg1, yg1, 0.);
+
+       poly->SetLineColor(2);
+       poly->Draw("s");
       }
-      poly2->SetLineColor(2);
-      poly2->Draw("s");
-    }
+   
+      //     }
 
+    }
 
     if(fChamber >4 && fChamber <11) {
       Int_t id=0;
       for(id=0; id<26; id++) {
        Int_t detElemId = fChamber*100+id;
-       if (  AliMUONSegmentationManager::IsValidDetElemId(detElemId) ) {
+       if (  segmentation->HasDE(detElemId) ) {
          AliMpSlatSegmentation * seg =   
-           (AliMpSlatSegmentation *) AliMUONSegmentationManager::Segmentation(detElemId, kBendingPlane);
-         const AliMpSlat * slat = seg->Slat();
-         Float_t deltax = slat->DX()/10.;
-         Float_t deltay = slat->DY()/10.;
+           (AliMpSlatSegmentation *) segmentation->GetMpSegmentation(detElemId, 0);
+         if (!seg) {  
+           seg = (AliMpSlatSegmentation *) 
+                 AliMUONSegmentationManager::Segmentation(detElemId, kBendingPlane);
+         }       
+         if (seg) {  
+           const AliMpSlat* slat = seg->Slat();
+           Float_t deltax = slat->DX();
+           Float_t deltay = slat->DY();
+           Float_t xlocal1 =  -deltax;
+           Float_t ylocal1 =  -deltay;
+           Float_t xlocal2 =  +deltax;
+           Float_t ylocal2 =  +deltay;
+           kGeomTransformer->Local2Global(detElemId, xlocal1, ylocal1, 0, xg1, yg1, zg1);
+           kGeomTransformer->Local2Global(detElemId, xlocal2, ylocal2, 0, xg2, yg2, zg2);
+
+           // drawing slat active volumes
+           Float_t xCenter = (xg1 + xg2)/2.;
+           Float_t yCenter = (yg1 + yg2)/2.;
+
+           TMarker3DBox* box = new TMarker3DBox(xCenter,yCenter,0,xlocal1,ylocal2,0,0,0);
+
+           box->SetFillStyle(0);
+           box->SetLineColor(2);
+           box->Draw("s");
+
+           // drawing inner circle + disc
+           TPolyLine3D* poly  = new  TPolyLine3D();
+           TPolyLine3D* poly1 = new  TPolyLine3D();
+
+           Int_t nPoint = 0;
+           Int_t nPoint1 = 0;
+           for (Float_t d = 0; d < 6.24; d+= 0.005) {
+             Double_t x = AliMUONConstants::Dmin((fChamber-1)/2) * TMath::Cos(d)/2.;
+             Double_t y = AliMUONConstants::Dmin((fChamber-1)/2) * TMath::Sin(d)/2.;
+             if (nPoint % 2 == 0) poly->SetPoint(nPoint++, 0., 0., 0.);
+             poly->SetPoint(nPoint++, x, y, 0.);
+             poly1->SetPoint(nPoint1++, x, y, 0.);
+
+           }
+           poly->SetLineColor(1);
+           poly->Draw("s");
+           poly1->SetLineColor(2);
+           poly1->Draw("s");
+         }  
+       }
+      }
+    }
+    
+/*-- Trigger Chambers ---------------------------------------*/
+    if(fChamber >10 && fChamber <15) {
+      Int_t id=0;
+      for(id=0; id<18; id++) {
+       Int_t detElemId = fChamber*100+id;
+       AliMpTriggerSegmentation * seg  
+         = (AliMpTriggerSegmentation *) segmentation->GetMpSegmentation(detElemId, 0);
+       if (!seg) {  
+         seg = (AliMpTriggerSegmentation *) 
+                 AliMUONSegmentationManager::Segmentation(detElemId, kBendingPlane);
+       }         
+       if (seg) {   
+         const AliMpTrigger* slat = seg->Slat();
+         Float_t deltax = slat->DX();
+         Float_t deltay = slat->DY();
          Float_t xlocal1 =  -deltax;
          Float_t ylocal1 =  -deltay;
          Float_t xlocal2 =  +deltax;
          Float_t ylocal2 =  +deltay;
-         Float_t xg1, xg2, yg1, yg2, zg1, zg2;
-         iChamber->GetGeometry()->Local2Global(detElemId, xlocal1, ylocal1, 0, xg1, yg1, zg1);
-         iChamber->GetGeometry()->Local2Global(detElemId, xlocal2, ylocal2, 0, xg2, yg2, zg2);
+         
+         kGeomTransformer->Local2Global(detElemId, xlocal1, ylocal1, 0, xg1, yg1, zg1);
+         kGeomTransformer->Local2Global(detElemId, xlocal2, ylocal2, 0, xg2, yg2, zg2);
 
          // drawing slat active volumes
          Float_t xCenter = (xg1 + xg2)/2.;
@@ -840,30 +926,11 @@ void AliMUONDisplay::DrawView(Float_t theta, Float_t phi, Float_t psi)
          TMarker3DBox* box = new TMarker3DBox(xCenter,yCenter,0,xlocal1,ylocal2,0,0,0);
 
          box->SetFillStyle(0);
-         box->SetLineColor(2);
+         box->SetLineColor(4);
          box->Draw("s");
-
-         // drawing inner circle + disc
-         TPolyLine3D* poly  = new  TPolyLine3D();
-         TPolyLine3D* poly1 = new  TPolyLine3D();
-
-         Int_t nPoint = 0;
-         Int_t nPoint1 = 0;
-         for (Float_t d = 0; d < 6.24; d+= 0.005) {
-           Double_t x = AliMUONConstants::Dmin((fChamber-1)/2) * TMath::Cos(d)/2.;
-           Double_t y = AliMUONConstants::Dmin((fChamber-1)/2) * TMath::Sin(d)/2.;
-           if (nPoint % 2 == 0) poly->SetPoint(nPoint++, 0., 0., 0.);
-           poly->SetPoint(nPoint++, x, y, 0.);
-           poly1->SetPoint(nPoint1++, x, y, 0.);
-
-         }
-         poly->SetLineColor(1);
-         poly->Draw("s");
-         poly1->SetLineColor(2);
-         poly1->Draw("s");
-       }
+       }  
       }
-    }  
+    }
 //add clusters to the pad
     DrawClusters();
     DrawHits();
@@ -1005,7 +1072,6 @@ void AliMUONDisplay::LoadDigits(Int_t chamber, Int_t cathode)
     ResetPoints();
     
     AliMUON *pMUON  =     (AliMUON*)gAlice->GetModule("MUON");
-    AliMUONChamber*       iChamber;
     AliMUONGeometrySegmentation*  segmentation2 = 0x0;
 
     GetMUONData()->SetTreeAddress("D");
@@ -1026,11 +1092,11 @@ void AliMUONDisplay::LoadDigits(Int_t chamber, Int_t cathode)
     if (ndigits == 0) return;
     if (fPoints == 0) fPoints = new TObjArray(ndigits);
     
-    iChamber = &(pMUON->Chamber(chamber-1));
+    //segmentation2 = iChamber->SegmentationModel2(cathode);
+    segmentation2
+      = pMUON->GetSegmentation()->GetModuleSegmentation(chamber-1, cathode-1);
 
-    segmentation2 = iChamber->SegmentationModel2(cathode);
-
-    Float_t zpos = iChamber->Z();
+    Float_t zpos = AliMUONConstants::DefaultChamberZ(chamber-1);
 
     AliMUONDigit  *mdig;
     AliMUONPoints *points  = 0;
@@ -1121,9 +1187,6 @@ void AliMUONDisplay::LoadCoG(Int_t chamber, Int_t /*cathode*/)
     
     ResetRpoints();
     
-    AliMUON *pMUON  = (AliMUON*)gAlice->GetModule("MUON");
-    AliMUONChamber*  iChamber;
-    
     GetMUONData()->SetTreeAddress("RC");
     TClonesArray *muonRawClusters  = GetMUONData()->RawClusters(chamber-1);
 
@@ -1139,8 +1202,7 @@ void AliMUONDisplay::LoadCoG(Int_t chamber, Int_t /*cathode*/)
     if (nrawcl == 0) return;
     if (fRpoints == 0) fRpoints = new TObjArray(nrawcl);
     
-    iChamber = &(pMUON->Chamber(chamber-1));
-    Float_t zpos=iChamber->Z();  
+    Float_t zpos = AliMUONConstants::DefaultChamberZ(chamber-1);  
     AliMUONRawCluster  *mRaw;
     AliMUONPoints *points = 0;
     //
@@ -1265,12 +1327,7 @@ void AliMUONDisplay::LoadHits(Int_t chamber)
  
     ResetPhits();
     
-    AliMUON *pMUON  = (AliMUON*)gAlice->GetModule("MUON");
-    AliMUONChamber*  iChamber;
-
-    iChamber = &(pMUON->Chamber(chamber-1));
-    Float_t zpos=iChamber->Z();
-
+    Float_t zpos=AliMUONConstants::DefaultChamberZ(chamber-1);
 
     if (GetMUONData()->TreeH()) {
       GetMUONData()->SetTreeAddress("H");