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
96 ClassImp(AliMUONVPainter)
99 //_____________________________________________________________________________
100 AliMUONVPainter::AliMUONVPainter(TRootIOCtor*) : TObject(),
104 fResponderGroup(0x0),
124 //_____________________________________________________________________________
125 AliMUONVPainter::AliMUONVPainter(const char* type)
130 fResponderGroup(0x0),
150 //_____________________________________________________________________________
151 AliMUONVPainter::AliMUONVPainter(const AliMUONVPainter& rhs)
156 fResponderGroup(0x0),
176 //_____________________________________________________________________________
178 AliMUONVPainter::operator=(const AliMUONVPainter& rhs)
180 /// assignment operator
188 //_____________________________________________________________________________
189 AliMUONVPainter::~AliMUONVPainter()
196 //_____________________________________________________________________________
198 AliMUONVPainter::Area() const
200 /// Return the area covered by this painter
203 return fContour->Area();
207 AliWarning("Returning an invalid area, as contour is not defined");
212 //_____________________________________________________________________________
214 AliMUONVPainter::Add(AliMUONVPainter* painter)
216 /// Add a child painter
217 if (!fChildren) fChildren = new TObjArray;
218 assert(painter->Mother()==0x0);
219 fChildren->Add(painter);
220 painter->SetMother(this);
223 //_____________________________________________________________________________
225 AliMUONVPainter::Children() const
227 /// Return the list of childrens
231 //_____________________________________________________________________________
233 AliMUONVPainter::Clicked(AliMUONVPainter* painter, Double_t* values)
235 /// Let our mother emit the signal as clients are probably connected to
236 /// our (grand)mother, not to us
240 Mother()->Clicked(painter,values);
244 Long_t param[] = { (Long_t)painter,(Long_t)values };
246 Emit("Clicked(AliMUONVPainter*,Double_t*)",param);
250 //_____________________________________________________________________________
252 AliMUONVPainter::ShiftClicked(AliMUONVPainter* painter, Double_t* values)
254 /// Let our mother emit the signal as clients are probably connected to
255 /// our (grand)mother, not to us
259 Mother()->ShiftClicked(painter,values);
263 Long_t param[] = { (Long_t)painter,(Long_t)values };
265 Emit("ShiftClicked(AliMUONVPainter*,Double_t*)",param);
269 //_____________________________________________________________________________
271 AliMUONVPainter::ComputeDataRange(const AliMUONVTrackerData&, Int_t,
272 Double_t&, Double_t&) const
274 /// Should compute the min and max of a given data source
275 AliError("Not implemented. Please fixe me");
278 //_____________________________________________________________________________
280 AliMUONVPainter::ContourName() const
282 /// Default implementation of the contour name.
284 TString name(PathName());
287 name += fAttributes.Name();
292 //_____________________________________________________________________________
294 AliMUONVPainter::Copy(TObject& object) const
296 /// Copy this to object.
298 TObject::Copy(object);
300 AliMUONVPainter& painter = static_cast<AliMUONVPainter&>(object);
302 painter.fType = fType;
303 painter.fName = fName;
304 painter.fPathName = fPathName;
306 painter.fMother = 0x0;
307 painter.fContour = fContour;
309 painter.fGroup = 0x0;
310 painter.fResponderGroup = 0x0;
311 painter.fPlotterGroup = 0x0;
313 painter.fBorderFactor = fBorderFactor;
315 painter.fAttributes = fAttributes;
317 painter.fAttributes.SetCathodeAndPlaneDisabled(kFALSE);
321 painter.fLineColor = fLineColor;
322 painter.fLineWidth = fLineWidth;
324 painter.fIsValid = fIsValid;
326 delete painter.fChildren;
327 painter.fChildren = 0x0;
329 painter.fID[0] = fID[0];
330 painter.fID[1] = fID[1];
332 delete painter.fHistogram;
333 painter.fHistogram = 0x0;
335 TIter next(fChildren);
338 while ( ( p = static_cast<AliMUONVPainter*>(next()) ) )
340 painter.Add(static_cast<AliMUONVPainter*>(p->Clone()));
343 painter.UpdateGroupsFrom(*this);
345 object.ResetBit(kCanDelete);
348 //_____________________________________________________________________________
350 AliMUONVPainter::CreateGroup(const char* type, Int_t depth)
352 /// Create a painter group at a given depth
354 if (!fPainterGroups) fPainterGroups = new TMap;
355 TObject* o = fPainterGroups->GetValue(type);
358 AliError(Form("Group %s is already there ! Check this",type));
361 AliMUONPainterGroup* group = new AliMUONPainterGroup(type,depth);
362 fPainterGroups->Add(new TObjString(type),group);
366 //_____________________________________________________________________________
368 AliMUONVPainter::CreateGroups()
370 /// Groups our children into groups
374 AliFatal("Not supposed to create groups for a children");
381 AliMUONVPainter* painter;
383 while ( ( painter = static_cast<AliMUONVPainter*>(next()) ) )
385 AliMUONPainterGroup* group = Group(painter->Type());
388 group = CreateGroup(painter->Type(),painter->Depth());
394 //_____________________________________________________________________________
396 AliMUONVPainter::Detach() const
398 /// Make this a new top painter (i.e. a master)
400 AliDebug(1,Form("Detaching %s",GetName()));
402 AliMUONVPainter* p = static_cast<AliMUONVPainter*>(Clone());
404 AliMUONVPainter* master = Master();
408 AliDebug(1,Form("UpdatingGroups of the detached painter %s from its master %s",
409 p->GetName(),master->GetName()));
410 p->UpdateGroupsFrom(*master);
416 //_____________________________________________________________________________
418 AliMUONVPainter::Depth() const
420 /// Return our depth in the hierarchy
424 return Mother()->Depth() + 1;
432 //_____________________________________________________________________________
434 AliMUONVPainter::DistancetoPrimitive(Int_t px, Int_t py)
436 /// See TObject::DistancetoPrimitive
438 static const Int_t kBigValue = 999999;
440 if (!gPad) return kBigValue;
444 AliMUONVPainter* painter = GetPainter(px,py,x,y);
446 x=y=0.0; // to avoid compiler warning
448 if ( painter == this) return 0;
453 //_____________________________________________________________________________
455 AliMUONVPainter::DoubleClicked(AliMUONVPainter*, Double_t*)
457 /// Should emit the DoubleClicked signal (if I knew how to detect those events...)
459 AliWarning("Please implement me !");
463 // // let our top mother emit the signal as clients are probably connected to
464 // // our mother, not to us
465 // Top()->DoubleClicked(painter,values);
469 // Long_t param[] = { (Long_t)painter,(Long_t)values };
471 // Emit("DoubleClicked(AliMUONVPainter*,Double_t*)",param);
475 //_____________________________________________________________________________
477 AliMUONVPainter::Draw(Option_t* opt)
479 /// Append ourselves to the current pad
483 gROOT->MakeDefCanvas();
486 Bool_t kMustSetRange(kFALSE);
491 if (sopt.Contains("R") ) kMustSetRange=kTRUE;
495 Double_t x1,y1,x2,y2;
496 GetBoundingBox(x1,y1,x2,y2);
497 if ( gPad) gPad->Range(x1,y1,x2,y2);
500 if ( !fMother && !fPainterGroups )
505 TIter next(fChildren);
506 AliMUONVPainter* painter;
507 while ( ( painter = static_cast<AliMUONVPainter*>(next()) ) )
517 //_____________________________________________________________________________
519 AliMUONVPainter::ExecuteEvent(Int_t event, Int_t px, Int_t py)
521 /// Handle graphics events
525 AliMUONVPainter* painter = GetPainter(px,py,x,y);
527 if ( painter == this )
529 Double_t values[] = { x,y };
534 ShiftClicked(this,values);
537 Clicked(this,values);
540 //the following statement is required against other loop executions before returning (depending on the time between the clicks)
541 gPad->GetCanvas()->HandleInput((EEventType)-1,0,0);
542 DoubleClicked(this,values);
548 //_____________________________________________________________________________
550 AliMUONVPainter::FlatList(TList& list)
552 /// Make a flat list of our children (and ourselves)
554 TIter next(fChildren);
555 AliMUONVPainter* painter;
556 while ( ( painter = static_cast<AliMUONVPainter*>(next())))
558 painter->FlatList(list);
564 //_____________________________________________________________________________
566 AliMUONVPainter::GetBoundingBox(Double_t& x1, Double_t& y1,
567 Double_t& x2, Double_t& y2) const
569 /// Get the bounding box = our area
570 AliMpArea area(Area().GetPositionX(),
571 Area().GetPositionY(),
572 Area().GetDimensionX()*fBorderFactor,
573 Area().GetDimensionY()*fBorderFactor);
575 x1 = area.LeftBorder();
576 y1 = area.DownBorder();
577 x2 = area.RightBorder();
578 y2 = area.UpBorder();
581 //_____________________________________________________________________________
583 AliMUONVPainter::GetObjectInfo(Int_t, Int_t) const
585 /// See TObject::GetObjectInfo
586 return const_cast<char*>(GetName());
589 //_____________________________________________________________________________
591 AliMUONVPainter::GetPainter(Int_t px, Int_t py, Double_t& x, Double_t& y) const
593 /// Get the responder painter at integer position (px,py), and get back its
594 /// absolute position (x,y)
596 PixelToPad(px,py,x,y);
598 if ( !IsInside(x,y) ) return 0x0;
600 if ( fGroup->IsResponder() ) return const_cast<AliMUONVPainter*>(this);
604 TIter next(fChildren);
605 AliMUONVPainter* painter;
607 while ( ( painter = static_cast<AliMUONVPainter*>(next()) ) )
609 AliMUONVPainter* p = painter->GetPainter(px,py,x,y);
617 //_____________________________________________________________________________
619 AliMUONVPainter::GetTypes(TObjArray& types) const
621 /// Get the list of types (as a TObjArray of TObjString)
622 /// of our hierarchy, sorted alphabetically
624 types.SetOwner(kTRUE);
628 tmp.SetOwner(kFALSE);
630 TIter next(fPainterGroups);
633 while ( ( str = static_cast<TObjString*>(next()) ) )
635 AliMUONPainterGroup* group = Group(str->String().Data());
641 Int_t n = tmp.GetLast()+1;
643 Int_t* index = new Int_t[n];
645 Int_t* a = new Int_t[n];
647 for ( Int_t i = 0; i < n; ++i )
649 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(tmp.At(i));
650 a[i] = group->Depth();
653 TMath::Sort(n,a,index,kFALSE);
655 for ( Int_t i = 0; i < n; ++i )
657 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(tmp.At(index[i]));
658 types.AddLast(new TObjString(group->Type()));
665 //_____________________________________________________________________________
667 AliMUONVPainter::Group(const char* type) const
669 /// Returns a group of a given type
670 if (!fPainterGroups) return 0x0;
671 return static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(type));
674 //_____________________________________________________________________________
676 AliMUONVPainter::Group(Int_t depth) const
678 /// Returns a group of a given depth
679 if (!fPainterGroups) return 0x0;
680 TIter next(fPainterGroups);
681 TObjString* groupName;
682 while ( ( groupName = static_cast<TObjString*>(next()) ) )
684 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>
685 (fPainterGroups->GetValue(groupName->String().Data()));
686 if ( group->Depth() == depth )
694 //_____________________________________________________________________________
696 AliMUONVPainter::IsInside(Double_t x, Double_t y) const
698 /// Whether point (x,y) is inside our contour
699 if (!fContour) return kFALSE;
700 return fContour->IsInside(x,y);
703 //_____________________________________________________________________________
705 AliMUONVPainter::IsResponder() const
707 /// Whether we're responding to mouse events
708 return MotherGroup()->IsResponder();
711 //_____________________________________________________________________________
713 AliMUONVPainter::Master() const
715 /// Return the top of the hierarchy
717 /// if we get no mother, we are the master
719 if ( Mother() == 0x0 ) return const_cast<AliMUONVPainter*>(this);
721 AliMUONVPainter* p = Mother();
723 while ( p->Mother() )
731 //_____________________________________________________________________________
733 AliMUONVPainter::Paint(Option_t*)
735 /// Paint ourselves of screen
736 /// If we have some data (i.e. we're belonging to the plotter group)
737 /// we use PaintArea.
738 /// And if must be outlined, then we do that too.
740 if ( !MotherGroup()->IsVisible() ) return;
742 if ( MotherGroup()->IsPlotter() )
744 PaintArea(*(MotherGroup()->Data()),
745 MotherGroup()->DataIndex(),
746 MotherGroup()->DataMin(),
747 MotherGroup()->DataMax());
750 if ( MotherGroup()->IsOutlined() )
757 AliMUONContourPainter::Paint(*fContour,1,1,2); // red fill with black thin outline
761 //_____________________________________________________________________________
763 AliMUONVPainter::Describe(const AliMUONVTrackerData&, Int_t, Double_t, Double_t)
765 /// Default implementation (must be overriden)
766 AliError(Form("%s : implement me",GetName()));
770 //_____________________________________________________________________________
772 AliMUONVPainter::PaintArea(const AliMUONVTrackerData&, Int_t, Double_t, Double_t)
774 /// Default implementation (must be overriden)
775 AliError(Form("%s : implement me",GetName()));
779 //_____________________________________________________________________________
781 AliMUONVPainter::PaintOutline(Int_t color, Int_t width, Double_t /*x*/, Double_t /*y*/)
783 /// Default implementation is simply a drawing of the contour lines,
784 /// not using the optional (x,y)
785 Int_t c = color >= 0 ? color : GetLineColor();
786 Int_t w = width >= 0 ? width : GetLineWidth();
788 AliMUONContourPainter::Paint(*fContour,c,w);
791 //_____________________________________________________________________________
793 AliMUONVPainter::PixelToPad(Int_t px, Int_t py, Double_t& x, Double_t& y)
795 /// convert (px,py) into pad position (x,y)
797 x = gPad->PadtoX(gPad->AbsPixeltoX(px));
798 y = gPad->PadtoY(gPad->AbsPixeltoY(py));
801 //_____________________________________________________________________________
803 AliMUONVPainter::Print(Option_t* opt) const
806 for ( Int_t i = 0; i < Depth()*4; ++i )
811 if ( !IsValid() ) cout << "!!!INVALID!!!" << endl;
813 cout << Form("%p Name %s Depth %d ContourName %s ID=(%d,%d)",
814 this,GetName(),Depth(),ContourName().Data(),ID0(),ID1());
816 if ( fResponderGroup )
818 cout << Form(" Responder group %p %s",fResponderGroup,fResponderGroup->Type());
822 cout << Form(" Plotter group %p %s",fPlotterGroup,fPlotterGroup->Type());
826 cout << Form(" Mother %p %s",Mother(),Mother()->GetName());
830 cout << Form(" Group %p %s ",MotherGroup(),MotherGroup()->Type());
835 cout << Form(" %d children",fChildren->GetLast()+1);
843 if ( fChildren && ( sopt == "FULL" || sopt == "CHILD" ) )
845 TIter next(fChildren);
846 AliMUONVPainter* painter;
847 while ( ( painter = static_cast<AliMUONVPainter*>(next()) ) )
853 if ( fPainterGroups && ( sopt == "FULL" || sopt == "GROUP" ) )
855 TIter next(fPainterGroups);
856 TObjString* groupName;
857 while ( ( groupName = static_cast<TObjString*>(next()) ) )
859 AliMUONPainterGroup* group = Group(groupName->String().Data());
865 //_____________________________________________________________________________
867 AliMUONVPainter::SetAttributes(const AliMUONAttPainter& attributes)
869 /// Set our attributes
870 fAttributes = attributes;
873 //_____________________________________________________________________________
875 AliMUONVPainter::SetContour(AliMUONContour* contour)
880 AliError(Form("Setting a null contour for painter %s : bad idea !",PathName().Data()));
885 //_____________________________________________________________________________
887 AliMUONVPainter::SetData(const char* pattern, AliMUONVTrackerData* data,
890 /// Tell all painters which type matches pattern that they should
891 /// monitor a given data source
893 if ( !fPainterGroups )
900 data->Connect("Destroyed()",ClassName(),this,Form("SetData(=\"%s\",0x0,-1)",pattern));
903 TIter next(fPainterGroups);
908 while ( ( str = static_cast<TObjString*>(next()) ) )
910 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(str));
912 if ( group->Matches(pattern) )
914 group->SetData(data,dataIndex);
917 fPlotterGroup = group;
922 group->SetData(0x0,-1);
926 // Update context menus
933 AliMUONPainterGroup* group = Master()->PlotterGroup();
935 while ( ( p = static_cast<AliMUONVPainter*>(pnext()) ) )
937 TList* l = p->IsA()->GetMenuList();
941 TClassMenuItem* n(0x0);
943 l->Add(new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
944 "Include","Include",p,"",-1,kTRUE));
945 l->Add(new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
946 "Exclude","Exclude",p,"",-1,kTRUE));
950 if ( data && data->IsHistogrammed(0) )
952 // Add histo drawing to the popup menu
953 TString name("Draw histogram of ");
955 name += data->ExternalDimensionName(0);
957 n = new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
958 name.Data(),"DrawHistogram0",p,"",-1,kTRUE);
963 n = new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
964 name.Data(),"DrawHistogramClone0",p,"",-1,kTRUE);
968 Int_t nd = data->IsSingleEvent() ? data->ExternalDimension() : data->ExternalDimension()*2;
970 for ( Int_t i = 0; i < nd; ++i )
972 n = new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
973 Form("Draw %s clone",data->DimensionName(i).Data()),
974 Form("DrawInternalHistogramClone%d",i),p,"",-1,kTRUE);
981 //_____________________________________________________________________________
983 AliMUONVPainter::DrawInternalHistogram(Int_t dim) const
985 /// Draw histogram (and delete the previous one)
990 DrawInternalHistogramClone(dim);
993 //_____________________________________________________________________________
995 AliMUONVPainter::DrawInternalHistogramClone(Int_t dim) const
999 fHistogram = AliMUONTrackerDataHistogrammer::CreateHisto(*this,-1,dim);
1008 //_____________________________________________________________________________
1010 AliMUONVPainter::DrawHistogram(Double_t* values) const
1012 /// Draw histogram (and delete the previous one)
1017 DrawHistogramClone(values);
1020 //_____________________________________________________________________________
1022 AliMUONVPainter::DrawHistogramClone(Double_t*) const
1026 fHistogram = AliMUONTrackerDataHistogrammer::CreateHisto(*this,0,-1);
1035 //_____________________________________________________________________________
1037 AliMUONVPainter::FillManuList(TObjArray& manuList) const
1039 /// Append to manulist
1040 /// This is the default implementation, which just calls the FillManuList
1041 /// of all our children.
1042 /// Some derived class might need to override this in order to exclude
1043 /// some children from the fill.
1045 TIter next(Children());
1049 while ( ( p = static_cast<AliMUONVPainter*>(next()) ) )
1051 p->FillManuList(manuList);
1055 //_____________________________________________________________________________
1057 AliMUONVPainter::SetLine(Int_t depth, Int_t lineColor, Int_t lineWidth)
1059 /// Set the line attributes of painters at a given depth
1060 AliMUONPainterGroup* group = Group(depth);
1063 group->SetLine(lineColor,lineWidth);
1067 //_____________________________________________________________________________
1069 AliMUONVPainter::SetMother(AliMUONVPainter* painter)
1075 //_____________________________________________________________________________
1077 AliMUONVPainter::SetOutlined(const char* pattern, Bool_t flag)
1079 /// Decide whether or not painters which type matches pattern
1080 /// should be outlined
1082 AliDebug(1,Form("pattern=%s flag=%d",pattern,flag));
1084 if (!fPainterGroups)
1089 TIter next(fPainterGroups);
1092 while ( ( str = static_cast<TObjString*>(next()) ) )
1094 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(str));
1095 if ( group->Matches(pattern) )
1097 group->SetOutlined(flag);
1102 //_____________________________________________________________________________
1104 AliMUONVPainter::SetResponder(const char* pattern)
1106 /// Set the painters matching pattern to be the responder
1108 AliDebug(1,Form("pattern=%s",pattern));
1110 if (!fPainterGroups)
1115 TIter next(fPainterGroups);
1118 fResponderGroup = 0x0;
1120 while ( ( str = static_cast<TObjString*>(next()) ) )
1122 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(str));
1123 if ( group->Matches(pattern) )
1125 AliDebug(1,Form("group %s is matching pattern %s : setting to responder",
1126 group->Type(),pattern));
1127 group->SetResponder(kTRUE);
1128 fResponderGroup = group;
1132 group->SetResponder(kFALSE);
1137 //_____________________________________________________________________________
1139 AliMUONVPainter::SetResponder(Int_t depth)
1141 /// Select as responder the *first* group that has a given depth
1143 AliDebug(1,Form("depth=%d",depth));
1145 if (!fPainterGroups)
1150 TIter next(fPainterGroups);
1153 fResponderGroup = 0x0;
1155 while ( ( str = static_cast<TObjString*>(next()) ) )
1157 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(str));
1158 if ( group->Depth() == depth )
1160 AliDebug(1,Form("group %s has correct depth = %d, using as responder",
1161 group->Type(),depth));
1162 group->SetResponder(kTRUE);
1163 fResponderGroup = group;
1168 group->SetResponder(kFALSE);
1173 //_____________________________________________________________________________
1175 AliMUONVPainter::SetVisible(const char* pattern, Bool_t flag)
1177 /// Decide whether the painters matching pattern should be visible or not
1178 AliDebug(1,Form("pattern=%s flag=%d",pattern,flag));
1180 if (!fPainterGroups)
1185 TIter next(fPainterGroups);
1188 while ( ( str = static_cast<TObjString*>(next()) ) )
1190 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(str));
1191 if ( group->Matches(pattern) )
1193 group->SetVisible(flag);
1198 //_____________________________________________________________________________
1200 AliMUONVPainter::UpdateGroupsFrom(const AliMUONVPainter& painter)
1202 /// (re)Create groups
1203 delete fPainterGroups;
1204 fPainterGroups = 0x0;
1208 // and copy the status of responder, plotter and visible
1209 if ( painter.ResponderGroup() )
1211 SetResponder(painter.ResponderGroup()->Type());
1214 if ( painter.PlotterGroup() )
1216 SetData(painter.PlotterGroup()->Type(),
1217 painter.PlotterGroup()->Data(),
1218 painter.PlotterGroup()->DataIndex());
1219 PlotterGroup()->SetDataRange(painter.PlotterGroup()->DataMin(),
1220 painter.PlotterGroup()->DataMax());
1224 painter.GetTypes(types);
1226 TObjString* groupName;
1228 while ( ( groupName = static_cast<TObjString*>(next()) ) )
1230 AliMUONPainterGroup* group = painter.Group(groupName->String().Data());
1231 if ( group->IsVisible() )
1233 SetVisible(group->Type(),kTRUE);
1237 SetVisible(group->Type(),kFALSE);
1240 if ( group->IsOutlined() )
1242 SetOutlined(group->Type(),kTRUE);
1246 SetOutlined(group->Type(),kFALSE);
1249 SetLine(group->Depth(),group->GetLineColor(),group->GetLineWidth());
1254 //_____________________________________________________________________________
1256 AliMUONVPainter::Include()
1258 /// Include this painter
1261 /// Update the global interactive read out configuration
1265 //_____________________________________________________________________________
1267 AliMUONVPainter::GetIROCManuList(TObjArray& manuList)
1269 /// Get the list of manus spanned by this painter AND by its dual
1271 FillManuList(manuList);
1274 AliMUONAttPainter att(Attributes());
1278 att.SetCathodeAndPlaneDisabled(kTRUE);
1280 AliMUONVPainter* p = AliMUONVPainter::CreatePainter(ClassName(),att,ID0(),ID1());
1284 p->FillManuList(manuList);
1290 //_____________________________________________________________________________
1292 AliMUONVPainter::WriteIROC(Double_t value)
1294 /// Update the interactive readout configuration
1297 GetIROCManuList(manuList);
1300 TIter nextm(&manuList);
1301 AliMUON2DMap store(true);
1303 while ((muid=static_cast<AliMpManuUID*>(nextm())))
1305 AliMUONVCalibParam* param = new AliMUONCalibParamND(1,64,
1307 muid->ManuId(),value);
1311 InteractiveReadOutConfig()->Replace(store);
1314 //_____________________________________________________________________________
1316 AliMUONVPainter::Exclude()
1318 /// Exclude this painter
1321 /// Update the global interactive read out configuration
1325 //_____________________________________________________________________________
1326 AliMUONVTrackerData*
1327 AliMUONVPainter::InteractiveReadOutConfig() const
1329 /// get the interactive readout config object
1330 return AliMUONPainterDataRegistry::Instance()->InteractiveReadOutConfig();
1333 //_____________________________________________________________________________
1335 AliMUONVPainter::CreatePainter(const char* className,
1336 const AliMUONAttPainter& att,
1337 Int_t id1, Int_t id2)
1339 /// Create a painter (factory method)
1341 TClass* c = TClass::GetClass(className);
1345 AliErrorClass(Form("Cannot get class %s",className));
1353 call.InitWithPrototype(c,className,"AliMUONAttPainter&,Int_t");
1355 if (call.IsValid()) n = 1;
1358 call.InitWithPrototype(c,className,"AliMUONAttPainter&,Int_t,Int_t");
1360 if ( call.IsValid() ) n = 2;
1363 Long_t returnLong(0x0);
1367 Long_t params[] = { (Long_t)(&att), (Long_t)(id1) };
1368 call.SetParamPtrs((void*)(params));
1369 call.Execute((void*)(0x0),returnLong);
1373 Long_t params[] = { (Long_t)(&att), (Long_t)(id1), (Long_t)(id2) };
1374 call.SetParamPtrs((void*)(params));
1375 call.Execute((void*)(0x0),returnLong);
1380 AliErrorClass(Form("Cannot create a painter of class %s",className));
1383 AliMUONVPainter* rv = reinterpret_cast<AliMUONVPainter*> (returnLong);
1387 AliErrorClass(Form("Painter of class %s is not valid",className));
1394 //_____________________________________________________________________________
1396 AliMUONVPainter::PaintArea(Int_t fillColor)
1398 /// Draw a filled area
1399 AliMUONContourPainter::Paint(*(Contour()),-1,-1,fillColor);