#include "AliMUONVPainter.h"
#include "AliLog.h"
#include "AliMUON2DMap.h"
#include "AliMUONCalibParamND.h"
#include "AliMUONContour.h"
#include "AliMUONContourPainter.h"
#include "AliMUONObjectPair.h"
#include "AliMUONPainterGroup.h"
#include "AliMUONPainterHelper.h"
#include "AliMUONPainterDataRegistry.h"
#include "AliMUONTrackerDataHistogrammer.h"
#include "AliMUONVTrackerData.h"
#include "AliMpManuUID.h"
#include <Riostream.h>
#include <TCanvas.h>
#include <TClass.h>
#include <TClassMenuItem.h>
#include <TH1.h>
#include <TList.h>
#include <TMap.h>
#include <TMath.h>
#include <TMethodCall.h>
#include <TObjArray.h>
#include <TObjString.h>
#include <TROOT.h>
#include <TVirtualPad.h>
#include <cassert>
#include <float.h>
using std::cout;
using std::endl;
ClassImp(AliMUONVPainter)
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)
{
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),
fChildren(0x0),
fPlotterGroup(0x0),
fBorderFactor(1.1),
fPad(0x0),
fAttributes(),
fLineColor(1),
fLineWidth(1),
fIsValid(kTRUE)
{
SetID(-1,-1);
}
AliMUONVPainter::AliMUONVPainter(const AliMUONVPainter& rhs)
: TObject(rhs),
TQObject(),
fHistogram(0x0),
fPainterGroups(0x0),
fResponderGroup(0x0),
fName(""),
fPathName(""),
fType(""),
fMother(0x0),
fGroup(0x0),
fContour(0x0),
fChildren(0x0),
fPlotterGroup(0x0),
fBorderFactor(1.0),
fPad(0x0),
fAttributes(),
fLineColor(-1),
fLineWidth(-1),
fIsValid(kTRUE)
{
rhs.Copy(*this);
}
AliMUONVPainter&
AliMUONVPainter::operator=(const AliMUONVPainter& rhs)
{
if ( this != &rhs )
{
rhs.Copy(*this);
}
return *this;
}
AliMUONVPainter::~AliMUONVPainter()
{
delete fChildren;
delete fHistogram;
}
AliMpArea
AliMUONVPainter::Area() const
{
if ( fContour )
{
return fContour->Area();
}
else
{
AliWarning("Returning an invalid area, as contour is not defined");
return AliMpArea();
}
}
void
AliMUONVPainter::Add(AliMUONVPainter* painter)
{
if (!fChildren) fChildren = new TObjArray;
assert(painter->Mother()==0x0);
fChildren->Add(painter);
painter->SetMother(this);
}
TCollection*
AliMUONVPainter::Children() const
{
return fChildren;
}
void
AliMUONVPainter::Clicked(AliMUONVPainter* painter, Double_t* values)
{
if ( Mother() )
{
Mother()->Clicked(painter,values);
}
else
{
Long_t param[] = { (Long_t)painter,(Long_t)values };
Emit("Clicked(AliMUONVPainter*,Double_t*)",param);
}
}
void
AliMUONVPainter::ShiftClicked(AliMUONVPainter* painter, Double_t* values)
{
if ( Mother() )
{
Mother()->ShiftClicked(painter,values);
}
else
{
Long_t param[] = { (Long_t)painter,(Long_t)values };
Emit("ShiftClicked(AliMUONVPainter*,Double_t*)",param);
}
}
void
AliMUONVPainter::ComputeDataRange(const AliMUONVTrackerData&, Int_t,
Double_t&, Double_t&) const
{
AliError("Not implemented. Please fixe me");
}
TString
AliMUONVPainter::ContourName() const
{
TString name(PathName());
name += "-";
name += fAttributes.Name();
return name;
}
void
AliMUONVPainter::Copy(TObject& object) const
{
TObject::Copy(object);
AliMUONVPainter& painter = static_cast<AliMUONVPainter&>(object);
painter.fType = fType;
painter.fName = fName;
painter.fPathName = fPathName;
painter.fMother = 0x0;
painter.fContour = fContour;
painter.fGroup = 0x0;
painter.fResponderGroup = 0x0;
painter.fPlotterGroup = 0x0;
painter.fBorderFactor = fBorderFactor;
painter.fAttributes = fAttributes;
painter.fAttributes.SetCathodeAndPlaneDisabled(kFALSE);
painter.fPad = fPad;
painter.fLineColor = fLineColor;
painter.fLineWidth = fLineWidth;
painter.fIsValid = fIsValid;
delete painter.fChildren;
painter.fChildren = 0x0;
painter.fID[0] = fID[0];
painter.fID[1] = fID[1];
delete painter.fHistogram;
painter.fHistogram = 0x0;
TIter next(fChildren);
AliMUONVPainter* p;
while ( ( p = static_cast<AliMUONVPainter*>(next()) ) )
{
painter.Add(static_cast<AliMUONVPainter*>(p->Clone()));
}
painter.UpdateGroupsFrom(*this);
object.ResetBit(kCanDelete);
}
AliMUONPainterGroup*
AliMUONVPainter::CreateGroup(const char* type, Int_t depth)
{
if (!fPainterGroups) fPainterGroups = new TMap;
TObject* o = fPainterGroups->GetValue(type);
if (o)
{
AliError(Form("Group %s is already there ! Check this",type));
return 0x0;
}
AliMUONPainterGroup* group = new AliMUONPainterGroup(type,depth);
fPainterGroups->Add(new TObjString(type),group);
return group;
}
void
AliMUONVPainter::CreateGroups()
{
if ( Mother() )
{
AliFatal("Not supposed to create groups for a children");
}
TList list;
FlatList(list);
TIter next(&list);
AliMUONVPainter* painter;
while ( ( painter = static_cast<AliMUONVPainter*>(next()) ) )
{
AliMUONPainterGroup* group = Group(painter->Type());
if (!group)
{
group = CreateGroup(painter->Type(),painter->Depth());
}
group->Add(painter);
}
}
AliMUONVPainter*
AliMUONVPainter::Detach() const
{
AliDebug(1,Form("Detaching %s",GetName()));
AliMUONVPainter* p = static_cast<AliMUONVPainter*>(Clone());
AliMUONVPainter* master = Master();
if ( master )
{
AliDebug(1,Form("UpdatingGroups of the detached painter %s from its master %s",
p->GetName(),master->GetName()));
p->UpdateGroupsFrom(*master);
}
return p;
}
Int_t
AliMUONVPainter::Depth() const
{
if ( Mother() )
{
return Mother()->Depth() + 1;
}
else
{
return 0;
}
}
Int_t
AliMUONVPainter::DistancetoPrimitive(Int_t px, Int_t py)
{
static const Int_t kBigValue = 999999;
if (!gPad) return kBigValue;
Double_t x,y;
AliMUONVPainter* painter = GetPainter(px,py,x,y);
x=y=0.0;
if ( painter == this) return 0;
return kBigValue;
}
void
AliMUONVPainter::DoubleClicked(AliMUONVPainter*, Double_t*)
{
AliWarning("Please implement me !");
}
void
AliMUONVPainter::Draw(Option_t* opt)
{
if (!gPad)
{
gROOT->MakeDefCanvas();
}
Bool_t kMustSetRange(kFALSE);
TString sopt(opt);
sopt.ToUpper();
if (sopt.Contains("R") ) kMustSetRange=kTRUE;
if (kMustSetRange)
{
Double_t x1,y1,x2,y2;
GetBoundingBox(x1,y1,x2,y2);
if ( gPad) gPad->Range(x1,y1,x2,y2);
}
if ( !fMother && !fPainterGroups )
{
CreateGroups();
}
TIter next(fChildren);
AliMUONVPainter* painter;
while ( ( painter = static_cast<AliMUONVPainter*>(next()) ) )
{
painter->Draw();
}
AppendPad(opt);
fPad = gPad;
}
void
AliMUONVPainter::ExecuteEvent(Int_t event, Int_t px, Int_t py)
{
Double_t x,y;
AliMUONVPainter* painter = GetPainter(px,py,x,y);
if ( painter == this )
{
Double_t values[] = { x,y };
switch (event)
{
case kButton2Up:
ShiftClicked(this,values);
break;
case kButton1Up:
Clicked(this,values);
break;
case kButton1Double:
gPad->GetCanvas()->HandleInput((EEventType)-1,0,0);
DoubleClicked(this,values);
break;
}
}
}
void
AliMUONVPainter::FlatList(TList& list)
{
TIter next(fChildren);
AliMUONVPainter* painter;
while ( ( painter = static_cast<AliMUONVPainter*>(next())))
{
painter->FlatList(list);
}
list.Add(this);
}
void
AliMUONVPainter::GetBoundingBox(Double_t& x1, Double_t& y1,
Double_t& x2, Double_t& y2) const
{
AliMpArea area(Area().GetPositionX(),
Area().GetPositionY(),
Area().GetDimensionX()*fBorderFactor,
Area().GetDimensionY()*fBorderFactor);
x1 = area.LeftBorder();
y1 = area.DownBorder();
x2 = area.RightBorder();
y2 = area.UpBorder();
}
char*
AliMUONVPainter::GetObjectInfo(Int_t, Int_t) const
{
return const_cast<char*>(GetName());
}
AliMUONVPainter*
AliMUONVPainter::GetPainter(Int_t px, Int_t py, Double_t& x, Double_t& y) const
{
PixelToPad(px,py,x,y);
if ( !IsInside(x,y) ) return 0x0;
if ( fGroup->IsResponder() ) return const_cast<AliMUONVPainter*>(this);
if (fChildren)
{
TIter next(fChildren);
AliMUONVPainter* painter;
while ( ( painter = static_cast<AliMUONVPainter*>(next()) ) )
{
AliMUONVPainter* p = painter->GetPainter(px,py,x,y);
if (p) return p;
}
}
return 0x0;
}
void
AliMUONVPainter::GetTypes(TObjArray& types) const
{
types.SetOwner(kTRUE);
types.Clear();
TObjArray tmp;
tmp.SetOwner(kFALSE);
TIter next(fPainterGroups);
TObjString* str;
while ( ( str = static_cast<TObjString*>(next()) ) )
{
AliMUONPainterGroup* group = Group(str->String().Data());
tmp.AddLast(group);
}
tmp.Sort();
Int_t n = tmp.GetLast()+1;
Int_t* index = new Int_t[n];
Int_t* a = new Int_t[n];
for ( Int_t i = 0; i < n; ++i )
{
AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(tmp.At(i));
a[i] = group->Depth();
}
TMath::Sort(n,a,index,kFALSE);
for ( Int_t i = 0; i < n; ++i )
{
AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(tmp.At(index[i]));
types.AddLast(new TObjString(group->Type()));
}
delete[] index;
delete[] a;
}
AliMUONPainterGroup*
AliMUONVPainter::Group(const char* type) const
{
if (!fPainterGroups) return 0x0;
return static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(type));
}
AliMUONPainterGroup*
AliMUONVPainter::Group(Int_t depth) const
{
if (!fPainterGroups) return 0x0;
TIter next(fPainterGroups);
TObjString* groupName;
while ( ( groupName = static_cast<TObjString*>(next()) ) )
{
AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>
(fPainterGroups->GetValue(groupName->String().Data()));
if ( group->Depth() == depth )
{
return group;
}
}
return 0x0;
}
Bool_t
AliMUONVPainter::IsInside(Double_t x, Double_t y) const
{
if (!fContour) return kFALSE;
return fContour->IsInside(x,y);
}
Bool_t
AliMUONVPainter::IsResponder() const
{
return MotherGroup()->IsResponder();
}
AliMUONVPainter*
AliMUONVPainter::Master() const
{
if ( Mother() == 0x0 ) return const_cast<AliMUONVPainter*>(this);
AliMUONVPainter* p = Mother();
while ( p->Mother() )
{
p = p->Mother();
}
return p;
}
void
AliMUONVPainter::Paint(Option_t*)
{
if ( !MotherGroup()->IsVisible() ) return;
if ( MotherGroup()->IsPlotter() )
{
PaintArea(*(MotherGroup()->Data()),
MotherGroup()->DataIndex(),
MotherGroup()->DataMin(),
MotherGroup()->DataMax());
}
if ( MotherGroup()->IsOutlined() )
{
PaintOutline();
}
if ( IsExcluded() )
{
AliMUONContourPainter::Paint(*fContour,1,1,2);
}
}
TString
AliMUONVPainter::Describe(const AliMUONVTrackerData&, Int_t, Double_t, Double_t)
{
AliError(Form("%s : implement me",GetName()));
return "";
}
void
AliMUONVPainter::PaintArea(const AliMUONVTrackerData&, Int_t, Double_t, Double_t)
{
AliError(Form("%s : implement me",GetName()));
return;
}
void
AliMUONVPainter::PaintOutline(Int_t color, Int_t width, Double_t , Double_t )
{
Int_t c = color >= 0 ? color : GetLineColor();
Int_t w = width >= 0 ? width : GetLineWidth();
AliMUONContourPainter::Paint(*fContour,c,w);
}
void
AliMUONVPainter::PixelToPad(Int_t px, Int_t py, Double_t& x, Double_t& y)
{
x = gPad->PadtoX(gPad->AbsPixeltoX(px));
y = gPad->PadtoY(gPad->AbsPixeltoY(py));
}
void
AliMUONVPainter::Print(Option_t* opt) const
{
for ( Int_t i = 0; i < Depth()*4; ++i )
{
cout << " ";
}
if ( !IsValid() ) cout << "!!!INVALID!!!" << endl;
cout << Form("%p Name %s Depth %d ContourName %s ID=(%d,%d)",
this,GetName(),Depth(),ContourName().Data(),ID0(),ID1());
if ( fResponderGroup )
{
cout << Form(" Responder group %p %s",fResponderGroup,fResponderGroup->Type());
}
if ( fPlotterGroup )
{
cout << Form(" Plotter group %p %s",fPlotterGroup,fPlotterGroup->Type());
}
if ( Mother() )
{
cout << Form(" Mother %p %s",Mother(),Mother()->GetName());
}
if ( MotherGroup() )
{
cout << Form(" Group %p %s ",MotherGroup(),MotherGroup()->Type());
}
if ( fChildren )
{
cout << Form(" %d children",fChildren->GetLast()+1);
}
cout << endl;
TString sopt(opt);
sopt.ToUpper();
if ( fChildren && ( sopt == "FULL" || sopt == "CHILD" ) )
{
TIter next(fChildren);
AliMUONVPainter* painter;
while ( ( painter = static_cast<AliMUONVPainter*>(next()) ) )
{
painter->Print(opt);
}
}
if ( fPainterGroups && ( sopt == "FULL" || sopt == "GROUP" ) )
{
TIter next(fPainterGroups);
TObjString* groupName;
while ( ( groupName = static_cast<TObjString*>(next()) ) )
{
AliMUONPainterGroup* group = Group(groupName->String().Data());
group->Print(opt);
}
}
}
void
AliMUONVPainter::SetAttributes(const AliMUONAttPainter& attributes)
{
fAttributes = attributes;
}
void
AliMUONVPainter::SetContour(AliMUONContour* contour)
{
if (!contour)
{
AliError(Form("Setting a null contour for painter %s : bad idea !",PathName().Data()));
}
fContour = contour;
}
void
AliMUONVPainter::SetData(const char* pattern, AliMUONVTrackerData* data,
Int_t dataIndex)
{
if ( !fPainterGroups )
{
CreateGroups();
}
if ( data )
{
data->Connect("Destroyed()",ClassName(),this,Form("SetData(=\"%s\",0x0,-1)",pattern));
}
TIter next(fPainterGroups);
TObjString* str;
fPlotterGroup = 0x0;
while ( ( str = static_cast<TObjString*>(next()) ) )
{
AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(str));
if ( group->Matches(pattern) )
{
group->SetData(data,dataIndex);
if ( data )
{
fPlotterGroup = group;
}
}
else
{
group->SetData(0x0,-1);
}
}
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) )
{
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
{
delete fHistogram;
fHistogram = 0x0;
DrawInternalHistogramClone(dim);
}
void
AliMUONVPainter::DrawInternalHistogramClone(Int_t dim) const
{
fHistogram = AliMUONTrackerDataHistogrammer::CreateHisto(*this,-1,dim);
if (fHistogram)
{
new TCanvas();
fHistogram->Draw();
}
}
void
AliMUONVPainter::DrawHistogram(Double_t* values) const
{
delete fHistogram;
fHistogram = 0x0;
DrawHistogramClone(values);
}
void
AliMUONVPainter::DrawHistogramClone(Double_t*) const
{
fHistogram = AliMUONTrackerDataHistogrammer::CreateHisto(*this,0,-1);
if (fHistogram)
{
new TCanvas();
fHistogram->Draw();
}
}
void
AliMUONVPainter::FillManuList(TObjArray& manuList) const
{
TIter next(Children());
AliMUONVPainter* p;
while ( ( p = static_cast<AliMUONVPainter*>(next()) ) )
{
p->FillManuList(manuList);
}
}
void
AliMUONVPainter::SetLine(Int_t depth, Int_t lineColor, Int_t lineWidth)
{
AliMUONPainterGroup* group = Group(depth);
if ( group )
{
group->SetLine(lineColor,lineWidth);
}
}
void
AliMUONVPainter::SetMother(AliMUONVPainter* painter)
{
fMother = painter;
}
void
AliMUONVPainter::SetOutlined(const char* pattern, Bool_t flag)
{
AliDebug(1,Form("pattern=%s flag=%d",pattern,flag));
if (!fPainterGroups)
{
CreateGroups();
}
TIter next(fPainterGroups);
TObjString* str;
while ( ( str = static_cast<TObjString*>(next()) ) )
{
AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(str));
if ( group->Matches(pattern) )
{
group->SetOutlined(flag);
}
}
}
void
AliMUONVPainter::SetResponder(const char* pattern)
{
AliDebug(1,Form("pattern=%s",pattern));
if (!fPainterGroups)
{
CreateGroups();
}
TIter next(fPainterGroups);
TObjString* str;
fResponderGroup = 0x0;
while ( ( str = static_cast<TObjString*>(next()) ) )
{
AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(str));
if ( group->Matches(pattern) )
{
AliDebug(1,Form("group %s is matching pattern %s : setting to responder",
group->Type(),pattern));
group->SetResponder(kTRUE);
fResponderGroup = group;
}
else
{
group->SetResponder(kFALSE);
}
}
}
void
AliMUONVPainter::SetResponder(Int_t depth)
{
AliDebug(1,Form("depth=%d",depth));
if (!fPainterGroups)
{
CreateGroups();
}
TIter next(fPainterGroups);
TObjString* str;
fResponderGroup = 0x0;
while ( ( str = static_cast<TObjString*>(next()) ) )
{
AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(str));
if ( group->Depth() == depth )
{
AliDebug(1,Form("group %s has correct depth = %d, using as responder",
group->Type(),depth));
group->SetResponder(kTRUE);
fResponderGroup = group;
break;
}
else
{
group->SetResponder(kFALSE);
}
}
}
void
AliMUONVPainter::SetVisible(const char* pattern, Bool_t flag)
{
AliDebug(1,Form("pattern=%s flag=%d",pattern,flag));
if (!fPainterGroups)
{
CreateGroups();
}
TIter next(fPainterGroups);
TObjString* str;
while ( ( str = static_cast<TObjString*>(next()) ) )
{
AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(str));
if ( group->Matches(pattern) )
{
group->SetVisible(flag);
}
}
}
void
AliMUONVPainter::UpdateGroupsFrom(const AliMUONVPainter& painter)
{
delete fPainterGroups;
fPainterGroups = 0x0;
CreateGroups();
if ( painter.ResponderGroup() )
{
SetResponder(painter.ResponderGroup()->Type());
}
if ( painter.PlotterGroup() )
{
SetData(painter.PlotterGroup()->Type(),
painter.PlotterGroup()->Data(),
painter.PlotterGroup()->DataIndex());
PlotterGroup()->SetDataRange(painter.PlotterGroup()->DataMin(),
painter.PlotterGroup()->DataMax());
}
TObjArray types;
painter.GetTypes(types);
TIter next(&types);
TObjString* groupName;
while ( ( groupName = static_cast<TObjString*>(next()) ) )
{
AliMUONPainterGroup* group = painter.Group(groupName->String().Data());
if ( group->IsVisible() )
{
SetVisible(group->Type(),kTRUE);
}
else
{
SetVisible(group->Type(),kFALSE);
}
if ( group->IsOutlined() )
{
SetOutlined(group->Type(),kTRUE);
}
else
{
SetOutlined(group->Type(),kFALSE);
}
SetLine(group->Depth(),group->GetLineColor(),group->GetLineWidth());
}
}
void
AliMUONVPainter::Include()
{
AliInfo(GetName());
WriteIROC(1);
}
void
AliMUONVPainter::GetIROCManuList(TObjArray& manuList)
{
FillManuList(manuList);
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)
{
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()
{
AliInfo(GetName());
WriteIROC(0.0);
}
AliMUONVTrackerData*
AliMUONVPainter::InteractiveReadOutConfig() const
{
return AliMUONPainterDataRegistry::Instance()->InteractiveReadOutConfig();
}
AliMUONVPainter*
AliMUONVPainter::CreatePainter(const char* className,
const AliMUONAttPainter& att,
Int_t id1, Int_t id2)
{
TClass* c = TClass::GetClass(className);
if (!c)
{
AliErrorClass(Form("Cannot get class %s",className));
return 0x0;
}
Int_t n(0);
TMethodCall call;
call.InitWithPrototype(c,className,"AliMUONAttPainter&,Int_t");
if (call.IsValid()) n = 1;
else
{
call.InitWithPrototype(c,className,"AliMUONAttPainter&,Int_t,Int_t");
if ( call.IsValid() ) n = 2;
}
Long_t returnLong(0x0);
if ( n ==1 )
{
Long_t params[] = { (Long_t)(&att), (Long_t)(id1) };
call.SetParamPtrs((void*)(params));
call.Execute((void*)(0x0),returnLong);
}
else if ( n == 2 )
{
Long_t params[] = { (Long_t)(&att), (Long_t)(id1), (Long_t)(id2) };
call.SetParamPtrs((void*)(params));
call.Execute((void*)(0x0),returnLong);
}
if (!returnLong)
{
AliErrorClass(Form("Cannot create a painter of class %s",className));
}
AliMUONVPainter* rv = reinterpret_cast<AliMUONVPainter*> (returnLong);
if (!rv->IsValid())
{
AliErrorClass(Form("Painter of class %s is not valid",className));
delete rv;
rv = 0x0;
}
return rv;
}
void
AliMUONVPainter::PaintArea(Int_t fillColor)
{
AliMUONContourPainter::Paint(*(Contour()),-1,-1,fillColor);
}