]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
In mapping:
authorivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 28 Jan 2009 11:07:09 +0000 (11:07 +0000)
committerivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 28 Jan 2009 11:07:09 +0000 (11:07 +0000)
Introduced new methods in AliMpSegmentation class for access
to AliMpSector, AliMpSlat and AliMpTrigger objects,
and replaced code where these objects are accessed via
unsafe casting AliMpVSegmentation with use of these new functions.
(Ivana, Laurent)

16 files changed:
MUON/AliMUONPainterContourMaker.cxx
MUON/AliMUONPainterHelper.cxx
MUON/AliMUONSt1GeometryBuilderV2.cxx
MUON/AliMUONTriggerCircuit.cxx
MUON/AliMUONTriggerGUI.cxx
MUON/mapping/AliMpBusPatch.cxx
MUON/mapping/AliMpDCSNamer.cxx
MUON/mapping/AliMpSectorSegmentation.h
MUON/mapping/AliMpSegmentation.cxx
MUON/mapping/AliMpSegmentation.h
MUON/mapping/AliMpSlatSegmentation.h
MUON/mapping/AliMpStationType.cxx
MUON/mapping/AliMpStationType.h
MUON/mapping/AliMpTriggerSegmentation.h
MUON/mapping/AliMpVPainter.cxx
MUON/mapping/AliMpVSegmentation.h

index cbeb36c349d4fe5b97323858219fcbf845b5e652..c7f9f5d527298a1e0ca058782aec80e8b995242e 100644 (file)
 #include "AliMpMotifPosition.h"
 #include "AliMpMotifType.h"
 #include "AliMpSector.h"
-#include "AliMpSectorSegmentation.h"
 #include "AliMpSegmentation.h"
 #include "AliMpSlat.h"
-#include "AliMpSlatSegmentation.h"
 #include "AliMpStationType.h"
 #include "AliMpVMotif.h"
 #include "AliCodeTimer.h"
@@ -690,25 +688,25 @@ AliMUONPainterContourMaker::FindMotifPosition(Int_t detElemId, Int_t manuId) con
   
   AliCodeTimerAuto("")
   
-  const AliMpVSegmentation* vseg = AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId);
-  if (!vseg)
-  {
-    AliFatal(Form("Could not find motif for DE %d manu %d",detElemId,manuId));
-  }
-  
   AliMp::StationType stationType = AliMpDEManager::GetStationType(detElemId);
   
   if ( stationType == AliMp::kStation345 ) 
   {
-    const AliMpSlatSegmentation* seg = static_cast<const AliMpSlatSegmentation*>(vseg);
-    const AliMpSlat* slat = seg->Slat();
-    return slat->FindMotifPosition(manuId);
+    const AliMpSlat* kSlat 
+      = AliMpSegmentation::Instance()->GetSlatByElectronics(detElemId,manuId);
+    if ( ! kSlat ) {
+      AliFatal(Form("Could not find motif for DE %d manu %d",detElemId,manuId));
+    }
+    return kSlat->FindMotifPosition(manuId);
   }
   else
   {
-    const AliMpSectorSegmentation* seg = static_cast<const AliMpSectorSegmentation*>(vseg);
-    const AliMpSector* sector = seg->GetSector();
-    return sector->GetMotifMap()->FindMotifPosition(manuId);
+    const AliMpSector* kSector 
+      = AliMpSegmentation::Instance()->GetSectorByElectronics(detElemId,manuId);
+    if ( ! kSector ) {
+      AliFatal(Form("Could not find motif for DE %d manu %d",detElemId,manuId));
+    }
+    return kSector->GetMotifMap()->FindMotifPosition(manuId);
   }
   return 0x0;
 }
index 1d44d68eed415b75759b1c1674e601493e92ea05..aa589f08e3897d49769bb5b6568263a0df7fa7db 100644 (file)
 #include "AliMpPCB.h"
 #include "AliMpPad.h"
 #include "AliMpSector.h"
-#include "AliMpSectorSegmentation.h"
 #include "AliMpSegmentation.h"
 #include "AliMpSlat.h"
-#include "AliMpSlatSegmentation.h"
 #include "AliMpStationType.h"
 #include "AliMpVPadIterator.h"
 #include "AliCodeTimer.h"
@@ -456,12 +454,7 @@ AliMUONPainterHelper::GetSector(Int_t detElemId, AliMp::PlaneType planeType) con
   
   AliMp::CathodType cathodeType = AliMpDEManager::GetCathod(detElemId,planeType);
   
-  const AliMpVSegmentation* seg =
-  AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,cathodeType);
-  
-  const AliMpSectorSegmentation* sectorSeg = static_cast<const AliMpSectorSegmentation*>(seg);
-  return sectorSeg->GetSector();
-  
+  return AliMpSegmentation::Instance()->GetSector(detElemId,cathodeType);
 }
 
 //_____________________________________________________________________________
@@ -472,11 +465,7 @@ AliMUONPainterHelper::GetSlat(Int_t detElemId, AliMp::CathodType cathodeType) co
   AliMp::StationType stationType = AliMpDEManager::GetStationType(detElemId);
   if ( stationType != AliMp::kStation345 ) return 0x0;
 
-  const AliMpVSegmentation* seg =
-    AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,cathodeType);
-  
-  const AliMpSlatSegmentation* slatSeg = static_cast<const AliMpSlatSegmentation*>(seg);
-  return slatSeg->Slat();
+  return AliMpSegmentation::Instance()->GetSlat(detElemId,cathodeType);
 }
 
 //_____________________________________________________________________________
@@ -484,11 +473,10 @@ const AliMpSlat*
 AliMUONPainterHelper::GetSlat(Int_t detElemId, Int_t manuId) const
 {
   /// Get a given slat
-  const AliMpVSegmentation* seg =
-    AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId);
-  
-  const AliMpSlatSegmentation* slatSeg = static_cast<const AliMpSlatSegmentation*>(seg);
-  return slatSeg->Slat();
+  AliMp::StationType stationType = AliMpDEManager::GetStationType(detElemId);
+  if ( stationType != AliMp::kStation345 ) return 0x0;
+
+  return AliMpSegmentation::Instance()->GetSlatByElectronics(detElemId,manuId);
 }
 
 //_____________________________________________________________________________
index 01ec8352caa58168e366a2823183788ff2e0d153..61aaca937198ffb7cb41539a424394fa9b40b80b 100644 (file)
@@ -36,7 +36,6 @@
 #include "AliMpContainers.h"
 #include "AliMpConstants.h"
 #include "AliMpCDB.h"
-#include "AliMpSectorSegmentation.h"
 #include "AliMpSector.h"
 #include "AliMpRow.h"
 #include "AliMpVRowSegment.h"
@@ -414,16 +413,12 @@ void AliMUONSt1GeometryBuilderV2::CreateQuadrant(Int_t chamber)
     AliFatal("Mapping has to be loaded first !");
   }
        
-  const AliMpSectorSegmentation* kSegmentation1 
-    = dynamic_cast<const AliMpSectorSegmentation*>(
-        AliMpSegmentation::Instance()
-          ->GetMpSegmentation(100, AliMpDEManager::GetCathod(100, AliMp::kBendingPlane))); 
-  if ( ! kSegmentation1 ) {
+  const AliMpSector* kSector1 
+    = AliMpSegmentation::Instance()->GetSector(100, AliMpDEManager::GetCathod(100, AliMp::kBendingPlane));
+  if ( ! kSector1 ) {
     AliFatal("Could not access sector segmentation !");
   }
 
-  const AliMpSector* kSector1 = kSegmentation1->GetSector();
-
   //Bool_t reflectZ = true;
   Bool_t reflectZ = false;
   //TVector3 where = TVector3(2.5+0.1+0.56+0.001, 2.5+0.1+0.001, 0.);
@@ -448,15 +443,12 @@ void AliMUONSt1GeometryBuilderV2::CreateQuadrant(Int_t chamber)
       // Fix (7) - overlap of SQ42 with MCHL (after moving the whole sector
       // in the true position)   
 
-  const AliMpSectorSegmentation* kSegmentation2 
-    = dynamic_cast<const AliMpSectorSegmentation*>(
-        AliMpSegmentation::Instance()
-          ->GetMpSegmentation(100, AliMpDEManager::GetCathod(100, AliMp::kNonBendingPlane))); 
-  if ( ! kSegmentation2 ) {
-    AliFatal("Could not access sector segmentation !");
+  const AliMpSector* kSector2 
+    = AliMpSegmentation::Instance()
+          ->GetSector(100, AliMpDEManager::GetCathod(100, AliMp::kNonBendingPlane));
+  if ( ! kSector2 ) {
+    AliFatal("Could not access sector !");
   }
-    
-  const AliMpSector* kSector2 = kSegmentation2->GetSector();
 
   //reflectZ = false;
   reflectZ = true;
index 721139da8a99bfe3a667992084f31712880f08ff..bc91a0b702038814afc4957d5bdc53ef454843f9 100644 (file)
@@ -28,7 +28,6 @@
 #include "AliMUONTriggerCircuit.h"
 #include "AliMUONConstants.h"
 
-#include "AliMpTriggerSegmentation.h"
 #include "AliMpTrigger.h"
 #include "AliMpSlat.h"
 #include "AliMpPCB.h"
@@ -238,8 +237,7 @@ void AliMUONTriggerCircuit::LoadYPos(AliMpLocalBoard* localBoard)
          ->GetMpSegmentation(fCurrentDetElem, AliMp::GetCathodType(icathode));  
 
       // get iFirstStrip in this module 
-      const AliMpTriggerSegmentation* trig = (AliMpTriggerSegmentation*)(fCurrentSeg);
-      const AliMpTrigger* t = trig->Slat();
+      const AliMpTrigger* t = AliMpSegmentation::Instance()->GetTrigger(fCurrentSeg);
       const AliMpSlat* slat = t->GetLayer(0);
 
       if (iline == 5) icolDo = icol + 1; // special case
@@ -328,8 +326,7 @@ void AliMUONTriggerCircuit::LoadXPos(AliMpLocalBoard* localBoard)
   if (zeroAllYLSB) iStripCircuit = 8;
   
   // get iFirstStrip in this module 
-  const AliMpTriggerSegmentation* trig = (AliMpTriggerSegmentation*)(fCurrentSeg);
-  const AliMpTrigger* t = trig->Slat();
+  const AliMpTrigger* t = AliMpSegmentation::Instance()->GetTrigger(fCurrentSeg);
   const AliMpSlat* slat = t->GetLayer(0);
   
   const AliMpPCB* pcb = slat->GetPCB(icol-1);
index c70b3088fdd631865d0da28cce780a941613ff18..fd50bb215e6c6b2f17ba5983c6c5ca09f83fba02 100644 (file)
@@ -1461,11 +1461,10 @@ void AliMUONTriggerGUI::InitBoards()
 
       // x-strips
       manuIdPrev = 0;
-      const AliMpTriggerSegmentation *trigseg0 = static_cast<const AliMpTriggerSegmentation*>(seg0);
       for (Int_t ix = 0; ix <= seg0->MaxPadIndexX(); ix++) {
        for (Int_t iy = 0; iy <= seg0->MaxPadIndexY(); iy++) {
          AliMpIntPair indices(ix,iy);
-         AliMpPad pad = trigseg0->PadByIndices(indices,kFALSE);
+         AliMpPad pad = seg0->PadByIndices(indices,kFALSE);
          if (pad.IsValid()) {
            AliMpIntPair loc = pad.GetLocation(0);
            Int_t manuId = loc.GetFirst();
@@ -1493,11 +1492,10 @@ void AliMUONTriggerGUI::InitBoards()
          
       // y-strips
       manuIdPrev = 0;
-      const AliMpTriggerSegmentation *trigseg1 = static_cast<const AliMpTriggerSegmentation*>(seg1);
       for (Int_t ix = 0; ix <= seg1->MaxPadIndexX(); ix++) {
        for (Int_t iy = 0; iy <= seg1->MaxPadIndexY(); iy++) {
          AliMpIntPair indices(ix,iy);
-         AliMpPad pad = trigseg1->PadByIndices(indices,kFALSE);
+         AliMpPad pad = seg1->PadByIndices(indices,kFALSE);
          if (pad.IsValid()) {
            Int_t nloc = pad.GetNofLocations();
            for (Int_t iloc = 0; iloc < nloc; iloc++) {
index 0b82f3acf82f89baef08445d997890d71f0a3a23..e001cff4fb54c4461058607ae788b486f201ef8d 100644 (file)
@@ -29,7 +29,6 @@
 #include "AliMpConstants.h"
 #include "AliMpDEManager.h"
 #include "AliMpSegmentation.h"
-#include "AliMpSlatSegmentation.h"
 #include "AliMpSlat.h"
 #include "AliMpPCB.h"
 #include "AliMpMotifPosition.h"
@@ -152,17 +151,11 @@ Bool_t AliMpBusPatch::SetNofManusPerModule(Int_t manuNumber)
 
   if ( AliMpDEManager::GetStationType(fDEId) == AliMp::kStation345 ) {
   
-    const AliMpSlatSegmentation* seg0 
-       = static_cast<const AliMpSlatSegmentation*>(
-            AliMpSegmentation::Instance()->GetMpSegmentation(fDEId, AliMp::kCath0));
-
-    const AliMpSlatSegmentation* seg1 
-       = static_cast<const AliMpSlatSegmentation*>(
-            AliMpSegmentation::Instance()->GetMpSegmentation(fDEId, AliMp::kCath1));
-
-    const AliMpSlat* slat0 = seg0->Slat();
-    const AliMpSlat* slat1 = seg1->Slat();
+    const AliMpSlat* kSlat0 
+       = AliMpSegmentation::Instance()->GetSlat(fDEId, AliMp::kCath0);
 
+    const AliMpSlat* kSlat1 
+       = AliMpSegmentation::Instance()->GetSlat(fDEId, AliMp::kCath1);
        
     Int_t iPcb = 0;
     Int_t iPcbPrev = -1;
@@ -174,8 +167,8 @@ Bool_t AliMpBusPatch::SetNofManusPerModule(Int_t manuNumber)
     // Loop over manu
     for (Int_t iManu = 0; iManu < GetNofManus(); ++iManu) {
       Int_t manuId = GetManuId(iManu);
-      AliMpMotifPosition* motifPos0 = slat0->FindMotifPosition(manuId);
-      AliMpMotifPosition* motifPos1 = slat1->FindMotifPosition(manuId);          
+      AliMpMotifPosition* motifPos0 = kSlat0->FindMotifPosition(manuId);
+      AliMpMotifPosition* motifPos1 = kSlat1->FindMotifPosition(manuId);         
       
       if ( !motifPos0 && !motifPos1 ) {
         // should never happen
@@ -187,11 +180,11 @@ Bool_t AliMpBusPatch::SetNofManusPerModule(Int_t manuNumber)
       // find PCB id
       if ( motifPos0 ) {
         x = motifPos0->Position().X();
-        length = slat0->GetPCB(0)->DX()*2.;
+        length = kSlat0->GetPCB(0)->DX()*2.;
       }
       if ( motifPos1 ) {
         x = motifPos1->Position().X();
-        length = slat1->GetPCB(0)->DX()*2.;
+        length = kSlat1->GetPCB(0)->DX()*2.;
       }
       
       iPcb = Int_t(x/length + AliMpConstants::LengthTolerance());
index b374e28f1b3df58e4ff9fce439fd325b3d3e8d19..b2b22acde92a434b46e0171340a041f590f6f1b0 100644 (file)
 #include "AliMpMotifMap.h"
 #include "AliMpMotifPosition.h"
 #include "AliMpSector.h"
-#include "AliMpSectorSegmentation.h"
 #include "AliMpSegmentation.h"
 #include "AliMpSlat.h"
-#include "AliMpSlatSegmentation.h"
 #include "AliMpConstants.h"
 #include <Riostream.h>
 #include <TMap.h>
@@ -667,11 +665,9 @@ AliMpDCSNamer::ManuId2PCBIndex(Int_t detElemId, Int_t manuId) const
   
   AliCodeTimerAuto("")
   
-  const AliMpSlatSegmentation* seg = static_cast<const AliMpSlatSegmentation*>
-    (AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId));
-       if (!seg) return -1;
-       
-  const AliMpSlat* slat = seg->Slat();
+  const AliMpSlat* slat 
+    = AliMpSegmentation::Instance()->GetSlatByElectronics(detElemId, manuId);
+  if ( ! slat ) return -1;
   
   return slat->FindPCBIndexByMotifPositionID(manuId);
 }
@@ -684,11 +680,10 @@ AliMpDCSNamer::ManuId2Sector(Int_t detElemId, Int_t manuId) const
   
   AliCodeTimerAuto("")
   
-  const AliMpSectorSegmentation* seg = static_cast<const AliMpSectorSegmentation*>
-  (AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId));
-       if (!seg) return -1;
-       
-  const AliMpSector* sector = seg->GetSector();
+  const AliMpSector* sector 
+    = AliMpSegmentation::Instance()->GetSectorByElectronics(detElemId, manuId);
+  if ( ! sector ) return -1;
+  
   const AliMpMotifMap* motifMap = sector->GetMotifMap();
   const AliMpMotifPosition* motifPos = motifMap->FindMotifPosition(manuId);
 
@@ -733,9 +728,8 @@ AliMpDCSNamer::NumberOfPCBs(Int_t detElemId) const
   }
   else
   {
-    const AliMpSlatSegmentation* seg = static_cast<const AliMpSlatSegmentation*>
-    (AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::kCath0));
-    const AliMpSlat* slat = seg->Slat();
+    const AliMpSlat* slat 
+      = AliMpSegmentation::Instance()->GetSlat(detElemId, AliMp::kCath0);
     return slat->GetSize();
   }
 }
index 7c4bdfa29b5ad4ee9e0cbaf6d998495a415a7a14..16f8dbfd1ea5366d66ab447079049eb11c4e8828 100755 (executable)
@@ -100,6 +100,8 @@ class AliMpSectorSegmentation : public AliMpVSegmentation
 
     AliMp::PlaneType PlaneType() const;
     
+    AliMp::StationType StationType() const;
+
     TVector2 Dimensions() const;
     
   private:
@@ -149,5 +151,10 @@ class AliMpSectorSegmentation : public AliMpVSegmentation
 inline const AliMpSector* AliMpSectorSegmentation::GetSector() const
 { return fkSector; }
 
+/// Return station type
+inline AliMp::StationType AliMpSectorSegmentation::StationType() const
+{ return AliMp::kStation12; }
+
+
 #endif //ALI_MP_SECTOR_SEGMENTATION_H
 
index d767773166a66dfd9a1b899a8ed15d2bd665915b..b75570ff07eaecf837d0e6f49410717d83973524 100644 (file)
@@ -332,3 +332,144 @@ AliMpSegmentation::GetMpSegmentationByElectronics(
    
   return static_cast<AliMpVSegmentation*>(object);
 }
+
+//_____________________________________________________________________________
+const AliMpSector*  
+AliMpSegmentation::GetSector(const AliMpVSegmentation* kSegmentation, 
+                             Bool_t warn) const
+{
+/// Return sector for given mapping segmentation.
+/// If segmentation is not of sector type, zero is returned 
+/// and an Error is issued if warn is set true (default). 
+
+  if ( ! kSegmentation ) return 0;
+
+  if ( kSegmentation->StationType() != AliMp::kStation12 ) {
+    if ( warn ) {
+      AliErrorStream() 
+        << "Segmentation is not of sector type" << endl;
+     }   
+     return 0;
+  }
+  
+  return 
+    static_cast<const AliMpSectorSegmentation*>(kSegmentation)->GetSector();
+}
+                             
+//_____________________________________________________________________________
+const AliMpSector*  
+AliMpSegmentation::GetSector(Int_t detElemId, AliMp::CathodType cath, 
+                             Bool_t warn) const
+{
+/// Return sector for given detElemId and cath.
+/// If segmentation is not of sector type, zero is returned 
+/// and an Error is issued if warn is set true (default). 
+
+  return GetSector(GetMpSegmentation(detElemId, cath, warn), warn);
+}    
+      
+//_____________________________________________________________________________
+const AliMpSector*  
+AliMpSegmentation::GetSectorByElectronics(Int_t detElemId, Int_t elCardID, 
+                             Bool_t warn) const
+{
+/// Return sector for given detElemId and elCardID.
+/// If segmentation is not of sector type, zero is returned 
+/// and an Error is issued if warn is set true (default). 
+
+  return GetSector(GetMpSegmentationByElectronics(detElemId, elCardID, warn), warn);
+}    
+      
+//_____________________________________________________________________________
+const AliMpSlat*    
+AliMpSegmentation::GetSlat(const AliMpVSegmentation* kSegmentation, 
+                           Bool_t warn) const
+{                           
+/// Return slat for given mapping segmentation.
+/// If segmentation is not of slat type, zero is returned 
+/// and an Error is issued if warn is set true (default). 
+
+  if ( ! kSegmentation ) return 0;
+  if ( kSegmentation->StationType() != AliMp::kStation345 ) {
+     if ( warn ) {
+       AliErrorStream() 
+         << "Segmentation is not of slat type" << endl;
+     }    
+     return 0;
+  }
+  
+  return 
+    static_cast<const AliMpSlatSegmentation*>(kSegmentation)->Slat();
+}    
+                           
+//_____________________________________________________________________________
+const AliMpSlat*  
+AliMpSegmentation::GetSlat(Int_t detElemId, AliMp::CathodType cath, 
+                           Bool_t warn) const
+{
+/// Return slat for given detElemId and cath.
+/// If segmentation is not of slat type, zero is returned 
+/// and an Error is issued if warn is set true (default). 
+
+  return GetSlat(GetMpSegmentation(detElemId, cath, warn), warn);
+}    
+
+//_____________________________________________________________________________
+const AliMpSlat*  
+AliMpSegmentation::GetSlatByElectronics(Int_t detElemId, Int_t elCardID, 
+                           Bool_t warn) const
+{
+/// Return slat for given detElemId and elCardID.
+/// If segmentation is not of slat type, zero is returned 
+/// and an Error is issued if warn is set true (default). 
+
+  return GetSlat(GetMpSegmentationByElectronics(detElemId, elCardID, warn), warn);
+}    
+
+//_____________________________________________________________________________
+const AliMpTrigger* 
+AliMpSegmentation::GetTrigger(const AliMpVSegmentation* kSegmentation, 
+                              Bool_t warn) const
+{                               
+/// Return trigger for given mapping segmentation.
+/// If segmentation is not of trigger type, zero is returned 
+/// and an Error is issued if warn is set true (default). 
+
+  if ( ! kSegmentation ) return 0;
+  if ( kSegmentation->StationType() != AliMp::kStationTrigger ) {
+     if ( warn ) {
+       AliErrorStream() 
+         << "Segmentation is not of trigger type" << endl;
+     }    
+     return 0;
+  }
+  
+  return 
+    static_cast<const AliMpTriggerSegmentation*>(kSegmentation)->Slat();
+}    
+
+//_____________________________________________________________________________
+const AliMpTrigger*  
+AliMpSegmentation::GetTrigger(Int_t detElemId, AliMp::CathodType cath, 
+                              Bool_t warn) const
+{
+/// Return trigger for given detElemId and cath.
+/// If segmentation is not of trigger type, zero is returned 
+/// and an Error is issued if warn is set true (default). 
+
+  return GetTrigger(GetMpSegmentation(detElemId, cath, warn), warn);
+}    
+
+//_____________________________________________________________________________
+const AliMpTrigger*  
+AliMpSegmentation::GetTriggerByElectronics(Int_t detElemId, Int_t elCardID, 
+                              Bool_t warn) const
+{
+/// Return trigger for given detElemId and elCardID.
+/// If segmentation is not of trigger type, zero is returned 
+/// and an Error is issued if warn is set true (default). 
+
+  return GetTrigger(GetMpSegmentationByElectronics(detElemId, elCardID, warn), warn);
+}    
index 5ba5a9ce5f1e750dad49c8c05eb88003f4ce6a15..5b4820e85b0fe72d67df17e63d9606209a7690ca 100644 (file)
@@ -12,7 +12,8 @@
 /// \brief Singleton container class for mapping segmentations
 ///
 /// It provides access to mapping segmentations based on the
-/// AliMpVSegmentation interface.                                        \n
+/// AliMpVSegmentation interface and to segmentations underlying
+/// detectors (sector, slat, trigger).                                  \n
 /// Mapping segmentations for all detection elements
 /// are created at the first call to AliMpSegmentation::Instance().
 /// The class is a singleton, it has all constructors
@@ -41,6 +42,9 @@ class AliMpVSegmentation;
 class AliMpSegmentation;
 class AliMpSlatMotifMap;
 class AliMpDataStreams;
+class AliMpSector;
+class AliMpSlat;
+class AliMpTrigger;
 class TRootIOCtor;
 
 class AliMpSegmentation : public  TObject {
@@ -55,6 +59,11 @@ class AliMpSegmentation : public  TObject {
                                        Bool_t warn = true);
 
     // methods
+    
+    //
+    // Access to segmentations
+    //
+    
     const AliMpVSegmentation* GetMpSegmentation(
                                  Int_t detElemId, AliMp::CathodType cath, 
                                 Bool_t warn = true) const;
@@ -62,7 +71,31 @@ class AliMpSegmentation : public  TObject {
     const AliMpVSegmentation* GetMpSegmentationByElectronics(
                                  Int_t detElemId, Int_t elCardID, 
                                 Bool_t warn = true) const;
-    
+    //
+    // Access to sectors, slats, triggers
+    //
+
+    const AliMpSector*  GetSector(const AliMpVSegmentation* kSegmentation, 
+                                  Bool_t warn = true) const;
+    const AliMpSector*  GetSector(Int_t detElemId, AliMp::CathodType cath, 
+                                  Bool_t warn = true) const;
+    const AliMpSector*  GetSectorByElectronics(Int_t detElemId, Int_t elCardID, 
+                                  Bool_t warn = true) const;
+  
+    const AliMpSlat*    GetSlat(const AliMpVSegmentation* kSegmentation, 
+                                  Bool_t warn = true) const;
+    const AliMpSlat*    GetSlat(Int_t detElemId, AliMp::CathodType cath, 
+                                  Bool_t warn = true) const;
+    const AliMpSlat*    GetSlatByElectronics(Int_t detElemId, Int_t elCardID, 
+                                  Bool_t warn = true) const;
+  
+    const AliMpTrigger* GetTrigger(const AliMpVSegmentation* kSegmentation, 
+                                  Bool_t warn = true) const;
+    const AliMpTrigger* GetTrigger(Int_t detElemId, AliMp::CathodType cath, 
+                                  Bool_t warn = true) const;
+    const AliMpTrigger* GetTriggerByElectronics(Int_t detElemId, Int_t elCardID, 
+                                  Bool_t warn = true) const;
+  
   private:
     AliMpSegmentation(const AliMpDataStreams& dataStreams);
     /// Not implemented
@@ -72,6 +105,7 @@ class AliMpSegmentation : public  TObject {
 
     AliMpVSegmentation* CreateMpSegmentation(
                               Int_t detElemId, AliMp::CathodType cath);
+                              
 
     AliMpExMap* FillElCardsMap(Int_t detElemId);
 
index 822a45d23d88a66f3ee7d07e078037aa8a229421..39f6f9f0b824cf97328b56060b2af149db71bceb 100644 (file)
@@ -71,7 +71,9 @@ class AliMpSlatSegmentation : public AliMpVSegmentation
   
   void GetAllElectronicCardIDs(TArrayI& ecn) const;
   
-  AliMp::PlaneType PlaneType() const;
+  virtual AliMp::PlaneType PlaneType() const;
+   
+  virtual AliMp::StationType StationType() const;
   
   TVector2 Dimensions() const;
   
@@ -87,4 +89,8 @@ class AliMpSlatSegmentation : public AliMpVSegmentation
   ClassDef(AliMpSlatSegmentation,2) // A slat for stations 3,4,5
 };
 
+/// Return station type
+inline AliMp::StationType AliMpSlatSegmentation::StationType() const
+{ return AliMp::kStation345; }
+
 #endif
index dd5110bc62abdf6cf2a0d658640823343b3e31a0..e8b9999714c1af5749453b759394b2d14fc07ea5 100644 (file)
@@ -21,6 +21,7 @@ TString AliMp::StationTypeName(AliMp::StationType stationType)
   switch ( stationType ) {
     case kStation1:       return "st1";     break;
     case kStation2:       return "st2";     break;
+    case kStation12:      return "st12";    break;
     case kStation345:     return "slat";    break;
     case kStationTrigger: return "trigger"; break;
   }
index 5b7c07084bbd2bc55923fb231bf826b5f2561f4b..93a946f179ff336702ff4fce43f9b044d29a2994 100644 (file)
@@ -21,6 +21,7 @@ namespace AliMp {
   {
     kStation1,           ///< station 1 (quadrants)
     kStation2,           ///< station 2 (quadrants)
+    kStation12,          ///< station 1,2 (quadrants)
     kStation345,         ///< station 3,4,5 (slats)
     kStationTrigger      ///< trigger stations (slats)
   };
index 358f76350e30a2c2ccbe86d102968f339bdb883c..88940c41360be7965777cc1d0aec9937d9a759a2 100644 (file)
@@ -62,8 +62,10 @@ public:
    
   virtual void GetAllElectronicCardIDs(TArrayI& ecn) const;
   
-  AliMp::PlaneType PlaneType() const;
-  
+  virtual AliMp::PlaneType PlaneType() const;
+   
+  virtual AliMp::StationType StationType() const;
   TVector2 Dimensions() const;
   
 private:
@@ -71,7 +73,7 @@ private:
   AliMpTriggerSegmentation(const AliMpTriggerSegmentation& right);
   /// Not implemented
   AliMpTriggerSegmentation&  operator = (const AliMpTriggerSegmentation& right);
-
+  
   const AliMpTrigger* fkSlat;  ///< Slat
   Bool_t              fIsOwner;///< Trigger slat ownership     
   Int_t fNofStrips; ///< Number of strips in this slat
@@ -79,4 +81,9 @@ private:
   ClassDef(AliMpTriggerSegmentation,3) // Segmentation for slat trigger stations
 };
 
+/// Return station type
+inline AliMp::StationType AliMpTriggerSegmentation::StationType() const
+{ return AliMp::kStationTrigger; }
+
+
 #endif
index d69991b70c561e5350ebc94ba2db4cc7e25ae448..4b54106ce089e969b64727e140c603796850f165 100755 (executable)
@@ -46,7 +46,7 @@
 #include "AliMpSlatPainter.h"
 #include "AliMpIteratorPainter.h"
 #include "AliMpVPadIterator.h"
-#include "AliMpSlatSegmentation.h"
+#include "AliMpSegmentation.h"
 //#include "AliMpSectorSegmentation.h"
 
 #include <TList.h>
@@ -180,11 +180,20 @@ AliMpVPainter *AliMpVPainter::CreatePainter(TObject *object)
 //      return new AliMpSectorPainter(sectorSegmentation->GetSector());
 //    }
 
+  /*
     const AliMpSlatSegmentation* slatSegmentation = dynamic_cast<const AliMpSlatSegmentation*>(object);
     if (slatSegmentation)
     {
       return new AliMpSlatPainter(slatSegmentation->Slat());
     }
+  */
+    const AliMpSlat* kSlat 
+      = AliMpSegmentation::Instance()->GetSlat((AliMpVSegmentation*)object);
+    if ( kSlat )
+    {
+      return new AliMpSlatPainter(kSlat);
+    }
+    
   }
   return painter;
 }
index 417192897286817a67040464c40861a19416c9df..75e0cd24fe26e20d5bf75787a7469079051548d3 100644 (file)
@@ -23,6 +23,7 @@
 #include "AliMpPadPair.h"
 #include "AliMpPad.h"
 #include "AliMpPlaneType.h"
+#include "AliMpStationType.h"
 
 class AliMpVPadIterator;
 class AliMpIntPair;
@@ -84,6 +85,9 @@ class AliMpVSegmentation : public TObject
             /// Return the plane type
     virtual AliMp::PlaneType PlaneType() const = 0;
     
+            /// Return the station type
+    virtual AliMp::StationType StationType() const = 0;
+
             /// Return the half-sizes of the detection element
     virtual TVector2 Dimensions() const = 0;