]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONSt345SlatSegmentationV2.cxx
Generic containers indexed by a triplet
[u/mrichter/AliRoot.git] / MUON / AliMUONSt345SlatSegmentationV2.cxx
index 8082b649557bba79e1b56ad60fc87a32fb021938..aff04f6be3509d2ddeaaf8c5448ac88a7a1e3229 100644 (file)
@@ -16,8 +16,8 @@
 /* $Id$ */
 
 #include "AliMUONSt345SlatSegmentationV2.h"
+#include "AliMUONConstants.h"
 
-#include "AliLog.h"
 #include "AliMpArea.h"
 #include "AliMpSlat.h"
 #include "AliMpSlatSegmentation.h"
 // Dpx, Dpy, Sector offer now to the clustering. That indeed should be
 // handled directly at the level of AliMpVSegmentation...
 #include "AliMpVPadIterator.h"
-#include "AliMUONSegmentationManager.h"
-#include "AliMUONConstants.h"
 
-#include "Riostream.h"
+#include "AliLog.h"
 
+#include "Riostream.h"
 #include "TClass.h"
 
 ClassImp(AliMUONSt345SlatSegmentationV2)
 
 namespace
 {
-  Double_t fgkLengthUnit = 0.1; // This class expects centimeters, while
-                                                                                                                               // AliMpSlat works with milimeters.
   Int_t fgIntOffset = 1;
   Float_t FMAX(1E9);
 }
@@ -64,7 +61,9 @@ fYhit(FMAX)
 }
 
 //_____________________________________________________________________________
-AliMUONSt345SlatSegmentationV2::AliMUONSt345SlatSegmentationV2(Int_t detElemId, AliMpPlaneType bendingOrNonBending)
+AliMUONSt345SlatSegmentationV2::AliMUONSt345SlatSegmentationV2(
+                                   AliMpVSegmentation* segmentation,
+                                   Int_t detElemId, AliMpPlaneType bendingOrNonBending)
 : AliMUONVGeometryDESegmentation(),
 fDetElemId(detElemId),
 fPlaneType(bendingOrNonBending),
@@ -77,8 +76,12 @@ fYhit(FMAX)
   //
   // Normal ctor.
   //
-       
-       ReadMappingData();
+
+  fSlatSegmentation = dynamic_cast<AliMpSlatSegmentation*>(segmentation);
+  if (fSlatSegmentation)
+    fSlat = fSlatSegmentation->Slat();
+  else 
+    AliFatal("Wrong mapping segmentation type");
                
   AliDebug(1,Form("this=%p detElemId=%3d %s fSlatSegmentation=%p",this,detElemId,
                                                                        ( (bendingOrNonBending==kBendingPlane)?"Bending":"NonBending" ),
@@ -141,7 +144,7 @@ AliMUONSt345SlatSegmentationV2::Dpx(int ipcb) const
   {
     AliFatal("pcb is null!");
   }
-       return pcb->PadSizeX() * fgkLengthUnit;
+       return pcb->PadSizeX();
 }
 
 //_____________________________________________________________________________
@@ -153,7 +156,7 @@ AliMUONSt345SlatSegmentationV2::Dpy(int ipcb) const
   {
     AliFatal("pcb is null!");
   }
-       return pcb->PadSizeY() * fgkLengthUnit;
+       return pcb->PadSizeY();
 }
 
 //_____________________________________________________________________________
@@ -191,9 +194,11 @@ AliMUONSt345SlatSegmentationV2::FirstPad(Float_t xhit, Float_t yhit,
   // Note that we convert the area position to a reference frame
   // located in the lower-left corner of the slat, instead of its
   // center.
-  AliMpArea area(TVector2((x01+x02)/2.0/fgkLengthUnit+fSlat->DX(),
-                                                                                                       (y01+y02)/2.0/fgkLengthUnit+fSlat->DY()),
-                                                                TVector2(xext/2.0/fgkLengthUnit,yext/2.0/fgkLengthUnit));
+//  AliMpArea area(TVector2((x01+x02)/2.0+fSlat->DX(),
+//                                                                                                     (y01+y02)/2.0+fSlat->DY()),
+//                                                              TVector2(xext/2.0,yext/2.0));
+  AliMpArea area(TVector2((x01+x02)/2.0,(y01+y02)/2.0),
+                                                                TVector2(xext/2.0,yext/2.0));
        
   delete fPadIterator;
        
@@ -233,6 +238,17 @@ AliMUONSt345SlatSegmentationV2::GetDirection()
   return kDirUndefined;
 }
 
+//______________________________________________________________________________
+const AliMpVSegmentation*  
+AliMUONSt345SlatSegmentationV2::GetMpSegmentation() const
+{
+// Returns the mapping segmentation
+// (provides access to electronics info)
+
+  return fSlatSegmentation;
+}  
+
+
 //_____________________________________________________________________________
 void 
 AliMUONSt345SlatSegmentationV2::GetNParallelAndOffset(Int_t,Int_t,Int_t*,Int_t*)
@@ -257,8 +273,8 @@ AliMUONSt345SlatSegmentationV2::GetPadC(Int_t ix, Int_t iy,
   AliMpPad pad = 
   fSlatSegmentation->PadByIndices(AliMpIntPair(ix-fgIntOffset,iy-fgIntOffset),
                                   kTRUE);
-  x = pad.Position().X() * fgkLengthUnit;
-  y = pad.Position().Y() * fgkLengthUnit;
+  x = pad.Position().X();
+  y = pad.Position().Y();
 }
 
 
@@ -275,11 +291,11 @@ void
 AliMUONSt345SlatSegmentationV2::GetPadI(Float_t x, Float_t y,
                                                                                                                                                                Int_t& ix, Int_t& iy)
 {
-  Double_t slatx = fSlat->DX();
-  Double_t slaty = fSlat->DY();
+//  Double_t slatx = fSlat->DX();
+//  Double_t slaty = fSlat->DY();
   AliMpPad pad = 
-    fSlatSegmentation->PadByPosition(TVector2(x/fgkLengthUnit+slatx, 
-                                                                                                                                       y/fgkLengthUnit+slaty), kTRUE);
+    fSlatSegmentation->PadByPosition(TVector2(x,y), kTRUE);
+//  fSlatSegmentation->PadByPosition(TVector2(x+slatx,y+slaty), kTRUE);
        
   if ( pad != AliMpPad::Invalid() )
        {
@@ -336,11 +352,11 @@ AliMUONSt345SlatSegmentationV2::IntegrationLimits(Float_t& x1, Float_t& x2,
        //   y1 = fYhit - fY - Dpy(fSector)/2.;
        //   y2 = y1 + Dpy(fSector);    
        
-  Float_t x = fCurrentPad.Position().X() * fgkLengthUnit;
-  Float_t y = fCurrentPad.Position().Y() * fgkLengthUnit;
+  Float_t x = fCurrentPad.Position().X();
+  Float_t y = fCurrentPad.Position().Y();
        
-  Float_t padsizex = fCurrentPad.Dimensions().X() * 2.0 * fgkLengthUnit;
-  Float_t padsizey = fCurrentPad.Dimensions().Y() * 2.0 * fgkLengthUnit;
+  Float_t padsizex = fCurrentPad.Dimensions().X() * 2.0;
+  Float_t padsizey = fCurrentPad.Dimensions().Y() * 2.0;
        
   x1 = fXhit - x - padsizex/2.0;
   x2 = x1 + padsizex;
@@ -404,7 +420,8 @@ AliMUONSt345SlatSegmentationV2::Neighbours(Int_t iX, Int_t iY, Int_t* Nlist,
        
   // Define the region to look into : a region slightly bigger
   // than the pad itself (10% bigger), in order to catch first neighbours.
-  AliMpArea area(pad.Position()+fSlat->Dimensions(),pad.Dimensions()*2.1); 
+//  AliMpArea area(pad.Position()+fSlat->Dimensions(),pad.Dimensions()*2.1); 
+  AliMpArea area(pad.Position(),pad.Dimensions()*2.1); 
                
   AliMpVPadIterator* it = fSlatSegmentation->CreateIterator(area);
   it->First();
@@ -463,20 +480,6 @@ AliMUONSt345SlatSegmentationV2::Print(Option_t*) const
   << " fSlatSegmentation->Slat()=" << fSlatSegmentation->Slat() << endl;
 }
 
-//_____________________________________________________________________________
-void
-AliMUONSt345SlatSegmentationV2::ReadMappingData()
-{
-       fSlatSegmentation = dynamic_cast<AliMpSlatSegmentation*>
-  (AliMUONSegmentationManager::Segmentation(fDetElemId,fPlaneType));
-       
-  if (!fSlatSegmentation)
-       {
-               AliFatal("Wrong segmentation type encountered");
-       }
-  fSlat = fSlatSegmentation->Slat();
-}
-
 //_____________________________________________________________________________
 Int_t
 AliMUONSt345SlatSegmentationV2::Sector(Int_t ix, Int_t)
@@ -561,19 +564,3 @@ AliMUONSt345SlatSegmentationV2::SigGenInit(Float_t,Float_t,Float_t)
 {
   AliFatal("Not Implemented");
 }
-
-//_____________________________________________________________________________
-void
-AliMUONSt345SlatSegmentationV2::Streamer(TBuffer &R__b)
-{
-  if (R__b.IsReading()) 
-       {
-    AliMUONSt345SlatSegmentationV2::Class()->ReadBuffer(R__b, this);
-    ReadMappingData();
-  } 
-  else 
-       {
-    AliMUONSt345SlatSegmentationV2::Class()->WriteBuffer(R__b, this);
-  }
-}
-