+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
// $Id$
+// $MpId: AliMpMotifMap.cxx,v 1.7 2005/08/26 15:43:36 ivana Exp $
// Category: motif
//
// Class AliMpMotifMap
AliMpMotifMap::AliMpMotifMap()
: TObject()
{
-//
+/// Default constructor
}
//_____________________________________________________________________________
-AliMpMotifMap::~AliMpMotifMap() {
-//
+AliMpMotifMap::~AliMpMotifMap()
+{
+/// Destructor
// Delete all registered motifs, motif types, motif positions
//_____________________________________________________________________________
Int_t AliMpMotifMap::GetIndex(const TString& s) const
{
-// Converts the TString to integer.
-// ---
+/// Convert the TString to integer.
if (s.Length() > 5) {
Fatal("GetIndex", "String too long.");
//______________________________________________________________________________
Int_t AliMpMotifMap::GetIndex(const AliMpIntPair& pair) const
{
-// Converts the pair of integers to integer.
-// ---
+/// Convert the pair of integers to integer.
if (pair.GetFirst() >= fgkSeparator || pair.GetSecond() >= fgkSeparator)
Fatal("GetIndex", "Index out of limit.");
//_____________________________________________________________________________
TString AliMpMotifMap::GetString(Int_t index) const
{
-// Converts the integer index to the string.
-// ---
+/// Convert the integer index to the string.
TString s;
while (index >0) {
//______________________________________________________________________________
AliMpIntPair AliMpMotifMap::GetPair(Int_t index) const
{
-// Converts the integer index to the pair of integers.
-// ---
+/// Convert the integer index to the pair of integers.
return AliMpIntPair((index-1)/fgkSeparator, (index-1)%fgkSeparator);
}
//_____________________________________________________________________________
void AliMpMotifMap::PrintMotif(const AliMpVMotif* motif) const
{
-// Prints the motif.
+/// Print the motif.
// ---
cout << motif->GetID().Data() << " "
//_____________________________________________________________________________
void AliMpMotifMap::PrintMotifType(const AliMpMotifType* motifType) const
{
-// Prints the motif type.
-// ---
+/// Print the motif type.
cout << motifType->GetID().Data() << " "
<< motifType->GetNofPadsX() << " "
void AliMpMotifMap::PrintMotifPosition(
const AliMpMotifPosition* motifPosition) const
{
-// Prints the motif position.
-// ---
+/// Print the motif position.
cout << motifPosition->GetID() << " "
<< motifPosition->GetMotif()->GetID() << " "
void AliMpMotifMap::PrintMotifPosition2(
const AliMpMotifPosition* motifPosition) const
{
-// Prints the motif position.
-// ---
+/// Print the motif position.
cout << setw(3) << motifPosition->GetLowIndicesLimit().GetFirst() << " "
<< setw(3) << motifPosition->GetLowIndicesLimit().GetSecond() << " "
//_____________________________________________________________________________
void AliMpMotifMap::PrintMotifs() const
{
-// Prints all the motifs and their motif types
-// for all motifs in the motifs map.
-// ---
+/// Print all the motifs and their motif types
+/// for all motifs in the motifs map.
#ifdef WITH_STL
if (fMotifs.size()) {
//_____________________________________________________________________________
void AliMpMotifMap::PrintMotifTypes() const
{
-// Prints all the the motifs types and their motif dimensions
-// for all motif types in the motif types map.
-// ---
+/// Print all the the motifs types and their motif dimensions
+/// for all motif types in the motif types map.
#ifdef WITH_STL
if (fMotifTypes.size()) {
//_____________________________________________________________________________
void AliMpMotifMap::PrintMotifPositions() const
{
-// Prints all the the motifs positions.
-// ---
+/// Print all the the motifs positions.
#ifdef WITH_STL
if (fMotifPositions.size()) {
#ifdef WITH_ROOT
if (fMotifPositions.GetSize()) {
- cout << "Dump of Motif Type Map - " << fMotifPositions.GetSize() << " entries:" << endl;
+ cout << "Dump of Motif Position Map - " << fMotifPositions.GetSize() << " entries:" << endl;
Int_t counter = 0;
MotifPositionMapIterator i(&fMotifPositions);
Long_t key, value;
//_____________________________________________________________________________
void AliMpMotifMap::PrintMotifPositions2() const
{
-// Prints all the the motifs positions from the second map
-// (by global indices)
-// ---
+/// Print all the the motifs positions from the second map
+/// (by global indices)
#ifdef WITH_STL
if (fMotifPositions2.size()) {
//_____________________________________________________________________________
Bool_t AliMpMotifMap::AddMotif(AliMpVMotif* motif, Bool_t warn)
{
-// Adds the specified motif
-// if the motif with this ID is not yet present.
-// ---
+/// Add the specified motif
+/// if the motif with this ID is not yet present.
AliMpVMotif* found = FindMotif(motif->GetID());
if (found) {
//_____________________________________________________________________________
Bool_t AliMpMotifMap::AddMotifType(AliMpMotifType* motifType, Bool_t warn)
{
-// Adds the specified motif type
-// if the motif with this ID is not yet present.
-// ---
+/// Add the specified motif type
+/// if the motif with this ID is not yet present.
AliMpMotifType* found = FindMotifType(motifType->GetID());
if (found) {
//_____________________________________________________________________________
Bool_t AliMpMotifMap::AddMotifPosition(AliMpMotifPosition* motifPosition, Bool_t warn)
{
-// Adds the specified motif position
-// if this position is not yet present.
-// ---
+/// Add the specified motif position
+/// if this position is not yet present.
AliMpMotifPosition* found = FindMotifPosition(motifPosition->GetID());
if (found) {
//_____________________________________________________________________________
void AliMpMotifMap::FillMotifPositionMap2()
{
-// Fills the second map (by global indices) of motif positions.
-// ---
+/// Fill the second map (by global indices) of motif positions.
#ifdef WITH_STL
if (fMotifPositions2.size() > 0 ) {
//_____________________________________________________________________________
void AliMpMotifMap::Print(const char* /*option*/) const
{
-// Prints the motifs and motif types maps.
-// ---
+/// Print the motifs and motif types maps.
PrintMotifs();
PrintMotifTypes();
//_____________________________________________________________________________
void AliMpMotifMap::PrintGlobalIndices(const char* fileName) const
{
-// Prints all the motifs positions and their global indices.
-// ---
+/// Print all the motifs 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.
-// ---
+/// Updates the motifs 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.
-// ---
+/// Finds 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
-// only if its motif type and motif dimensions agree
-// with the given motifTypeID and motifDimensions.
-// Disagreement causes fatal error.
-// ---
-
+/// Finds 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.
+
AliMpVMotif* motif = FindMotif(motifID);
if (motif && motif->GetMotifType()->GetID() != motifTypeID) {
//_____________________________________________________________________________
AliMpMotifType* AliMpMotifMap::FindMotifType(const TString& motifTypeID) const
{
-// Finds the motif type with the specified motif type ID.
-// ---
+/// Find the motif type with the specified motif type ID.
#ifdef WITH_STL
MotifTypeMapIterator i = fMotifTypes.find(motifTypeID);
AliMpMotifPosition*
AliMpMotifMap::FindMotifPosition(Int_t motifPositionID) const
{
-// Finds the motif position with the specified motif position ID.
-// ---
+/// Find the motif position with the specified motif position ID.
#ifdef WITH_STL
MotifPositionMapIterator i = fMotifPositions.find(motifPositionID);
AliMpMotifPosition*
AliMpMotifMap::FindMotifPosition(const AliMpIntPair& indices) const
{
-// Finds the last motif position which has the global indices (low limit)
-// less then the indices specified.
-// ---
+/// Find the last motif position which has the global indices (low limit)
+/// less then the indices specified.
#ifdef WITH_STL
MotifPositionMap2Iterator found