#include "AliMUONVPainter.h"
+#include "AliCodeTimer.h"
+#include "AliLog.h"
#include "AliMUONObjectPair.h"
#include "AliMUONPainterContour.h"
#include "AliMUONPainterGroup.h"
#include "AliMUONPainterHelper.h"
+#include "AliMUONTrackerDataHistogrammer.h"
#include "AliMUONVTrackerData.h"
-#include "AliCodeTimer.h"
-#include "AliLog.h"
#include <Riostream.h>
#include <TCanvas.h>
#include <TClass.h>
-#include <TClass.h>
+#include <TClassMenuItem.h>
+#include <TH1.h>
#include <TList.h>
#include <TMap.h>
#include <TMath.h>
#include <cassert>
#include <float.h>
-
/// \class AliMUONVPainter
///
/// Base class for a graphical object representing some part of the
//_____________________________________________________________________________
AliMUONVPainter::AliMUONVPainter(const char* type)
: TObject(),
+ TQObject(),
fName(""),
fPathName(""),
fType(type),
fAttributes(),
fLineColor(1),
fLineWidth(1),
- fIsValid(kTRUE)
+ fIsValid(kTRUE),
+ fHistogram(0x0)
{
/// ctor
SetID(-1,-1);
//_____________________________________________________________________________
AliMUONVPainter::AliMUONVPainter(const AliMUONVPainter& rhs)
: TObject(rhs),
+TQObject(),
fName(""),
fPathName(""),
fType(""),
fAttributes(),
fLineColor(-1),
fLineWidth(-1),
-fIsValid(kTRUE)
+fIsValid(kTRUE),
+fHistogram(0x0)
{
/// copy ctor
rhs.Copy(*this);
{
/// dtor
delete fChildren;
+ delete fHistogram;
}
//_____________________________________________________________________________
void
AliMUONVPainter::Clicked(AliMUONVPainter* painter, Double_t* values)
{
- // let our mother emit the signal as clients are probably connected to
- // our (grand)mother, not to us
+ /// Let our mother emit the signal as clients are probably connected to
+ /// our (grand)mother, not to us
if ( Mother() )
{
void
AliMUONVPainter::ShiftClicked(AliMUONVPainter* painter, Double_t* values)
{
- // let our mother emit the signal as clients are probably connected to
- // our (grand)mother, not to us
+ /// Let our mother emit the signal as clients are probably connected to
+ /// our (grand)mother, not to us
if ( Mother() )
{
painter.fID[0] = fID[0];
painter.fID[1] = fID[1];
+ delete painter.fHistogram;
+ painter.fHistogram = 0x0;
+
TIter next(fChildren);
AliMUONVPainter* p;
void
AliMUONVPainter::FlatList(TList& list)
{
- /// Make a flat list of our children
+ /// Make a flat list of our children (and ourselves)
TIter next(fChildren);
AliMUONVPainter* painter;
CreateGroups();
}
+ if ( data )
+ {
+ data->Connect("Destroyed()",ClassName(),this,Form("SetData(=\"%s\",0x0,-1)",pattern));
+ }
+
TIter next(fPainterGroups);
TObjString* str;
while ( ( str = static_cast<TObjString*>(next()) ) )
{
AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(str));
+
if ( group->Matches(pattern) )
{
group->SetData(data,dataIndex);
group->SetData(0x0,-1);
}
}
+
+ // Update context menus
+ TList list;
+ FlatList(list);
+
+ TIter pnext(&list);
+ AliMUONVPainter* p;
+
+ AliMUONPainterGroup* group = Master()->PlotterGroup();
+
+ while ( ( p = static_cast<AliMUONVPainter*>(pnext()) ) )
+ {
+ TList* l = p->IsA()->GetMenuList();
+
+// l->Clear();
+ l->Delete();
+
+ if ( group )
+ {
+ Int_t dim = group->Data()->InternalToExternal(group->DataIndex());
+ if ( dim < group->Data()->ExternalDimension() )
+ {
+ if ( data && data->IsHistogrammed(dim) )
+ {
+ // Add histo drawing to the popup menu
+ TClassMenuItem* n = new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
+ "Draw histogram","DrawHistogram0",p,"",-1,kTRUE);
+ l->Add(n);
+
+ n = new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
+ "Draw histogram clone","DrawHistogramClone0",p,"",-1,kTRUE);
+ l->Add(n);
+ }
+
+ }
+
+ for ( Int_t i = 0; i < data->ExternalDimension()*2; ++i )
+ {
+ TClassMenuItem* n = new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
+ Form("Draw %s clone",data->DimensionName(i).Data()),
+ Form("DrawInternalHistogramClone%d",i),p,"",-1,kTRUE);
+ l->Add(n);
+ }
+ }
+ }
+}
+
+//_____________________________________________________________________________
+void
+AliMUONVPainter::DrawInternalHistogram(Int_t dim) const
+{
+ /// Draw histogram (and delete the previous one)
+
+ delete fHistogram;
+ fHistogram = 0x0;
+
+ DrawInternalHistogramClone(dim);
+}
+
+//_____________________________________________________________________________
+void
+AliMUONVPainter::DrawInternalHistogramClone(Int_t dim) const
+{
+ /// Draw histogram
+
+ fHistogram = AliMUONTrackerDataHistogrammer::CreateHisto(*this,-1,dim);
+
+ if (fHistogram)
+ {
+ new TCanvas();
+ fHistogram->Draw();
+ }
+}
+
+//_____________________________________________________________________________
+void
+AliMUONVPainter::DrawHistogram(Double_t* values) const
+{
+ /// Draw histogram (and delete the previous one)
+
+ delete fHistogram;
+ fHistogram = 0x0;
+
+ DrawHistogramClone(values);
+}
+
+//_____________________________________________________________________________
+void
+AliMUONVPainter::DrawHistogramClone(Double_t*) const
+{
+ /// Draw histogram
+
+ fHistogram = AliMUONTrackerDataHistogrammer::CreateHisto(*this,0,-1);
+
+ if (fHistogram)
+ {
+ new TCanvas();
+ fHistogram->Draw();
+ }
+}
+
+//_____________________________________________________________________________
+void
+AliMUONVPainter::FillManuList(TObjArray& manuList) const
+{
+ /// Append to manulist
+ /// This is the default implementation, which just calls the FillManuList
+ /// of all our children.
+ /// Some derived class might need to override this in order to exclude
+ /// some children from the fill.
+
+ TIter next(Children());
+
+ AliMUONVPainter* p;
+
+ while ( ( p = static_cast<AliMUONVPainter*>(next()) ) )
+ {
+ p->FillManuList(manuList);
+ }
}
//_____________________________________________________________________________