27 #include "TPaveLabel.h"
28 #include <Riostream.h>
31 #include <TObjArray.h>
32 #include <TObjString.h>
34 #include <TVirtualPad.h>
62 fPainters->SetOwner(kTRUE);
65 fAttributes.SetSingle(kFALSE);
95 for ( Int_t i = 0; i <
Size(); ++i )
109 clone->
Adopt(newPainter);
113 AliError(Form(
"Failed to create painter of class %s ID0 %d ID1 %d",
114 oldPainter->ClassName(),
129 Double_t dataMin(FLT_MAX);
130 Double_t dataMax(-FLT_MAX);
131 Bool_t atLeastOnePlotter(kFALSE);
133 for ( Int_t i = 0; i <
Size(); ++i )
138 Double_t min(FLT_MAX);
139 Double_t max(-FLT_MAX);
143 atLeastOnePlotter = kTRUE;
147 dataMin = TMath::Min(min,dataMin);
148 dataMax = TMath::Max(max,dataMax);
153 if ( dataMin > dataMax && atLeastOnePlotter )
155 AliError(Form(
"data min %e > max %e : setting both to 0.0",
157 dataMin = dataMax = 0.0;
166 void* destObject,
const char* destMethod)
170 for ( Int_t i = 0; i <
Size(); ++i )
172 Painter(i)->Connect(sourceMethod,destClassName,destObject,destMethod);
199 Int_t mw = ( w <= 0 ? TMath::Nint(gClient->GetDisplayWidth()*0.9) : w );
200 Int_t mh = ( h <= 0 ? TMath::Nint(gClient->GetDisplayHeight()*0.9) : h );
204 TCanvas* d =
new TCanvas(name.Data(),name.Data(),x,y,mw,mh);
206 TVirtualPad* pTitle =
new TPad(Form(
"%s-title",name.Data()),Form(
"%s-title",name.Data()),0,0.9,1.0,0.99);
212 TPaveLabel* text =
new TPaveLabel(0,0,1,1,
"");
213 text->SetFillStyle(0);
214 text->SetFillColor(0);
215 text->SetTextColor(4);
216 text->SetBorderSize(0);
218 text->SetLabel(name.Data());
224 TVirtualPad* pMatrix =
new TPad(Form(
"%s-matrix",name.Data()),Form(
"%s-matrix",name.Data()),0,0,0.9,0.89);
233 TVirtualPad* pColor =
new TPad(Form(
"%s-color",name.Data()),Form(
"%s-color",name.Data()),0.91,0.01,0.99,0.89);
235 pColor->Range(0,0,1,1);
241 Int_t ndivisions(20);
243 Double_t rangeXmin(0.1);
244 Double_t rangeXmax(0.9);
253 Double_t step = (max-min)/ndivisions;
255 Double_t hsize = 1.0/(ndivisions+2);
259 for ( Int_t i = -1; i < ndivisions+1; ++i )
261 Double_t value = max - (min + step*i);
265 Bool_t limit(kFALSE);
270 Double_t yvalue(0.0);
278 else if ( i == ndivisions )
287 if ( TMath::Abs(yvalue) < 1E5 )
289 label = Form(
"%s %7.2f",sign.Data(),yvalue);
293 label = Form(
"%s %e",sign.Data(),yvalue);
297 TPaveLabel* box =
new TPaveLabel(rangeXmin,TMath::Max(0.001,ypos-hsize),rangeXmax,ypos,label.Data(),
"");
301 box->SetFillColor(color);
302 box->SetTextColor( i == -1 ? 0 : 1 );
303 box->SetBorderSize(1);
304 box->SetLineColor(1);
308 d->SetEditable(kFALSE);
322 for ( Int_t i = 0; i <
Size(); ++i )
330 dataMin = TMath::Min(dataMin,g->
DataMin());
331 dataMax = TMath::Max(dataMax,g->
DataMax());
343 types.SetOwner(kTRUE);
346 for ( Int_t i = 0; i <
Size(); ++i )
353 while ( ( o = next() ) )
355 if ( ! types.FindObject(o) )
357 types.AddLast(o->Clone());
370 return ( group ? group->
Data() : 0x0 );
379 return ( group ? group->
Type() :
"" );
388 return ( group ? group->
DataIndex() : -1 );
399 gROOT->MakeDefCanvas();
402 TVirtualPad* pad = gPad;
404 gPad->Divide(
Nx(),
Ny());
406 for ( Int_t i = 0; i <
Size(); ++i )
421 if ( strlen(whatname) > 0 )
423 return Form(
"%s-%s-%s",whatname,basename,att.
GetName());
427 return Form(
"nodata-%s-%s",basename,att.
GetName());
437 if ( index <= fPainters->GetLast() )
460 for ( Int_t i = 0; i <
Size(); ++i )
463 painter->
SetData(pattern,d,indexInData);
504 for ( Int_t i = 0; i <
Size(); ++i )
565 for ( Int_t i = 0; i <
Size(); ++i )
576 for ( Int_t i = 0; i <
Size(); ++i )
596 Bool_t cathode0(kFALSE);
597 Bool_t cathode1(kFALSE);
598 Bool_t bending(kFALSE);
599 Bool_t nonbending(kFALSE);
600 Bool_t front(kFALSE);
602 Bool_t cathplaneexclusive(kFALSE);
603 Bool_t cathplanedisabled(kFALSE);
605 for ( Int_t i = 0; i <
Size(); ++i )
646 for ( Int_t i = 0; i <
Size() && a.
IsValid(); ++i )
Int_t ColorFromValue(Double_t value, Double_t min, Double_t max) const
static AliMUONPainterHelper * Instance()
TObjArray * fPainters
painters in that matrix
Bool_t IsNonBendingPlane() const
Whether we are representing non bending plane.
virtual const char * GetName() const
Get matrix name.
Int_t Nx() const
Number of painters to arrange in x-direction.
void SetOutlined(const char *pattern, Bool_t flag)
Int_t DataIndex() const
Return the index within the data.
virtual void Draw(Option_t *opt="")
Bool_t IsPlaneDefined() const
Whether we are defined by plane.
void Draw(Option_t *opt="")
void SetResponder(const char *pattern)
virtual void SetResponder(const char *pattern)
Bool_t IsCathodeDefined() const
Whether we are defined by cathode.
Bool_t IsBendingPlane() const
Whether we are representing bending plane.
static std::string NameIt(const char *what, const char *basename, const AliMUONAttPainter &att)
void SetViewPoint(Bool_t front, Bool_t back)
void SetCathode(Bool_t cath0, Bool_t cath1)
void GetTypes(TObjArray &types) const
Bool_t IsCathodeAndPlaneDisabled() const
Whether cathode & plane are disabled.
virtual TString DimensionName(Int_t dim) const =0
Get the name of a given (internal) dimension.
Int_t ID0() const
Get our first ID.
void SetDataRange(Double_t min, Double_t max)
Set the data range.
static AliMUONVPainter * CreatePainter(const char *className, const AliMUONAttPainter &att, Int_t id1, Int_t id2)
Bool_t IsBackView() const
Whether the painter is to be represented from back (as seen from IP)
TString fBasename
base name of that matrix
AliMUONVTrackerData * Data() const
Return the data we are plotting.
void Connect(const char *sourceMethod, const char *destClassName, void *destObject, const char *destMethod)
void ComputeDataRange()
Compute the data range for this matrix.
static TString Descriptor2Ranges(const char *dataSourceDescriptor)
TCanvas * CreateCanvas(Int_t x=0, Int_t y=0, Int_t w=-1, Int_t h=-1)
const AliMUONAttPainter & Attributes() const
Get our attributes.
const char * Type() const
Our type.
virtual AliMUONAttPainter Validate(const AliMUONAttPainter &attributes) const
Convert attributes so they are valid ones for us.
Int_t ID1() const
Get our second ID.
Base class for a graphical object representing some part of the MUON tracking system.
Bool_t IsCathodeAndPlaneMutuallyExclusive() const
Whether we can select both cathode and plane.
void SetDimensionRange(const char *dataSourceName, const char *dimensionName, Double_t xmin, Double_t xmax)
const char * Basename() const
Base name (short name)
AliMUONPainterMatrix * Clone(const AliMUONAttPainter &attributes) const
void SetCathodeAndPlaneDisabled(Bool_t value)
void ComputeDataRange(Double_t &dataMin, Double_t &dataMax)
void SetData(const char *pattern, AliMUONVTrackerData *d, Int_t indexInData)
Bool_t IsCathode1() const
Whether we are representing cathode 1.
virtual const char * GetName() const
Return our name.
TString DataSourceDescriptor(const char *dataSourceName) const
AliMUONVPainter * Master() const
TString fWhatname
data name
virtual ~AliMUONPainterMatrix()
void GetTypes(TObjArray &types) const
void GetDataRange(Double_t &dataMin, Double_t &dataMax) const
Get the data range for this matrix.
AliMUONPainterMatrix(const char *basename="", Int_t nx=1, Int_t ny=1)
AliMUONAttPainter Validate(const AliMUONAttPainter &att) const
Normalize attributes.
static Bool_t Ranges2DimensionRange(const char *ranges, const char *dimensionName, Double_t &xmin, Double_t &xmax)
AliMUONVTrackerData * Data() const
void Adopt(AliMUONVPainter *painter)
Adopt a painter in this matrix.
Bool_t IsFrontView() const
Whether the painter is to be represented from front (as seen from IP)
Bool_t IsValid() const
Whether we are valid.
Bool_t IsCathode0() const
Whether we are representing cathode 0.
AliMUONPainterEnv * Env()
Return the environment.
void SetDataRange(Double_t min, Double_t max)
Force a given data range for all painter groups belonging to this matrix.
void UpdateGroupsFrom(const AliMUONVPainter &painter)
Basic attributes shared by all painters.
Double_t DataMin() const
Min data we are plotting.
void SetCathodeAndPlaneMutuallyExclusive(Bool_t value)
void SetData(const char *pattern, AliMUONVTrackerData *data, Int_t dataIndex)
A group of AliMUONVPainter.
void SetPlane(Bool_t bending, Bool_t nonBending)
AliMUONPainterGroup * PlotterGroup() const
Return the plotter group.
Int_t Ny() const
Number of painters to arrange in y-direction.
Base class for MUON data that can be presented at different levels in the hierarchy of the MUON syste...
AliMUONVPainter * Painter(Int_t index) const
Get a painter.
A matrix of AliMUONVPainter.
void SetOutlined(const char *pattern, Bool_t value)
Double_t DataMax() const
Max data we are plotting.
Int_t Size() const
Number of painters (should be <= Nx*Ny)
Int_t fNy
number of columns
void Print(Option_t *opt="") const
Printout.
TString DataPattern() const
AliMUONAttPainter fAttributes
attributes of our painter(s)