]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
- Adding new methods to AliMpVSegmentation which can speed up things here
authorivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 18 Feb 2009 10:45:47 +0000 (10:45 +0000)
committerivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 18 Feb 2009 10:45:47 +0000 (10:45 +0000)
  and there:
    HasPadByIndices,
    HasPadByLocation,
    GetNofElectronicsCards,
    Position,
    HasMotifPosition
    MotifPosition,
- Change AliMpMotifType implementation to speed up the search by location.
(Laurent)

20 files changed:
MUON/mapping/AliMpConnection.h
MUON/mapping/AliMpMotif.cxx
MUON/mapping/AliMpMotifPosition.cxx
MUON/mapping/AliMpMotifPosition.h
MUON/mapping/AliMpMotifReader.cxx
MUON/mapping/AliMpMotifSpecial.cxx
MUON/mapping/AliMpMotifType.cxx
MUON/mapping/AliMpMotifType.h
MUON/mapping/AliMpMotifTypePadIterator.cxx
MUON/mapping/AliMpPCB.cxx
MUON/mapping/AliMpSector.cxx
MUON/mapping/AliMpSector.h
MUON/mapping/AliMpSectorSegmentation.cxx
MUON/mapping/AliMpSectorSegmentation.h
MUON/mapping/AliMpSlatSegmentation.cxx
MUON/mapping/AliMpSlatSegmentation.h
MUON/mapping/AliMpTriggerSegmentation.cxx
MUON/mapping/AliMpTriggerSegmentation.h
MUON/mapping/AliMpVSegmentation.cxx
MUON/mapping/AliMpVSegmentation.h

index 4bb74b10804bf93fe017dbacc2e6c20efdbf51dd..d2eaa3ee60e52b8532701422b79ea1795119f73b 100755 (executable)
@@ -30,6 +30,8 @@ class AliMpConnection : public TObject
 
     // methods
 
+  Int_t ManuChannel() const { return fGassiNum; }
+  
     //
     // accessors
     //
index 816d7396549ca207071898601516ef21b5caaac4..5090237bbadac7898958519325139dbc1ba227fc 100755 (executable)
@@ -67,7 +67,7 @@ TVector2 AliMpMotif::GetPadDimensions(const AliMpIntPair& localIndices) const
 {
   /// Give the dimension of the specified pad in the motif
 
-  if (GetMotifType()->HasPad(localIndices))
+  if (GetMotifType()->HasPadByLocalIndices(localIndices))
     return fPadDimensions;
   else {
     Warning("GetPadDimensions","indices outside range");
index ef85f0707147bf324d2e9ab7c072c7cd5c5e9b20..38ff2f06df5bfc851dc81d2ce414fa93aaffc477 100755 (executable)
@@ -27,7 +27,6 @@
 #include "AliMpMotifPosition.h"
 #include "AliMpMotifPositionPadIterator.h"
 #include "AliMpMotifType.h"
-
 #include <Riostream.h>
 
 /// \cond CLASSIMP
@@ -70,7 +69,7 @@ AliMpVPadIterator* AliMpMotifPosition::CreateIterator() const
 }  
 
 //______________________________________________________________________________
-Bool_t AliMpMotifPosition::HasPad(const AliMpIntPair& indices) const
+Bool_t AliMpMotifPosition::HasPadByIndices(const AliMpIntPair& indices) const
 {
 /// Return true if pad with the specified indices exists in 
 /// this motif position.
@@ -79,7 +78,16 @@ Bool_t AliMpMotifPosition::HasPad(const AliMpIntPair& indices) const
   
   if (fMotif->GetMotifType()->IsFull()) return kTRUE;
   
-  return fMotif->GetMotifType()->HasPad(indices-GetLowIndicesLimit());
+  return fMotif->GetMotifType()->HasPadByLocalIndices(indices-GetLowIndicesLimit());
+}
+
+//______________________________________________________________________________
+Bool_t AliMpMotifPosition::HasPadByManuChannel(Int_t manuChannel) const
+{
+  /// Return true if pad with the specified manuChannel exists in 
+  /// this motif position.
+
+  return fMotif->GetMotifType()->HasPadByManuChannel(manuChannel);
 }
 
 //_____________________________________________________________________________
index 3a608cd82cde9c36e81e7c10e0c2831000c166ae..de26abd943f783c52dc49c3544b344c0494f6d1d 100755 (executable)
@@ -33,7 +33,8 @@ class AliMpMotifPosition : public AliMpVIndexed
   // get methods
   Int_t        GetID() const;
   AliMpVMotif* GetMotif() const;
-  Bool_t       HasPad(const AliMpIntPair& indices) const;
+  Bool_t       HasPadByIndices(const AliMpIntPair& indices) const;
+  Bool_t       HasPadByManuChannel(Int_t manuChannel) const;
 
   // Geometry
   TVector2 Position() const;
index e909e8d6205b70d0abfebdc41a88b92f73f06227..7faafe59340e187acaca91d39ca4fd60bfff45d9 100644 (file)
@@ -233,7 +233,12 @@ AliMpMotifType* AliMpMotifReader::BuildMotifType(const TString& motifTypeId)
     AliMpConnection* connection 
       = new AliMpConnection(padNum,numBerg,numKapton,gassiNum, AliMpIntPair(ix,iy));
     
-    motifType->AddConnection(AliMpIntPair(ix,iy),connection);
+    Bool_t ok = motifType->AddConnection(connection);
+    
+    if (!ok)
+    {
+      AliFatal("Could not add connection");
+    }
                   
     if (ix>=nofPadsX) nofPadsX=ix+1;
     if (iy>=nofPadsY) nofPadsY=iy+1;
index 902e46ca5478f8c618422f46271aa089880d6e96..a8e900f86fe2c1040a29282ffdfea03dc8571a81 100755 (executable)
@@ -103,7 +103,7 @@ AliMpMotifSpecial::GetPadDimensions(const AliMpIntPair& localIndices) const
 {
 /// Return the dimensions of pad located at the given indices
 
-  if (GetMotifType()->HasPad(localIndices)) {
+  if (GetMotifType()->HasPadByLocalIndices(localIndices)) {
 #ifdef WITH_STL
     return fPadDimensionsVector[VectorIndex(localIndices)];
 #endif  
@@ -275,7 +275,7 @@ void AliMpMotifSpecial::SetPadDimensions(const AliMpIntPair& localIndices,
   /// Set the dimensions of the pad located at \a localIndices to the given
   /// \a dimensions
   
-  if ( !GetMotifType()->HasPad(localIndices)){
+  if ( !GetMotifType()->HasPadByLocalIndices(localIndices)){
     Warning("SetPadDimensions","Pad indices outside limits");
     return;
   }  
index 7d72904db097c61e30bf2149ab123f3fe944ad34..0a7c7f1ed897cc6e2670cb9ee551c1952014be98 100755 (executable)
 
 #include <cstdlib>
 #include "AliMpMotifType.h"
-
 #include "AliMpExMapIterator.h"
 #include "AliMpMotifTypePadIterator.h"
 #include "AliMpConnection.h"
-
+#include "AliMpConstants.h"
 #include "AliLog.h"
 #include "AliMpFiles.h"
 #include "TSystem.h"
@@ -46,48 +45,53 @@ const Int_t AliMpMotifType::fgkPadNumForA = 65;
 
 //______________________________________________________________________________
 AliMpMotifType::AliMpMotifType(const TString &id) 
-  : TObject(),
-    fID(id),
-    fNofPadsX(0),   
-    fNofPadsY(0),
-    fConnections()
+: TObject(),
+fID(id),
+fNofPadsX(0),   
+fNofPadsY(0),
+fNofPads(0),
+fMaxNofPads(AliMpConstants::ManuNofChannels()),
+fConnectionsByLocalIndices(fMaxNofPads*fMaxNofPads),
+fConnectionsByManuChannel(fMaxNofPads)
 {
   /// Standard constructor                                                   \n
   /// Please note that id should be of the form %s for station 1,2,
   //  %s-%e-%e for station345 and %sx%e for stationTrigger
-      
-      AliDebug(1,Form("this=%p id=%s",this,id.Data()));
+
+  fConnectionsByLocalIndices.SetOwner(kTRUE);
+  fConnectionsByManuChannel.SetOwner(kFALSE);
+  AliDebug(1,Form("this=%p id=%s",this,id.Data()));
 }
 
 //______________________________________________________________________________
-AliMpMotifType::AliMpMotifType(TRootIOCtor* ioCtor) 
-  : TObject(),
-    fID(""),
-    fNofPadsX(0),   
-    fNofPadsY(0),
-#ifdef WITH_STL
-    fConnections()
-#endif
-#ifdef WITH_ROOT
-    fConnections(ioCtor)
-#endif
+AliMpMotifType::AliMpMotifType(TRootIOCtor*) 
+: TObject(),
+fID(""),
+fNofPadsX(0),   
+fNofPadsY(0),
+fNofPads(0),
+fMaxNofPads(0),
+fConnectionsByLocalIndices(),
+fConnectionsByManuChannel()
 {
   /// Default constructor
-      AliDebug(1,Form("this=%p",this));
+  AliDebug(1,Form("this=%p",this));
 }
 
 //______________________________________________________________________________
 AliMpMotifType::AliMpMotifType(const AliMpMotifType& rhs)
 : TObject(),
-  fID(""),
-  fNofPadsX(0),   
-  fNofPadsY(0),
-  fConnections()
+fID(""),
+fNofPadsX(0),   
+fNofPadsY(0),
+fNofPads(0),
+fMaxNofPads(0),
+fConnectionsByLocalIndices(),
+fConnectionsByManuChannel()
 {
   /// Copy constructor
-
-    AliDebug(1,Form("this=%p (copy ctor)",this));
-    rhs.Copy(*this);
+  AliDebug(1,Form("this=%p (copy ctor)",this));
+  rhs.Copy(*this);
 }
 
 //______________________________________________________________________________
@@ -95,7 +99,7 @@ AliMpMotifType&
 AliMpMotifType::operator=(const AliMpMotifType& rhs)
 {
   /// Assignment operator
-
+  
   TObject::operator=(rhs);
   rhs.Copy(*this);
   return *this;  
@@ -120,24 +124,18 @@ AliMpMotifType::Copy(TObject& object) const
   mt.fID = fID;
   mt.fNofPadsX = fNofPadsX;
   mt.fNofPadsY = fNofPadsY;
-  mt.fConnections = fConnections;
+  mt.fNofPads = fNofPads;
+  mt.fMaxNofPads = fMaxNofPads;
+  mt.fConnectionsByLocalIndices = fConnectionsByLocalIndices;
+  mt.fConnectionsByManuChannel = fConnectionsByManuChannel;  
 }
 
 //______________________________________________________________________________
 AliMpMotifType::~AliMpMotifType() 
 {
-/// Destructor
-
-#ifdef WITH_STL
- for(ConnectionMapCIterator i = fConnections.begin();
-  i!=fConnections.end();++i)
-   delete i->second;
+  /// Destructor
 
-  fConnections.erase(fConnections.begin(),fConnections.end());
-#endif  
-  
   AliDebug(1,Form("this=%p",this));
-//  StdoutToAliDebug(1,this->Print(););
 }
 
 //______________________________________________________________________________
@@ -181,135 +179,130 @@ TString AliMpMotifType::PadName(Int_t padNum) const
 }
 
 //______________________________________________________________________________
-void AliMpMotifType::AddConnection(const AliMpIntPair &localIndices, 
-                               AliMpConnection* connection)
+Bool_t 
+AliMpMotifType::AddConnection(AliMpConnection* connection)
 {
   /// Add the connection to the map
   
-#ifdef WITH_STL
-  fConnections[localIndices]=connection;
-#endif
-
-#ifdef WITH_ROOT
-  fConnections.Add(localIndices, connection);
-#endif   
-
-  connection->SetOwner(this);
+  if (!connection) return kFALSE;
+  
+  Int_t ix = connection->LocalIndices().GetFirst();
+  Int_t iy = connection->LocalIndices().GetSecond();
+  
+  Int_t manuChannel = connection->ManuChannel();
+  
+  if ( ix >=0 && ix < fMaxNofPads &&
+      iy >=0 && iy < fMaxNofPads && 
+      manuChannel >= 0 && manuChannel < AliMpConstants::ManuNofChannels())
+  {
+  
+    Int_t index = ix + iy*AliMpConstants::ManuNofChannels();
+    
+    AliMpConnection* c = FindConnectionByLocalIndices(connection->LocalIndices());
+    
+    if (c)
+    {
+      AliError(Form("Connection already exists for ix=%d iy=%d",ix,iy));
+      return kFALSE;
+    }
+    
+    ++fNofPads;
+
+    fConnectionsByLocalIndices[index] = connection;
+    fConnectionsByManuChannel[manuChannel] = connection;
+    
+    connection->SetOwner(this);
+    
+    return kTRUE;
+  
+  }
+  return kFALSE;
 }  
 
 //______________________________________________________________________________
-AliMpConnection *AliMpMotifType::FindConnectionByPadNum(Int_t padNum) const
+AliMpConnection*
+AliMpMotifType::FindConnectionByPadNum(Int_t padNum) const
 {
   /// Retrieve the AliMpConnection pointer from its pad num
+  /// This method is quite inefficient as we're looping over all connections
+  
+  TIter next(&fConnectionsByManuChannel);
+  AliMpConnection* connection;
   
-#ifdef WITH_STL
- for(ConnectionMapCIterator i = fConnections.begin();
-  i!=fConnections.end();++i)
-   if (i->second->GetPadNum()==padNum) return i->second;
- return 0;
-#endif
-
-#ifdef WITH_ROOT
- TIter next(fConnections.CreateIterator());
- AliMpConnection* connection;
- while ( ( connection = static_cast<AliMpConnection*>(next()) ) )
- {
-   if (connection->GetPadNum()==padNum) return connection;
- }
- return 0x0;
-#endif
+  while ( ( connection = static_cast<AliMpConnection*>(next()) ) )
+  {
+    if (connection->GetPadNum()==padNum) return connection;
+  }    
+  return 0x0;
 }
 
 //______________________________________________________________________________
-AliMpConnection *AliMpMotifType::FindConnectionByLocalIndices(
-                                       const AliMpIntPair& localIndices) const
+AliMpConnection*
+AliMpMotifType::FindConnectionByLocalIndices(const AliMpIntPair& localIndices) const
 {
   /// Retrieve the AliMpConnection pointer from its position (in pad unit)
-  
-  if (!localIndices.IsValid()) return 0;
 
-#ifdef WITH_STL
-  ConnectionMapCIterator i = fConnections.find(localIndices);
- if (i != fConnections.end())
-   return i->second;
- else return 0;
-#endif
+  Int_t ix = localIndices.GetFirst();
+  Int_t iy = localIndices.GetSecond();
+  
+  if ( ix < fNofPadsX && iy < fNofPadsY && ix >= 0 && iy >= 0 )
+  {  
+    Int_t index = ix + iy*fMaxNofPads;
 
-#ifdef WITH_ROOT
-  return (AliMpConnection*)fConnections.GetValue(localIndices);
-#endif
+    return static_cast<AliMpConnection*>(fConnectionsByLocalIndices.UncheckedAt(index));
+  }
+  else
+  {
+    return 0x0;
+  }
 }
 
 //______________________________________________________________________________
-AliMpConnection *AliMpMotifType::FindConnectionByGassiNum(Int_t gassiNum) const
+AliMpConnection*
+AliMpMotifType::FindConnectionByGassiNum(Int_t gassiNum) const
 {
   /// Return the connection for the given gassiplex number
   
-#ifdef WITH_STL
- for(ConnectionMapCIterator i = fConnections.begin();
-  i!=fConnections.end();++i)
-   if (i->second->GetGassiNum()==gassiNum) return i->second;
- return 0;
-#endif
-
-#ifdef WITH_ROOT
- TIter next(fConnections.CreateIterator());
- AliMpConnection* connection;
- while ( ( connection = static_cast<AliMpConnection*>(next()) ) )
- {
-   if (connection->GetGassiNum()==gassiNum) return connection;
- }
- return 0x0;
-#endif
+  if ( gassiNum >=0 && gassiNum < fMaxNofPads ) 
+  {
+    return static_cast<AliMpConnection*>(fConnectionsByManuChannel.UncheckedAt(gassiNum));
+  }
+  
+  return 0x0;
 }
 
 //______________________________________________________________________________
-AliMpConnection *AliMpMotifType::FindConnectionByKaptonNum(Int_t kaptonNum) const
+AliMpConnection*
+AliMpMotifType::FindConnectionByKaptonNum(Int_t kaptonNum) const
 {
   /// Give the connection related to the given kapton number
+  /// Inefficient method as we loop over connections to find the right one
+  
+  TIter next(&fConnectionsByManuChannel);
+  AliMpConnection* connection;
   
-#ifdef WITH_STL
- for(ConnectionMapCIterator i = fConnections.begin();
-  i!=fConnections.end();++i)
-   if (i->second->GetKaptonNum()==kaptonNum) return i->second;
- return 0;
-#endif
-
-#ifdef WITH_ROOT
- TIter next(fConnections.CreateIterator());
- AliMpConnection* connection;
- while ( ( connection = static_cast<AliMpConnection*>(next()) ) )
- {
-   if (connection->GetKaptonNum()==kaptonNum) return connection;
- }
- return 0x0;
-#endif
+  while ( ( connection = static_cast<AliMpConnection*>(next()) ) )
+  {
+    if ( connection && connection->GetKaptonNum()==kaptonNum) return connection;
+  }
+  return 0x0;
 }
+
 //______________________________________________________________________________
-AliMpConnection *AliMpMotifType::FindConnectionByBergNum(Int_t bergNum) const
+AliMpConnection*
+AliMpMotifType::FindConnectionByBergNum(Int_t bergNum) const
 {
   /// Retrieve the connection from a Berg connector number
+  /// Inefficient method as we loop over connections to find the right one
+  
+  TIter next(&fConnectionsByManuChannel);
+  AliMpConnection* connection;
   
-#ifdef WITH_STL
- for(ConnectionMapCIterator i = fConnections.begin();
-  i!=fConnections.end();++i)
-   if (i->second->GetBergNum()==bergNum) return i->second;
- return 0;
-#endif
-
-#ifdef WITH_ROOT
- TIter next(fConnections.CreateIterator());
- AliMpConnection* connection;
- while ( ( connection = static_cast<AliMpConnection*>(next()) ) )
- {
-   if (connection->GetBergNum()==bergNum) return connection;
- }
- return 0x0;
-#endif
+  while ( ( connection = static_cast<AliMpConnection*>(next()) ) )
+  {
+    if ( connection && connection->GetBergNum()==bergNum) return connection;
+  }
+  return 0x0;
 }
 
 
@@ -326,22 +319,14 @@ AliMpIntPair AliMpMotifType::FindLocalIndicesByPadNum(Int_t padNum) const
 {
   /// Retrieve the AliMpConnection pointer from its pad num
   
-#ifdef WITH_STL
- for(ConnectionMapCIterator i = fConnections.begin();
-  i!=fConnections.end();++i)
-   if (i->second->GetPadNum()==padNum) return i->first;
-#endif
-   
-#ifdef WITH_ROOT
-  TIter next(fConnections.CreateIterator());
-  AliMpConnection* connection;
+  AliMpConnection* connection = FindConnectionByPadNum(padNum);
   
-  while ( ( connection = static_cast<AliMpConnection*>(next()) ) )
+  if (connection)
   {
-    if (connection->GetPadNum()==padNum) return connection->LocalIndices();
+    return connection->LocalIndices();
   }
-#endif
- return AliMpIntPair::Invalid();
+  else
   return AliMpIntPair::Invalid();
 }
 
 //______________________________________________________________________________
@@ -349,47 +334,29 @@ AliMpIntPair AliMpMotifType::FindLocalIndicesByGassiNum(Int_t gassiNum) const
 {
   /// Return the connection for the given gassiplex number
   
-#ifdef WITH_STL
- for(ConnectionMapCIterator i = fConnections.begin();
-  i!=fConnections.end();++i)
-   if (i->second->GetGassiNum()==gassiNum) return i->first;
-#endif
-   
-#ifdef WITH_ROOT
-  TIter next(fConnections.CreateIterator());
-  AliMpConnection* connection;
+  AliMpConnection* connection = FindConnectionByGassiNum(gassiNum);
   
-  while ( ( connection = static_cast<AliMpConnection*>(next()) ) )
+  if (connection)
   {
-    if (connection->GetGassiNum()==gassiNum) return connection->LocalIndices();
+    return connection->LocalIndices();
   }
-#endif
-   
- return AliMpIntPair::Invalid();
+  else
+    return AliMpIntPair::Invalid();
 }
 
 //______________________________________________________________________________
 AliMpIntPair AliMpMotifType::FindLocalIndicesByKaptonNum(Int_t kaptonNum) const
 {
   /// Give the connection related to the given kapton number
+
+  AliMpConnection* connection = FindConnectionByKaptonNum(kaptonNum);
   
-#ifdef WITH_STL
- for(ConnectionMapCIterator i = fConnections.begin();
-  i!=fConnections.end();++i)
-   if (i->second->GetKaptonNum()==kaptonNum) return i->first;
-#endif
-   
-#ifdef WITH_ROOT
-  TIter next(fConnections.CreateIterator());
-  AliMpConnection* connection;
-  
-  while ( ( connection = static_cast<AliMpConnection*>(next()) ) )
+  if (connection)
   {
-    if (connection->GetKaptonNum()==kaptonNum) return connection->LocalIndices();
+    return connection->LocalIndices();
   }
-#endif
-   
- return AliMpIntPair::Invalid();
+  else
+    return AliMpIntPair::Invalid();
 }
 
 //______________________________________________________________________________
@@ -397,54 +364,34 @@ AliMpIntPair AliMpMotifType::FindLocalIndicesByBergNum(Int_t bergNum) const
 {
   /// Retrieve the connection from a Berg connector number
   
-#ifdef WITH_STL
- for(ConnectionMapCIterator i = fConnections.begin();
-  i!=fConnections.end();++i)
-   if (i->second->GetBergNum()==bergNum) return i->first;
-#endif
-   
-#ifdef WITH_ROOT
-  TIter next(fConnections.CreateIterator());
-  AliMpConnection* connection;
+  AliMpConnection* connection = FindConnectionByBergNum(bergNum);
   
-  while ( ( connection = static_cast<AliMpConnection*>(next()) ) )
+  if (connection)
   {
-    if (connection->GetBergNum()==bergNum) return connection->LocalIndices();
+    return connection->LocalIndices();
   }
-#endif
-   
- return AliMpIntPair::Invalid();
+  else
+    return AliMpIntPair::Invalid();
 }
 
 //______________________________________________________________________________
-Int_t  AliMpMotifType::GetNofPads() const   
+Bool_t 
+AliMpMotifType::HasPadByLocalIndices(const AliMpIntPair& localIndices) const
 {
-/// Return the number of pads
-
-#ifdef WITH_STL
-  return fConnections.size();
-#endif
-   
-#ifdef WITH_ROOT
-  return fConnections.GetSize();
-#endif
+  /// Return true if the pad indexed by \a localIndices has a connection
+    
+  return ( FindConnectionByLocalIndices(localIndices) != 0x0 );
 }
 
 //______________________________________________________________________________
-Bool_t AliMpMotifType::HasPad(const AliMpIntPair& localIndices) const
+Bool_t 
+AliMpMotifType::HasPadByManuChannel(Int_t manuChannel) const
 {
   /// Return true if the pad indexed by \a localIndices has a connection
   
-  if (!localIndices.IsValid()) return false;
-
-#ifdef WITH_STL
-  return fConnections.find(localIndices)!=fConnections.end();
-#endif
-
-#ifdef WITH_ROOT
-  TObject* value = fConnections.GetValue(localIndices);
-  return value!=0;
-#endif
+  if ( manuChannel >= fNofPads ) return kFALSE;
+  
+  return ( FindConnectionByGassiNum(manuChannel) != 0x0 );
 }
 
 //______________________________________________________________________________
index 7ab08e415baeb566c8fc57a6a2f7e1f50fe891de..3be991e03f3630b4b4d5941a1b2ed89a3f626307 100755 (executable)
 #include "AliMpContainers.h"
 
 #include "AliMpIntPair.h"
-#ifdef WITH_ROOT
-#include "AliMpExMap.h"
+#ifndef ROOT_TObjArray
+#  include "TObjArray.h"
 #endif
 
 #include <TString.h>
 
-#ifdef WITH_STL
-#include <map>
-#endif
-
-class AliMpConnection;
 class AliMpVPadIterator;
+class AliMpConnection;
 
 class AliMpMotifType : public TObject
-{
-  public:
-#ifdef WITH_STL
-    /// Connection map type
-    typedef std::map< AliMpIntPair, AliMpConnection* > ConnectionMap;
-    /// Connection map iterator type
-    typedef ConnectionMap::const_iterator     ConnectionMapCIterator;
-#endif    
-#ifdef WITH_ROOT
-    /// Connection map type
-    typedef AliMpExMap ConnectionMap;
-#endif    
-
+  {
   public:
     AliMpMotifType(const TString &id);
     AliMpMotifType(const AliMpMotifType& rhs);
     AliMpMotifType& operator=(const AliMpMotifType& rhs);
     AliMpMotifType(TRootIOCtor* ioCtor);
     virtual ~AliMpMotifType();
-
+    
     TObject* Clone(const char* newname="") const;
     
     virtual AliMpVPadIterator* CreateIterator() const;
-
+    
     // find methods
     AliMpConnection *FindConnectionByPadNum(Int_t padNum) const;
     AliMpConnection *FindConnectionByLocalIndices(
-                               const AliMpIntPair& localIndices) const;
+                         const AliMpIntPair& localIndices) const;
     AliMpConnection *FindConnectionByGassiNum(Int_t gassiNum) const;
     AliMpConnection *FindConnectionByKaptonNum(Int_t kaptonNum) const;
     AliMpConnection *FindConnectionByBergNum(Int_t bergNum) const;
-
+    
     AliMpIntPair FindLocalIndicesByPadNum(Int_t padNum) const;
     AliMpIntPair FindLocalIndicesByGassiNum(Int_t gassiNum) const;
     AliMpIntPair FindLocalIndicesByKaptonNum(Int_t kaptonNum) const;
     AliMpIntPair FindLocalIndicesByBergNum(Int_t bergNum) const;
     AliMpIntPair FindLocalIndicesByConnection(
-                               const AliMpConnection* connection) const;
-
+                         const AliMpConnection* connection) const;
+    
     // set methods
     void SetNofPads(Int_t nofPadsX, Int_t nofPadY);
     
     // get methods
-             /// Return unique motif ID
+    /// Return unique motif ID
     TString  GetID() const        {return fID;}
-             /// Return number of pads in x direction
+    /// Return number of pads in x direction
     Int_t    GetNofPadsX() const  {return fNofPadsX;}
-             /// Return number of pads in y direction
+    /// Return number of pads in y direction
     Int_t    GetNofPadsY() const  {return fNofPadsY;}
-    Int_t    GetNofPads() const;
+    
+    Int_t    GetNofPads() const   {return fNofPads;}
     
     // Other methods
-    void AddConnection(const AliMpIntPair &localIndices, 
-                       AliMpConnection* connection);
+    Bool_t AddConnection(AliMpConnection* connection);
+
     virtual void Print(Option_t *option="") const;
+    
     Int_t   PadNum(const TString &padName) const;
+    
     TString PadName(Int_t padNum) const;
-    Bool_t  HasPad(const AliMpIntPair& localIndices) const;
-    Bool_t  IsFull() const;
+
+    Bool_t HasPadByLocalIndices(const AliMpIntPair& localIndices) const;
+
+    Bool_t HasPadByManuChannel(Int_t manuChannel) const;
+
+    Bool_t HasPadByGassiNum(Int_t gassiNum) const { return HasPadByManuChannel(gassiNum); }
+    
+    Bool_t IsFull() const;
     
     Bool_t Save(const char* motifName) const;
     Bool_t Save() const;
-
-  private:
-      void Copy(TObject& o) const;
     
   private:
     /// Not implemented
     AliMpMotifType();
+
+    // methods
+    void Copy(TObject& o) const;
+
     // static data members
     static const Int_t  fgkPadNumForA; ///< the pad number for the pad "A"
-  
+    
     // data members
     TString   fID;              ///< unique motif ID
     Int_t     fNofPadsX;        ///< number of pads in x direction
     Int_t     fNofPadsY;        ///< number of pads in y direction
-    ConnectionMap fConnections; ///< Map (ix,iy) of connections
+    Int_t     fNofPads;    ///< total number of pads (= the number of non-void entries in the arrays below)
+    Int_t     fMaxNofPads; ///< max number of pads we can hold
+    TObjArray fConnectionsByLocalIndices; ///< array [ix + 64*iy ] -> AliMpConnection*
+    TObjArray fConnectionsByManuChannel;  ///< array [manuChannel] -> AliMpConnection*
     
-  ClassDef(AliMpMotifType,1)  // Motif type
-};
+    ClassDef(AliMpMotifType,2)  // Motif type
+  };
 
 // inline functions
 
@@ -121,3 +118,4 @@ inline Bool_t AliMpMotifType::IsFull() const
 
 #endif //ALI_MP_MOTIF_TYPE_H
 
+
index f03d8970f09f484f547bdd39fad92fff28d80ce0..9b4e68d1b777c0f4d263bf0140a3201c8d28a5d4 100755 (executable)
@@ -105,7 +105,7 @@ AliMpMotifTypePadIterator::FindFirstPadInLine(AliMpIntPair indices) const
     if (!fkMotifType) return AliMpIntPair::Invalid();
 
     while (indices.GetFirst() < fkMotifType->GetNofPadsX()) {
-        if (fkMotifType->HasPad(indices)) return indices;
+        if (fkMotifType->HasPadByLocalIndices(indices)) return indices;
         indices += AliMpIntPair(1,0);
     }
     return AliMpIntPair::Invalid();
@@ -134,7 +134,7 @@ void AliMpMotifTypePadIterator::First()
         return ;
     }
     fCurrentPosition = AliMpIntPair(0,0);
-    if (fkMotifType->HasPad(fCurrentPosition)) return;
+    if (fkMotifType->HasPadByLocalIndices(fCurrentPosition)) return;
     
     
     // if (0,0) is not available
index c1c9568961005318d2a8ff7929482a39844e3f58..9ddb95bbf35185535384b45fc20ae13f87f7a62f 100644 (file)
@@ -534,7 +534,7 @@ AliMpPCB::FindMotifPosition(Int_t ix, Int_t iy) const
 #endif
     {
       AliMpMotifPosition* mp = (AliMpMotifPosition*)fMotifPositions[i];
-      if ( mp->HasPad(AliMpIntPair(ix,iy)) )
+      if ( mp->HasPadByIndices(AliMpIntPair(ix,iy)) )
       {
         return mp;
       }
@@ -562,7 +562,7 @@ AliMpPCB::FindMotifPosition(Double_t x, Double_t y) const
     
     AliMpIntPair localIndices(mp->GetMotif()->PadIndicesLocal(localPos));
     
-    if ( localIndices.IsValid() && mp->GetMotif()->GetMotifType()->HasPad(localIndices) )
+    if ( localIndices.IsValid() && mp->GetMotif()->GetMotifType()->HasPadByLocalIndices(localIndices) )
     {
       return mp;
     }
index ecd64ae5e969e28f32a661fc0cfd1383e0c83636..33040d5b4a42fb4747ccd582577b67d48a38ab1c 100755 (executable)
@@ -527,6 +527,15 @@ AliMpSector::GetPlaneType() const
   return GetDirection()==AliMp::kY ? AliMp::kBendingPlane : AliMp::kNonBendingPlane;
 }
 
+//_____________________________________________________________________________
+Int_t 
+AliMpSector::GetNofMotifPositions() const
+{
+  /// Return the number of manus
+  
+  return fMotifMap->GetNofMotifPositions();
+}
+
 //_____________________________________________________________________________
 void 
 AliMpSector::GetAllMotifPositionsIDs(TArrayI& ecn) const
index 1f6e08f7f6ea0423fe4497a5bbc73594439abf5b..4efd4c7aebc6308e00792663f4cbb5839f51a081 100755 (executable)
@@ -105,6 +105,7 @@ class AliMpSector : public TNamed
     
     virtual void Print(Option_t* opt="") const;
     
+  Int_t GetNofMotifPositions() const;
     
   private:
     /// Not implemented
index c04381350cbb9d4b137a6bd535393e45dcd21517..92e601c0cfb636e20538f57531e86db4ea97d8c8 100755 (executable)
@@ -112,15 +112,6 @@ AliMpSectorSegmentation::~AliMpSectorSegmentation()
 // private methods
 //
 
-//_____________________________________________________________________________
-void 
-AliMpSectorSegmentation::GetAllElectronicCardIDs(TArrayI& ecn) const
-{
-  /// Fill the array ecn with all manuIds
-
-  GetSector()->GetAllMotifPositionsIDs(ecn);
-}
-
 #ifdef WITH_ROOT
 //______________________________________________________________________________
 Long_t AliMpSectorSegmentation::GetIndex(const TVector2& vector2) const
@@ -219,7 +210,7 @@ AliMpSectorSegmentation::FindMotifPosition(const AliMpIntPair& indices) const
                 motifPos 
                  = fkSector->GetMotifMap()
                    ->FindMotifPosition(seg->GetMotifPositionId(imot));
-                if (motifPos && motifPos->HasPad(indices)) return motifPos;
+                if (motifPos && motifPos->HasPadByIndices(indices)) return motifPos;
               }
             }
           }
@@ -259,7 +250,7 @@ AliMpSectorSegmentation::FindMotifPosition(const AliMpIntPair& indices) const
         motifPos 
          = fkSector->GetMotifMap()
            ->FindMotifPosition(seg->GetMotifPositionId(imot));
-        if (motifPos && motifPos->HasPad(indices)) break;
+        if (motifPos && motifPos->HasPadByIndices(indices)) break;
       }      
       if (imot==seg->GetNofMotifs()) return 0;
    
@@ -329,15 +320,6 @@ AliMpSectorSegmentation::PadByYDirection(const TVector2& startPosition,
 // public methods
 //
 
-//______________________________________________________________________________
-AliMpVPadIterator* 
-AliMpSectorSegmentation::CreateIterator() const
-{
-/// Create the sector iterator
-
-  return new AliMpSectorPadIterator(fkSector);
-}
-
 //______________________________________________________________________________
 AliMpVPadIterator* 
 AliMpSectorSegmentation::CreateIterator(const AliMpArea& area) const
@@ -357,13 +339,12 @@ AliMpSectorSegmentation::CreateIterator(const AliMpArea& area) const
 }   
   
 //______________________________________________________________________________
-Int_t 
-AliMpSectorSegmentation::GetNeighbours(const AliMpPad& pad, TObjArray& neighbours,
-                                       Bool_t includeSelf,
-                                       Bool_t includeVoid) const
+AliMpVPadIterator* 
+AliMpSectorSegmentation::CreateIterator() const
 {
-  /// Uses default implementation
-  return AliMpVSegmentation::GetNeighbours(pad,neighbours,includeSelf,includeVoid);
+/// Create the sector iterator
+
+  return new AliMpSectorPadIterator(fkSector);
 }
 
 //______________________________________________________________________________
@@ -377,17 +358,13 @@ AliMpSectorSegmentation::CreateIterator(const AliMpPad& centerPad,
 }   
   
 //______________________________________________________________________________
-TVector2
-AliMpSectorSegmentation::Dimensions() const
-{
-  return GetSector()->Dimensions();
-}
-
-//______________________________________________________________________________
-AliMp::PlaneType
-AliMpSectorSegmentation::PlaneType() const
+Int_t 
+AliMpSectorSegmentation::GetNeighbours(const AliMpPad& pad, TObjArray& neighbours,
+                                       Bool_t includeSelf,
+                                       Bool_t includeVoid) const
 {
-  return GetSector()->GetPlaneType();
+  /// Uses default implementation
+  return AliMpVSegmentation::GetNeighbours(pad,neighbours,includeSelf,includeVoid);
 }
 
 //______________________________________________________________________________
@@ -519,6 +496,41 @@ AliMpSectorSegmentation::PadByDirection(const TVector2& startPosition,
   return AliMpPad::Invalid();  
 }
 
+//_____________________________________________________________________________
+Bool_t 
+AliMpSectorSegmentation::HasPadByIndices(const AliMpIntPair& indices) const
+{
+  ///  Whether or not we have a pad at indices=(ix,iy) 
+  
+  AliMpMotifPosition* motifPos = FindMotifPosition(indices);
+  
+  if (motifPos) return motifPos->HasPadByIndices(indices);
+  
+  return kFALSE;
+}
+
+//_____________________________________________________________________________
+Bool_t 
+AliMpSectorSegmentation::HasPadByLocation(const AliMpIntPair& location) const
+{
+  /// Whether or not we have a pad at location=(manuId,manuChannel)
+  
+  AliMpMotifPosition* motifPos = 
+  fkSector->GetMotifMap()->FindMotifPosition(location.GetFirst());
+  
+  if ( motifPos ) return motifPos->HasPadByManuChannel(location.GetSecond());
+  
+  return kFALSE;
+}
+
+//______________________________________________________________________________
+Bool_t AliMpSectorSegmentation::HasPad(const AliMpIntPair& indices) const
+{
+/// Does the pad specified by \a indices exist ?
+
+  return PadByIndices(indices,kFALSE) != AliMpPad::Invalid();
+}
+
 //______________________________________________________________________________
 Int_t  AliMpSectorSegmentation::MaxPadIndexX() const
 {
@@ -543,29 +555,73 @@ Int_t  AliMpSectorSegmentation::NofPads() const
   return fkSector->GetNofPads();
 }
 
-//______________________________________________________________________________
-Bool_t AliMpSectorSegmentation::HasPad(const AliMpIntPair& indices) const
+//_____________________________________________________________________________
+void 
+AliMpSectorSegmentation::GetAllElectronicCardIDs(TArrayI& ecn) const
 {
-/// Does the pad specified by \a indices exist ?
+  /// Fill the array ecn with all manuIds
 
-  return PadByIndices(indices,kFALSE) != AliMpPad::Invalid();
+  GetSector()->GetAllMotifPositionsIDs(ecn);
+}
+
+//_____________________________________________________________________________
+Int_t 
+AliMpSectorSegmentation::GetNofElectronicCards() const
+{
+  /// Get the number of manus of this sector
+  
+  return fkSector->GetNofMotifPositions();  
+}
+
+//_____________________________________________________________________________
+Bool_t 
+AliMpSectorSegmentation::HasMotifPosition(Int_t manuId) const
+{
+  /// Whether we get a given manu. Uses default implementation
+  return (AliMpVSegmentation::HasMotifPosition(manuId) != 0x0);
+}
+
+//_____________________________________________________________________________
+AliMpMotifPosition* 
+AliMpSectorSegmentation::MotifPosition(Int_t manuId) const
+{
+  /// Return a given manu
+  return fkSector->GetMotifMap()->FindMotifPosition(manuId);
 }
 
 //______________________________________________________________________________
-Bool_t AliMpSectorSegmentation::HasMotifPosition(Int_t motifPositionID) const
+AliMp::PlaneType
+AliMpSectorSegmentation::PlaneType() const
+{
+  return GetSector()->GetPlaneType();
+}
+
+//______________________________________________________________________________
+TVector2
+AliMpSectorSegmentation::Dimensions() const
 {
-/// Does the motif position specified by motifPositionID exist ?
+/// Return sector dimensions
 
-  return (fkSector->GetMotifMap()->FindMotifPosition(motifPositionID) != 0);
+  return GetSector()->Dimensions();
 }
 
 //______________________________________________________________________________
-TVector2  AliMpSectorSegmentation::GetMinPadDimensions() const
+TVector2 
+AliMpSectorSegmentation::Position() const 
+{ 
+/// Return sector position
+
+  return GetSector()->Position(); 
+}
+
+//______________________________________________________________________________
+void
+AliMpSectorSegmentation::Print(Option_t* opt) const
 {
-/// Returne the dimensions of the smallest pad.
+/// Print the sector
 
-  return fkSector->GetMinPadDimensions();
-}  
+  fkSector->Print(opt);
+}
 
 //______________________________________________________________________________
 Int_t AliMpSectorSegmentation::Zone(const AliMpPad& pad, Bool_t warning) const
@@ -629,6 +685,14 @@ AliMpSectorSegmentation::PadDimensions(Int_t zone, Bool_t warning) const
   return TVector2();
 }  
 
+//______________________________________________________________________________
+TVector2  AliMpSectorSegmentation::GetMinPadDimensions() const
+{
+/// Returne the dimensions of the smallest pad.
+
+  return fkSector->GetMinPadDimensions();
+}  
+
 //______________________________________________________________________________
 Bool_t AliMpSectorSegmentation::CircleTest(const AliMpIntPair& indices) const
 {
@@ -667,15 +731,6 @@ Bool_t AliMpSectorSegmentation::CircleTest(const AliMpIntPair& indices) const
   return true;
 }
 
-//______________________________________________________________________________
-void
-AliMpSectorSegmentation::Print(Option_t* opt) const
-{
-/// Print the sector
-
-  fkSector->Print(opt);
-}
-
 //______________________________________________________________________________
 void AliMpSectorSegmentation::PrintZones() const
 {
@@ -705,4 +760,4 @@ void AliMpSectorSegmentation::PrintZones() const
   }
 #endif
 }
-  
+
index 16f8dbfd1ea5366d66ab447079049eb11c4e8828..1fc19d4a0b3fe5c150161111960b22bdcc14d1bb 100755 (executable)
@@ -65,9 +65,9 @@ class AliMpSectorSegmentation : public AliMpVSegmentation
     AliMpVPadIterator* CreateIterator(const AliMpPad& centerPad,
                                       Bool_t includeCenter=kFALSE) const;
 
-     Int_t GetNeighbours(const AliMpPad& pad, TObjArray& neighbours,
-                         Bool_t includeSelf = kFALSE,
-                         Bool_t includeVoid = kFALSE) const;
+    virtual Int_t GetNeighbours(const AliMpPad& pad, TObjArray& neighbours,
+                               Bool_t includeSelf = kFALSE,
+                               Bool_t includeVoid = kFALSE) const;
     
     // methods  
     virtual AliMpPad PadByLocation(const AliMpIntPair& location,
@@ -79,31 +79,36 @@ class AliMpSectorSegmentation : public AliMpVSegmentation
     virtual AliMpPad PadByDirection(const TVector2& startPosition, 
                                Double_t distance) const;
  
+    virtual Bool_t HasPadByIndices(const AliMpIntPair& indices) const;
+    virtual Bool_t HasPadByLocation(const AliMpIntPair& location) const;
+    virtual Bool_t HasPad(const AliMpIntPair& indices) const;
+  
     virtual Int_t  MaxPadIndexX() const;
     virtual Int_t  MaxPadIndexY() const;
     virtual Int_t  NofPads() const;
 
+    virtual void   GetAllElectronicCardIDs(TArrayI& ecn) const;
+    virtual Int_t  GetNofElectronicCards() const;
+    virtual Bool_t HasMotifPosition(Int_t motifPositionID) const;
+    virtual AliMpMotifPosition* MotifPosition(Int_t manuId) const;
+
+    virtual AliMp::PlaneType   PlaneType() const;
+    virtual AliMp::StationType StationType() const;
+
+    virtual TVector2 Dimensions() const;
+    virtual TVector2 Position() const;
+  
+    virtual void Print(Option_t* opt="") const;
+    
     virtual Int_t    Zone(const AliMpPad& pad, Bool_t warning = kTRUE) const;
     virtual TVector2 PadDimensions(Int_t zone, Bool_t warning = kTRUE) const;
 
-    virtual Bool_t HasPad(const AliMpIntPair& indices) const;
-    Bool_t HasMotifPosition(Int_t motifPositionID) const;
     TVector2 GetMinPadDimensions() const;
     Bool_t CircleTest(const AliMpIntPair& indices) const;
     void   PrintZones() const;
    
     const AliMpSector* GetSector() const;
-
-    virtual void Print(Option_t* opt="") const;
-    
-    virtual void GetAllElectronicCardIDs(TArrayI& ecn) const;
-
-    AliMp::PlaneType PlaneType() const;
-    
-    AliMp::StationType StationType() const;
-
-    TVector2 Dimensions() const;
-    
+  
   private:
     /// Not implemented
     AliMpSectorSegmentation(const AliMpSectorSegmentation& right);
index 9fd09b32a2bca67621d99186d4de2d0b587ca2a7..d21ff7d81f602e3d1c283274c946d39ac0fe7bd6 100644 (file)
@@ -382,3 +382,66 @@ AliMpSlatSegmentation::Slat() const
   
   return fkSlat;
 }
+
+//_____________________________________________________________________________
+Bool_t 
+AliMpSlatSegmentation::HasPadByIndices(const AliMpIntPair& indices) const
+{
+  /// Tell whether we have a pad at indices=(ix,iy)
+  
+  AliMpMotifPosition* motifPos = Slat()->FindMotifPosition(indices.GetFirst(),
+                                                           indices.GetSecond());
+  
+  if (motifPos) return motifPos->HasPadByIndices(indices);
+  
+  return kFALSE;
+}
+
+//_____________________________________________________________________________
+Bool_t 
+AliMpSlatSegmentation::HasPadByLocation(const AliMpIntPair& location) const
+{
+  /// Tell whether we have a pad at location=(manuId,manuChannel)
+  
+  AliMpMotifPosition* motifPos = Slat()->FindMotifPosition(location.GetFirst());
+  
+  if ( motifPos ) return motifPos->HasPadByManuChannel(location.GetSecond());
+  
+  return kFALSE;  
+}
+
+
+//_____________________________________________________________________________
+Int_t 
+AliMpSlatSegmentation::GetNofElectronicCards() const
+{
+  /// Get the number of manus of this slat
+  return Slat()->GetNofElectronicCards();
+
+}
+
+//_____________________________________________________________________________
+TVector2 
+AliMpSlatSegmentation::Position() const
+{
+  /// Return position of origin
+  
+  return Slat()->Position();
+}
+
+//_____________________________________________________________________________
+Bool_t 
+AliMpSlatSegmentation::HasMotifPosition(Int_t manuId) const
+{
+  /// Use default implementation
+  return AliMpVSegmentation::HasMotifPosition(manuId);
+}
+
+//_____________________________________________________________________________
+AliMpMotifPosition* 
+AliMpSlatSegmentation::MotifPosition(Int_t manuId) const
+{
+  /// Get back a given manu
+  return Slat()->FindMotifPosition(manuId);
+}
+
index 39f6f9f0b824cf97328b56060b2af149db71bceb..01af41c99cbefe82265ab6dcb4120bf6b60d4230 100644 (file)
@@ -77,6 +77,18 @@ class AliMpSlatSegmentation : public AliMpVSegmentation
   
   TVector2 Dimensions() const;
   
+  virtual Bool_t HasPadByIndices(const AliMpIntPair& indices) const;
+  
+  virtual Bool_t HasPadByLocation(const AliMpIntPair& location) const;
+
+  virtual Int_t GetNofElectronicCards() const;
+  
+  virtual TVector2 Position() const;
+  
+  virtual Bool_t HasMotifPosition(Int_t manuId) const;
+  
+  virtual AliMpMotifPosition* MotifPosition(Int_t manuId) const;
+  
  private:
   /// Not implemented
   AliMpSlatSegmentation(const AliMpSlatSegmentation& right);
index c6878fc92fbf1daf16c9d0534cf32b30c6c3e562..9e8f2f8e568cd60b313c5c731620e6e6735c6619 100644 (file)
@@ -338,3 +338,40 @@ AliMpTriggerSegmentation::Slat() const
   
   return fkSlat;
 }
+
+//_____________________________________________________________________________
+Int_t 
+AliMpTriggerSegmentation::GetNofElectronicCards() const
+{
+  /// Get the number of local board numbers
+  
+  TArrayI ecn;
+  fkSlat->GetAllLocalBoardNumbers(ecn);
+  return ecn.GetSize();  
+}
+
+//_____________________________________________________________________________
+TVector2 
+AliMpTriggerSegmentation::Position() const 
+{ 
+  /// Return position of origin
+  
+  return Slat()->Position();
+}
+
+//_____________________________________________________________________________
+AliMpMotifPosition* 
+AliMpTriggerSegmentation::MotifPosition(Int_t /* manuId */) const
+{
+  /// No implemented (yet ?)
+  AliError("Not implemented");
+  return 0x0;
+}
+
+//_____________________________________________________________________________
+Bool_t 
+AliMpTriggerSegmentation::HasMotifPosition(Int_t manuId) const
+{
+  /// Uses default implementation
+  return AliMpVSegmentation::HasMotifPosition(manuId);
+}
index 88940c41360be7965777cc1d0aec9937d9a759a2..b02b63212929e848549cc0b8e5518de4b864ebdf 100644 (file)
@@ -68,6 +68,14 @@ public:
  
   TVector2 Dimensions() const;
   
+  virtual Int_t GetNofElectronicCards() const;
+  
+  virtual TVector2 Position() const;
+  
+  virtual Bool_t HasMotifPosition(Int_t manuId) const;
+  
+  virtual AliMpMotifPosition* MotifPosition(Int_t manuId) const;
+  
 private:
   /// Not implemented
   AliMpTriggerSegmentation(const AliMpTriggerSegmentation& right);
index f064896efe58042b4c4ed195448c39aa0740c77d..24fecd72754cd87bcbf30c287456b41ba50196db 100644 (file)
@@ -253,3 +253,32 @@ AliMpPadPair AliMpVSegmentation::PadsRight(const AliMpPad& pad) const
   return FindPads(position1, position2);
 }
 
+//_____________________________________________________________________________
+Bool_t 
+AliMpVSegmentation::HasPadByIndices(const AliMpIntPair& indices) const
+{
+  /// Default implementation. Must be overwritten if can be made more
+  /// efficient in the child class
+  
+  return (PadByIndices(indices,kFALSE) != AliMpPad::Invalid());
+}
+
+//_____________________________________________________________________________
+Bool_t 
+AliMpVSegmentation::HasPadByLocation(const AliMpIntPair& location) const
+{
+  /// Default implementation. Must be overwritten if can be made more
+  /// efficient in the child class
+  
+  return (PadByLocation(location,kFALSE) != AliMpPad::Invalid());
+}
+
+//_____________________________________________________________________________
+Bool_t 
+AliMpVSegmentation::HasMotifPosition(Int_t manuId) const
+{
+  /// Default implementation to know if we hold a given manu
+  return ( MotifPosition(manuId) != 0x0 );
+}
+
+
index 75e0cd24fe26e20d5bf75787a7469079051548d3..52f7cb1699aa2012158913158ef3823f1e24dc15 100644 (file)
@@ -28,6 +28,7 @@
 class AliMpVPadIterator;
 class AliMpIntPair;
 class AliMpArea;
+class AliMpMotifPosition;
 
 class TArrayI;
 class TVector2;
@@ -39,6 +40,10 @@ class AliMpVSegmentation : public TObject
     AliMpVSegmentation();
     virtual ~AliMpVSegmentation();
   
+    //
+    // methods 
+    //
+
     // factory methods
     /// Create iterator over pads in the given area 
     virtual AliMpVPadIterator* CreateIterator(const AliMpArea& area) const = 0;
@@ -52,8 +57,6 @@ class AliMpVSegmentation : public TObject
                                 Bool_t includeSelf=kFALSE,
                                 Bool_t includeVoid=kFALSE) const = 0;
 
-    // methods 
-    //
             /// Find pad by location
     virtual AliMpPad PadByLocation(const AliMpIntPair& location, 
                                Bool_t warning = true) const = 0;
@@ -69,6 +72,17 @@ class AliMpVSegmentation : public TObject
     virtual AliMpPadPair PadsLeft(const AliMpPad& pad) const;
     virtual AliMpPadPair PadsRight(const AliMpPad& pad) const;
 
+            /// Return true if the pad with given indices exists.
+            /// Compared with the PadByIndices method, this one can generally be implemented
+            /// faster, as one does not have to create an AliMpPad object... 
+    virtual Bool_t HasPadByIndices(const AliMpIntPair& indices) const;
+  
+            /// Return true if the pad with given location exists
+    virtual Bool_t HasPadByLocation(const AliMpIntPair& location) const;
+  
+            /// For backward compatibility
+    virtual Bool_t HasPad(const AliMpIntPair& indices) const { return HasPadByIndices(indices); }
+  
             /// Return maximum pad index in X direction
     virtual Int_t  MaxPadIndexX() const = 0;
             /// Return maximum pad index in Y direction
@@ -76,12 +90,18 @@ class AliMpVSegmentation : public TObject
             /// Return the number of pads in the detection element
     virtual Int_t  NofPads() const = 0;
 
-            /// Return true if the pad with given indices exists
-    virtual Bool_t HasPad(const AliMpIntPair& indices) const = 0;
-    
             /// Fill the given array with the electronic card IDs
     virtual void GetAllElectronicCardIDs(TArrayI& ecn) const = 0;
 
+            /// Get the number of electronic card IDs 
+    virtual Int_t GetNofElectronicCards() const = 0;
+    
+            /// Whether or not we have a given manu
+    virtual Bool_t HasMotifPosition(Int_t manuId) const = 0;
+  
+            /// Return the position of a given manu (aka motifPosition)
+    virtual AliMpMotifPosition* MotifPosition(Int_t manuId) const = 0;
+
             /// Return the plane type
     virtual AliMp::PlaneType PlaneType() const = 0;
     
@@ -91,6 +111,10 @@ class AliMpVSegmentation : public TObject
             /// Return the half-sizes of the detection element
     virtual TVector2 Dimensions() const = 0;
     
+            /// Return the position of the origine of the detection element
+    virtual TVector2 Position() const = 0;
+  
+  
   private:  
     // methods
     AliMpPadPair FindPads(const TVector2& position1,