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"
21 #include "AliMUON2DMap.h"
22 #include "AliMUONCalibParamND.h"
23 #include "AliMUONContour.h"
24 #include "AliMUONContourPainter.h"
25 #include "AliMUONObjectPair.h"
26 #include "AliMUONPainterGroup.h"
27 #include "AliMUONPainterHelper.h"
28 #include "AliMUONPainterDataRegistry.h"
29 #include "AliMUONTrackerDataHistogrammer.h"
30 #include "AliMUONVTrackerData.h"
31 #include "AliMpManuUID.h"
32 #include <Riostream.h>
35 #include <TClassMenuItem.h>
40 #include <TMethodCall.h>
41 #include <TObjArray.h>
42 #include <TObjString.h>
44 #include <TVirtualPad.h>
48 /// \class AliMUONVPainter
50 /// Base class for a graphical object representing some part of the
51 /// MUON tracking system.
53 /// A painter is a graphical representation of some part (e.g. detection element,
54 /// full chamber, one manu, etc...) of the MUON tracking system.
56 /// A painter is a double fold hierarchical structure.
58 /// First, a painter is part of a tree (mother->childrens), that describe
59 /// the natural organization of the spectrometer. For instance, a chamber
60 /// painter has children that are the detection element, the detection elements
61 /// themselves contain manus, which in turn contain channels.
63 /// Second, a painter contains a number of "painter groups" (see AliMUONPainterGroup).
64 /// A group gather all the painters of the same type,
65 /// where the type is a string identifying which part of system we're dealing
66 /// with (chamber, DE, manu, etc...)
68 /// The groups are there to ease the manipulation of similar painters, e.g. if
69 /// we want to hide all detection elements, we hide the "detection element group"
70 /// Some special groups are the responder and the plotter groups. The responder
71 /// group is the group which is currently responding to mouse events.
72 /// The plotter group is the group which is supposed to represent some data.
74 /// There are two ways to represent the painter on screen. In any case, we can
75 /// outline the painter (i.e. draw its borders) (see AliMUONVPainter::PaintOutline).
76 /// In the cases where the painter is attached to some data source (i.e. it is
77 /// used to represent some data about its type, e.g. the mean charge on some manu),
78 /// we can draw the full area of the contour, using some color (see
79 /// AliMUONVPainter::PaintArea).
81 /// Note that you can outline several types of painters (aka groups) at the same
82 /// time, but you cannot plot several groups at the same time.
84 /// Painters are TQObject so they can emit signals.
86 /// Currently emitted signal are :
88 /// void Clicked(AliMUONVPainter* painter, Double_t*);
89 /// DoubleClicked(AliMUONVPainter* painter, Double_t*);
91 /// to know which and where a painter was (double-) clicked.
93 /// \author Laurent Aphecetche, Subatech
98 ClassImp(AliMUONVPainter)
101 //_____________________________________________________________________________
102 AliMUONVPainter::AliMUONVPainter(TRootIOCtor*) : TObject(),
106 fResponderGroup(0x0),
126 //_____________________________________________________________________________
127 AliMUONVPainter::AliMUONVPainter(const char* type)
132 fResponderGroup(0x0),
152 //_____________________________________________________________________________
153 AliMUONVPainter::AliMUONVPainter(const AliMUONVPainter& rhs)
158 fResponderGroup(0x0),
178 //_____________________________________________________________________________
180 AliMUONVPainter::operator=(const AliMUONVPainter& rhs)
182 /// assignment operator
190 //_____________________________________________________________________________
191 AliMUONVPainter::~AliMUONVPainter()
198 //_____________________________________________________________________________
200 AliMUONVPainter::Area() const
202 /// Return the area covered by this painter
205 return fContour->Area();
209 AliWarning("Returning an invalid area, as contour is not defined");
214 //_____________________________________________________________________________
216 AliMUONVPainter::Add(AliMUONVPainter* painter)
218 /// Add a child painter
219 if (!fChildren) fChildren = new TObjArray;
220 assert(painter->Mother()==0x0);
221 fChildren->Add(painter);
222 painter->SetMother(this);
225 //_____________________________________________________________________________
227 AliMUONVPainter::Children() const
229 /// Return the list of childrens
233 //_____________________________________________________________________________
235 AliMUONVPainter::Clicked(AliMUONVPainter* painter, Double_t* values)
237 /// Let our mother emit the signal as clients are probably connected to
238 /// our (grand)mother, not to us
242 Mother()->Clicked(painter,values);
246 Long_t param[] = { (Long_t)painter,(Long_t)values };
248 Emit("Clicked(AliMUONVPainter*,Double_t*)",param);
252 //_____________________________________________________________________________
254 AliMUONVPainter::ShiftClicked(AliMUONVPainter* painter, Double_t* values)
256 /// Let our mother emit the signal as clients are probably connected to
257 /// our (grand)mother, not to us
261 Mother()->ShiftClicked(painter,values);
265 Long_t param[] = { (Long_t)painter,(Long_t)values };
267 Emit("ShiftClicked(AliMUONVPainter*,Double_t*)",param);
271 //_____________________________________________________________________________
273 AliMUONVPainter::ComputeDataRange(const AliMUONVTrackerData&, Int_t,
274 Double_t&, Double_t&) const
276 /// Should compute the min and max of a given data source
277 AliError("Not implemented. Please fixe me");
280 //_____________________________________________________________________________
282 AliMUONVPainter::ContourName() const
284 /// Default implementation of the contour name.
286 TString name(PathName());
289 name += fAttributes.Name();
294 //_____________________________________________________________________________
296 AliMUONVPainter::Copy(TObject& object) const
298 /// Copy this to object.
300 TObject::Copy(object);
302 AliMUONVPainter& painter = static_cast<AliMUONVPainter&>(object);
304 painter.fType = fType;
305 painter.fName = fName;
306 painter.fPathName = fPathName;
308 painter.fMother = 0x0;
309 painter.fContour = fContour;
311 painter.fGroup = 0x0;
312 painter.fResponderGroup = 0x0;
313 painter.fPlotterGroup = 0x0;
315 painter.fBorderFactor = fBorderFactor;
317 painter.fAttributes = fAttributes;
319 painter.fAttributes.SetCathodeAndPlaneDisabled(kFALSE);
323 painter.fLineColor = fLineColor;
324 painter.fLineWidth = fLineWidth;
326 painter.fIsValid = fIsValid;
328 delete painter.fChildren;
329 painter.fChildren = 0x0;
331 painter.fID[0] = fID[0];
332 painter.fID[1] = fID[1];
334 delete painter.fHistogram;
335 painter.fHistogram = 0x0;
337 TIter next(fChildren);
340 while ( ( p = static_cast<AliMUONVPainter*>(next()) ) )
342 painter.Add(static_cast<AliMUONVPainter*>(p->Clone()));
345 painter.UpdateGroupsFrom(*this);
347 object.ResetBit(kCanDelete);
350 //_____________________________________________________________________________
352 AliMUONVPainter::CreateGroup(const char* type, Int_t depth)
354 /// Create a painter group at a given depth
356 if (!fPainterGroups) fPainterGroups = new TMap;
357 TObject* o = fPainterGroups->GetValue(type);
360 AliError(Form("Group %s is already there ! Check this",type));
363 AliMUONPainterGroup* group = new AliMUONPainterGroup(type,depth);
364 fPainterGroups->Add(new TObjString(type),group);
368 //_____________________________________________________________________________
370 AliMUONVPainter::CreateGroups()
372 /// Groups our children into groups
376 AliFatal("Not supposed to create groups for a children");
383 AliMUONVPainter* painter;
385 while ( ( painter = static_cast<AliMUONVPainter*>(next()) ) )
387 AliMUONPainterGroup* group = Group(painter->Type());
390 group = CreateGroup(painter->Type(),painter->Depth());
396 //_____________________________________________________________________________
398 AliMUONVPainter::Detach() const
400 /// Make this a new top painter (i.e. a master)
402 AliDebug(1,Form("Detaching %s",GetName()));
404 AliMUONVPainter* p = static_cast<AliMUONVPainter*>(Clone());
406 AliMUONVPainter* master = Master();
410 AliDebug(1,Form("UpdatingGroups of the detached painter %s from its master %s",
411 p->GetName(),master->GetName()));
412 p->UpdateGroupsFrom(*master);
418 //_____________________________________________________________________________
420 AliMUONVPainter::Depth() const
422 /// Return our depth in the hierarchy
426 return Mother()->Depth() + 1;
434 //_____________________________________________________________________________
436 AliMUONVPainter::DistancetoPrimitive(Int_t px, Int_t py)
438 /// See TObject::DistancetoPrimitive
440 static const Int_t kBigValue = 999999;
442 if (!gPad) return kBigValue;
446 AliMUONVPainter* painter = GetPainter(px,py,x,y);
448 x=y=0.0; // to avoid compiler warning
450 if ( painter == this) return 0;
455 //_____________________________________________________________________________
457 AliMUONVPainter::DoubleClicked(AliMUONVPainter*, Double_t*)
459 /// Should emit the DoubleClicked signal (if I knew how to detect those events...)
461 AliWarning("Please implement me !");
465 // // let our top mother emit the signal as clients are probably connected to
466 // // our mother, not to us
467 // Top()->DoubleClicked(painter,values);
471 // Long_t param[] = { (Long_t)painter,(Long_t)values };
473 // Emit("DoubleClicked(AliMUONVPainter*,Double_t*)",param);
477 //_____________________________________________________________________________
479 AliMUONVPainter::Draw(Option_t* opt)
481 /// Append ourselves to the current pad
485 gROOT->MakeDefCanvas();
488 Bool_t kMustSetRange(kFALSE);
493 if (sopt.Contains("R") ) kMustSetRange=kTRUE;
497 Double_t x1,y1,x2,y2;
498 GetBoundingBox(x1,y1,x2,y2);
499 if ( gPad) gPad->Range(x1,y1,x2,y2);
502 if ( !fMother && !fPainterGroups )
507 TIter next(fChildren);
508 AliMUONVPainter* painter;
509 while ( ( painter = static_cast<AliMUONVPainter*>(next()) ) )
519 //_____________________________________________________________________________
521 AliMUONVPainter::ExecuteEvent(Int_t event, Int_t px, Int_t py)
523 /// Handle graphics events
527 AliMUONVPainter* painter = GetPainter(px,py,x,y);
529 if ( painter == this )
531 Double_t values[] = { x,y };
536 ShiftClicked(this,values);
539 Clicked(this,values);
542 //the following statement is required against other loop executions before returning (depending on the time between the clicks)
543 gPad->GetCanvas()->HandleInput((EEventType)-1,0,0);
544 DoubleClicked(this,values);
550 //_____________________________________________________________________________
552 AliMUONVPainter::FlatList(TList& list)
554 /// Make a flat list of our children (and ourselves)
556 TIter next(fChildren);
557 AliMUONVPainter* painter;
558 while ( ( painter = static_cast<AliMUONVPainter*>(next())))
560 painter->FlatList(list);
566 //_____________________________________________________________________________
568 AliMUONVPainter::GetBoundingBox(Double_t& x1, Double_t& y1,
569 Double_t& x2, Double_t& y2) const
571 /// Get the bounding box = our area
572 AliMpArea area(Area().GetPositionX(),
573 Area().GetPositionY(),
574 Area().GetDimensionX()*fBorderFactor,
575 Area().GetDimensionY()*fBorderFactor);
577 x1 = area.LeftBorder();
578 y1 = area.DownBorder();
579 x2 = area.RightBorder();
580 y2 = area.UpBorder();
583 //_____________________________________________________________________________
585 AliMUONVPainter::GetObjectInfo(Int_t, Int_t) const
587 /// See TObject::GetObjectInfo
588 return const_cast<char*>(GetName());
591 //_____________________________________________________________________________
593 AliMUONVPainter::GetPainter(Int_t px, Int_t py, Double_t& x, Double_t& y) const
595 /// Get the responder painter at integer position (px,py), and get back its
596 /// absolute position (x,y)
598 PixelToPad(px,py,x,y);
600 if ( !IsInside(x,y) ) return 0x0;
602 if ( fGroup->IsResponder() ) return const_cast<AliMUONVPainter*>(this);
606 TIter next(fChildren);
607 AliMUONVPainter* painter;
609 while ( ( painter = static_cast<AliMUONVPainter*>(next()) ) )
611 AliMUONVPainter* p = painter->GetPainter(px,py,x,y);
619 //_____________________________________________________________________________
621 AliMUONVPainter::GetTypes(TObjArray& types) const
623 /// Get the list of types (as a TObjArray of TObjString)
624 /// of our hierarchy, sorted alphabetically
626 types.SetOwner(kTRUE);
630 tmp.SetOwner(kFALSE);
632 TIter next(fPainterGroups);
635 while ( ( str = static_cast<TObjString*>(next()) ) )
637 AliMUONPainterGroup* group = Group(str->String().Data());
643 Int_t n = tmp.GetLast()+1;
645 Int_t* index = new Int_t[n];
647 Int_t* a = new Int_t[n];
649 for ( Int_t i = 0; i < n; ++i )
651 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(tmp.At(i));
652 a[i] = group->Depth();
655 TMath::Sort(n,a,index,kFALSE);
657 for ( Int_t i = 0; i < n; ++i )
659 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(tmp.At(index[i]));
660 types.AddLast(new TObjString(group->Type()));
667 //_____________________________________________________________________________
669 AliMUONVPainter::Group(const char* type) const
671 /// Returns a group of a given type
672 if (!fPainterGroups) return 0x0;
673 return static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(type));
676 //_____________________________________________________________________________
678 AliMUONVPainter::Group(Int_t depth) const
680 /// Returns a group of a given depth
681 if (!fPainterGroups) return 0x0;
682 TIter next(fPainterGroups);
683 TObjString* groupName;
684 while ( ( groupName = static_cast<TObjString*>(next()) ) )
686 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>
687 (fPainterGroups->GetValue(groupName->String().Data()));
688 if ( group->Depth() == depth )
696 //_____________________________________________________________________________
698 AliMUONVPainter::IsInside(Double_t x, Double_t y) const
700 /// Whether point (x,y) is inside our contour
701 if (!fContour) return kFALSE;
702 return fContour->IsInside(x,y);
705 //_____________________________________________________________________________
707 AliMUONVPainter::IsResponder() const
709 /// Whether we're responding to mouse events
710 return MotherGroup()->IsResponder();
713 //_____________________________________________________________________________
715 AliMUONVPainter::Master() const
717 /// Return the top of the hierarchy
719 /// if we get no mother, we are the master
721 if ( Mother() == 0x0 ) return const_cast<AliMUONVPainter*>(this);
723 AliMUONVPainter* p = Mother();
725 while ( p->Mother() )
733 //_____________________________________________________________________________
735 AliMUONVPainter::Paint(Option_t*)
737 /// Paint ourselves of screen
738 /// If we have some data (i.e. we're belonging to the plotter group)
739 /// we use PaintArea.
740 /// And if must be outlined, then we do that too.
742 if ( !MotherGroup()->IsVisible() ) return;
744 if ( MotherGroup()->IsPlotter() )
746 PaintArea(*(MotherGroup()->Data()),
747 MotherGroup()->DataIndex(),
748 MotherGroup()->DataMin(),
749 MotherGroup()->DataMax());
752 if ( MotherGroup()->IsOutlined() )
759 AliMUONContourPainter::Paint(*fContour,1,1,2); // red fill with black thin outline
763 //_____________________________________________________________________________
765 AliMUONVPainter::Describe(const AliMUONVTrackerData&, Int_t, Double_t, Double_t)
767 /// Default implementation (must be overriden)
768 AliError(Form("%s : implement me",GetName()));
772 //_____________________________________________________________________________
774 AliMUONVPainter::PaintArea(const AliMUONVTrackerData&, Int_t, Double_t, Double_t)
776 /// Default implementation (must be overriden)
777 AliError(Form("%s : implement me",GetName()));
781 //_____________________________________________________________________________
783 AliMUONVPainter::PaintOutline(Int_t color, Int_t width, Double_t /*x*/, Double_t /*y*/)
785 /// Default implementation is simply a drawing of the contour lines,
786 /// not using the optional (x,y)
787 Int_t c = color >= 0 ? color : GetLineColor();
788 Int_t w = width >= 0 ? width : GetLineWidth();
790 AliMUONContourPainter::Paint(*fContour,c,w);
793 //_____________________________________________________________________________
795 AliMUONVPainter::PixelToPad(Int_t px, Int_t py, Double_t& x, Double_t& y)
797 /// convert (px,py) into pad position (x,y)
799 x = gPad->PadtoX(gPad->AbsPixeltoX(px));
800 y = gPad->PadtoY(gPad->AbsPixeltoY(py));
803 //_____________________________________________________________________________
805 AliMUONVPainter::Print(Option_t* opt) const
808 for ( Int_t i = 0; i < Depth()*4; ++i )
813 if ( !IsValid() ) cout << "!!!INVALID!!!" << endl;
815 cout << Form("%p Name %s Depth %d ContourName %s ID=(%d,%d)",
816 this,GetName(),Depth(),ContourName().Data(),ID0(),ID1());
818 if ( fResponderGroup )
820 cout << Form(" Responder group %p %s",fResponderGroup,fResponderGroup->Type());
824 cout << Form(" Plotter group %p %s",fPlotterGroup,fPlotterGroup->Type());
828 cout << Form(" Mother %p %s",Mother(),Mother()->GetName());
832 cout << Form(" Group %p %s ",MotherGroup(),MotherGroup()->Type());
837 cout << Form(" %d children",fChildren->GetLast()+1);
845 if ( fChildren && ( sopt == "FULL" || sopt == "CHILD" ) )
847 TIter next(fChildren);
848 AliMUONVPainter* painter;
849 while ( ( painter = static_cast<AliMUONVPainter*>(next()) ) )
855 if ( fPainterGroups && ( sopt == "FULL" || sopt == "GROUP" ) )
857 TIter next(fPainterGroups);
858 TObjString* groupName;
859 while ( ( groupName = static_cast<TObjString*>(next()) ) )
861 AliMUONPainterGroup* group = Group(groupName->String().Data());
867 //_____________________________________________________________________________
869 AliMUONVPainter::SetAttributes(const AliMUONAttPainter& attributes)
871 /// Set our attributes
872 fAttributes = attributes;
875 //_____________________________________________________________________________
877 AliMUONVPainter::SetContour(AliMUONContour* contour)
882 AliError(Form("Setting a null contour for painter %s : bad idea !",PathName().Data()));
887 //_____________________________________________________________________________
889 AliMUONVPainter::SetData(const char* pattern, AliMUONVTrackerData* data,
892 /// Tell all painters which type matches pattern that they should
893 /// monitor a given data source
895 if ( !fPainterGroups )
902 data->Connect("Destroyed()",ClassName(),this,Form("SetData(=\"%s\",0x0,-1)",pattern));
905 TIter next(fPainterGroups);
910 while ( ( str = static_cast<TObjString*>(next()) ) )
912 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(str));
914 if ( group->Matches(pattern) )
916 group->SetData(data,dataIndex);
919 fPlotterGroup = group;
924 group->SetData(0x0,-1);
928 // Update context menus
935 AliMUONPainterGroup* group = Master()->PlotterGroup();
937 while ( ( p = static_cast<AliMUONVPainter*>(pnext()) ) )
939 TList* l = p->IsA()->GetMenuList();
943 TClassMenuItem* n(0x0);
945 l->Add(new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
946 "Include","Include",p,"",-1,kTRUE));
947 l->Add(new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
948 "Exclude","Exclude",p,"",-1,kTRUE));
952 if ( data && data->IsHistogrammed(0) )
954 // Add histo drawing to the popup menu
955 TString name("Draw histogram of ");
957 name += data->ExternalDimensionName(0);
959 n = new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
960 name.Data(),"DrawHistogram0",p,"",-1,kTRUE);
965 n = new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
966 name.Data(),"DrawHistogramClone0",p,"",-1,kTRUE);
970 Int_t nd = data->IsSingleEvent() ? data->ExternalDimension() : data->ExternalDimension()*2;
972 for ( Int_t i = 0; i < nd; ++i )
974 n = new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
975 Form("Draw %s clone",data->DimensionName(i).Data()),
976 Form("DrawInternalHistogramClone%d",i),p,"",-1,kTRUE);
983 //_____________________________________________________________________________
985 AliMUONVPainter::DrawInternalHistogram(Int_t dim) const
987 /// Draw histogram (and delete the previous one)
992 DrawInternalHistogramClone(dim);
995 //_____________________________________________________________________________
997 AliMUONVPainter::DrawInternalHistogramClone(Int_t dim) const
1001 fHistogram = AliMUONTrackerDataHistogrammer::CreateHisto(*this,-1,dim);
1010 //_____________________________________________________________________________
1012 AliMUONVPainter::DrawHistogram(Double_t* values) const
1014 /// Draw histogram (and delete the previous one)
1019 DrawHistogramClone(values);
1022 //_____________________________________________________________________________
1024 AliMUONVPainter::DrawHistogramClone(Double_t*) const
1028 fHistogram = AliMUONTrackerDataHistogrammer::CreateHisto(*this,0,-1);
1037 //_____________________________________________________________________________
1039 AliMUONVPainter::FillManuList(TObjArray& manuList) const
1041 /// Append to manulist
1042 /// This is the default implementation, which just calls the FillManuList
1043 /// of all our children.
1044 /// Some derived class might need to override this in order to exclude
1045 /// some children from the fill.
1047 TIter next(Children());
1051 while ( ( p = static_cast<AliMUONVPainter*>(next()) ) )
1053 p->FillManuList(manuList);
1057 //_____________________________________________________________________________
1059 AliMUONVPainter::SetLine(Int_t depth, Int_t lineColor, Int_t lineWidth)
1061 /// Set the line attributes of painters at a given depth
1062 AliMUONPainterGroup* group = Group(depth);
1065 group->SetLine(lineColor,lineWidth);
1069 //_____________________________________________________________________________
1071 AliMUONVPainter::SetMother(AliMUONVPainter* painter)
1077 //_____________________________________________________________________________
1079 AliMUONVPainter::SetOutlined(const char* pattern, Bool_t flag)
1081 /// Decide whether or not painters which type matches pattern
1082 /// should be outlined
1084 AliDebug(1,Form("pattern=%s flag=%d",pattern,flag));
1086 if (!fPainterGroups)
1091 TIter next(fPainterGroups);
1094 while ( ( str = static_cast<TObjString*>(next()) ) )
1096 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(str));
1097 if ( group->Matches(pattern) )
1099 group->SetOutlined(flag);
1104 //_____________________________________________________________________________
1106 AliMUONVPainter::SetResponder(const char* pattern)
1108 /// Set the painters matching pattern to be the responder
1110 AliDebug(1,Form("pattern=%s",pattern));
1112 if (!fPainterGroups)
1117 TIter next(fPainterGroups);
1120 fResponderGroup = 0x0;
1122 while ( ( str = static_cast<TObjString*>(next()) ) )
1124 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(str));
1125 if ( group->Matches(pattern) )
1127 AliDebug(1,Form("group %s is matching pattern %s : setting to responder",
1128 group->Type(),pattern));
1129 group->SetResponder(kTRUE);
1130 fResponderGroup = group;
1134 group->SetResponder(kFALSE);
1139 //_____________________________________________________________________________
1141 AliMUONVPainter::SetResponder(Int_t depth)
1143 /// Select as responder the *first* group that has a given depth
1145 AliDebug(1,Form("depth=%d",depth));
1147 if (!fPainterGroups)
1152 TIter next(fPainterGroups);
1155 fResponderGroup = 0x0;
1157 while ( ( str = static_cast<TObjString*>(next()) ) )
1159 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(str));
1160 if ( group->Depth() == depth )
1162 AliDebug(1,Form("group %s has correct depth = %d, using as responder",
1163 group->Type(),depth));
1164 group->SetResponder(kTRUE);
1165 fResponderGroup = group;
1170 group->SetResponder(kFALSE);
1175 //_____________________________________________________________________________
1177 AliMUONVPainter::SetVisible(const char* pattern, Bool_t flag)
1179 /// Decide whether the painters matching pattern should be visible or not
1180 AliDebug(1,Form("pattern=%s flag=%d",pattern,flag));
1182 if (!fPainterGroups)
1187 TIter next(fPainterGroups);
1190 while ( ( str = static_cast<TObjString*>(next()) ) )
1192 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(str));
1193 if ( group->Matches(pattern) )
1195 group->SetVisible(flag);
1200 //_____________________________________________________________________________
1202 AliMUONVPainter::UpdateGroupsFrom(const AliMUONVPainter& painter)
1204 /// (re)Create groups
1205 delete fPainterGroups;
1206 fPainterGroups = 0x0;
1210 // and copy the status of responder, plotter and visible
1211 if ( painter.ResponderGroup() )
1213 SetResponder(painter.ResponderGroup()->Type());
1216 if ( painter.PlotterGroup() )
1218 SetData(painter.PlotterGroup()->Type(),
1219 painter.PlotterGroup()->Data(),
1220 painter.PlotterGroup()->DataIndex());
1221 PlotterGroup()->SetDataRange(painter.PlotterGroup()->DataMin(),
1222 painter.PlotterGroup()->DataMax());
1226 painter.GetTypes(types);
1228 TObjString* groupName;
1230 while ( ( groupName = static_cast<TObjString*>(next()) ) )
1232 AliMUONPainterGroup* group = painter.Group(groupName->String().Data());
1233 if ( group->IsVisible() )
1235 SetVisible(group->Type(),kTRUE);
1239 SetVisible(group->Type(),kFALSE);
1242 if ( group->IsOutlined() )
1244 SetOutlined(group->Type(),kTRUE);
1248 SetOutlined(group->Type(),kFALSE);
1251 SetLine(group->Depth(),group->GetLineColor(),group->GetLineWidth());
1256 //_____________________________________________________________________________
1258 AliMUONVPainter::Include()
1260 /// Include this painter
1263 /// Update the global interactive read out configuration
1267 //_____________________________________________________________________________
1269 AliMUONVPainter::GetIROCManuList(TObjArray& manuList)
1271 /// Get the list of manus spanned by this painter AND by its dual
1273 FillManuList(manuList);
1276 AliMUONAttPainter att(Attributes());
1280 att.SetCathodeAndPlaneDisabled(kTRUE);
1282 AliMUONVPainter* p = AliMUONVPainter::CreatePainter(ClassName(),att,ID0(),ID1());
1286 p->FillManuList(manuList);
1292 //_____________________________________________________________________________
1294 AliMUONVPainter::WriteIROC(Double_t value)
1296 /// Update the interactive readout configuration
1299 GetIROCManuList(manuList);
1302 TIter nextm(&manuList);
1303 AliMUON2DMap store(true);
1305 while ((muid=static_cast<AliMpManuUID*>(nextm())))
1307 AliMUONVCalibParam* param = new AliMUONCalibParamND(1,64,
1309 muid->ManuId(),value);
1313 InteractiveReadOutConfig()->Replace(store);
1316 //_____________________________________________________________________________
1318 AliMUONVPainter::Exclude()
1320 /// Exclude this painter
1323 /// Update the global interactive read out configuration
1327 //_____________________________________________________________________________
1328 AliMUONVTrackerData*
1329 AliMUONVPainter::InteractiveReadOutConfig() const
1331 /// get the interactive readout config object
1332 return AliMUONPainterDataRegistry::Instance()->InteractiveReadOutConfig();
1335 //_____________________________________________________________________________
1337 AliMUONVPainter::CreatePainter(const char* className,
1338 const AliMUONAttPainter& att,
1339 Int_t id1, Int_t id2)
1341 /// Create a painter (factory method)
1343 TClass* c = TClass::GetClass(className);
1347 AliErrorClass(Form("Cannot get class %s",className));
1355 call.InitWithPrototype(c,className,"AliMUONAttPainter&,Int_t");
1357 if (call.IsValid()) n = 1;
1360 call.InitWithPrototype(c,className,"AliMUONAttPainter&,Int_t,Int_t");
1362 if ( call.IsValid() ) n = 2;
1365 Long_t returnLong(0x0);
1369 Long_t params[] = { (Long_t)(&att), (Long_t)(id1) };
1370 call.SetParamPtrs((void*)(params));
1371 call.Execute((void*)(0x0),returnLong);
1375 Long_t params[] = { (Long_t)(&att), (Long_t)(id1), (Long_t)(id2) };
1376 call.SetParamPtrs((void*)(params));
1377 call.Execute((void*)(0x0),returnLong);
1382 AliErrorClass(Form("Cannot create a painter of class %s",className));
1385 AliMUONVPainter* rv = reinterpret_cast<AliMUONVPainter*> (returnLong);
1389 AliErrorClass(Form("Painter of class %s is not valid",className));
1396 //_____________________________________________________________________________
1398 AliMUONVPainter::PaintArea(Int_t fillColor)
1400 /// Draw a filled area
1401 AliMUONContourPainter::Paint(*(Contour()),-1,-1,fillColor);