**************************************************************************/
// $Id$
-// $MpId: AliMpMotifMap.cxx,v 1.14 2006/03/17 11:38:06 ivana Exp $
+// $MpId: AliMpMotifMap.cxx,v 1.16 2006/05/24 13:58:41 ivana Exp $
// Category: motif
-// -------------------
+
+//-----------------------------------------------------------------------------
// Class AliMpMotifMap
// -------------------
// Class describing the motif map container, where motifs are
// mapped to their string IDs.
// Included in AliRoot: 2003/05/02
// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
+//-----------------------------------------------------------------------------
#include "AliMpMotifMap.h"
#include "AliMpVMotif.h"
#include <TVector2.h>
#include <TArrayI.h>
+/// \cond CLASSIMP
ClassImp(AliMpMotifMap)
+/// \endcond
//_____________________________________________________________________________
AliMpMotifMap::AliMpMotifMap(Bool_t /*standardConstructor*/)
void AliMpMotifMap::PrintMotif(const AliMpVMotif* motif) const
{
/// Print the motif.
-// ---
cout << motif->GetID().Data() << " "
<< motif->GetMotifType()->GetID() << " "
#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
{
+/// Calculate total number of pads in the map
+
Int_t nofPads = 0;
#ifdef WITH_STL
//_____________________________________________________________________________
void AliMpMotifMap::PrintMotifPositions() const
{
-/// Print all the the motifs positions.
+/// Print all motif positions.
#ifdef WITH_STL
if (fMotifPositions.size()) {
//_____________________________________________________________________________
void AliMpMotifMap::PrintMotifPositions2() const
{
-/// Print all the the motifs positions from the second map
+/// Print all motif positions from the second map
/// (by global indices)
#ifdef WITH_STL
//_____________________________________________________________________________
void AliMpMotifMap::PrintGlobalIndices(const char* fileName) const
{
-/// Print all the motifs positions and their global indices.
+/// Print all motif positions and their global indices.
ofstream out(fileName, ios::out);
//_____________________________________________________________________________
void AliMpMotifMap::UpdateGlobalIndices(const char* fileName)
{
-/// Updates the motifs positions global indices
-/// from the file.
+/// Update the motif positions global indices from the file.
ifstream in(fileName, ios::in);
//_____________________________________________________________________________
AliMpVMotif* AliMpMotifMap::FindMotif(const TString& motifID) const
{
-/// Finds the motif with the specified ID.
+/// Find the motif with the specified ID.
#ifdef WITH_STL
MotifMapIterator i = fMotifs.find(motifID);
const TString& motifTypeID,
const TVector2& padDimensions ) const
{
-/// Finds the motif with the specified ID and returns it
+/// Find the motif with the specified ID and returns it
/// only if its motif type and motif dimensions agree
/// with the given motifTypeID and motifDimensions.
/// Disagreement causes fatal error.