1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 #include "AliMUONVPainter.h"
20 #include "AliCodeTimer.h"
22 #include "AliMUONObjectPair.h"
23 #include "AliMUONPainterContour.h"
24 #include "AliMUONPainterGroup.h"
25 #include "AliMUONPainterHelper.h"
26 #include "AliMUONTrackerDataHistogrammer.h"
27 #include "AliMUONVTrackerData.h"
28 #include <Riostream.h>
31 #include <TClassMenuItem.h>
36 #include <TMethodCall.h>
37 #include <TObjArray.h>
38 #include <TObjString.h>
40 #include <TVirtualPad.h>
44 /// \class AliMUONVPainter
46 /// Base class for a graphical object representing some part of the
47 /// MUON tracking system.
49 /// A painter is a graphical representation of some part (e.g. detection element,
50 /// full chamber, one manu, etc...) of the MUON tracking system.
52 /// A painter is a double fold hierarchical structure.
54 /// First, a painter is part of a tree (mother->childrens), that describe
55 /// the natural organization of the spectrometer. For instance, a chamber
56 /// painter has children that are the detection element, the detection elements
57 /// themselves contain manus, which in turn contain channels.
59 /// Second, a painter contains a number of "painter groups" (see AliMUONPainterGroup).
60 /// A group gather all the painters of the same type,
61 /// where the type is a string identifying which part of system we're dealing
62 /// with (chamber, DE, manu, etc...)
64 /// The groups are there to ease the manipulation of similar painters, e.g. if
65 /// we want to hide all detection elements, we hide the "detection element group"
66 /// Some special groups are the responder and the plotter groups. The responder
67 /// group is the group which is currently responding to mouse events.
68 /// The plotter group is the group which is supposed to represent some data.
70 /// There are two ways to represent the painter on screen. In any case, we can
71 /// outline the painter (i.e. draw its borders) (see AliMUONVPainter::PaintOutline).
72 /// In the cases where the painter is attached to some data source (i.e. it is
73 /// used to represent some data about its type, e.g. the mean charge on some manu),
74 /// we can draw the full area of the contour, using some color (see
75 /// AliMUONVPainter::PaintArea).
77 /// Note that you can outline several types of painters (aka groups) at the same
78 /// time, but you cannot plot several groups at the same time.
80 /// Painters are TQObject so they can emit signals.
82 /// Currently emitted signal are :
84 /// void Clicked(AliMUONVPainter* painter, Double_t*);
85 /// DoubleClicked(AliMUONVPainter* painter, Double_t*);
87 /// to know which and where a painter was (double-) clicked.
89 /// \author Laurent Aphecetche, Subatech
92 ClassImp(AliMUONVPainter)
95 //_____________________________________________________________________________
96 AliMUONVPainter::AliMUONVPainter(const char* type)
107 fResponderGroup(0x0),
121 //_____________________________________________________________________________
122 AliMUONVPainter::AliMUONVPainter(const AliMUONVPainter& rhs)
133 fResponderGroup(0x0),
147 //_____________________________________________________________________________
149 AliMUONVPainter::operator=(const AliMUONVPainter& rhs)
151 /// assignment operator
159 //_____________________________________________________________________________
160 AliMUONVPainter::~AliMUONVPainter()
167 //_____________________________________________________________________________
169 AliMUONVPainter::Area() const
171 /// Return the area covered by this painter
174 return fContour->Area();
178 AliWarning("Returning an invalid area, as contour is not defined");
183 //_____________________________________________________________________________
185 AliMUONVPainter::Add(AliMUONVPainter* painter)
187 /// Add a child painter
188 if (!fChildren) fChildren = new TObjArray;
189 assert(painter->Mother()==0x0);
190 fChildren->Add(painter);
191 painter->SetMother(this);
194 //_____________________________________________________________________________
196 AliMUONVPainter::Children() const
198 /// Return the list of childrens
202 //_____________________________________________________________________________
204 AliMUONVPainter::Clicked(AliMUONVPainter* painter, Double_t* values)
206 /// Let our mother emit the signal as clients are probably connected to
207 /// our (grand)mother, not to us
211 Mother()->Clicked(painter,values);
215 Long_t param[] = { (Long_t)painter,(Long_t)values };
217 Emit("Clicked(AliMUONVPainter*,Double_t*)",param);
221 //_____________________________________________________________________________
223 AliMUONVPainter::ShiftClicked(AliMUONVPainter* painter, Double_t* values)
225 /// Let our mother emit the signal as clients are probably connected to
226 /// our (grand)mother, not to us
230 Mother()->ShiftClicked(painter,values);
234 Long_t param[] = { (Long_t)painter,(Long_t)values };
236 Emit("ShiftClicked(AliMUONVPainter*,Double_t*)",param);
240 //_____________________________________________________________________________
242 AliMUONVPainter::ComputeDataRange(const AliMUONVTrackerData&, Int_t,
243 Double_t&, Double_t&) const
245 /// Should compute the min and max of a given data source
246 AliError("Not implemented. Please fixe me");
249 //_____________________________________________________________________________
251 AliMUONVPainter::ContourName() const
253 /// Default implementation of the contour name.
255 TString name(PathName());
258 name += fAttributes.Name();
263 //_____________________________________________________________________________
265 AliMUONVPainter::Copy(TObject& object) const
267 /// Copy this to object.
269 TObject::Copy(object);
271 AliMUONVPainter& painter = static_cast<AliMUONVPainter&>(object);
273 painter.fType = fType;
274 painter.fName = fName;
275 painter.fPathName = fPathName;
277 painter.fMother = 0x0;
278 painter.fContour = fContour;
280 painter.fGroup = 0x0;
281 painter.fResponderGroup = 0x0;
282 painter.fPlotterGroup = 0x0;
284 painter.fBorderFactor = fBorderFactor;
286 painter.fAttributes = fAttributes;
288 painter.fAttributes.SetCathodeAndPlaneDisabled(kFALSE);
292 painter.fLineColor = fLineColor;
293 painter.fLineWidth = fLineWidth;
295 painter.fIsValid = fIsValid;
297 delete painter.fChildren;
298 painter.fChildren = 0x0;
300 painter.fID[0] = fID[0];
301 painter.fID[1] = fID[1];
303 delete painter.fHistogram;
304 painter.fHistogram = 0x0;
306 TIter next(fChildren);
309 while ( ( p = static_cast<AliMUONVPainter*>(next()) ) )
311 painter.Add(static_cast<AliMUONVPainter*>(p->Clone()));
314 painter.UpdateGroupsFrom(*this);
316 object.ResetBit(kCanDelete);
319 //_____________________________________________________________________________
321 AliMUONVPainter::CreateGroup(const char* type, Int_t depth)
323 /// Create a painter group at a given depth
325 if (!fPainterGroups) fPainterGroups = new TMap;
326 TObject* o = fPainterGroups->GetValue(type);
329 AliError(Form("Group %s is already there ! Check this",type));
332 AliMUONPainterGroup* group = new AliMUONPainterGroup(type,depth);
333 fPainterGroups->Add(new TObjString(type),group);
337 //_____________________________________________________________________________
339 AliMUONVPainter::CreateGroups()
341 /// Groups our children into groups
345 AliFatal("Not supposed to create groups for a children");
352 AliMUONVPainter* painter;
354 while ( ( painter = static_cast<AliMUONVPainter*>(next()) ) )
356 AliMUONPainterGroup* group = Group(painter->Type());
359 group = CreateGroup(painter->Type(),painter->Depth());
365 //_____________________________________________________________________________
367 AliMUONVPainter::Detach() const
369 /// Make this a new top painter (i.e. a master)
371 AliDebug(1,Form("Detaching %s",GetName()));
373 AliMUONVPainter* p = static_cast<AliMUONVPainter*>(Clone());
375 AliMUONVPainter* master = Master();
379 AliDebug(1,Form("UpdatingGroups of the detached painter %s from its master %s",
380 p->GetName(),master->GetName()));
381 p->UpdateGroupsFrom(*master);
387 //_____________________________________________________________________________
389 AliMUONVPainter::Depth() const
391 /// Return our depth in the hierarchy
395 return Mother()->Depth() + 1;
403 //_____________________________________________________________________________
405 AliMUONVPainter::DistancetoPrimitive(Int_t px, Int_t py)
407 /// See TObject::DistancetoPrimitive
409 static const Int_t kBigValue = 999999;
411 if (!gPad) return kBigValue;
415 AliMUONVPainter* painter = GetPainter(px,py,x,y);
417 x=y=0.0; // to avoid compiler warning
419 if ( painter == this) return 0;
424 //_____________________________________________________________________________
426 AliMUONVPainter::DoubleClicked(AliMUONVPainter*, Double_t*)
428 /// Should emit the DoubleClicked signal (if I knew how to detect those events...)
430 AliWarning("Please implement me !");
434 // // let our top mother emit the signal as clients are probably connected to
435 // // our mother, not to us
436 // Top()->DoubleClicked(painter,values);
440 // Long_t param[] = { (Long_t)painter,(Long_t)values };
442 // Emit("DoubleClicked(AliMUONVPainter*,Double_t*)",param);
446 //_____________________________________________________________________________
448 AliMUONVPainter::Draw(Option_t* opt)
450 /// Append ourselves to the current pad
454 gROOT->MakeDefCanvas();
457 Bool_t kMustSetRange(kFALSE);
462 if (sopt.Contains("R") ) kMustSetRange=kTRUE;
466 Double_t x1,y1,x2,y2;
467 GetBoundingBox(x1,y1,x2,y2);
468 if ( gPad) gPad->Range(x1,y1,x2,y2);
471 if ( !fMother && !fPainterGroups )
476 TIter next(fChildren);
477 AliMUONVPainter* painter;
478 while ( ( painter = static_cast<AliMUONVPainter*>(next()) ) )
488 //_____________________________________________________________________________
490 AliMUONVPainter::ExecuteEvent(Int_t event, Int_t px, Int_t py)
492 /// Handle graphics events
496 AliMUONVPainter* painter = GetPainter(px,py,x,y);
498 if ( painter == this )
500 Double_t values[] = { x,y };
505 ShiftClicked(this,values);
508 Clicked(this,values);
511 //the following statement is required against other loop executions before returning (depending on the time between the clicks)
512 gPad->GetCanvas()->HandleInput((EEventType)-1,0,0);
513 DoubleClicked(this,values);
519 //_____________________________________________________________________________
521 AliMUONVPainter::FlatList(TList& list)
523 /// Make a flat list of our children (and ourselves)
525 TIter next(fChildren);
526 AliMUONVPainter* painter;
527 while ( ( painter = static_cast<AliMUONVPainter*>(next())))
529 painter->FlatList(list);
535 //_____________________________________________________________________________
537 AliMUONVPainter::GetBoundingBox(Double_t& x1, Double_t& y1,
538 Double_t& x2, Double_t& y2) const
540 /// Get the bounding box = our area
541 AliMpArea area(Area().Position(),Area().Dimensions()*fBorderFactor);
543 x1 = area.LeftBorder();
544 y1 = area.DownBorder();
545 x2 = area.RightBorder();
546 y2 = area.UpBorder();
549 //_____________________________________________________________________________
551 AliMUONVPainter::GetObjectInfo(Int_t, Int_t) const
553 /// See TObject::GetObjectInfo
554 return const_cast<char*>(GetName());
557 //_____________________________________________________________________________
559 AliMUONVPainter::GetPainter(Int_t px, Int_t py, Double_t& x, Double_t& y) const
561 /// Get the responder painter at integer position (px,py), and get back its
562 /// absolute position (x,y)
564 PixelToPad(px,py,x,y);
566 if ( !IsInside(x,y) ) return 0x0;
568 if ( fGroup->IsResponder() ) return const_cast<AliMUONVPainter*>(this);
572 TIter next(fChildren);
573 AliMUONVPainter* painter;
575 while ( ( painter = static_cast<AliMUONVPainter*>(next()) ) )
577 AliMUONVPainter* p = painter->GetPainter(px,py,x,y);
585 //_____________________________________________________________________________
587 AliMUONVPainter::GetTypes(TObjArray& types) const
589 /// Get the list of types (as a TObjArray of TObjString)
590 /// of our hierarchy, sorted alphabetically
592 types.SetOwner(kTRUE);
596 tmp.SetOwner(kFALSE);
598 TIter next(fPainterGroups);
601 while ( ( str = static_cast<TObjString*>(next()) ) )
603 AliMUONPainterGroup* group = Group(str->String().Data());
609 Int_t n = tmp.GetLast()+1;
611 Int_t* index = new Int_t[n];
613 Int_t* a = new Int_t[n];
615 for ( Int_t i = 0; i < n; ++i )
617 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(tmp.At(i));
618 a[i] = group->Depth();
621 TMath::Sort(n,a,index,kFALSE);
623 for ( Int_t i = 0; i < n; ++i )
625 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(tmp.At(index[i]));
626 types.AddLast(new TObjString(group->Type()));
633 //_____________________________________________________________________________
635 AliMUONVPainter::Group(const char* type) const
637 /// Returns a group of a given type
638 if (!fPainterGroups) return 0x0;
639 return static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(type));
642 //_____________________________________________________________________________
644 AliMUONVPainter::Group(Int_t depth) const
646 /// Returns a group of a given depth
647 if (!fPainterGroups) return 0x0;
648 TIter next(fPainterGroups);
649 TObjString* groupName;
650 while ( ( groupName = static_cast<TObjString*>(next()) ) )
652 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>
653 (fPainterGroups->GetValue(groupName->String().Data()));
654 if ( group->Depth() == depth )
662 //_____________________________________________________________________________
664 AliMUONVPainter::IsInside(Double_t x, Double_t y) const
666 /// Whether point (x,y) is inside our contour
667 if (!fContour) return kFALSE;
668 return fContour->IsInside(x,y);
671 //_____________________________________________________________________________
673 AliMUONVPainter::IsResponder() const
675 /// Whether we're responding to mouse events
676 return MotherGroup()->IsResponder();
679 //_____________________________________________________________________________
681 AliMUONVPainter::Master() const
683 /// Return the top of the hierarchy
685 /// if we get no mother, we are the master
687 if ( Mother() == 0x0 ) return const_cast<AliMUONVPainter*>(this);
689 AliMUONVPainter* p = Mother();
691 while ( p->Mother() )
699 //_____________________________________________________________________________
701 AliMUONVPainter::Paint(Option_t*)
703 /// Paint ourselves of screen
704 /// If we have some data (i.e. we're belonging to the plotter group)
705 /// we use PaintArea.
706 /// And if must be outlined, then we do that too.
708 if ( !MotherGroup()->IsVisible() ) return;
710 if ( MotherGroup()->IsPlotter() )
712 PaintArea(*(MotherGroup()->Data()),
713 MotherGroup()->DataIndex(),
714 MotherGroup()->DataMin(),
715 MotherGroup()->DataMax());
718 if ( MotherGroup()->IsOutlined() )
724 //_____________________________________________________________________________
726 AliMUONVPainter::Describe(const AliMUONVTrackerData&, Int_t, Double_t, Double_t)
728 /// Default implementation (must be overriden)
729 AliError(Form("%s : implement me",GetName()));
733 //_____________________________________________________________________________
735 AliMUONVPainter::PaintArea(const AliMUONVTrackerData&, Int_t, Double_t, Double_t)
737 /// Default implementation (must be overriden)
738 AliError(Form("%s : implement me",GetName()));
741 //_____________________________________________________________________________
743 AliMUONVPainter::PaintOutline(Int_t color, Int_t width, Double_t /*x*/, Double_t /*y*/)
745 /// Default implementation is simply a drawing of the contour lines,
746 /// not using the optional (x,y)
747 Int_t c = color >= 0 ? color : GetLineColor();
748 Int_t w = width >= 0 ? width : GetLineWidth();
750 fContour->PaintOutline(c,w);
753 //_____________________________________________________________________________
755 AliMUONVPainter::PixelToPad(Int_t px, Int_t py, Double_t& x, Double_t& y)
757 /// convert (px,py) into pad position (x,y)
759 x = gPad->PadtoX(gPad->AbsPixeltoX(px));
760 y = gPad->PadtoY(gPad->AbsPixeltoY(py));
763 //_____________________________________________________________________________
765 AliMUONVPainter::Print(Option_t* opt) const
768 for ( Int_t i = 0; i < Depth()*4; ++i )
773 if ( !IsValid() ) cout << "!!!INVALID!!!" << endl;
775 cout << Form("%p Name %s Depth %d ContourName %s ID=(%d,%d)",
776 this,GetName(),Depth(),ContourName().Data(),ID0(),ID1());
778 if ( fResponderGroup )
780 cout << Form(" Responder group %p %s",fResponderGroup,fResponderGroup->Type());
784 cout << Form(" Plotter group %p %s",fPlotterGroup,fPlotterGroup->Type());
788 cout << Form(" Mother %p %s",Mother(),Mother()->GetName());
792 cout << Form(" Group %p %s ",MotherGroup(),MotherGroup()->Type());
797 cout << Form(" %d children",fChildren->GetLast()+1);
805 if ( fChildren && ( sopt == "FULL" || sopt == "CHILD" ) )
807 TIter next(fChildren);
808 AliMUONVPainter* painter;
809 while ( ( painter = static_cast<AliMUONVPainter*>(next()) ) )
815 if ( fPainterGroups && ( sopt == "FULL" || sopt == "GROUP" ) )
817 TIter next(fPainterGroups);
818 TObjString* groupName;
819 while ( ( groupName = static_cast<TObjString*>(next()) ) )
821 AliMUONPainterGroup* group = Group(groupName->String().Data());
827 //_____________________________________________________________________________
829 AliMUONVPainter::SetAttributes(const AliMUONAttPainter& attributes)
831 /// Set our attributes
832 fAttributes = attributes;
835 //_____________________________________________________________________________
837 AliMUONVPainter::SetContour(AliMUONPainterContour* contour)
842 AliError(Form("Setting a null contour for painter %s : bad idea !",PathName().Data()));
847 //_____________________________________________________________________________
849 AliMUONVPainter::SetData(const char* pattern, AliMUONVTrackerData* data,
852 /// Tell all painters which type matches pattern that they should
853 /// monitor a given data source
855 if ( !fPainterGroups )
862 data->Connect("Destroyed()",ClassName(),this,Form("SetData(=\"%s\",0x0,-1)",pattern));
865 TIter next(fPainterGroups);
870 while ( ( str = static_cast<TObjString*>(next()) ) )
872 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(str));
874 if ( group->Matches(pattern) )
876 group->SetData(data,dataIndex);
879 fPlotterGroup = group;
884 group->SetData(0x0,-1);
888 // Update context menus
895 AliMUONPainterGroup* group = Master()->PlotterGroup();
897 while ( ( p = static_cast<AliMUONVPainter*>(pnext()) ) )
899 TList* l = p->IsA()->GetMenuList();
906 Int_t dim = group->Data()->InternalToExternal(group->DataIndex());
907 if ( dim < group->Data()->ExternalDimension() )
909 if ( data && data->IsHistogrammed(dim) )
911 // Add histo drawing to the popup menu
912 TClassMenuItem* n = new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
913 "Draw histogram","DrawHistogram0",p,"",-1,kTRUE);
916 n = new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
917 "Draw histogram clone","DrawHistogramClone0",p,"",-1,kTRUE);
923 for ( Int_t i = 0; i < data->ExternalDimension()*2; ++i )
925 TClassMenuItem* n = new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
926 Form("Draw %s clone",data->DimensionName(i).Data()),
927 Form("DrawInternalHistogramClone%d",i),p,"",-1,kTRUE);
934 //_____________________________________________________________________________
936 AliMUONVPainter::DrawInternalHistogram(Int_t dim) const
938 /// Draw histogram (and delete the previous one)
943 DrawInternalHistogramClone(dim);
946 //_____________________________________________________________________________
948 AliMUONVPainter::DrawInternalHistogramClone(Int_t dim) const
952 fHistogram = AliMUONTrackerDataHistogrammer::CreateHisto(*this,-1,dim);
961 //_____________________________________________________________________________
963 AliMUONVPainter::DrawHistogram(Double_t* values) const
965 /// Draw histogram (and delete the previous one)
970 DrawHistogramClone(values);
973 //_____________________________________________________________________________
975 AliMUONVPainter::DrawHistogramClone(Double_t*) const
979 fHistogram = AliMUONTrackerDataHistogrammer::CreateHisto(*this,0,-1);
988 //_____________________________________________________________________________
990 AliMUONVPainter::FillManuList(TObjArray& manuList) const
992 /// Append to manulist
993 /// This is the default implementation, which just calls the FillManuList
994 /// of all our children.
995 /// Some derived class might need to override this in order to exclude
996 /// some children from the fill.
998 TIter next(Children());
1002 while ( ( p = static_cast<AliMUONVPainter*>(next()) ) )
1004 p->FillManuList(manuList);
1008 //_____________________________________________________________________________
1010 AliMUONVPainter::SetLine(Int_t depth, Int_t lineColor, Int_t lineWidth)
1012 /// Set the line attributes of painters at a given depth
1013 AliMUONPainterGroup* group = Group(depth);
1016 group->SetLine(lineColor,lineWidth);
1020 //_____________________________________________________________________________
1022 AliMUONVPainter::SetMother(AliMUONVPainter* painter)
1028 //_____________________________________________________________________________
1030 AliMUONVPainter::SetOutlined(const char* pattern, Bool_t flag)
1032 /// Decide whether or not painters which type matches pattern
1033 /// should be outlined
1035 AliDebug(1,Form("pattern=%s flag=%d",pattern,flag));
1037 if (!fPainterGroups)
1042 TIter next(fPainterGroups);
1045 while ( ( str = static_cast<TObjString*>(next()) ) )
1047 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(str));
1048 if ( group->Matches(pattern) )
1050 group->SetOutlined(flag);
1055 //_____________________________________________________________________________
1057 AliMUONVPainter::SetResponder(const char* pattern)
1059 /// Set the painters matching pattern to be the responder
1061 AliDebug(1,Form("pattern=%s",pattern));
1063 if (!fPainterGroups)
1068 TIter next(fPainterGroups);
1071 fResponderGroup = 0x0;
1073 while ( ( str = static_cast<TObjString*>(next()) ) )
1075 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(str));
1076 if ( group->Matches(pattern) )
1078 AliDebug(1,Form("group %s is matching pattern %s : setting to responder",
1079 group->Type(),pattern));
1080 group->SetResponder(kTRUE);
1081 fResponderGroup = group;
1085 group->SetResponder(kFALSE);
1090 //_____________________________________________________________________________
1092 AliMUONVPainter::SetResponder(Int_t depth)
1094 /// Select as responder the *first* group that has a given depth
1096 AliDebug(1,Form("depth=%d",depth));
1098 if (!fPainterGroups)
1103 TIter next(fPainterGroups);
1106 fResponderGroup = 0x0;
1108 while ( ( str = static_cast<TObjString*>(next()) ) )
1110 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(str));
1111 if ( group->Depth() == depth )
1113 AliDebug(1,Form("group %s has correct depth = %d, using as responder",
1114 group->Type(),depth));
1115 group->SetResponder(kTRUE);
1116 fResponderGroup = group;
1121 group->SetResponder(kFALSE);
1126 //_____________________________________________________________________________
1128 AliMUONVPainter::SetVisible(const char* pattern, Bool_t flag)
1130 /// Decide whether the painters matching pattern should be visible or not
1131 AliDebug(1,Form("pattern=%s flag=%d",pattern,flag));
1133 if (!fPainterGroups)
1138 TIter next(fPainterGroups);
1141 while ( ( str = static_cast<TObjString*>(next()) ) )
1143 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(str));
1144 if ( group->Matches(pattern) )
1146 group->SetVisible(flag);
1151 //_____________________________________________________________________________
1153 AliMUONVPainter::UpdateGroupsFrom(const AliMUONVPainter& painter)
1155 /// (re)Create groups
1156 delete fPainterGroups;
1157 fPainterGroups = 0x0;
1161 // and copy the status of responder, plotter and visible
1162 if ( painter.ResponderGroup() )
1164 SetResponder(painter.ResponderGroup()->Type());
1167 if ( painter.PlotterGroup() )
1169 SetData(painter.PlotterGroup()->Type(),
1170 painter.PlotterGroup()->Data(),
1171 painter.PlotterGroup()->DataIndex());
1172 PlotterGroup()->SetDataRange(painter.PlotterGroup()->DataMin(),
1173 painter.PlotterGroup()->DataMax());
1177 painter.GetTypes(types);
1179 TObjString* groupName;
1181 while ( ( groupName = static_cast<TObjString*>(next()) ) )
1183 AliMUONPainterGroup* group = painter.Group(groupName->String().Data());
1184 if ( group->IsVisible() )
1186 SetVisible(group->Type(),kTRUE);
1190 SetVisible(group->Type(),kFALSE);
1193 if ( group->IsOutlined() )
1195 SetOutlined(group->Type(),kTRUE);
1199 SetOutlined(group->Type(),kFALSE);
1202 SetLine(group->Depth(),group->GetLineColor(),group->GetLineWidth());
1206 //_____________________________________________________________________________
1208 AliMUONVPainter::CreatePainter(const char* className,
1209 const AliMUONAttPainter& att,
1210 Int_t id1, Int_t id2)
1212 /// Create a painter (factory method)
1214 TClass* c = TClass::GetClass(className);
1218 AliErrorClass(Form("Cannot get class %s",className));
1226 call.InitWithPrototype(c,className,"AliMUONAttPainter&,Int_t");
1228 if (call.IsValid()) n = 1;
1231 call.InitWithPrototype(c,className,"AliMUONAttPainter&,Int_t,Int_t");
1233 if ( call.IsValid() ) n = 2;
1236 Long_t returnLong(0x0);
1240 Long_t params[] = { (Long_t)(&att), (Long_t)(id1) };
1241 call.SetParamPtrs((void*)(params));
1242 call.Execute((void*)(0x0),returnLong);
1246 Long_t params[] = { (Long_t)(&att), (Long_t)(id1), (Long_t)(id2) };
1247 call.SetParamPtrs((void*)(params));
1248 call.Execute((void*)(0x0),returnLong);
1253 AliErrorClass(Form("Cannot create a painter of class %s",className));
1256 AliMUONVPainter* rv = reinterpret_cast<AliMUONVPainter*> (returnLong);
1260 AliErrorClass(Form("Painter of class %s is not valid",className));