Update of mchview related classes to allow easy printing of trackerdata plots.
authorlaphecet <laphecet@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 17 Nov 2009 14:23:31 +0000 (14:23 +0000)
committerlaphecet <laphecet@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 17 Nov 2009 14:23:31 +0000 (14:23 +0000)
The heart of the modifications is the addition of the AliMUONPainterMatrix::Draw and
AliMUONPainterMatrix::CreateCanvas methods.

Those methods will be usefull for the MUON tracker shifter (via amoreMCH).

------ Details below :

AliMUONAttPainter

Changed how the name is constructed.

AliMUONMchViewApplication
AliMUONPainterMasterFrame

Adding Print button(s).
Internal reorganization to ease the creation of new tabs with painter master frames.

AliMUONPainterColorSlider

Small correction.

AliMUONPainterDataSourceFrame

Added CreatePedestalCanvases and CreateFullTracker.

AliMUONPainterHelper

Removing no longer used parts.

AliMUONPainterMatrix

Changed the naming convention, and added Draw and CreateCanvas methods.

AliMUONPainterMatrixFrame

Updated SaveAs method

mchview.cxx

Going to version 1.03

15 files changed:
MUON/AliMUONAttPainter.cxx
MUON/AliMUONMchViewApplication.cxx
MUON/AliMUONMchViewApplication.h
MUON/AliMUONPainterColorSlider.cxx
MUON/AliMUONPainterDataSourceFrame.cxx
MUON/AliMUONPainterDataSourceFrame.h
MUON/AliMUONPainterHelper.cxx
MUON/AliMUONPainterHelper.h
MUON/AliMUONPainterMasterFrame.cxx
MUON/AliMUONPainterMasterFrame.h
MUON/AliMUONPainterMatrix.cxx
MUON/AliMUONPainterMatrix.h
MUON/AliMUONPainterMatrixFrame.cxx
MUON/AliMUONPainterMatrixFrame.h
MUON/mchview.cxx

index e9b51e6..14290cd 100644 (file)
@@ -74,11 +74,12 @@ AliMUONAttPainter::Name() const
     if ( name.Length() > 0 ) name += "-";
     name += PlaneName();
   }
-  if ( ViewPointName().Length() > 0 ) 
-  {
-    if ( name.Length() > 0 ) name += "-";
-    name += ViewPointName();
-  }
+
+//  if ( ViewPointName().Length() > 0 ) 
+//  {
+//    if ( name.Length() > 0 ) name += "-";
+//    name += ViewPointName();
+//  }
   
   return name;
 }
@@ -125,8 +126,8 @@ AliMUONAttPainter::PlaneName() const
   /// Return plane name in short form
   if ( IsBendingPlane() && IsNonBendingPlane() ) return "Both";
   else if ( !IsBendingPlane() && !IsNonBendingPlane() ) return "";
-  else if ( IsBendingPlane() ) return "B";
-  else if ( IsNonBendingPlane() ) return "NB";
+  else if ( IsBendingPlane() ) return "Bending";
+  else if ( IsNonBendingPlane() ) return "NonBending";
   return "";
 }
 
index 9476c89..5559878 100644 (file)
@@ -26,7 +26,9 @@
 #include "AliMUONPainterDataSourceFrame.h"
 #include "AliMUONPainterEnv.h"
 #include "AliMUONPainterHelper.h"
+#include "AliMUONPainterGroup.h"
 #include "AliMUONPainterMasterFrame.h"
+#include "AliMUONPainterMatrix.h"
 #include "AliMUONPainterRegistry.h"
 #include "AliMUONTrackerDataCompareDialog.h"
 #include "AliMUONTrackerDataWrapper.h"
@@ -77,7 +79,8 @@ AliMUONMchViewApplication::AliMUONMchViewApplication(const char* name,
                                                      UInt_t ox, UInt_t oy) 
 : TRint(name,argc,argv),
   fMainFrame(0x0),
-  fPainterMasterFrame(0x0)
+  fPainterMasterFrameList(new TList),
+  fTabs(0x0)
 {
 
   /// ctor
@@ -92,38 +95,41 @@ AliMUONMchViewApplication::AliMUONMchViewApplication(const char* name,
 
   fMainFrame = new TGMainFrame(gClient->GetRoot(),w,h);
 
-  AliMUONPainterHelper::Instance()->GenerateDefaultMatrices();
-
   CreateMenuBar(w);
 
   const Int_t kbs = 2;
   
 //  h -= 60; // menubar
   
-  TGTab* tabs = new TGTab(fMainFrame,w,h);
+  fTabs = new TGTab(fMainFrame,w,h);
+  
+  TGCompositeFrame* t = fTabs->AddTab("Painter Master Frame");
+
+  fPainterMasterFrameList->SetOwner(kTRUE);
+  
   
-  TGCompositeFrame* t = tabs->AddTab("Painter Master Frame");
+  AliMUONPainterMasterFrame* pmf = new AliMUONPainterMasterFrame(t,t->GetWidth()-kbs*2,t->GetHeight()-kbs*2,
+                                                                 GenerateStartupMatrix());
 
-  fPainterMasterFrame =
-    new AliMUONPainterMasterFrame(t,t->GetWidth()-kbs*2,t->GetHeight()-kbs*2);
+  fPainterMasterFrameList->Add(pmf);
   
-  t->AddFrame(fPainterMasterFrame, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,kbs,kbs,kbs,kbs));
+  t->AddFrame(pmf, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,kbs,kbs,kbs,kbs));
 
-  t = tabs->AddTab("Data Sources");
+  t = fTabs->AddTab("Data Sources");
   
   AliMUONPainterDataSourceFrame* dsf = 
     new AliMUONPainterDataSourceFrame(t,t->GetWidth()-kbs*2,t->GetHeight()-kbs*2);
   
   t->AddFrame(dsf,new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,kbs,kbs,kbs,kbs));
   
-  fMainFrame->AddFrame(tabs,new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,0,0,0,0));
+  fMainFrame->AddFrame(fTabs,new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,0,0,0,0));
 
   fMainFrame->SetWindowName("mchview - Visualization of MUON Tracker detector");
 
   fMainFrame->MapSubwindows();
   fMainFrame->Resize();
   
-  fPainterMasterFrame->Update();
+  pmf->Update();
   
   fMainFrame->MapWindow();
   
@@ -190,9 +196,9 @@ AliMUONMchViewApplication::AliMUONMchViewApplication(const char* name,
   
   if ( painter ) 
   {
-    fPainterMasterFrame->ShiftClicked(painter,0x0);
+    pmf->ShiftClicked(painter,0x0);
     
-    fPainterMasterFrame->Update();
+    pmf->Update();
   }
       
 }
@@ -201,6 +207,44 @@ AliMUONMchViewApplication::AliMUONMchViewApplication(const char* name,
 AliMUONMchViewApplication::~AliMUONMchViewApplication()
 {
   /// dtor
+  delete fPainterMasterFrameList;
+}
+
+//_____________________________________________________________________________
+AliMUONPainterMatrix*
+AliMUONMchViewApplication::GenerateStartupMatrix()
+{
+  /// Kind of bootstrap method to trigger the generation of all contours
+  
+  AliCodeTimerAuto("",0);
+  
+  AliMUONAttPainter att;
+  
+  att.SetViewPoint(kTRUE,kFALSE);
+  att.SetCathode(kFALSE,kFALSE);
+  att.SetPlane(kTRUE,kFALSE);
+
+  AliMUONPainterMatrix* matrix = new AliMUONPainterMatrix("Tracker",5,2);
+    
+  for ( Int_t i = 0; i < 10; ++i )
+  {
+    AliMUONVPainter* painter = new AliMUONChamberPainter(att,i);
+    
+    painter->SetResponder("Chamber");
+    
+    painter->SetOutlined("*",kFALSE);
+    
+    painter->SetOutlined("MANU",kTRUE);
+    
+    for ( Int_t j = 0; j < 3; ++j ) 
+    {
+      painter->SetLine(j,1,4-j);
+    }
+    
+    matrix->Adopt(painter);    
+  }
+  AliMUONPainterRegistry::Instance()->Register(matrix);
+  return matrix;
 }
 
 //______________________________________________________________________________
@@ -222,8 +266,7 @@ AliMUONMchViewApplication::CompareData()
   t->SetWindowName("mchview compare data tool");
   t->SetIconName("mchview compare data tool");
   
-  t->MapRaised();
-  
+  t->MapRaised();  
 }
 
 //______________________________________________________________________________
@@ -398,7 +441,16 @@ AliMUONMchViewApplication::PrintAs()
   new TGFileDialog(gClient->GetRoot(),gClient->GetRoot(),
                    kFDSave,&fileInfo);
   
-  fPainterMasterFrame->SaveAs(gSystem->ExpandPathName(Form("%s",fileInfo.fFilename)));
+  TIter next(fPainterMasterFrameList);
+  AliMUONPainterMasterFrame* pmf;
+  Bool_t first(kTRUE);
+  
+  while ( ( pmf = static_cast<AliMUONPainterMasterFrame*>(next()) ) )
+  {
+    pmf->SaveAs(gSystem->ExpandPathName(Form("%s",fileInfo.fFilename)),
+                first ? "RECREATE" : "UPDATE");
+    first = kFALSE;
+  }
 }
 
 //______________________________________________________________________________
@@ -414,6 +466,15 @@ AliMUONMchViewApplication::ReleaseNotes()
   
   TGTextView* rn = new TGTextView(t);
 
+  rn->AddLine("1.03");
+  rn->AddLine("");
+  rn->AddLine("Add Print buttons");
+  rn->AddLine("Add the automatic creation of often used canvases when using pedestal source");
+  // Internal reorganization to allow several independent tabs to be created to 
+  // show different master frames (not used yet). Important for the moment
+  // is the ability to create a PainterMatrix and pass it to the PainterMasterFrame
+  rn->AddLine("");
+  
   rn->AddLine("1.02");
   rn->AddLine("");
   rn->AddLine("Internal change (merging of AliMUONTrackerACFDataMaker and AliMUONTrackerOCDBDataMaker into AliMUONTrackerConditionDataMaker)");
index 2260ff9..7c40675 100644 (file)
 #   include <TRint.h>
 #endif
 
-class AliMUONPainterMasterFrame;
+class TList;
 class TDirectory;
 class TGMainFrame;
+class AliMUONPainterMatrix;
+class TGTab;
 
 class AliMUONMchViewApplication : public TRint
 {
@@ -30,7 +32,7 @@ public:
   void HandleMenu(Int_t i);
 
   /// Return the version number of the mchview application
-  static const char* Version() { return "1.02"; }
+  static const char* Version() { return "1.03"; }
   
   /// Return the SVN revision  and version number of the mchview application
   static const char* FullVersion() { return Form("mchview Version %s ($Id$)",Version()); }
@@ -51,10 +53,12 @@ private:
   void PrintAs();
   void ReleaseNotes();
   void ReadDir(TDirectory& dir);
-       
+       AliMUONPainterMatrix* GenerateStartupMatrix();
+
 private:
   TGMainFrame* fMainFrame; ///< pointer to our mainframe
-  AliMUONPainterMasterFrame* fPainterMasterFrame; ///< pointer to our main object
+  TList* fPainterMasterFrameList; ///< list of painterMasterFrame objects
+  TGTab* fTabs; ///< our tabs
   
   static const Int_t fgkFILESAVEAS; ///< File/Save As... menu
   static const Int_t fgkFILEOPEN; ///< File/Open... menu
@@ -65,7 +69,7 @@ private:
   
   static const char* fgkFileTypes[]; ///< For the open menu
   
-  ClassDef(AliMUONMchViewApplication,4) // mchview application
+  ClassDef(AliMUONMchViewApplication,5) // mchview application
 };
 
 #endif
index 58952b8..9c52d1c 100644 (file)
@@ -54,7 +54,7 @@ AliMUONPainterColorSlider::AliMUONPainterColorSlider(const TGWindow* p,
   
   Double_t step = (max-min)/ndivisions;
   
-  for ( Int_t i = -1; i <= ndivisions+1; ++i ) 
+  for ( Int_t i = -1; i < ndivisions+1; ++i ) 
   {
     Double_t value = max - (min + step*i);
     
@@ -76,9 +76,6 @@ AliMUONPainterColorSlider::AliMUONPainterColorSlider(const TGWindow* p,
   
   AddFrame(fEntryMin,new TGLayoutHints(kLHintsExpandX,0,0,topBorder,0));
   
-//  fEntryMin->SetFormat(TGNumberFormat::kNESRealOne);
-//  fEntryMax->SetFormat(TGNumberFormat::kNESRealOne);
-  
   AddFrame(fAutoButton,new TGLayoutHints(kLHintsExpandX,0,0,topBorder,0));
   
   fAutoButton->Connect("Clicked()","AliMUONPainterColorSlider",this,"DataRangeAutoRequested()");
index 4047a82..599646e 100644 (file)
 #include "AliMUONPainterDataSourceFrame.h"
 
 #include "AliLog.h"
+#include "AliMUONChamberPainter.h"
+#include "AliMUONMchViewApplication.h"
+#include "AliMUONPainterDataRegistry.h"
 #include "AliMUONPainterDataSourceItem.h"
 #include "AliMUONPainterEnv.h"
 #include "AliMUONPainterHelper.h"
-#include "AliMUONPainterDataRegistry.h"
+#include "AliMUONPainterMatrix.h"
+#include "AliMUONPainterRegistry.h"
 #include "AliMUONRecoParam.h"
 #include "AliMUONTrackerConditionDataMaker.h"
 #include "AliMUONTrackerDataMaker.h"
 #include "AliRawReader.h"
+#include <TCanvas.h>
 #include <TGButton.h>
 #include <TGComboBox.h>
 #include <TGFileDialog.h>
@@ -35,6 +40,7 @@
 #include <TGrid.h>
 #include <TObjArray.h>
 #include <TObjString.h>
+#include <TMath.h>
 #include <TRegexp.h>
 #include <TString.h>
 #include <TSystem.h>
@@ -379,15 +385,19 @@ AliMUONPainterDataSourceFrame::CreateOCDBDataSource(const TString& uri)
 
 //_____________________________________________________________________________
 void
-AliMUONPainterDataSourceFrame::CreateACFDataSource(const TString& acfPath, const TString& type)
+AliMUONPainterDataSourceFrame::RegisterDataSource(AliMUONVTrackerDataMaker* reader,
+                                                  const char* dsName)
 {
-  /// Create an ACF data source for a given (path,type) 
-
-  AliMUONVTrackerDataMaker* reader = new AliMUONTrackerConditionDataMaker(acfPath.Data(),
-                                                                          type.Data());
-  
-  if ( reader->IsValid() ) 
+  /// Register a new data source
+  if ( reader && reader->IsValid() ) 
   {
+    AliMUONMchViewApplication* app = dynamic_cast<AliMUONMchViewApplication*>(gApplication);
+    if (!app)
+    {
+      AliError("Could not cast application to the expected type ! CHECK THAT !");
+    }
+    
     AliMUONPainterDataRegistry::Instance()->Register(reader);
     
     AliMUONPainterEnv* env = AliMUONPainterHelper::Instance()->Env();
@@ -396,15 +406,115 @@ AliMUONPainterDataSourceFrame::CreateACFDataSource(const TString& acfPath, const
     
     env->Set(fgkNumberOfDataSourcesKey,n+1);
     
-    TString ds(Form("ACF;%s;%s",acfPath.Data(),type.Data()));
-    
-    env->Set(Form(fgkDataSourceURIKey,n),ds.Data());
+    env->Set(Form(fgkDataSourceURIKey,n),dsName);
     
     env->Save();
     
-    AddRecentSource(ds.Data());
+    AddRecentSource(dsName);
+    
+    if ( app ) 
+    {
+      
+      TString name(dsName);
+      name.ToUpper();
+      
+      if ( name.Contains("PED") )
+      {
+        CreatePedestalCanvases(reader->Data());
+      }
+    }
+  }  
+}
+
+//_____________________________________________________________________________
+void
+AliMUONPainterDataSourceFrame::CreatePedestalCanvases(AliMUONVTrackerData* data,
+                                                      Double_t pedMin, Double_t pedMax,
+                                                      Double_t sigmaMin, Double_t sigmaMax)
+{
+  /// Create 4 canvases with the pedestals contained in data
+  /// to show mean and sigma, for bending and non bending, with given limits
+                                                 
+  TList matrices;
+  
+  AliMUONAttPainter att[2];
+  
+  att[0].SetViewPoint(kTRUE,kFALSE);
+  att[0].SetCathode(kFALSE,kFALSE);
+  att[0].SetPlane(kTRUE,kFALSE);
+  
+  att[1].SetViewPoint(kTRUE,kFALSE);
+  att[1].SetCathode(kFALSE,kFALSE);
+  att[1].SetPlane(kFALSE,kTRUE);
+  
+  for ( Int_t iatt = 0; iatt < 2; ++iatt ) 
+  {
+    matrices.Add(CreateFullTracker(data,0,pedMin,pedMax,att[iatt]));
+    matrices.Add(CreateFullTracker(data,1,sigmaMin,sigmaMax,att[iatt]));
   }
   
+  TIter next(&matrices);
+  AliMUONPainterMatrix* matrix;
+  
+  Int_t w = TMath::Nint(gClient->GetDisplayWidth()*0.9);
+  Int_t h = TMath::Nint(gClient->GetDisplayHeight()*0.9);
+  
+  Int_t x[] = { 0, 0, 20 + w/2, 20 + w/2 };
+  Int_t y[] = { 0, h/2+30, 0, h/2+30 };
+  
+  Int_t i(0);
+  
+  while ( ( matrix = static_cast<AliMUONPainterMatrix*>(next())) )
+  {
+    TCanvas* c = matrix->CreateCanvas(x[i],y[i],w/2,h/2);
+    c->Draw();
+    c->SaveAs(Form("%s.png",c->GetName()));
+    ++i;
+  }
+}
+
+//_____________________________________________________________________________
+AliMUONPainterMatrix*
+AliMUONPainterDataSourceFrame::CreateFullTracker(AliMUONVTrackerData* data, 
+                                                 Int_t dim, 
+                                                 Double_t xmin, Double_t xmax,
+                                                 const AliMUONAttPainter& att)
+{
+  /// Generate, draw and register a matrix of 10 painters to show all the tracker
+  /// chambers
+    
+  AliMUONPainterMatrix* matrix = new AliMUONPainterMatrix("Tracker",5,2);
+  
+  for ( Int_t ichamber = 0; ichamber < 10; ++ichamber )
+  {
+    AliMUONVPainter* painter = new AliMUONChamberPainter(att,ichamber);
+    
+    painter->SetResponder("BUSPATCH");
+    
+    painter->SetOutlined("*",kFALSE);
+    
+    matrix->Adopt(painter);    
+  }
+  
+  matrix->SetData("MANU",data,dim);    
+  matrix->SetDataRange(xmin,xmax);    
+  
+  AliMUONPainterRegistry::Instance()->Register(matrix);
+    
+  return matrix;
+}
+
+
+//_____________________________________________________________________________
+void
+AliMUONPainterDataSourceFrame::CreateACFDataSource(const TString& acfPath, const TString& type)
+{
+  /// Create an ACF data source for a given (path,type) 
+
+  AliMUONVTrackerDataMaker* reader = new AliMUONTrackerConditionDataMaker(acfPath.Data(),
+                                                                          type.Data());
+  
+  RegisterDataSource(reader,Form("ACF;%s;%s",acfPath.Data(),type.Data()));
 }
 
 //_____________________________________________________________________________
@@ -419,24 +529,7 @@ AliMUONPainterDataSourceFrame::CreateOCDBDataSource(const TString& cdbPath,
                                                                           cdbPath.Data(),
                                                                           type.Data());
   
-  if ( reader->IsValid() ) 
-  {
-    AliMUONPainterDataRegistry::Instance()->Register(reader);
-    
-    AliMUONPainterEnv* env = AliMUONPainterHelper::Instance()->Env();
-    
-    Int_t n = env->Integer(fgkNumberOfDataSourcesKey);
-    
-    env->Set(fgkNumberOfDataSourcesKey,n+1);
-    
-    TString ds(Form("OCDB;%s;%d;%s",cdbPath.Data(),runNumber,type.Data()));
-    
-    env->Set(Form(fgkDataSourceURIKey,n),ds.Data());
-    
-    env->Save();
-    
-    AddRecentSource(ds.Data());
-  }
+  RegisterDataSource(reader,Form("OCDB;%s;%d;%s",cdbPath.Data(),runNumber,type.Data()));
 }
 
 //_____________________________________________________________________________
@@ -598,23 +691,11 @@ AliMUONPainterDataSourceFrame::CreateRawDataSource(const TString& uri)
   {
     reader = new AliMUONTrackerDataMaker(rawReader,histogram);
   }
-  
+
   reader->SetSource(filename.Data());
-  
-  AliMUONPainterDataRegistry::Instance()->Register(reader);
-  
-  AliMUONPainterEnv* env = AliMUONPainterHelper::Instance()->Env();
-  
-  Int_t n = env->Integer(fgkNumberOfDataSourcesKey);
-  
-  env->Set(fgkNumberOfDataSourcesKey,n+1);
-  
-  env->Set(Form(fgkDataSourceURIKey,n),uri.Data());
-  
-  AddRecentSource(uri.Data());
-  
-  env->Save();
 
+  RegisterDataSource(reader,uri.Data());
+                       
   return kTRUE;
 }
 
index c6733ec..29315a1 100644 (file)
 #  include <TGFrame.h>
 #endif
 
+class AliMUONAttPainter;
 class AliMUONPainterDataSourceItem;
+class AliMUONPainterMatrix;
 class AliMUONVTrackerDataMaker;
+class AliMUONVTrackerData;
 class TGCheckButton;
 class TGComboBox;
 class TGGroupFrame;
@@ -55,6 +58,15 @@ public:
 
   void StopRunning();
 
+  static void CreatePedestalCanvases(AliMUONVTrackerData* data,
+                                     Double_t pedMin=0, Double_t pedMax=500,
+                                     Double_t sigmaMin=0, Double_t sigmaMax=5);
+  
+  static AliMUONPainterMatrix* CreateFullTracker(AliMUONVTrackerData* data, 
+                                                 Int_t dim, 
+                                                 Double_t xmin, Double_t xmax, 
+                                                 const AliMUONAttPainter& att);
+
 private:
   /// Not implemented
   AliMUONPainterDataSourceFrame(const AliMUONPainterDataSourceFrame& rhs);
@@ -73,6 +85,8 @@ private:
 
   void CreateACFDataSource(const TString& acfPath, const TString& type);
   
+  void RegisterDataSource(AliMUONVTrackerDataMaker* reader, const char* dsName);
+  
 private:
     
   TGGroupFrame* fRecentSourceSelector; ///< to select recently used sources   
index 8cc51a8..eca927e 100644 (file)
@@ -27,7 +27,6 @@
 #include "AliMUONGeometryTransformer.h"
 #include "AliMUONManuContourMaker.h"
 #include "AliMUONPainterEnv.h"
-#include "AliMUONPainterMatrix.h"
 #include "AliMUONPainterRegistry.h"
 #include "AliMUONPadStatusMaker.h"
 #include "AliMUONVCalibParam.h"
@@ -60,6 +59,7 @@
 #include <TLine.h>
 #include <TList.h>
 #include <TMap.h>
+#include <TMath.h>
 #include <TObjArray.h>
 #include <TObjString.h>
 #include <TStyle.h>
@@ -86,7 +86,6 @@ AliMUONPainterHelper* AliMUONPainterHelper::fgInstance(0x0);
 //_____________________________________________________________________________
 AliMUONPainterHelper::AliMUONPainterHelper() : 
 TObject(),
-fPainterMatrices(0x0),
 fEnv(0x0),
 fReal(0x0),
 fExploded(0x0)
@@ -109,7 +108,6 @@ fExploded(0x0)
 AliMUONPainterHelper::~AliMUONPainterHelper()
 {
   /// dtor
-  delete fPainterMatrices;
   delete fReal;
   delete fExploded;
   fEnv->Save();
@@ -153,54 +151,6 @@ AliMUONPainterHelper::GetContour(const char* contourName, Bool_t explodedView) c
   return 0x0;
 }
 
-//_____________________________________________________________________________
-void
-AliMUONPainterHelper::GenerateDefaultMatrices()
-{
-  /// Kind of bootstrap method to trigger the generation of all contours
-  
-  AliCodeTimerAuto("",0);
-  
-  fPainterMatrices = new TObjArray;
-  fPainterMatrices->SetOwner(kFALSE);
-  
-  TObjArray attributes;
-  
-  AliMUONAttPainter att;
-  
-  att.SetViewPoint(kTRUE,kFALSE);
-  att.SetCathode(kFALSE,kFALSE);
-  att.SetPlane(kTRUE,kFALSE);
-  attributes.Add(new AliMUONAttPainter(att));
-
-  TIter next(&attributes);
-  AliMUONAttPainter* a;
-  
-  while ( ( a = static_cast<AliMUONAttPainter*>(next()) ) )
-  {
-    AliMUONPainterMatrix* matrix = new AliMUONPainterMatrix("Tracker",5,2);
-    
-    for ( Int_t i = 0; i < 10; ++i )
-    {
-      AliMUONVPainter* painter = new AliMUONChamberPainter(*a,i);
-      
-      painter->SetResponder("Chamber");
-      
-      painter->SetOutlined("*",kFALSE);
-      
-      painter->SetOutlined("MANU",kTRUE);
-      
-      for ( Int_t j = 0; j < 3; ++j ) 
-      {
-        painter->SetLine(j,1,4-j);
-      }
-      
-      matrix->Adopt(painter);    
-    }
-    AliMUONPainterRegistry::Instance()->Register(matrix);
-    fPainterMatrices->Add(matrix);
-  }
-}
 
 //_____________________________________________________________________________
 AliMp::CathodType
@@ -373,7 +323,7 @@ AliMUONPainterHelper::ColorFromValue(Double_t value, Double_t min, Double_t max)
   else if (value <= min) rv = 0;
   else
   {
-    if  ( max == min ) return gStyle->GetColorPalette(1);
+    if  ( TMath::AreEqualRel(max,min,1E-6) ) return gStyle->GetColorPalette(1);
     Double_t range = max - min;
     Double_t offset = value - min;
     rv = gStyle->GetColorPalette( 1 + int( offset*(gStyle->GetNumberOfColors()-2)/range - 0.5 ) );
@@ -411,12 +361,7 @@ AliMUONPainterHelper::Print(Option_t* opt) const
   {
     if ( fExploded ) fExploded->Print();
     if ( fReal ) fReal->Print();
-  }
-  
-  if ( fPainterMatrices && ( sopt.Contains("MATRI") || sopt.Contains("FULL") ) )
-  {
-    fPainterMatrices->Print(opt);
-  }
+  }  
 }
 
 //_____________________________________________________________________________
index ad7b750..5a3ab94 100644 (file)
@@ -123,8 +123,6 @@ public:
   
   TObjArray* GetAllContoursAsArray(Bool_t explodedView=kTRUE) const;
 
-  void GenerateDefaultMatrices();
-
 private:
     
   /// Not implemented
@@ -138,12 +136,11 @@ private:
 private:
   static AliMUONPainterHelper* fgInstance; ///< global instance
   
-  TObjArray* fPainterMatrices; ///< default matrices
   AliMUONPainterEnv* fEnv; ///< resources
   mutable AliMUONContourHandler* fReal; ///< contours in real coordinates
   mutable AliMUONContourHandler* fExploded; ///< contours in exploded coordinates
   
-  ClassDef(AliMUONPainterHelper,3) // Helper class for painters
+  ClassDef(AliMUONPainterHelper,4) // Helper class for painters
 };
 
 #endif
index bbcbbd3..681ced3 100644 (file)
 #include <TCanvas.h>
 #include <TEnv.h>
 #include <TGComboBox.h>
+#include <TGFileDialog.h>
 #include <TGLabel.h>
 #include <TObjArray.h>
 #include <TObjString.h>
 #include <TGButtonGroup.h>
 #include <TGMsgBox.h>
+#include <TSystem.h>
 
 /// \class AliMUONPainterMasterFrame
 ///
@@ -71,16 +73,18 @@ const Int_t AliMUONPainterMasterFrame::fgkBorderSize = 10;
 
 //_____________________________________________________________________________
 AliMUONPainterMasterFrame::AliMUONPainterMasterFrame(const TGWindow* p, 
-                                                     UInt_t w, UInt_t h)
+                                                     UInt_t w, UInt_t h, AliMUONPainterMatrix* matrix)
 : TGCompositeFrame(p,w,h,kVerticalFrame),
-  fNavigationFrame(0x0),
-  fPainterMatrixFrame(0x0),
-  fBackButton(0x0),
-  fForwardButton(0x0),
-  fGroupTitle(0x0),
-  fNavigation(),
-  fCurrentNavigationPosition(-1),
-  fAttPainterSelectorFrame(0x0)
+fNavigationFrame(0x0),
+fPainterMatrixFrame(0x0),
+fBackButton(0x0),
+fForwardButton(0x0),
+fGroupTitle(0x0),
+fPrintMeButton(0x0),
+fPrintAsButton(0x0),
+fNavigation(),
+fCurrentNavigationPosition(-1),
+fAttPainterSelectorFrame(0x0)
 {  
   /// ctor
     
@@ -92,12 +96,15 @@ AliMUONPainterMasterFrame::AliMUONPainterMasterFrame(const TGWindow* p,
   AddFrame(fNavigationFrame,new TGLayoutHints(kLHintsExpandX|kLHintsTop,
                                               fgkBorderSize,fgkBorderSize,
                                               fgkBorderSize,fgkBorderSize));
-    
+  
   fBackButton = new TGPictureButton(fNavigationFrame,
-                                       gClient->GetPicture("tb_back.xpm"));
+                                    gClient->GetPicture("tb_back.xpm"));
   
   fForwardButton = new TGPictureButton(fNavigationFrame,
-                                       gClient->GetPicture("tb_forw.xpm"));
+                                       gClient->GetPicture("tb_forw.xpm"));    
+
+  fPrintMeButton = new TGTextButton(fNavigationFrame,"Print");
+  fPrintAsButton = new TGTextButton(fNavigationFrame,"Print As...");
 
   fAttPainterSelectorFrame = new AliMUONAttPainterSelectorFrame(fNavigationFrame,w/2,20);
   
@@ -107,7 +114,10 @@ AliMUONPainterMasterFrame::AliMUONPainterMasterFrame(const TGWindow* p,
   fNavigationFrame->AddFrame(fForwardButton,new TGLayoutHints(kLHintsCenterY));
   
   fNavigationFrame->AddFrame(fAttPainterSelectorFrame,new TGLayoutHints(kLHintsCenterY,10));
-  
+
+  fNavigationFrame->AddFrame(fPrintMeButton,new TGLayoutHints(kLHintsCenterY,10));
+  fNavigationFrame->AddFrame(fPrintAsButton,new TGLayoutHints(kLHintsCenterY,10));
+
   fAttPainterSelectorFrame->Connect("Clicked(AliMUONAttPainter*)",
                                     "AliMUONPainterMasterFrame",
                                     this,
@@ -123,13 +133,19 @@ AliMUONPainterMasterFrame::AliMUONPainterMasterFrame(const TGWindow* p,
                           this,
                           "Backward()");
     
+  fPrintMeButton->Connect("Clicked()","AliMUONPainterMasterFrame",
+                        this,
+                        "PrintMe()");
+
+  fPrintAsButton->Connect("Clicked()","AliMUONPainterMasterFrame",
+                        this,
+                        "PrintAs()");
   
-                                                                   
   UInt_t w1 = wi;
   //  UInt_t h1 = hi - fNavigationFrame->GetHeight() - 3*fgkBorderSize;
   UInt_t h1 = hi - 7*12;
   
-  MakeTopPainterMatrix(w1,h1);
+  MakeTopPainterMatrix(w1,h1,matrix);
 
   AddFrame(fPainterMatrixFrame,new TGLayoutHints(kLHintsExpandX,
                                                 fgkBorderSize,fgkBorderSize,
@@ -145,7 +161,7 @@ AliMUONPainterMasterFrame::AliMUONPainterMasterFrame(const TGWindow* p,
                                               this,
                                               "PainterMatrixWantToShow(AliMUONPainterMatrix*)");
   
-  fPainterMatrixFrame->DataSourceWasChanged("*",0x0,-1);
+  fPainterMatrixFrame->DataSourceWasChanged(matrix->DataPattern().Data(),matrix->Data(),matrix->DataIndex());
 }
 
 //_____________________________________________________________________________
@@ -197,7 +213,33 @@ AliMUONPainterMasterFrame::PainterMatrixWantToShow(AliMUONPainterMatrix* group)
   
   ShowPainterMatrix(group);  
 }
-                                                
+     
+//_____________________________________________________________________________
+void
+AliMUONPainterMasterFrame::PrintAs() const
+{
+  /// Handle the PrintAs button
+  
+  TGFileInfo fileInfo;
+  
+  new TGFileDialog(gClient->GetRoot(),gClient->GetRoot(),
+                   kFDSave,&fileInfo);
+  
+  if ( fileInfo.fFilename ) 
+  {
+    SaveAs(gSystem->ExpandPathName(Form("%s",fileInfo.fFilename)),"RECREATE");
+  }
+}
+
+//_____________________________________________________________________________
+void
+AliMUONPainterMasterFrame::PrintMe() const
+{
+  /// Handle the PrintMe button
+  
+  SaveAs(gSystem->ExpandPathName(Form("%s.png",fPainterMatrixFrame->Matrix()->GetName())),"RECREATE");
+}
+
 //_____________________________________________________________________________
 void
 AliMUONPainterMasterFrame::SetNavigation(Int_t i)
@@ -320,7 +362,7 @@ AliMUONPainterMasterFrame::ShiftClicked(AliMUONVPainter* painter, Double_t*)
   
   TString basename(Form("%s-DUAL",painter->GetName()));
   
-  TString newName = AliMUONPainterMatrix::NameIt(basename.Data(),a);
+  TString newName = AliMUONPainterMatrix::NameIt(currentMatrix->Whatname(),basename.Data(),a);
   
   AliMUONPainterMatrix* matrix = AliMUONPainterRegistry::Instance()->PainterMatrix(newName.Data());
   
@@ -410,6 +452,7 @@ AliMUONPainterMasterFrame::Update()
   /// Update ourselves
   
   fPainterMatrixFrame->Update();
+  fPainterMatrixFrame->UpdateInterface(kFALSE);
 }
 
 //_____________________________________________________________________________
@@ -423,32 +466,20 @@ AliMUONPainterMasterFrame::UpdateAttributes(const AliMUONPainterMatrix& painterM
 
 //_____________________________________________________________________________
 void
-AliMUONPainterMasterFrame::MakeTopPainterMatrix(UInt_t w, UInt_t h)
+AliMUONPainterMasterFrame::MakeTopPainterMatrix(UInt_t w, UInt_t h, AliMUONPainterMatrix* matrix)
 {
   /// Create the first painter matrix that appears when we are create
   /// FIXME: how to make this more flexible ?
   
   fPainterMatrixFrame = new AliMUONPainterMatrixFrame(this,w,h);
 
-  AliMUONAttPainter att;
-  
-  att.SetPlane(kTRUE,kFALSE);
-//  att.SetCathode(kTRUE,kFALSE);
-  att.SetViewPoint(kTRUE,kFALSE);
-    
-  TString name = AliMUONPainterMatrix::NameIt("Tracker",att);
-  
-  AliMUONPainterMatrix* painterMatrix = AliMUONPainterRegistry::Instance()->PainterMatrix(name);
-  
-  if (!painterMatrix)
+  if (matrix)
   {
-    AliError(Form("Could not get pre-defined painter matrix %s : check that !",name.Data()));
+    PainterMatrixWantToShow(matrix);
   }
   else
   {
-    PainterMatrixWantToShow(painterMatrix);
-//    fPainterMatrixFrame->Use(painterMatrix);
-//    ShowPainterMatrix(painterMatrix);
+    AliError("Cannot work without a painterMatrix");
   }
 }
 
@@ -493,7 +524,7 @@ AliMUONPainterMasterFrame::AttributesChanged(AliMUONAttPainter* newValues)
   
   // First check if we already have this matrix available
   
-  TString newName = AliMUONPainterMatrix::NameIt(currentMatrix->Basename(),a);
+  TString newName = AliMUONPainterMatrix::NameIt(currentMatrix->Whatname(),currentMatrix->Basename(),a);
   
   AliMUONPainterMatrix* matrix = AliMUONPainterRegistry::Instance()->PainterMatrix(newName.Data());
 
index 7bc4856..cf873aa 100644 (file)
@@ -33,7 +33,7 @@ class TObjArray;
 class AliMUONPainterMasterFrame : public TGCompositeFrame
 {
 public:
-  AliMUONPainterMasterFrame(const TGWindow* p, UInt_t w, UInt_t h);
+  AliMUONPainterMasterFrame(const TGWindow* p, UInt_t w, UInt_t h, AliMUONPainterMatrix* matrix);
   virtual ~AliMUONPainterMasterFrame();
 
   void Backward();
@@ -54,6 +54,10 @@ public:
   
   void SaveAs(const char* filename = "", Option_t* option = "") const;
   
+  void PrintAs() const;
+
+  void PrintMe() const;
+  
 private:
   /// not implemented
   AliMUONPainterMasterFrame(const AliMUONPainterMasterFrame& rhs);
@@ -61,12 +65,12 @@ private:
   AliMUONPainterMasterFrame& operator=(const AliMUONPainterMasterFrame& rhs);
   
   void AddPainterMatrix(AliMUONPainterMatrix* group);
-  void MakeTopPainterMatrix(UInt_t w, UInt_t h);
+  void MakeTopPainterMatrix(UInt_t w, UInt_t h, AliMUONPainterMatrix* matrix);
   void SetNavigation(Int_t i);
   void ShowPainterMatrix(AliMUONPainterMatrix* group);  
   void UpdateNavigation();
   void UpdateAttributes(const AliMUONPainterMatrix& painterMatrix);
-
+  
 private:
   TGHorizontalFrame* fNavigationFrame; ///< top frame for navigation
   AliMUONPainterMatrixFrame* fPainterMatrixFrame; ///< main frame with painters
@@ -74,6 +78,8 @@ private:
   TGButton* fBackButton; ///< navigation back 
   TGButton* fForwardButton; ///< navigation forward
   TGLabel* fGroupTitle; ///< top title
+  TGButton* fPrintMeButton; ///< print button
+  TGButton* fPrintAsButton; ///< print... button
   
   TArrayI fNavigation; ///< navigation "history"
     
index 1953fd2..7d0037d 100644 (file)
 
 #include "AliMUONPainterMatrix.h"
 
+#include "AliLog.h"
 #include "AliMUONPainterGroup.h"
+#include "AliMUONPainterHelper.h"
 #include "AliMUONVPainter.h"
-#include "AliLog.h"
+#include "AliMUONVTrackerData.h"
+#include "TCanvas.h"
+#include "TGClient.h"
+#include "TPaveLabel.h"
 #include <Riostream.h>
+#include <TBox.h>
+#include <TMath.h>
 #include <TObjArray.h>
-#include <float.h>
 #include <TObjString.h>
+#include <TROOT.h>
+#include <TVirtualPad.h>
+#include <float.h>
 
 ///\class AliMUONPainterMatrix
 ///
@@ -31,7 +40,7 @@
 ///
 ///\author Laurent Aphecetche, Subatech
 
-///\cond CLASSIMP
+///\cond CLASSIMP 
 ClassImp(AliMUONPainterMatrix)
 ///\endcond
 
@@ -39,21 +48,19 @@ ClassImp(AliMUONPainterMatrix)
 AliMUONPainterMatrix::AliMUONPainterMatrix(const char* name, Int_t nx, Int_t ny)
 : TObject(),
   fBasename(name),
-  fName(""),
+  fWhatname(""),
   fNx(nx),
   fNy(ny),
   fPainters(new TObjArray(fNx*fNy)),
   fAttributes()
 {
-    /// ctor
-
-    fPainters->SetOwner(kTRUE);
-    if ( fNx*fNy > 1 ) 
-    {
-      fAttributes.SetSingle(kFALSE);
-    }
-    
-    fName = NameIt(name,fAttributes);
+  /// ctor
+  
+  fPainters->SetOwner(kTRUE);
+  if ( fNx*fNy > 1 ) 
+  {
+    fAttributes.SetSingle(kFALSE);
+  }
 }
 
 //_____________________________________________________________________________
@@ -116,21 +123,30 @@ AliMUONPainterMatrix::UpdateAttributes()
   fAttributes.SetViewPoint(front,back);
   fAttributes.SetCathodeAndPlaneMutuallyExclusive(cathplaneexclusive);
   fAttributes.SetCathodeAndPlaneDisabled(cathplanedisabled);
+}
+
+//_____________________________________________________________________________
+const char*
+AliMUONPainterMatrix::Name() const
+{
+  /// Build our name
   
-  fName = NameIt(fBasename,fAttributes);
+  return NameIt(fWhatname.Data(),fBasename.Data(),fAttributes).Data();
 }
 
 //_____________________________________________________________________________
 TString
-AliMUONPainterMatrix::NameIt(const TString& basename, const AliMUONAttPainter& att)
+AliMUONPainterMatrix::NameIt(const char* whatname, const char* basename, const AliMUONAttPainter& att)
 {
   /// Build a name 
-  TString name(basename);
-  
-  name += "-";
-  name += att.Name();
-  
-  return name;
+  if ( strlen(whatname) > 0 ) 
+  {
+    return Form("%s-%s-%s",whatname,basename,att.Name().Data());
+  }
+  else
+  {
+    return Form("noda-%s-%s",basename,att.Name().Data());
+  }
 }
 
 //_____________________________________________________________________________
@@ -195,6 +211,143 @@ AliMUONPainterMatrix::Connect(const char* sourceMethod, const char* destClassNam
 }
 
 //_____________________________________________________________________________
+TCanvas*
+AliMUONPainterMatrix::CreateCanvas(Int_t x, Int_t y, Int_t w, Int_t h)
+{
+  /// Generate a canvas to show the painter matrix.
+  ///
+  /// Layout is the following :
+  ///
+  /// ----------------------------------------------------
+  /// |    title describing what is plotted              |
+  /// ----------------------------------------------------
+  /// |                                        |         |
+  /// |                                        |         |
+  /// |                                        |         |
+  /// |                                        |         |
+  /// |                                        |         |
+  /// |             painter themselves         | color   |
+  /// |                                        | range   |
+  /// |                                        |         |
+  /// |                                        |         |
+  /// ----------------------------------------------------
+  ///
+  
+  Int_t mw = ( w <= 0 ? TMath::Nint(gClient->GetDisplayWidth()*0.9) : w );
+  Int_t mh = ( h <= 0 ? TMath::Nint(gClient->GetDisplayHeight()*0.9) : h );
+  
+  TString name(Name());
+  
+  TCanvas* d = new TCanvas(name.Data(),name.Data(),x,y,mw,mh);
+
+  TVirtualPad* pTitle = new TPad(Form("%s-title",name.Data()),Form("%s-title",name.Data()),0,0.9,1.0,0.99);
+  
+  pTitle->Draw();
+  
+  pTitle->cd();
+  
+  TPaveLabel* text = new TPaveLabel(0,0,1,1,"");
+  text->SetFillStyle(0);
+  text->SetFillColor(0);
+  text->SetTextColor(4);
+  text->SetBorderSize(0);
+  
+  text->SetLabel(name.Data());
+  
+  text->Draw();
+  
+  d->cd();
+  
+  TVirtualPad* pMatrix = new TPad(Form("%s-matrix",name.Data()),Form("%s-matrix",name.Data()),0,0,0.9,0.89);
+  
+  pMatrix->Draw();
+  pMatrix->cd();
+  
+  Draw();
+  
+  d->cd();
+  
+  TVirtualPad* pColor = new TPad(Form("%s-color",name.Data()),Form("%s-color",name.Data()),0.91,0.01,0.99,0.89);
+    
+  pColor->Range(0,0,1,1);
+
+  pColor->Draw();
+  
+  pColor->cd();
+  
+  Int_t ndivisions(20);
+  
+  Double_t rangeXmin(0.1);
+  Double_t rangeXmax(0.9);
+  
+  Double_t ymin, ymax;
+  
+  GetDataRange(ymin,ymax);
+    
+  Double_t min(0.0);
+  Double_t max(1.0);
+  
+  Double_t step = (max-min)/ndivisions;
+
+  Double_t hsize = 1.0/(ndivisions+2);
+
+  Double_t ypos = 1.0;
+  
+  for ( Int_t i = -1; i < ndivisions+1; ++i ) 
+  {
+    Double_t value = max - (min + step*i);
+    
+    Int_t color = AliMUONPainterHelper::Instance()->ColorFromValue(value,min,max);
+    
+    Bool_t limit(kFALSE);
+    
+    TString label;
+    TString sign;
+    
+    Double_t yvalue(0.0);
+    
+    if ( i == -1 )
+    {
+      yvalue = ymax;
+      limit = kTRUE;
+      sign = ">";
+    }
+    else if ( i == ndivisions )
+    {
+      yvalue = ymin;
+      limit = kTRUE;
+      sign = "<=";
+    }
+    
+    if (limit)
+    {
+      if ( TMath::Abs(yvalue) < 1E5 ) 
+      {
+        label = Form("%s %7.2f",sign.Data(),yvalue);    
+      }
+      else
+      {
+        label = Form("%s %e",sign.Data(),yvalue);
+      }
+    }
+
+    TPaveLabel* box = new TPaveLabel(rangeXmin,TMath::Max(0.001,ypos-hsize),rangeXmax,ypos,label.Data(),"");    
+    
+    ypos -= hsize;
+    
+    box->SetFillColor(color);
+    box->SetTextColor( i == -1 ? 0 : 1 );
+    box->SetBorderSize(1);
+    box->SetLineColor(1);
+    box->Draw();
+  }  
+  
+  d->SetEditable(kFALSE);
+  
+  return d;
+}
+
+//_____________________________________________________________________________
 void
 AliMUONPainterMatrix::GetDataRange(Double_t& dataMin, Double_t& dataMax) const
 {
@@ -244,6 +397,32 @@ AliMUONPainterMatrix::GetTypes(TObjArray& types) const
   }  
 }
 
+
+//_____________________________________________________________________________
+void
+AliMUONPainterMatrix::Draw(Option_t*)
+{
+  /// Append our painters to the current pad
+
+  if (!gPad) 
+  {
+    gROOT->MakeDefCanvas();
+  }
+  
+  TVirtualPad* pad = gPad;
+
+  gPad->Divide(Nx(),Ny());
+  
+  for ( Int_t i = 0; i < Size(); ++i ) 
+  {
+    AliMUONVPainter* painter = Painter(i);
+    pad->cd(i+1);
+    painter->Draw("R");
+  }  
+  
+  AppendPad("");
+}
+
 //_____________________________________________________________________________
 AliMUONVPainter* 
 AliMUONPainterMatrix::Painter(Int_t index) const
@@ -296,6 +475,15 @@ AliMUONPainterMatrix::SetData(const char* pattern, AliMUONVTrackerData* d,
     AliMUONVPainter* painter = Painter(i);
     painter->SetData(pattern,d,indexInData);
   }
+  
+  if ( d ) 
+  {
+    fWhatname = Form("%s-%s",d->GetName(),d->DimensionName(indexInData).Data());
+  }
+  else
+  {
+    fWhatname = "";
+  }
 }
 
 //_____________________________________________________________________________
@@ -328,7 +516,7 @@ void
 AliMUONPainterMatrix::Print(Option_t*) const
 {
   /// Printout
-  cout << "Basename=" << fBasename.Data() << " Name=" << fName.Data() 
+  cout << "Whatname=" << fWhatname.Data() << "Basename=" << fBasename.Data() 
   << " Nx=" << fNx << " Ny=" << fNy << " Att=" << fAttributes.GetName() << endl;
 }
 
@@ -352,7 +540,7 @@ AliMUONPainterMatrix::Clone(const AliMUONAttPainter& attributes) const
 {
   /// Clone with given attributes
   
-  AliMUONPainterMatrix* clone = new AliMUONPainterMatrix(Basename().Data(),Nx(),Ny());
+  AliMUONPainterMatrix* clone = new AliMUONPainterMatrix(Basename(),Nx(),Ny());
 
   for ( Int_t i = 0; i < Size(); ++i ) 
   {
@@ -419,5 +607,3 @@ AliMUONPainterMatrix::Validate(const AliMUONAttPainter& att) const
   }
   return a;
 }
-
-
index 3dc3b6b..dff15d5 100644 (file)
@@ -25,6 +25,7 @@
 class AliMUONVPainter;
 class AliMUONVTrackerData;
 class TObjArray;
+class TCanvas;
 
 class AliMUONPainterMatrix : public TObject
 {
@@ -50,17 +51,17 @@ public:
   
   /// Get the data range for this matrix
   void GetDataRange(Double_t& dataMin, Double_t& dataMax) const;
-  
-  /// Get our name
-  virtual const char* GetName() const { return Name().Data(); }
 
-  static TString NameIt(const TString& basename, const AliMUONAttPainter& att);
+  /// Get matrix name
+  virtual const char* GetName() const { return Name(); }
+
+  /// Get our name
+  virtual const char* Name() const;
 
-  /// Matrix name
-  virtual TString Name() const { return fName; }
-  
   /// Base name (short name)
-  virtual TString Basename() const { return fBasename; }
+  const char* Basename() const { return fBasename.Data(); }
+  
+  const char* Whatname() const { return fWhatname.Data(); }
   
   void GetTypes(TObjArray& types) const;
 
@@ -97,6 +98,12 @@ public:
   /// Normalize attributes
   AliMUONAttPainter Validate(const AliMUONAttPainter& att) const;
   
+  static TString NameIt(const char* what, const char* basename, const AliMUONAttPainter& att);
+
+  void Draw(Option_t* opt="");
+  
+  TCanvas* CreateCanvas(Int_t x=0, Int_t y=0, Int_t w=-1, Int_t h=-1);
+
 private:
   /// Not implemented
   AliMUONPainterMatrix(const AliMUONPainterMatrix& rhs);
@@ -107,13 +114,13 @@ private:
   
 private:
   TString fBasename; ///< base name of that matrix
-  TString fName; ///< complete name
+  TString fWhatname; ///< data name
   Int_t fNx; ///< number of rows
   Int_t fNy; ///< number of columns
   TObjArray* fPainters; ///< painters in that matrix
   AliMUONAttPainter fAttributes; ///< attributes of our painter(s)
   
-  ClassDef(AliMUONPainterMatrix,1) // Matrix of AliMUONVPainter
+  ClassDef(AliMUONPainterMatrix,2) // Matrix of AliMUONVPainter
 };
 
 #endif
index feb6f1c..67fe4ac 100644 (file)
@@ -476,7 +476,12 @@ void
 AliMUONPainterMatrixFrame::SaveAs(const char* filename, Option_t* option) const
 {
   /// Save painter matrix (in the sense of "print") in filename
-  fView->GetCanvas()->SaveAs(filename,option);
+  
+  TCanvas* d = fPainterMatrix->CreateCanvas();
+  
+  d->SaveAs(filename,option);
+  
+  delete d;
 }
 
 //_____________________________________________________________________________
index 0f84781..9c668e1 100644 (file)
@@ -66,6 +66,8 @@ public:
   
   void SaveAs(const char* filename="", Option_t* option="") const;
 
+  void UpdateInterface(Bool_t fromScratch);
+  
 private:
   /// not implemented
   AliMUONPainterMatrixFrame(const AliMUONPainterMatrixFrame& rhs);
@@ -81,8 +83,6 @@ private:
   
   void UpdateDataRange();
   
-  void UpdateInterface(Bool_t fromScratch);
-
   void ViewModified();
   
 private:
index 0ae4d89..557d67e 100644 (file)
@@ -128,8 +128,6 @@ int main(int argc, char** argv)
     return Usage();
   }
   
-  AliWarningGeneral("main","FIXME ? Remove default storage and run number from here...");
-  
   AliCDBManager::Instance()->SetDefaultStorage(defaultOCDB.Data());
   AliCDBManager::Instance()->SetRun(0);
  
@@ -179,8 +177,6 @@ int main(int argc, char** argv)
   
   AliMUONMchViewApplication* theApp = new AliMUONMchViewApplication("mchview", &argc, argv, w,h,gox,goy);
    
-  AliCodeTimer::Instance()->Print();
-
   TIter next(&filesToOpen);
   TObjString* s;
   while ( ( s = static_cast<TObjString*>(next()) ) )