// methods
+ Int_t ManuChannel() const { return fGassiNum; }
+
//
// accessors
//
{
/// 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");
#include "AliMpMotifPosition.h"
#include "AliMpMotifPositionPadIterator.h"
#include "AliMpMotifType.h"
-
#include <Riostream.h>
/// \cond CLASSIMP
}
//______________________________________________________________________________
-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.
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);
}
//_____________________________________________________________________________
// 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;
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;
{
/// 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
/// 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;
}
#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"
//______________________________________________________________________________
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);
}
//______________________________________________________________________________
AliMpMotifType::operator=(const AliMpMotifType& rhs)
{
/// Assignment operator
-
+
TObject::operator=(rhs);
rhs.Copy(*this);
return *this;
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(););
}
//______________________________________________________________________________
}
//______________________________________________________________________________
-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;
}
{
/// 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();
}
//______________________________________________________________________________
{
/// 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();
}
//______________________________________________________________________________
{
/// 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 );
}
//______________________________________________________________________________
#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
#endif //ALI_MP_MOTIF_TYPE_H
+
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();
return ;
}
fCurrentPosition = AliMpIntPair(0,0);
- if (fkMotifType->HasPad(fCurrentPosition)) return;
+ if (fkMotifType->HasPadByLocalIndices(fCurrentPosition)) return;
// if (0,0) is not available
#endif
{
AliMpMotifPosition* mp = (AliMpMotifPosition*)fMotifPositions[i];
- if ( mp->HasPad(AliMpIntPair(ix,iy)) )
+ if ( mp->HasPadByIndices(AliMpIntPair(ix,iy)) )
{
return mp;
}
AliMpIntPair localIndices(mp->GetMotif()->PadIndicesLocal(localPos));
- if ( localIndices.IsValid() && mp->GetMotif()->GetMotifType()->HasPad(localIndices) )
+ if ( localIndices.IsValid() && mp->GetMotif()->GetMotifType()->HasPadByLocalIndices(localIndices) )
{
return mp;
}
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
virtual void Print(Option_t* opt="") const;
+ Int_t GetNofMotifPositions() const;
private:
/// Not implemented
// 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
motifPos
= fkSector->GetMotifMap()
->FindMotifPosition(seg->GetMotifPositionId(imot));
- if (motifPos && motifPos->HasPad(indices)) return motifPos;
+ if (motifPos && motifPos->HasPadByIndices(indices)) return motifPos;
}
}
}
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;
// public methods
//
-//______________________________________________________________________________
-AliMpVPadIterator*
-AliMpSectorSegmentation::CreateIterator() const
-{
-/// Create the sector iterator
-
- return new AliMpSectorPadIterator(fkSector);
-}
-
//______________________________________________________________________________
AliMpVPadIterator*
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);
}
//______________________________________________________________________________
}
//______________________________________________________________________________
-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);
}
//______________________________________________________________________________
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
{
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
return TVector2();
}
+//______________________________________________________________________________
+TVector2 AliMpSectorSegmentation::GetMinPadDimensions() const
+{
+/// Returne the dimensions of the smallest pad.
+
+ return fkSector->GetMinPadDimensions();
+}
+
//______________________________________________________________________________
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
{
}
#endif
}
-
+
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,
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);
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);
+}
+
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);
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);
+}
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);
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 );
+}
+
+
class AliMpVPadIterator;
class AliMpIntPair;
class AliMpArea;
+class AliMpMotifPosition;
class TArrayI;
class TVector2;
AliMpVSegmentation();
virtual ~AliMpVSegmentation();
+ //
+ // methods
+ //
+
// factory methods
/// Create iterator over pads in the given area
virtual AliMpVPadIterator* CreateIterator(const AliMpArea& area) const = 0;
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;
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
/// 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;
/// 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,