]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONPainterRegistry.cxx
Always delete TObjArrays created by TString::Tokenize (Ruben)
[u/mrichter/AliRoot.git] / MUON / AliMUONPainterRegistry.cxx
index 4b0c02c965ae05ab12ed8a201b5957bce5b79034..aee1fd6b781593c0ed99b36bf4d0f97094a3c1b6 100644 (file)
 
 #include "AliMUONPainterRegistry.h"
 
+#include "AliMpManuIterator.h"
+#include "AliMUON2DMap.h"
+#include "AliMUONCalibParamND.h"
 #include "AliMUONPainterMatrix.h"
-#include "AliMUONVTrackerData.h"
-#include "AliMUONVTrackerDataMaker.h"
 #include "AliLog.h"
 #include <TGMenu.h>
 #include <TGWindow.h>
@@ -35,6 +36,8 @@
 ///
 ///\author Laurent Aphecetche, Subatech
 
+using std::cout;
+using std::endl;
 ///\cond CLASSIMP
 ClassImp(AliMUONPainterRegistry)
 ///\endcond
@@ -42,109 +45,21 @@ ClassImp(AliMUONPainterRegistry)
 AliMUONPainterRegistry* AliMUONPainterRegistry::fgInstance(0x0);
 
 //_____________________________________________________________________________
-AliMUONPainterRegistry::AliMUONPainterRegistry() : TObject(),
-fDataSources(new TObjArray),
+AliMUONPainterRegistry::AliMUONPainterRegistry() : TObject(), TQObject(),
 fPainterMatrices(new TObjArray),
-fDataReaders(new TObjArray),
 fHistoryMenu(0x0),
 fMenuBar(0x0),
 fHistoryCounter(0)
 {
   /// ctor
-  fDataSources->SetOwner(kTRUE); 
   fPainterMatrices->SetOwner(kTRUE);
-  fDataReaders->SetOwner(kTRUE);
 }
 
 //_____________________________________________________________________________
 AliMUONPainterRegistry::~AliMUONPainterRegistry()
 {
   /// dtor
-  delete fDataSources;
   delete fPainterMatrices;
-  delete fDataReaders;
-}
-
-//_____________________________________________________________________________
-AliMUONVTrackerDataMaker* 
-AliMUONPainterRegistry::DataReader(Int_t i) const
-{
-  /// Get one data source
-  if ( i >= 0 && i <= fDataReaders->GetLast() )
-  {
-    return static_cast<AliMUONVTrackerDataMaker*>(fDataReaders->At(i));
-  }
-  else
-  {
-    AliError(Form("Index out of bounds : %d / %d",i,fDataReaders->GetLast()+1));
-    return 0x0;
-  }
-}
-
-//_____________________________________________________________________________
-AliMUONVTrackerData* 
-AliMUONPainterRegistry::DataSource(Int_t i) const
-{
-  /// Get one data source
-  if ( i >= 0 && i <= fDataSources->GetLast() )
-  {
-    return static_cast<AliMUONVTrackerData*>(fDataSources->At(i));
-  }
-  else
-  {
-    AliError(Form("Index out of bounds : %d / %d",i,fDataSources->GetLast()+1));
-    return 0x0;
-  }
-}
-
-//_____________________________________________________________________________
-void 
-AliMUONPainterRegistry::DataReaderWasRegistered(AliMUONVTrackerDataMaker* data)
-{
-  /// A new reader source was registered
-  Long_t param[] = { (Long_t)data };
-  
-  Emit("DataReaderWasRegistered(AliMUONVTrackerDataMaker*)",param);
-}
-
-//_____________________________________________________________________________
-void
-AliMUONPainterRegistry::DataReaderWasUnregistered(AliMUONVTrackerDataMaker* data)
-{
-  /// A data reader was unregistered
-  Long_t param[] = { (Long_t)data };
-  
-  Emit("DataReaderWasUnregistered(AliMUONVTrackerDataMaker*)",param);
-  
-}
-
-//_____________________________________________________________________________
-void 
-AliMUONPainterRegistry::DataSourceWasRegistered(AliMUONVTrackerData* data)
-{
-  /// A new data source was registered
-  Long_t param[] = { (Long_t)data };
-  
-  Emit("DataSourceWasRegistered(AliMUONVTrackerData*)",param);
-}
-
-//_____________________________________________________________________________
-void
-AliMUONPainterRegistry::DataSourceWasUnregistered(AliMUONVTrackerData* data)
-{
-  /// A data source was unregistered
-  Long_t param[] = { (Long_t)data };
-  
-  Emit("DataSourceWasUnregistered(AliMUONVTrackerData*)",param);
-  
-}
-
-//_____________________________________________________________________________
-AliMUONVTrackerData*
-AliMUONPainterRegistry::FindDataSource(const char* name) const
-{
-  /// Find a data source by name
-  return static_cast<AliMUONVTrackerData*>(fDataSources->FindObject(name));
 }
 
 //_____________________________________________________________________________
@@ -155,17 +70,9 @@ AliMUONPainterRegistry::FindIndexOf(AliMUONPainterMatrix* group) const
   return fPainterMatrices->IndexOf(group);
 }
 
-//_____________________________________________________________________________
-Int_t 
-AliMUONPainterRegistry::FindIndexOf(AliMUONVTrackerData* data) const
-{
-  /// Get the index of a given data
-  return fDataSources->IndexOf(data);
-}
-
 //_____________________________________________________________________________
 AliMUONPainterMatrix*
-AliMUONPainterRegistry::FindPainterMatrix(const char* name) const
+AliMUONPainterRegistry::PainterMatrix(const char* name) const
 {
   /// Get a painterMatrix by name
   return static_cast<AliMUONPainterMatrix*>(fPainterMatrices->FindObject(name));
@@ -213,7 +120,7 @@ AliMUONPainterRegistry::PainterMatrix(Int_t i) const
 
 //_____________________________________________________________________________
 void 
-AliMUONPainterRegistry::PainterMatrixWantToShow(AliMUONPainterMatrix* group)
+AliMUONPainterRegistry::PainterMatrixWantToShow(const AliMUONPainterMatrix* group)
 {
   /// A given paintermatrix want to appear on screen
   Long_t param[] = { (Long_t)group };
@@ -238,7 +145,7 @@ AliMUONPainterRegistry::AddToHistory(AliMUONPainterMatrix* group)
                           "AliMUONPainterRegistry",this,
                           "HistoryMenuActivated(Int_t)");
     
-    AliDebug(1,Form("HistoryMenu create at %x",fHistoryMenu));
+    AliDebug(1,Form("HistoryMenu create at %p",fHistoryMenu));
   }
   
   if ( fHistoryMenu ) 
@@ -267,7 +174,7 @@ AliMUONPainterRegistry::AddToHistory(AliMUONPainterMatrix* group)
 
 //_____________________________________________________________________________
 void 
-AliMUONPainterRegistry::PainterMatrixWasRegistered(AliMUONPainterMatrix* group)
+AliMUONPainterRegistry::PainterMatrixWasRegistered(const AliMUONPainterMatrix* group)
 {
   /// A new painter matrix was registered
   Long_t param[] = { (Long_t)group };
@@ -277,7 +184,7 @@ AliMUONPainterRegistry::PainterMatrixWasRegistered(AliMUONPainterMatrix* group)
 
 //_____________________________________________________________________________
 void 
-AliMUONPainterRegistry::PainterMatrixWasUnregistered(AliMUONPainterMatrix* group)
+AliMUONPainterRegistry::PainterMatrixWasUnregistered(const AliMUONPainterMatrix* group)
 {
   /// A painter matrix was unregistered
   Long_t param[] = { (Long_t)group };
@@ -293,32 +200,8 @@ AliMUONPainterRegistry::Print(Option_t* opt) const
   TString sopt(opt);
   sopt.ToUpper();
   
-  cout << "Number of data sources = " << NumberOfDataSources() << endl;
-  cout << "Number of data readers = " << NumberOfDataReaders() << endl;
   cout << "Number of painter matrices = " << NumberOfPainterMatrices() << endl;
   
-  if ( sopt.Contains("FULL") || sopt.Contains("READER") )
-  {
-    TIter next(fDataReaders);
-    AliMUONVTrackerDataMaker* reader;
-    
-    while ( ( reader = static_cast<AliMUONVTrackerDataMaker*>(next()) ) )
-    {
-      reader->Print();
-    }
-  }
-  
-  if ( sopt.Contains("FULL") || sopt.Contains("DATA") )
-  {
-    TIter next(fDataSources);
-    AliMUONVTrackerData* data;
-     
-    while ( ( data = static_cast<AliMUONVTrackerData*>(next()) ) )
-    {
-      data->Print();
-    }
-  }
-
   if ( sopt.Contains("FULL") || sopt.Contains("MATRIX") )
   {
     TIter next(fPainterMatrices);
@@ -344,42 +227,6 @@ AliMUONPainterRegistry::Register(AliMUONPainterMatrix* group)
   return fPainterMatrices->IndexOf(group);
 }
 
-//_____________________________________________________________________________
-void
-AliMUONPainterRegistry::Register(AliMUONVTrackerData* data)
-{
-  /// data is adopted, i.e. the registry becomes the owner of it.
-  fDataSources->AddLast(data);
-  DataSourceWasRegistered(data);
-}
-
-//_____________________________________________________________________________
-void
-AliMUONPainterRegistry::Register(AliMUONVTrackerDataMaker* reader)
-{
-  /// reader is adopted, i.e. the registry becomes the owner of it.
-  fDataReaders->AddLast(reader);
-  DataReaderWasRegistered(reader);
-  Register(reader->Data());
-  reader->SetOwner(kFALSE); // important so data it not deleted twice
-}
-
-//_____________________________________________________________________________
-Int_t 
-AliMUONPainterRegistry::NumberOfDataReaders() const
-{
-  /// The number of data readers we handle
-  return fDataReaders->GetLast()+1;
-}
-
-//_____________________________________________________________________________
-Int_t 
-AliMUONPainterRegistry::NumberOfDataSources() const
-{
-  /// The number of data soures we handle
-  return fDataSources->GetLast()+1;
-}
-
 //_____________________________________________________________________________
 Int_t 
 AliMUONPainterRegistry::NumberOfPainterMatrices() const
@@ -388,52 +235,6 @@ AliMUONPainterRegistry::NumberOfPainterMatrices() const
   return fPainterMatrices->GetLast()+1;
 }
 
-//_____________________________________________________________________________
-Bool_t 
-AliMUONPainterRegistry::Unregister(AliMUONVTrackerData* data)
-{
-  /// Unregister some data
-  
-  if (!data) return kFALSE;
-  
-  DataSourceWasUnregistered(data);
-
-  TObject* o = fDataSources->Remove(data);
-  if ( o ) 
-  {
-    delete o;
-  }
-  else
-  {
-    AliError(Form("Could not unregister data named %s title %s",data->GetName(),
-                  data->GetTitle()));
-  }
-  return ( o != 0x0 );
-}
-
-//_____________________________________________________________________________
-Bool_t 
-AliMUONPainterRegistry::Unregister(AliMUONVTrackerDataMaker* reader)
-{
-  /// Unregister some reader
-  
-  if (!reader) return kFALSE;
-  
-  DataReaderWasUnregistered(reader);
-  
-  TObject* o = fDataReaders->Remove(reader);
-  if ( o ) 
-  {
-    delete o;
-  }
-  else
-  {
-    AliError(Form("Could not unregister data named %s title %s",reader->GetName(),
-                  reader->GetTitle()));
-  }
-  return ( o != 0x0 );
-}
-
 //_____________________________________________________________________________
 Bool_t 
 AliMUONPainterRegistry::Unregister(AliMUONPainterMatrix* group)