#include "AliMUONVPainter.h"
+#include "AliLog.h"
+#include "AliMUON2DMap.h"
+#include "AliMUONCalibParamND.h"
+#include "AliMUONContour.h"
+#include "AliMUONContourPainter.h"
#include "AliMUONObjectPair.h"
-#include "AliMUONPainterContour.h"
#include "AliMUONPainterGroup.h"
#include "AliMUONPainterHelper.h"
+#include "AliMUONPainterDataRegistry.h"
+#include "AliMUONTrackerDataHistogrammer.h"
#include "AliMUONVTrackerData.h"
-#include "AliCodeTimer.h"
-#include "AliLog.h"
+#include "AliMpManuUID.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
ClassImp(AliMUONVPainter)
///\endcond
+//_____________________________________________________________________________
+AliMUONVPainter::AliMUONVPainter(TRootIOCtor*) : TObject(),
+TQObject(),
+fHistogram(0x0),
+fPainterGroups(0x0),
+fResponderGroup(0x0),
+fName(""),
+fPathName(""),
+fType(""),
+fMother(0x0),
+fGroup(0x0),
+fContour(0x0),
+fChildren(0x0),
+fPlotterGroup(0x0),
+fBorderFactor(1.1),
+fPad(0x0),
+fAttributes(),
+fLineColor(1),
+fLineWidth(1),
+fIsValid(kTRUE)
+{
+ /// streamer ctor
+ SetID(-1,-1);
+}
+
//_____________________________________________________________________________
AliMUONVPainter::AliMUONVPainter(const char* type)
: TObject(),
+ TQObject(),
+ fHistogram(0x0),
+ fPainterGroups(0x0),
+ fResponderGroup(0x0),
fName(""),
fPathName(""),
fType(type),
fMother(0x0),
fGroup(0x0),
fContour(0x0),
- fPainterGroups(0x0),
fChildren(0x0),
- fResponderGroup(0x0),
fPlotterGroup(0x0),
fBorderFactor(1.1),
fPad(0x0),
//_____________________________________________________________________________
AliMUONVPainter::AliMUONVPainter(const AliMUONVPainter& rhs)
: TObject(rhs),
+TQObject(),
+fHistogram(0x0),
+fPainterGroups(0x0),
+fResponderGroup(0x0),
fName(""),
fPathName(""),
fType(""),
fMother(0x0),
fGroup(0x0),
fContour(0x0),
-fPainterGroups(0x0),
fChildren(0x0),
-fResponderGroup(0x0),
fPlotterGroup(0x0),
fBorderFactor(1.0),
fPad(0x0),
{
/// dtor
delete fChildren;
+ delete fHistogram;
}
//_____________________________________________________________________________
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;
Double_t& x2, Double_t& y2) const
{
/// Get the bounding box = our area
- AliMpArea area(Area().Position(),Area().Dimensions()*fBorderFactor);
+ AliMpArea area(Area().GetPositionX(),
+ Area().GetPositionY(),
+ Area().GetDimensionX()*fBorderFactor,
+ Area().GetDimensionY()*fBorderFactor);
x1 = area.LeftBorder();
y1 = area.DownBorder();
{
PaintOutline();
}
+
+ if ( IsExcluded() )
+ {
+ AliMUONContourPainter::Paint(*fContour,1,1,2); // red fill with black thin outline
+ }
}
//_____________________________________________________________________________
{
/// Default implementation (must be overriden)
AliError(Form("%s : implement me",GetName()));
+ return;
}
//_____________________________________________________________________________
Int_t c = color >= 0 ? color : GetLineColor();
Int_t w = width >= 0 ? width : GetLineWidth();
- fContour->PaintOutline(c,w);
+ AliMUONContourPainter::Paint(*fContour,c,w);
}
//_____________________________________________________________________________
//_____________________________________________________________________________
void
-AliMUONVPainter::SetContour(AliMUONPainterContour* contour)
+AliMUONVPainter::SetContour(AliMUONContour* contour)
{
/// Set out contour
if (!contour)
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->Delete();
+
+ TClassMenuItem* n(0x0);
+
+ l->Add(new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
+ "Include","Include",p,"",-1,kTRUE));
+ l->Add(new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
+ "Exclude","Exclude",p,"",-1,kTRUE));
+
+ if ( group )
+ {
+ if ( data && data->IsHistogrammed(0) )
+ {
+ // Add histo drawing to the popup menu
+ TString name("Draw histogram of ");
+
+ name += data->ExternalDimensionName(0);
+
+ n = new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
+ name.Data(),"DrawHistogram0",p,"",-1,kTRUE);
+ l->Add(n);
+
+ name += " clone";
+
+ n = new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
+ name.Data(),"DrawHistogramClone0",p,"",-1,kTRUE);
+ l->Add(n);
+ }
+
+ Int_t nd = data->IsSingleEvent() ? data->ExternalDimension() : data->ExternalDimension()*2;
+
+ for ( Int_t i = 0; i < nd; ++i )
+ {
+ 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);
+ }
}
//_____________________________________________________________________________
SetLine(group->Depth(),group->GetLineColor(),group->GetLineWidth());
}
+
+}
+
+//_____________________________________________________________________________
+void
+AliMUONVPainter::Include()
+{
+ /// Include this painter
+ AliInfo(GetName());
+
+ /// Update the global interactive read out configuration
+ WriteIROC(1);
+}
+
+//_____________________________________________________________________________
+void
+AliMUONVPainter::GetIROCManuList(TObjArray& manuList)
+{
+ /// Get the list of manus spanned by this painter AND by its dual
+
+ FillManuList(manuList);
+
+ // get our dual
+ AliMUONAttPainter att(Attributes());
+
+ att.Invert();
+
+ att.SetCathodeAndPlaneDisabled(kTRUE);
+
+ AliMUONVPainter* p = AliMUONVPainter::CreatePainter(ClassName(),att,ID0(),ID1());
+
+ if (p)
+ {
+ p->FillManuList(manuList);
+ }
+
+ delete p;
+}
+
+//_____________________________________________________________________________
+void
+AliMUONVPainter::WriteIROC(Double_t value)
+{
+ /// Update the interactive readout configuration
+
+ TObjArray manuList;
+ GetIROCManuList(manuList);
+
+ AliMpManuUID* muid;
+ TIter nextm(&manuList);
+ AliMUON2DMap store(true);
+
+ while ((muid=static_cast<AliMpManuUID*>(nextm())))
+ {
+ AliMUONVCalibParam* param = new AliMUONCalibParamND(1,64,
+ muid->DetElemId(),
+ muid->ManuId(),value);
+ store.Add(param);
+ }
+
+ InteractiveReadOutConfig()->Replace(store);
+}
+
+//_____________________________________________________________________________
+void
+AliMUONVPainter::Exclude()
+{
+ /// Exclude this painter
+ AliInfo(GetName());
+
+ /// Update the global interactive read out configuration
+ WriteIROC(0.0);
+}
+
+//_____________________________________________________________________________
+AliMUONVTrackerData*
+AliMUONVPainter::InteractiveReadOutConfig() const
+{
+ /// get the interactive readout config object
+ return AliMUONPainterDataRegistry::Instance()->InteractiveReadOutConfig();
}
//_____________________________________________________________________________
return rv;
}
+//_____________________________________________________________________________
+void
+AliMUONVPainter::PaintArea(Int_t fillColor)
+{
+ /// Draw a filled area
+ AliMUONContourPainter::Paint(*(Contour()),-1,-1,fillColor);
+}