]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/mapping/AliMpMotifMap.cxx
Adding functions for iterating over motif positions
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpMotifMap.cxx
index 1cdce35f2195876769231750463f57fe402880a7..4267649d240e0de661bc21ba374f0343d3cf7448 100755 (executable)
@@ -258,6 +258,41 @@ AliMpMotifMap::GetAllMotifPositionsIDs(TArrayI& ecn) const
 #endif  
 }
 
+//_____________________________________________________________________________
+UInt_t  AliMpMotifMap::GetNofMotifPositions() const
+{
+/// Return the number of all motif positions IDs (electronic card numbers)
+
+#ifdef WITH_STL
+  return fMotifPositions.size();  
+#endif
+  
+#ifdef WITH_ROOT  
+  return fMotifPositions.GetSize();
+#endif 
+} 
+
+//_____________________________________________________________________________
+AliMpMotifPosition* AliMpMotifMap::GetMotifPosition(UInt_t index) const
+{
+/// Return the motif position which is in the map on the index-th position
+
+  if ( index >= GetNofMotifPositions() ) {
+    AliErrorStream() << "Index " << index << " outside limits." << endl;
+    return 0;
+  }   
+
+#ifdef WITH_STL
+  MotifPositionMapIterator it = fMotifPositions.begin();
+  std::advance(it, index);
+  return it->second;
+#endif
+  
+#ifdef WITH_ROOT  
+  return (AliMpMotifPosition*)fMotifPositions.GetObject(index);
+#endif 
+}
+
 //_____________________________________________________________________________
 Int_t AliMpMotifMap::CalculateNofPads() const 
 {