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
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;
}
/// 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 "";
}
#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"
UInt_t ox, UInt_t oy)
: TRint(name,argc,argv),
fMainFrame(0x0),
- fPainterMasterFrame(0x0)
+ fPainterMasterFrameList(new TList),
+ fTabs(0x0)
{
/// ctor
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();
if ( painter )
{
- fPainterMasterFrame->ShiftClicked(painter,0x0);
+ pmf->ShiftClicked(painter,0x0);
- fPainterMasterFrame->Update();
+ pmf->Update();
}
}
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;
}
//______________________________________________________________________________
t->SetWindowName("mchview compare data tool");
t->SetIconName("mchview compare data tool");
- t->MapRaised();
-
+ t->MapRaised();
}
//______________________________________________________________________________
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;
+ }
}
//______________________________________________________________________________
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)");
# include <TRint.h>
#endif
-class AliMUONPainterMasterFrame;
+class TList;
class TDirectory;
class TGMainFrame;
+class AliMUONPainterMatrix;
+class TGTab;
class AliMUONMchViewApplication : public TRint
{
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()); }
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
static const char* fgkFileTypes[]; ///< For the open menu
- ClassDef(AliMUONMchViewApplication,4) // mchview application
+ ClassDef(AliMUONMchViewApplication,5) // mchview application
};
#endif
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);
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()");
#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>
#include <TGrid.h>
#include <TObjArray.h>
#include <TObjString.h>
+#include <TMath.h>
#include <TRegexp.h>
#include <TString.h>
#include <TSystem.h>
//_____________________________________________________________________________
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();
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()));
}
//_____________________________________________________________________________
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()));
}
//_____________________________________________________________________________
{
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;
}
# include <TGFrame.h>
#endif
+class AliMUONAttPainter;
class AliMUONPainterDataSourceItem;
+class AliMUONPainterMatrix;
class AliMUONVTrackerDataMaker;
+class AliMUONVTrackerData;
class TGCheckButton;
class TGComboBox;
class TGGroupFrame;
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);
void CreateACFDataSource(const TString& acfPath, const TString& type);
+ void RegisterDataSource(AliMUONVTrackerDataMaker* reader, const char* dsName);
+
private:
TGGroupFrame* fRecentSourceSelector; ///< to select recently used sources
#include "AliMUONGeometryTransformer.h"
#include "AliMUONManuContourMaker.h"
#include "AliMUONPainterEnv.h"
-#include "AliMUONPainterMatrix.h"
#include "AliMUONPainterRegistry.h"
#include "AliMUONPadStatusMaker.h"
#include "AliMUONVCalibParam.h"
#include <TLine.h>
#include <TList.h>
#include <TMap.h>
+#include <TMath.h>
#include <TObjArray.h>
#include <TObjString.h>
#include <TStyle.h>
//_____________________________________________________________________________
AliMUONPainterHelper::AliMUONPainterHelper() :
TObject(),
-fPainterMatrices(0x0),
fEnv(0x0),
fReal(0x0),
fExploded(0x0)
AliMUONPainterHelper::~AliMUONPainterHelper()
{
/// dtor
- delete fPainterMatrices;
delete fReal;
delete fExploded;
fEnv->Save();
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
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 ) );
{
if ( fExploded ) fExploded->Print();
if ( fReal ) fReal->Print();
- }
-
- if ( fPainterMatrices && ( sopt.Contains("MATRI") || sopt.Contains("FULL") ) )
- {
- fPainterMatrices->Print(opt);
- }
+ }
}
//_____________________________________________________________________________
TObjArray* GetAllContoursAsArray(Bool_t explodedView=kTRUE) const;
- void GenerateDefaultMatrices();
-
private:
/// Not implemented
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
#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
///
//_____________________________________________________________________________
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
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);
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,
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,
this,
"PainterMatrixWantToShow(AliMUONPainterMatrix*)");
- fPainterMatrixFrame->DataSourceWasChanged("*",0x0,-1);
+ fPainterMatrixFrame->DataSourceWasChanged(matrix->DataPattern().Data(),matrix->Data(),matrix->DataIndex());
}
//_____________________________________________________________________________
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)
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());
/// Update ourselves
fPainterMatrixFrame->Update();
+ fPainterMatrixFrame->UpdateInterface(kFALSE);
}
//_____________________________________________________________________________
//_____________________________________________________________________________
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");
}
}
// 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());
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();
void SaveAs(const char* filename = "", Option_t* option = "") const;
+ void PrintAs() const;
+
+ void PrintMe() const;
+
private:
/// not implemented
AliMUONPainterMasterFrame(const AliMUONPainterMasterFrame& rhs);
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
TGButton* fBackButton; ///< navigation back
TGButton* fForwardButton; ///< navigation forward
TGLabel* fGroupTitle; ///< top title
+ TGButton* fPrintMeButton; ///< print button
+ TGButton* fPrintAsButton; ///< print... button
TArrayI fNavigation; ///< navigation "history"
#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
///
///
///\author Laurent Aphecetche, Subatech
-///\cond CLASSIMP
+///\cond CLASSIMP
ClassImp(AliMUONPainterMatrix)
///\endcond
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);
+ }
}
//_____________________________________________________________________________
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());
+ }
}
//_____________________________________________________________________________
}
}
+//_____________________________________________________________________________
+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
}
}
+
+//_____________________________________________________________________________
+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
AliMUONVPainter* painter = Painter(i);
painter->SetData(pattern,d,indexInData);
}
+
+ if ( d )
+ {
+ fWhatname = Form("%s-%s",d->GetName(),d->DimensionName(indexInData).Data());
+ }
+ else
+ {
+ fWhatname = "";
+ }
}
//_____________________________________________________________________________
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;
}
{
/// 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 )
{
}
return a;
}
-
-
class AliMUONVPainter;
class AliMUONVTrackerData;
class TObjArray;
+class TCanvas;
class AliMUONPainterMatrix : public TObject
{
/// 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;
/// 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);
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
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;
}
//_____________________________________________________________________________
void SaveAs(const char* filename="", Option_t* option="") const;
+ void UpdateInterface(Bool_t fromScratch);
+
private:
/// not implemented
AliMUONPainterMatrixFrame(const AliMUONPainterMatrixFrame& rhs);
void UpdateDataRange();
- void UpdateInterface(Bool_t fromScratch);
-
void ViewModified();
private:
return Usage();
}
- AliWarningGeneral("main","FIXME ? Remove default storage and run number from here...");
-
AliCDBManager::Instance()->SetDefaultStorage(defaultOCDB.Data());
AliCDBManager::Instance()->SetRun(0);
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()) ) )