]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONTriggerSegmentationV2.cxx
New TGeo features allow us to avoid the use of MANY.
[u/mrichter/AliRoot.git] / MUON / AliMUONTriggerSegmentationV2.cxx
index 1c1f25957ee9f2b82951ce37d0e520bd71b654b8..de53031caad3c388aad05bb6c377a273b122b620 100644 (file)
 
 #include "AliMUONTriggerSegmentationV2.h"
 
-#include "AliLog.h"
-
 #include "AliMpPCB.h"
 #include "AliMpTrigger.h"
 #include "AliMpTriggerSegmentation.h"
 #include "AliMpSlat.h"
 
-#include "AliMUONSegmentationManager.h"
+#include "AliLog.h"
 
 #include "Riostream.h"
 #include "TClass.h"
@@ -69,8 +67,9 @@ fLineNumber(-1)
 }
 
 //_____________________________________________________________________________
-AliMUONTriggerSegmentationV2::AliMUONTriggerSegmentationV2(Int_t detElemId,
-                                                           AliMpPlaneType bendingOrNonBending) 
+AliMUONTriggerSegmentationV2::AliMUONTriggerSegmentationV2(
+                                   AliMpVSegmentation* segmentation,
+                                   Int_t detElemId, AliMpPlaneType bendingOrNonBending)
 : AliMUONVGeometryDESegmentation(),
 fDetElemId(detElemId),
 fPlaneType(bendingOrNonBending),
@@ -83,7 +82,20 @@ fLineNumber(-1)
   //
   // Normal ctor.
   //
-       ReadMappingData();
+
+  fSlatSegmentation = dynamic_cast<AliMpTriggerSegmentation*>(segmentation);
+  if (fSlatSegmentation)
+    fSlat = fSlatSegmentation->Slat();
+  else 
+    AliFatal("Wrong mapping segmentation type");
+               
+  TString id(fSlat->GetID());
+  Ssiz_t pos = id.Last('L');
+  if ( pos <= 0 )
+  {
+    AliFatal(Form("Cannot infer line number for slat %s",id.Data()));
+  }
+  fLineNumber = TString(id(pos+1),1).Atoi();
                
   AliDebug(1,Form("this=%p detElemId=%3d %s fSlatSegmentation=%p",this,detElemId,
                                                                        ( (bendingOrNonBending==kBendingPlane)?"Bending":"NonBending" ),
@@ -199,6 +211,16 @@ AliMUONTriggerSegmentationV2::GetDirection()
   return kDirUndefined;
 }
 
+//______________________________________________________________________________
+const AliMpVSegmentation*  
+AliMUONTriggerSegmentationV2::GetMpSegmentation() const
+{
+// Returns the mapping segmentation
+// (provides access to electronics info)
+
+  return fSlatSegmentation;
+}  
+
 //_____________________________________________________________________________
 void 
 AliMUONTriggerSegmentationV2::GetNParallelAndOffset(Int_t,Int_t,Int_t*,Int_t*)
@@ -244,10 +266,8 @@ AliMUONTriggerSegmentationV2::GetPadI(Float_t x, Float_t y,
                   fSlatSegmentation->GetName(),
                   x,y,ixGlo,iyGlo));
   
-  Double_t slatx = fSlat->DX();
-  Double_t slaty = fSlat->DY();
   AliMpPad pad = 
-    fSlatSegmentation->PadByPosition(TVector2(x+slatx,y+slaty), kTRUE);
+    fSlatSegmentation->PadByPosition(TVector2(x,y), kTRUE);
        
   if ( pad != AliMpPad::Invalid() )
        {
@@ -354,8 +374,7 @@ AliMUONTriggerSegmentationV2::HasPad(Float_t x, Float_t y, Float_t)
 //  Bool_t ok1 = HasPad(ixPC,iyPC);
 
   AliMpPad pad = 
-    fSlatSegmentation->PadByPosition(TVector2(x+fSlat->DX(),y+fSlat->DY()),
-                                     kFALSE);
+  fSlatSegmentation->PadByPosition(TVector2(x,y),kFALSE);
   return pad.IsValid();
 }
 
@@ -643,27 +662,6 @@ AliMUONTriggerSegmentationV2::Print(Option_t* opt) const
   }
 }
 
-//_____________________________________________________________________________
-void 
-AliMUONTriggerSegmentationV2::ReadMappingData()
-{
-  fSlatSegmentation = dynamic_cast<AliMpTriggerSegmentation*>
-  (AliMUONSegmentationManager::Segmentation(fDetElemId,fPlaneType));
-  
-       if (!fSlatSegmentation)
-       {
-               AliFatal("Wrong segmentation type encountered");
-       }
-  fSlat = fSlatSegmentation->Slat();
-  TString id(fSlat->GetID());
-  Ssiz_t pos = id.Last('L');
-  if ( pos <= 0 )
-  {
-    AliFatal(Form("Cannot infer line number for slat %s",id.Data()));
-  }
-  fLineNumber = TString(id(pos+1),1).Atoi();
-}
-
 //_____________________________________________________________________________
 Int_t
 AliMUONTriggerSegmentationV2::Sector(Int_t ix, Int_t iy)
@@ -776,23 +774,6 @@ AliMUONTriggerSegmentationV2::SigGenInit(Float_t,Float_t,Float_t)
   AliFatal("Not Implemented");
 }
 
-//_____________________________________________________________________________
-void
-AliMUONTriggerSegmentationV2::Streamer(TBuffer &R__b)
-{
-  if (R__b.IsReading()) 
-       {
-    AliMUONTriggerSegmentationV2::Class()->ReadBuffer(R__b, this);
-    ReadMappingData();
-  } 
-  else 
-       {
-    AliMUONTriggerSegmentationV2::Class()->WriteBuffer(R__b, this);
-  }
-}
-
-
-