#include <cstdlib>
#include "AliMpMotifType.h"
+
+#include "AliMpExMapIterator.h"
#include "AliMpMotifTypePadIterator.h"
#include "AliMpConnection.h"
fID(id),
fNofPadsX(0),
fNofPadsY(0),
-#ifdef WITH_STL
fConnections()
-#endif
-#ifdef WITH_ROOT
- fConnections(true)
-#endif
{
/// Standard constructor \n
/// Please note that id should be of the form %s for station 1,2,
}
//______________________________________________________________________________
-AliMpMotifType::AliMpMotifType()
+AliMpMotifType::AliMpMotifType(TRootIOCtor* ioCtor)
: TObject(),
fID(""),
fNofPadsX(0),
fNofPadsY(0),
+#ifdef WITH_STL
fConnections()
+#endif
+#ifdef WITH_ROOT
+ fConnections(ioCtor)
+#endif
{
/// Default constructor
AliDebug(1,Form("this=%p",this));
#endif
#ifdef WITH_ROOT
- TExMapIter i = fConnections.GetIterator();
- Long_t key, value;
- while ( i.Next(key, value) ) {
- AliMpConnection* connection = (AliMpConnection*)value;
- if (connection->GetPadNum()==padNum) return connection;
- }
- return 0;
+ TIter next(fConnections.CreateIterator());
+ AliMpConnection* connection;
+
+ while ( ( connection = static_cast<AliMpConnection*>(next()) ) )
+ {
+ if (connection->GetPadNum()==padNum) return connection;
+ }
+ return 0x0;
#endif
}
#endif
#ifdef WITH_ROOT
- TExMapIter i = fConnections.GetIterator();
- Long_t key, value;
- while ( i.Next(key, value) ) {
- AliMpConnection* connection = (AliMpConnection*)value;
- if (connection->GetGassiNum()==gassiNum) return connection;
- }
- return 0;
+ TIter next(fConnections.CreateIterator());
+ AliMpConnection* connection;
+
+ while ( ( connection = static_cast<AliMpConnection*>(next()) ) )
+ {
+ if (connection->GetGassiNum()==gassiNum) return connection;
+ }
+ return 0x0;
#endif
}
#endif
#ifdef WITH_ROOT
- TExMapIter i = fConnections.GetIterator();
- Long_t key, value;
- while ( i.Next(key, value) ) {
- AliMpConnection* connection = (AliMpConnection*)value;
- if (connection->GetKaptonNum()==kaptonNum) return connection;
- }
- return 0;
+ TIter next(fConnections.CreateIterator());
+ AliMpConnection* connection;
+
+ while ( ( connection = static_cast<AliMpConnection*>(next()) ) )
+ {
+ if (connection->GetKaptonNum()==kaptonNum) return connection;
+ }
+ return 0x0;
#endif
}
//______________________________________________________________________________
#endif
#ifdef WITH_ROOT
- TExMapIter i = fConnections.GetIterator();
- Long_t key, value;
- while ( i.Next(key, value) ) {
- AliMpConnection* connection = (AliMpConnection*)value;
- if (connection->GetBergNum()==bergNum) return connection;
- }
- return 0;
+ TIter next(fConnections.CreateIterator());
+ AliMpConnection* connection;
+
+ while ( ( connection = static_cast<AliMpConnection*>(next()) ) )
+ {
+ if (connection->GetBergNum()==bergNum) return connection;
+ }
+ return 0x0;
#endif
}
//______________________________________________________________________________
-AliMpIntPair AliMpMotifType::FindLocalIndicesByConnection(
- const AliMpConnection* connection) const
+AliMpIntPair AliMpMotifType::FindLocalIndicesByConnection(const AliMpConnection* connection) const
{
- /// Retrieve the pad position from the connection pointer.
- /// Not to be used widely, since it use a search in the
- /// connection list...
-
-#ifdef WITH_STL
- for(ConnectionMapCIterator i = fConnections.begin();
- i!=fConnections.end();++i)
- if (i->second==connection) return i->first;
-#endif
-
-#ifdef WITH_ROOT
- TExMapIter i = fConnections.GetIterator();
- Long_t key, value;
- while ( i.Next(key, value) ) {
- AliMpConnection* aConnection = (AliMpConnection*)value;
- if (aConnection == connection) return AliMpExMap::GetPair(key);
- }
-#endif
+ /// Reurn the pad position from the connection pointer.
- return AliMpIntPair::Invalid();
+ return connection->LocalIndices();
}
//______________________________________________________________________________
#endif
#ifdef WITH_ROOT
- TExMapIter i = fConnections.GetIterator();
- Long_t key, value;
- while ( i.Next(key, value) ) {
- AliMpConnection* connection = (AliMpConnection*)value;
- if (connection->GetPadNum() == padNum) return AliMpExMap::GetPair(key);
- }
+ TIter next(fConnections.CreateIterator());
+ AliMpConnection* connection;
+
+ while ( ( connection = static_cast<AliMpConnection*>(next()) ) )
+ {
+ if (connection->GetPadNum()==padNum) return connection->LocalIndices();
+ }
#endif
return AliMpIntPair::Invalid();
}
#endif
#ifdef WITH_ROOT
- TExMapIter i = fConnections.GetIterator();
- Long_t key, value;
- while ( i.Next(key, value) ) {
- AliMpConnection* connection = (AliMpConnection*)value;
- if (connection->GetGassiNum()==gassiNum) return AliMpExMap::GetPair(key);
- }
+ TIter next(fConnections.CreateIterator());
+ AliMpConnection* connection;
+
+ while ( ( connection = static_cast<AliMpConnection*>(next()) ) )
+ {
+ if (connection->GetGassiNum()==gassiNum) return connection->LocalIndices();
+ }
#endif
return AliMpIntPair::Invalid();
#endif
#ifdef WITH_ROOT
- TExMapIter i = fConnections.GetIterator();
- Long_t key, value;
- while ( i.Next(key, value) ) {
- AliMpConnection* connection = (AliMpConnection*)value;
- if (connection->GetKaptonNum()==kaptonNum) return AliMpExMap::GetPair(key);
- }
+ TIter next(fConnections.CreateIterator());
+ AliMpConnection* connection;
+
+ while ( ( connection = static_cast<AliMpConnection*>(next()) ) )
+ {
+ if (connection->GetKaptonNum()==kaptonNum) return connection->LocalIndices();
+ }
#endif
return AliMpIntPair::Invalid();
#endif
#ifdef WITH_ROOT
- TExMapIter i = fConnections.GetIterator();
- Long_t key, value;
- while ( i.Next(key, value) ) {
- AliMpConnection* connection = (AliMpConnection*)value;
- if (connection->GetBergNum()==bergNum) return AliMpExMap::GetPair(key);
- }
+ TIter next(fConnections.CreateIterator());
+ AliMpConnection* connection;
+
+ while ( ( connection = static_cast<AliMpConnection*>(next()) ) )
+ {
+ if (connection->GetBergNum()==bergNum) return connection->LocalIndices();
+ }
#endif
return AliMpIntPair::Invalid();