]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONSt12QuadrantSegmentation.cxx
Updated with refactoring of geometry & segmentation classes;
[u/mrichter/AliRoot.git] / MUON / AliMUONSt12QuadrantSegmentation.cxx
index 1258f3728edd0ceb14b832927afb1e178c5aab4d..69d67d31306293a49bbd5e1e9858ffc1a843d65f 100644 (file)
 // the mapping package
 //
 // Author: Ivana Hrivnacova, IPN Orsay
-
 #include <TError.h>
 #include <TF1.h>
 #include <TObjArray.h>
 #include <TVector2.h>
+#include <TSystem.h>
+
+#include "AliLog.h"
 
 #include "AliMpPad.h"
 #include "AliMpArea.h"
-#include "AliMpReader.h"
+#include "AliMpSectorReader.h"
 #include "AliMpSector.h"
 #include "AliMpVPadIterator.h"
 #include "AliMpSectorSegmentation.h"
-
-#include "AliMUONSt12QuadrantSegmentation.h"
-#include "AliRun.h"
-#include "AliMUON.h"
-#include "AliMUONChamber.h"
-#include "AliLog.h"
 #include "AliMpFiles.h"
 #include "AliMpNeighboursPadIterator.h"
-#include <TSystem.h>
+
+#include "AliMUONSt12QuadrantSegmentation.h"
+#include "AliMUONConstants.h"
 
 ClassImp(AliMUONSt12QuadrantSegmentation)
 
-const Float_t  AliMUONSt12QuadrantSegmentation::fgkWireD = 0.20; 
-const Float_t  AliMUONSt12QuadrantSegmentation::fgkLengthUnit = 0.1; 
+const Float_t  AliMUONSt12QuadrantSegmentation::fgkWireD = 0.21; 
 
 //______________________________________________________________________________
 AliMUONSt12QuadrantSegmentation::AliMUONSt12QuadrantSegmentation(
@@ -86,6 +84,8 @@ AliMUONSt12QuadrantSegmentation::AliMUONSt12QuadrantSegmentation(
   fCorrA->AddAt(0,0);
   fCorrA->AddAt(0,1);
   fCorrA->AddAt(0,2);
+
+  AliDebug(1, Form("ctor this = %p", this) ); 
 }
 
 //______________________________________________________________________________
@@ -116,6 +116,8 @@ AliMUONSt12QuadrantSegmentation::AliMUONSt12QuadrantSegmentation()
   fYt(0.),
   fCorrA(0) {
 // Default Constructor
+
+  AliDebug(1, Form("default (empty) ctor this = %p", this));
 }
 
 //______________________________________________________________________________
@@ -130,6 +132,8 @@ AliMUONSt12QuadrantSegmentation::AliMUONSt12QuadrantSegmentation(const AliMUONSt
 AliMUONSt12QuadrantSegmentation::~AliMUONSt12QuadrantSegmentation() {
 // Destructor
 
+  AliDebug(1, Form("dtor this = %p", this));
+
   delete fSector;
   delete fSectorSegmentation;  
   delete fSectorIterator;  
@@ -165,8 +169,8 @@ void AliMUONSt12QuadrantSegmentation::UpdateCurrentPadValues(const AliMpPad& pad
 
   fIx = pad.GetIndices().GetFirst();
   fIy = pad.GetIndices().GetSecond();
-  fX = pad.Position().X() * fgkLengthUnit;
-  fY = pad.Position().Y() * fgkLengthUnit;
+  fX = pad.Position().X();
+  fY = pad.Position().Y();
   fZone = fSectorSegmentation->Zone(pad);
 }  
 
@@ -181,12 +185,12 @@ void AliMUONSt12QuadrantSegmentation::ReadMappingData()
    if (!gSystem->Getenv("MINSTALL")) {    
      TString dirPath = gSystem->Getenv("ALICE_ROOT");
      dirPath += "/MUON/mapping"; 
-     AliMpFiles::Instance()->SetTopPath(dirPath);
+     AliMpFiles::SetTopPath(dirPath);
      gSystem->Setenv("MINSTALL", dirPath.Data());
      //cout << "AliMpFiles top path set to " << dirPath << endl;         
    }
   
-  AliMpReader r(fStationType, fPlaneType);
+  AliMpSectorReader r(fStationType, fPlaneType);
   fSector = r.BuildSector();
   fSectorSegmentation = new AliMpSectorSegmentation(fSector);
 }
@@ -222,7 +226,7 @@ Bool_t  AliMUONSt12QuadrantSegmentation::HasPad(Float_t x, Float_t y, Float_t /*
   // fSector->GetMotifMap()->Print();
 
   AliMpPad pad = fSectorSegmentation
-               ->PadByPosition(TVector2(x/fgkLengthUnit, y/fgkLengthUnit), false);
+               ->PadByPosition(TVector2(x,y), false);
 
   return pad.IsValid();
 }  
@@ -253,7 +257,7 @@ AliMUONGeometryDirection  AliMUONSt12QuadrantSegmentation::GetDirection()
 }  
 
 //______________________________________________________________________________
-const AliMpSectorSegmentation*  
+const AliMpVSegmentation*  
 AliMUONSt12QuadrantSegmentation::GetMpSegmentation() const
 {
 // Returns the mapping segmentation
@@ -294,8 +298,7 @@ void  AliMUONSt12QuadrantSegmentation::GetPadI(Float_t x, Float_t y,
 // If there is no pad, ix = 0, iy = 0 are returned.
 // ---
 
-  AliMpPad pad = fSectorSegmentation
-               ->PadByPosition(TVector2(x/fgkLengthUnit, y/fgkLengthUnit), true);
+  AliMpPad pad = fSectorSegmentation->PadByPosition(TVector2(x,y), true);
 
   ix = pad.GetIndices().GetFirst();
   iy = pad.GetIndices().GetSecond();
@@ -322,8 +325,8 @@ void  AliMUONSt12QuadrantSegmentation::GetPadC(Int_t ix, Int_t iy,
 
   AliMpPad pad = fSectorSegmentation->PadByIndices(AliMpIntPair(ix,iy), true);
 
-  x = pad.Position().X() * fgkLengthUnit;
-  y = pad.Position().Y() * fgkLengthUnit;
+  x = pad.Position().X();
+  y = pad.Position().Y();
 }
 
 
@@ -336,10 +339,8 @@ void AliMUONSt12QuadrantSegmentation::Init(Int_t chamber)
  // find Npx, Npy and save this info
   
   // reference to chamber
- AliMUON *pMUON  = (AliMUON *) gAlice->GetModule("MUON");
- fChamber = &(pMUON->Chamber(chamber));
- fRmin=fChamber->RInner();
- fRmax=fChamber->ROuter();  
+ fRmin=AliMUONConstants::Rmin(0);
+ fRmax=AliMUONConstants::Rmax(0);  
  fZ = 0;
  fId=chamber;
 }
@@ -370,7 +371,7 @@ Float_t AliMUONSt12QuadrantSegmentation::Dpx(Int_t isector) const
 // Pad size in x by sector
 // ---
 
-  return fSectorSegmentation->PadDimensions(isector).X()*2.*fgkLengthUnit;
+  return fSectorSegmentation->PadDimensions(isector).X()*2.0;
 } 
 
 //______________________________________________________________________________
@@ -379,7 +380,7 @@ Float_t AliMUONSt12QuadrantSegmentation::Dpy(Int_t isector) const
 // Pad size in x, y by Sector 
 // ---
 
-  return fSectorSegmentation->PadDimensions(isector).Y()*2.*fgkLengthUnit;
+  return fSectorSegmentation->PadDimensions(isector).Y()*2.0;
 }
 
 //______________________________________________________________________________
@@ -442,11 +443,16 @@ void  AliMUONSt12QuadrantSegmentation::FirstPad(Float_t xhit, Float_t yhit, Floa
   if (dx == 0.)  dx = 0.01;
   if (dy == 0.)  dy = 0.01;
   
+  // Delete previous iterator
+  delete  fSectorIterator;
+  
   fSectorIterator 
     = fSectorSegmentation
-        ->CreateIterator(AliMpArea(TVector2(fXhit/fgkLengthUnit, fYhit/fgkLengthUnit), 
-                                  TVector2(dx/fgkLengthUnit, dy/fgkLengthUnit)));
+        ->CreateIterator(AliMpArea(TVector2(fXhit,fYhit),TVector2(dx,dy)));
 
+  AliDebug(1,Form("CreateIterator area=%e,%e +- %e,%e %s",
+                  fXhit,fYhit,dx,dy,PlaneTypeName(fPlaneType)));
+  
   fSectorIterator->First();            
 
   if (! fSectorIterator->IsDone())
@@ -490,7 +496,7 @@ Float_t AliMUONSt12QuadrantSegmentation::Distance2AndOffset(Int_t iX, Int_t iY,
   if (!pad.IsValid())
     AliFatal("Cannot locate pad.");
 
-  return (pad.Position()*fgkLengthUnit - TVector2(x, y)).Mod2();
+  return (pad.Position() - TVector2(x, y)).Mod2();
 }
 
 //______________________________________________________________________________
@@ -573,7 +579,7 @@ Int_t AliMUONSt12QuadrantSegmentation::Sector(Float_t x, Float_t y)
 
   return fSectorSegmentation
            ->Zone(fSectorSegmentation
-                   ->PadByPosition(TVector2(x/fgkLengthUnit, y/fgkLengthUnit)));
+                   ->PadByPosition(TVector2(x,y)));
 }
 
 //______________________________________________________________________________