]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONGeometrySVMap.cxx
New TGeo features allow us to avoid the use of MANY.
[u/mrichter/AliRoot.git] / MUON / AliMUONGeometrySVMap.cxx
index eab7e7fb54ee2b9945ac466adc1ac773278bb41e..545d4ff0a6c04345737c9edaa0e9d2c44067a95e 100644 (file)
@@ -1,3 +1,18 @@
+/**************************************************************************
+ * 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$
 //
 // Class AliMUONGeometrySVMap
 
 ClassImp(AliMUONGeometrySVMap)
 
-//
-// Class AliMUONStringIntMap
-//
-
-//______________________________________________________________________________
-AliMUONStringIntMap::AliMUONStringIntMap()
- : TObject(),
-   fNofItems(0),
-   fFirstArray(100),
-   fSecondArray(100)
-{
-// Standard constructor
-
-  fFirstArray.SetOwner(true);
-}
-
-//______________________________________________________________________________
-AliMUONStringIntMap::AliMUONStringIntMap(const AliMUONStringIntMap& rhs)
-  : TObject(rhs)
-{
-  AliFatal("Copy constructor is not implemented.");
-}
-
-//______________________________________________________________________________
-AliMUONStringIntMap& 
-AliMUONStringIntMap::operator = (const AliMUONStringIntMap& rhs) 
-{
-  // check assignement to self
-  if (this == &rhs) return *this;
-
-  AliFatal("Assignment operator is not implemented.");
-    
-  return *this;  
-}
-
-//______________________________________________________________________________
-AliMUONStringIntMap::~AliMUONStringIntMap()
-{
-// Destructor
-
-  fFirstArray.Delete();
-}
-
-
-//______________________________________________________________________________
-Bool_t  AliMUONStringIntMap::Add(const TString& first, Int_t second)
-{
-// Add map element if first not yet present
-// ---
-
-  Int_t second2 = Get(first);
-  if ( second2 > 0 ) {
-    AliError(Form("%s is already present in the map", first.Data()));
-    return false;
-  }
-  
-  // Resize TArrayI if needed
-  if (fSecondArray.GetSize() == fNofItems) fSecondArray.Set(2*fNofItems);
-  
-  fFirstArray.Add(new TObjString(first)); 
-  fSecondArray.AddAt(second, fNofItems);
-  fNofItems++;
-   
-  return true;
-}  
-
-//______________________________________________________________________________
-Int_t  AliMUONStringIntMap::Get(const TString& first) const
-{
-// Find the element with specified key (first)
-// ---
-  
-  for (Int_t i=0; i<fNofItems; i++) {
-    if ( ((TObjString*)fFirstArray.At(i))->GetString() == first )
-      return fSecondArray.At(i);
-  }
-  
-  return 0;
-}      
-
-//______________________________________________________________________________
-Int_t  AliMUONStringIntMap::GetNofItems() const
-{
-// Returns the number of elements
-// ---
-
-  return fNofItems;
-}  
-
-//______________________________________________________________________________
-void  AliMUONStringIntMap::Clear()
-{
-// Deletes the elements
-// ---
-
-  cout << "######### clearing map " << endl;
-
-  fNofItems = 0;
-  fFirstArray.Delete();
-  fSecondArray.Reset();
-
-  cout << "######### clearing map done " << endl;
-}  
-    
-//______________________________________________________________________________
-void AliMUONStringIntMap::Print(const char* /*option*/) const
-{
-// Prints the map elements
-
-  for (Int_t i=0; i<fNofItems; i++) {
-    cout << setw(4)
-         << i << "  "
-         << ((TObjString*)fFirstArray.At(i))->GetString()
-        << "  "
-        << setw(5)
-        << fSecondArray.At(i)
-        << endl;
-  }
-}       
-
-//______________________________________________________________________________
-void AliMUONStringIntMap::Print(const TString& key, ofstream& out) const
-{
-// Prints the map elements
-
-  for (Int_t i=0; i<fNofItems; i++) {
-    out  << key << "  "
-         << ((TObjString*)fFirstArray.At(i))->GetString()
-        << "  "
-        << setw(5)
-        << fSecondArray.At(i)
-        << endl;
-  }
-}       
-
-
-//
-// Class AliMUONGeometrySVMap
-//
-
 //______________________________________________________________________________
 AliMUONGeometrySVMap::AliMUONGeometrySVMap(Int_t initSize)
  : TObject(),
    fSVMap(),
    fSVPositions(initSize)
 { 
-// Standard constructor
+/// Standard constructor
   
   fSVPositions.SetOwner(true);
 }
@@ -181,19 +56,23 @@ AliMUONGeometrySVMap::AliMUONGeometrySVMap()
    fSVMap(),
    fSVPositions()
 {
-// Default constructor
+/// Default constructor
 }
 
 //______________________________________________________________________________
 AliMUONGeometrySVMap::AliMUONGeometrySVMap(const AliMUONGeometrySVMap& rhs)
   : TObject(rhs)
 {
+/// Protected copy constructor
+
   AliFatal("Copy constructor is not implemented.");
 }
 
 //______________________________________________________________________________
-AliMUONGeometrySVMap::~AliMUONGeometrySVMap() {
-//
+AliMUONGeometrySVMap::~AliMUONGeometrySVMap() 
+{
+/// Destructor
+
   fSVPositions.Delete();
 }
 
@@ -201,6 +80,8 @@ AliMUONGeometrySVMap::~AliMUONGeometrySVMap() {
 AliMUONGeometrySVMap& 
 AliMUONGeometrySVMap::operator = (const AliMUONGeometrySVMap& rhs) 
 {
+/// Protected assignement operator
+
   // check assignement to self
   if (this == &rhs) return *this;
 
@@ -217,8 +98,7 @@ AliMUONGeometrySVMap::operator = (const AliMUONGeometrySVMap& rhs)
 const TGeoCombiTrans* 
 AliMUONGeometrySVMap::FindByName(const TString& name) const
 {
-// Finds TGeoCombiTrans in the array of positions by name 
-// ---
+/// Find TGeoCombiTrans in the array of positions by name 
 
   for (Int_t i=0; i<fSVPositions.GetEntriesFast(); i++) { 
      TGeoCombiTrans* transform = (TGeoCombiTrans*) fSVPositions.At(i);
@@ -238,9 +118,8 @@ AliMUONGeometrySVMap::FindByName(const TString& name) const
 void AliMUONGeometrySVMap::Add(const TString& volumePath, 
                                Int_t detElemId)
 {
-// Add the specified sensitive volume path and the detElemId 
-// to the map
-// ---
+/// Add the specified sensitive volume path and the detElemId 
+/// to the map
  
   fSVMap.Add(volumePath, detElemId);
 }                        
@@ -249,9 +128,8 @@ void AliMUONGeometrySVMap::Add(const TString& volumePath,
 void AliMUONGeometrySVMap::AddPosition(const TString& volumePath, 
                               const TGeoTranslation& globalPosition)
 {
-// Add global position for the sensitive volume specified by volumePath  
-// in the array of transformations if this volumePath is not yet present. 
-// ---
+/// Add global position for the sensitive volume specified by volumePath  
+/// in the array of transformations if this volumePath is not yet present. 
  
   TGeoTranslation* newTransform = new TGeoTranslation(globalPosition);
   Int_t detElemId = fSVMap.Get(volumePath);
@@ -275,7 +153,7 @@ void AliMUONGeometrySVMap::AddPosition(const TString& volumePath,
 }                    
     
 //______________________________________________________________________________
-void AliMUONGeometrySVMap::Clear()
+void AliMUONGeometrySVMap::Clear(Option_t* /*option*/)
 {
 // Clears the sensitive volumes map
 
@@ -285,7 +163,7 @@ void AliMUONGeometrySVMap::Clear()
 //______________________________________________________________________________
 void AliMUONGeometrySVMap::ClearPositions()
 {
-// Clears the array of transformations
+/// Clear the array of transformations
 
   fSVPositions.Delete();
 }  
@@ -293,8 +171,7 @@ void AliMUONGeometrySVMap::ClearPositions()
 //______________________________________________________________________________
 void AliMUONGeometrySVMap::SortPositions()
 {
-// Sort the array of positions by names.
-// ---
+/// Sort the array of positions by names.
 
   fSVPositions.Sort(fSVPositions.GetEntriesFast());
 }
@@ -302,8 +179,7 @@ void AliMUONGeometrySVMap::SortPositions()
 //______________________________________________________________________________
 void  AliMUONGeometrySVMap::Print(const char* option) const
 {    
-// Prints the map of sensitive volumes and detector elements 
-// ---
+/// Print the map of sensitive volumes and detector elements 
 
   fSVMap.Print(option);
 }  
@@ -311,8 +187,7 @@ void  AliMUONGeometrySVMap::Print(const char* option) const
 //______________________________________________________________________________
 void  AliMUONGeometrySVMap::PrintPositions() const
 {
-// Prints the sensitive volumes global positions
-// ---
+/// Print the sensitive volumes global positions
 
   for (Int_t i=0; i<fSVPositions.GetEntriesFast(); i++) {
     
@@ -339,9 +214,8 @@ void  AliMUONGeometrySVMap::PrintPositions() const
 //______________________________________________________________________________
 void  AliMUONGeometrySVMap::WriteMap(ofstream& out) const
 {    
-// Prints the map of sensitive volumes and detector elements 
-// into specified stream
-// ---
+/// Print the map of sensitive volumes and detector elements 
+/// into specified stream
 
   fSVMap.Print("SV", out);
 }  
@@ -349,8 +223,7 @@ void  AliMUONGeometrySVMap::WriteMap(ofstream& out) const
 //______________________________________________________________________________
 Int_t  AliMUONGeometrySVMap::GetDetElemId(const TString& volumePath) const
 {
-// Returns detection element Id for the sensitive volume specified by path
-// ---
+/// Return detection element Id for the sensitive volume specified by path
 
   return fSVMap.Get(volumePath);
 }