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(),
111 fResponderGroup(0x0),
123 //_____________________________________________________________________________
124 AliMUONVPainter::AliMUONVPainter(const char* type)
136 fResponderGroup(0x0),
149 //_____________________________________________________________________________
150 AliMUONVPainter::AliMUONVPainter(const AliMUONVPainter& rhs)
162 fResponderGroup(0x0),
175 //_____________________________________________________________________________
177 AliMUONVPainter::operator=(const AliMUONVPainter& rhs)
179 /// assignment operator
187 //_____________________________________________________________________________
188 AliMUONVPainter::~AliMUONVPainter()
195 //_____________________________________________________________________________
197 AliMUONVPainter::Area() const
199 /// Return the area covered by this painter
202 return fContour->Area();
206 AliWarning("Returning an invalid area, as contour is not defined");
211 //_____________________________________________________________________________
213 AliMUONVPainter::Add(AliMUONVPainter* painter)
215 /// Add a child painter
216 if (!fChildren) fChildren = new TObjArray;
217 assert(painter->Mother()==0x0);
218 fChildren->Add(painter);
219 painter->SetMother(this);
222 //_____________________________________________________________________________
224 AliMUONVPainter::Children() const
226 /// Return the list of childrens
230 //_____________________________________________________________________________
232 AliMUONVPainter::Clicked(AliMUONVPainter* painter, Double_t* values)
234 /// Let our mother emit the signal as clients are probably connected to
235 /// our (grand)mother, not to us
239 Mother()->Clicked(painter,values);
243 Long_t param[] = { (Long_t)painter,(Long_t)values };
245 Emit("Clicked(AliMUONVPainter*,Double_t*)",param);
249 //_____________________________________________________________________________
251 AliMUONVPainter::ShiftClicked(AliMUONVPainter* painter, Double_t* values)
253 /// Let our mother emit the signal as clients are probably connected to
254 /// our (grand)mother, not to us
258 Mother()->ShiftClicked(painter,values);
262 Long_t param[] = { (Long_t)painter,(Long_t)values };
264 Emit("ShiftClicked(AliMUONVPainter*,Double_t*)",param);
268 //_____________________________________________________________________________
270 AliMUONVPainter::ComputeDataRange(const AliMUONVTrackerData&, Int_t,
271 Double_t&, Double_t&) const
273 /// Should compute the min and max of a given data source
274 AliError("Not implemented. Please fixe me");
277 //_____________________________________________________________________________
279 AliMUONVPainter::ContourName() const
281 /// Default implementation of the contour name.
283 TString name(PathName());
286 name += fAttributes.Name();
291 //_____________________________________________________________________________
293 AliMUONVPainter::Copy(TObject& object) const
295 /// Copy this to object.
297 TObject::Copy(object);
299 AliMUONVPainter& painter = static_cast<AliMUONVPainter&>(object);
301 painter.fType = fType;
302 painter.fName = fName;
303 painter.fPathName = fPathName;
305 painter.fMother = 0x0;
306 painter.fContour = fContour;
308 painter.fGroup = 0x0;
309 painter.fResponderGroup = 0x0;
310 painter.fPlotterGroup = 0x0;
312 painter.fBorderFactor = fBorderFactor;
314 painter.fAttributes = fAttributes;
316 painter.fAttributes.SetCathodeAndPlaneDisabled(kFALSE);
320 painter.fLineColor = fLineColor;
321 painter.fLineWidth = fLineWidth;
323 painter.fIsValid = fIsValid;
325 delete painter.fChildren;
326 painter.fChildren = 0x0;
328 painter.fID[0] = fID[0];
329 painter.fID[1] = fID[1];
331 delete painter.fHistogram;
332 painter.fHistogram = 0x0;
334 TIter next(fChildren);
337 while ( ( p = static_cast<AliMUONVPainter*>(next()) ) )
339 painter.Add(static_cast<AliMUONVPainter*>(p->Clone()));
342 painter.UpdateGroupsFrom(*this);
344 object.ResetBit(kCanDelete);
347 //_____________________________________________________________________________
349 AliMUONVPainter::CreateGroup(const char* type, Int_t depth)
351 /// Create a painter group at a given depth
353 if (!fPainterGroups) fPainterGroups = new TMap;
354 TObject* o = fPainterGroups->GetValue(type);
357 AliError(Form("Group %s is already there ! Check this",type));
360 AliMUONPainterGroup* group = new AliMUONPainterGroup(type,depth);
361 fPainterGroups->Add(new TObjString(type),group);
365 //_____________________________________________________________________________
367 AliMUONVPainter::CreateGroups()
369 /// Groups our children into groups
373 AliFatal("Not supposed to create groups for a children");
380 AliMUONVPainter* painter;
382 while ( ( painter = static_cast<AliMUONVPainter*>(next()) ) )
384 AliMUONPainterGroup* group = Group(painter->Type());
387 group = CreateGroup(painter->Type(),painter->Depth());
393 //_____________________________________________________________________________
395 AliMUONVPainter::Detach() const
397 /// Make this a new top painter (i.e. a master)
399 AliDebug(1,Form("Detaching %s",GetName()));
401 AliMUONVPainter* p = static_cast<AliMUONVPainter*>(Clone());
403 AliMUONVPainter* master = Master();
407 AliDebug(1,Form("UpdatingGroups of the detached painter %s from its master %s",
408 p->GetName(),master->GetName()));
409 p->UpdateGroupsFrom(*master);
415 //_____________________________________________________________________________
417 AliMUONVPainter::Depth() const
419 /// Return our depth in the hierarchy
423 return Mother()->Depth() + 1;
431 //_____________________________________________________________________________
433 AliMUONVPainter::DistancetoPrimitive(Int_t px, Int_t py)
435 /// See TObject::DistancetoPrimitive
437 static const Int_t kBigValue = 999999;
439 if (!gPad) return kBigValue;
443 AliMUONVPainter* painter = GetPainter(px,py,x,y);
445 x=y=0.0; // to avoid compiler warning
447 if ( painter == this) return 0;
452 //_____________________________________________________________________________
454 AliMUONVPainter::DoubleClicked(AliMUONVPainter*, Double_t*)
456 /// Should emit the DoubleClicked signal (if I knew how to detect those events...)
458 AliWarning("Please implement me !");
462 // // let our top mother emit the signal as clients are probably connected to
463 // // our mother, not to us
464 // Top()->DoubleClicked(painter,values);
468 // Long_t param[] = { (Long_t)painter,(Long_t)values };
470 // Emit("DoubleClicked(AliMUONVPainter*,Double_t*)",param);
474 //_____________________________________________________________________________
476 AliMUONVPainter::Draw(Option_t* opt)
478 /// Append ourselves to the current pad
482 gROOT->MakeDefCanvas();
485 Bool_t kMustSetRange(kFALSE);
490 if (sopt.Contains("R") ) kMustSetRange=kTRUE;
494 Double_t x1,y1,x2,y2;
495 GetBoundingBox(x1,y1,x2,y2);
496 if ( gPad) gPad->Range(x1,y1,x2,y2);
499 if ( !fMother && !fPainterGroups )
504 TIter next(fChildren);
505 AliMUONVPainter* painter;
506 while ( ( painter = static_cast<AliMUONVPainter*>(next()) ) )
516 //_____________________________________________________________________________
518 AliMUONVPainter::ExecuteEvent(Int_t event, Int_t px, Int_t py)
520 /// Handle graphics events
524 AliMUONVPainter* painter = GetPainter(px,py,x,y);
526 if ( painter == this )
528 Double_t values[] = { x,y };
533 ShiftClicked(this,values);
536 Clicked(this,values);
539 //the following statement is required against other loop executions before returning (depending on the time between the clicks)
540 gPad->GetCanvas()->HandleInput((EEventType)-1,0,0);
541 DoubleClicked(this,values);
547 //_____________________________________________________________________________
549 AliMUONVPainter::FlatList(TList& list)
551 /// Make a flat list of our children (and ourselves)
553 TIter next(fChildren);
554 AliMUONVPainter* painter;
555 while ( ( painter = static_cast<AliMUONVPainter*>(next())))
557 painter->FlatList(list);
563 //_____________________________________________________________________________
565 AliMUONVPainter::GetBoundingBox(Double_t& x1, Double_t& y1,
566 Double_t& x2, Double_t& y2) const
568 /// Get the bounding box = our area
569 AliMpArea area(Area().GetPositionX(),
570 Area().GetPositionY(),
571 Area().GetDimensionX()*fBorderFactor,
572 Area().GetDimensionY()*fBorderFactor);
574 x1 = area.LeftBorder();
575 y1 = area.DownBorder();
576 x2 = area.RightBorder();
577 y2 = area.UpBorder();
580 //_____________________________________________________________________________
582 AliMUONVPainter::GetObjectInfo(Int_t, Int_t) const
584 /// See TObject::GetObjectInfo
585 return const_cast<char*>(GetName());
588 //_____________________________________________________________________________
590 AliMUONVPainter::GetPainter(Int_t px, Int_t py, Double_t& x, Double_t& y) const
592 /// Get the responder painter at integer position (px,py), and get back its
593 /// absolute position (x,y)
595 PixelToPad(px,py,x,y);
597 if ( !IsInside(x,y) ) return 0x0;
599 if ( fGroup->IsResponder() ) return const_cast<AliMUONVPainter*>(this);
603 TIter next(fChildren);
604 AliMUONVPainter* painter;
606 while ( ( painter = static_cast<AliMUONVPainter*>(next()) ) )
608 AliMUONVPainter* p = painter->GetPainter(px,py,x,y);
616 //_____________________________________________________________________________
618 AliMUONVPainter::GetTypes(TObjArray& types) const
620 /// Get the list of types (as a TObjArray of TObjString)
621 /// of our hierarchy, sorted alphabetically
623 types.SetOwner(kTRUE);
627 tmp.SetOwner(kFALSE);
629 TIter next(fPainterGroups);
632 while ( ( str = static_cast<TObjString*>(next()) ) )
634 AliMUONPainterGroup* group = Group(str->String().Data());
640 Int_t n = tmp.GetLast()+1;
642 Int_t* index = new Int_t[n];
644 Int_t* a = new Int_t[n];
646 for ( Int_t i = 0; i < n; ++i )
648 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(tmp.At(i));
649 a[i] = group->Depth();
652 TMath::Sort(n,a,index,kFALSE);
654 for ( Int_t i = 0; i < n; ++i )
656 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(tmp.At(index[i]));
657 types.AddLast(new TObjString(group->Type()));
664 //_____________________________________________________________________________
666 AliMUONVPainter::Group(const char* type) const
668 /// Returns a group of a given type
669 if (!fPainterGroups) return 0x0;
670 return static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(type));
673 //_____________________________________________________________________________
675 AliMUONVPainter::Group(Int_t depth) const
677 /// Returns a group of a given depth
678 if (!fPainterGroups) return 0x0;
679 TIter next(fPainterGroups);
680 TObjString* groupName;
681 while ( ( groupName = static_cast<TObjString*>(next()) ) )
683 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>
684 (fPainterGroups->GetValue(groupName->String().Data()));
685 if ( group->Depth() == depth )
693 //_____________________________________________________________________________
695 AliMUONVPainter::IsInside(Double_t x, Double_t y) const
697 /// Whether point (x,y) is inside our contour
698 if (!fContour) return kFALSE;
699 return fContour->IsInside(x,y);
702 //_____________________________________________________________________________
704 AliMUONVPainter::IsResponder() const
706 /// Whether we're responding to mouse events
707 return MotherGroup()->IsResponder();
710 //_____________________________________________________________________________
712 AliMUONVPainter::Master() const
714 /// Return the top of the hierarchy
716 /// if we get no mother, we are the master
718 if ( Mother() == 0x0 ) return const_cast<AliMUONVPainter*>(this);
720 AliMUONVPainter* p = Mother();
722 while ( p->Mother() )
730 //_____________________________________________________________________________
732 AliMUONVPainter::Paint(Option_t*)
734 /// Paint ourselves of screen
735 /// If we have some data (i.e. we're belonging to the plotter group)
736 /// we use PaintArea.
737 /// And if must be outlined, then we do that too.
739 if ( !MotherGroup()->IsVisible() ) return;
741 if ( MotherGroup()->IsPlotter() )
743 PaintArea(*(MotherGroup()->Data()),
744 MotherGroup()->DataIndex(),
745 MotherGroup()->DataMin(),
746 MotherGroup()->DataMax());
749 if ( MotherGroup()->IsOutlined() )
756 AliMUONContourPainter::Paint(*fContour,1,1,2); // red fill with black thin outline
760 //_____________________________________________________________________________
762 AliMUONVPainter::Describe(const AliMUONVTrackerData&, Int_t, Double_t, Double_t)
764 /// Default implementation (must be overriden)
765 AliError(Form("%s : implement me",GetName()));
769 //_____________________________________________________________________________
771 AliMUONVPainter::PaintArea(const AliMUONVTrackerData&, Int_t, Double_t, Double_t)
773 /// Default implementation (must be overriden)
774 AliError(Form("%s : implement me",GetName()));
778 //_____________________________________________________________________________
780 AliMUONVPainter::PaintOutline(Int_t color, Int_t width, Double_t /*x*/, Double_t /*y*/)
782 /// Default implementation is simply a drawing of the contour lines,
783 /// not using the optional (x,y)
784 Int_t c = color >= 0 ? color : GetLineColor();
785 Int_t w = width >= 0 ? width : GetLineWidth();
787 AliMUONContourPainter::Paint(*fContour,c,w);
790 //_____________________________________________________________________________
792 AliMUONVPainter::PixelToPad(Int_t px, Int_t py, Double_t& x, Double_t& y)
794 /// convert (px,py) into pad position (x,y)
796 x = gPad->PadtoX(gPad->AbsPixeltoX(px));
797 y = gPad->PadtoY(gPad->AbsPixeltoY(py));
800 //_____________________________________________________________________________
802 AliMUONVPainter::Print(Option_t* opt) const
805 for ( Int_t i = 0; i < Depth()*4; ++i )
810 if ( !IsValid() ) cout << "!!!INVALID!!!" << endl;
812 cout << Form("%p Name %s Depth %d ContourName %s ID=(%d,%d)",
813 this,GetName(),Depth(),ContourName().Data(),ID0(),ID1());
815 if ( fResponderGroup )
817 cout << Form(" Responder group %p %s",fResponderGroup,fResponderGroup->Type());
821 cout << Form(" Plotter group %p %s",fPlotterGroup,fPlotterGroup->Type());
825 cout << Form(" Mother %p %s",Mother(),Mother()->GetName());
829 cout << Form(" Group %p %s ",MotherGroup(),MotherGroup()->Type());
834 cout << Form(" %d children",fChildren->GetLast()+1);
842 if ( fChildren && ( sopt == "FULL" || sopt == "CHILD" ) )
844 TIter next(fChildren);
845 AliMUONVPainter* painter;
846 while ( ( painter = static_cast<AliMUONVPainter*>(next()) ) )
852 if ( fPainterGroups && ( sopt == "FULL" || sopt == "GROUP" ) )
854 TIter next(fPainterGroups);
855 TObjString* groupName;
856 while ( ( groupName = static_cast<TObjString*>(next()) ) )
858 AliMUONPainterGroup* group = Group(groupName->String().Data());
864 //_____________________________________________________________________________
866 AliMUONVPainter::SetAttributes(const AliMUONAttPainter& attributes)
868 /// Set our attributes
869 fAttributes = attributes;
872 //_____________________________________________________________________________
874 AliMUONVPainter::SetContour(AliMUONContour* contour)
879 AliError(Form("Setting a null contour for painter %s : bad idea !",PathName().Data()));
884 //_____________________________________________________________________________
886 AliMUONVPainter::SetData(const char* pattern, AliMUONVTrackerData* data,
889 /// Tell all painters which type matches pattern that they should
890 /// monitor a given data source
892 if ( !fPainterGroups )
899 data->Connect("Destroyed()",ClassName(),this,Form("SetData(=\"%s\",0x0,-1)",pattern));
902 TIter next(fPainterGroups);
907 while ( ( str = static_cast<TObjString*>(next()) ) )
909 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(str));
911 if ( group->Matches(pattern) )
913 group->SetData(data,dataIndex);
916 fPlotterGroup = group;
921 group->SetData(0x0,-1);
925 // Update context menus
932 AliMUONPainterGroup* group = Master()->PlotterGroup();
934 while ( ( p = static_cast<AliMUONVPainter*>(pnext()) ) )
936 TList* l = p->IsA()->GetMenuList();
940 TClassMenuItem* n(0x0);
942 l->Add(new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
943 "Include","Include",p,"",-1,kTRUE));
944 l->Add(new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
945 "Exclude","Exclude",p,"",-1,kTRUE));
949 if ( data && data->IsHistogrammed(0) )
951 // Add histo drawing to the popup menu
952 TString name("Draw histogram of ");
954 name += data->ExternalDimensionName(0);
956 n = new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
957 name.Data(),"DrawHistogram0",p,"",-1,kTRUE);
962 n = new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
963 name.Data(),"DrawHistogramClone0",p,"",-1,kTRUE);
967 Int_t nd = data->IsSingleEvent() ? data->ExternalDimension() : data->ExternalDimension()*2;
969 for ( Int_t i = 0; i < nd; ++i )
971 n = new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
972 Form("Draw %s clone",data->DimensionName(i).Data()),
973 Form("DrawInternalHistogramClone%d",i),p,"",-1,kTRUE);
980 //_____________________________________________________________________________
982 AliMUONVPainter::DrawInternalHistogram(Int_t dim) const
984 /// Draw histogram (and delete the previous one)
989 DrawInternalHistogramClone(dim);
992 //_____________________________________________________________________________
994 AliMUONVPainter::DrawInternalHistogramClone(Int_t dim) const
998 fHistogram = AliMUONTrackerDataHistogrammer::CreateHisto(*this,-1,dim);
1007 //_____________________________________________________________________________
1009 AliMUONVPainter::DrawHistogram(Double_t* values) const
1011 /// Draw histogram (and delete the previous one)
1016 DrawHistogramClone(values);
1019 //_____________________________________________________________________________
1021 AliMUONVPainter::DrawHistogramClone(Double_t*) const
1025 fHistogram = AliMUONTrackerDataHistogrammer::CreateHisto(*this,0,-1);
1034 //_____________________________________________________________________________
1036 AliMUONVPainter::FillManuList(TObjArray& manuList) const
1038 /// Append to manulist
1039 /// This is the default implementation, which just calls the FillManuList
1040 /// of all our children.
1041 /// Some derived class might need to override this in order to exclude
1042 /// some children from the fill.
1044 TIter next(Children());
1048 while ( ( p = static_cast<AliMUONVPainter*>(next()) ) )
1050 p->FillManuList(manuList);
1054 //_____________________________________________________________________________
1056 AliMUONVPainter::SetLine(Int_t depth, Int_t lineColor, Int_t lineWidth)
1058 /// Set the line attributes of painters at a given depth
1059 AliMUONPainterGroup* group = Group(depth);
1062 group->SetLine(lineColor,lineWidth);
1066 //_____________________________________________________________________________
1068 AliMUONVPainter::SetMother(AliMUONVPainter* painter)
1074 //_____________________________________________________________________________
1076 AliMUONVPainter::SetOutlined(const char* pattern, Bool_t flag)
1078 /// Decide whether or not painters which type matches pattern
1079 /// should be outlined
1081 AliDebug(1,Form("pattern=%s flag=%d",pattern,flag));
1083 if (!fPainterGroups)
1088 TIter next(fPainterGroups);
1091 while ( ( str = static_cast<TObjString*>(next()) ) )
1093 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(str));
1094 if ( group->Matches(pattern) )
1096 group->SetOutlined(flag);
1101 //_____________________________________________________________________________
1103 AliMUONVPainter::SetResponder(const char* pattern)
1105 /// Set the painters matching pattern to be the responder
1107 AliDebug(1,Form("pattern=%s",pattern));
1109 if (!fPainterGroups)
1114 TIter next(fPainterGroups);
1117 fResponderGroup = 0x0;
1119 while ( ( str = static_cast<TObjString*>(next()) ) )
1121 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(str));
1122 if ( group->Matches(pattern) )
1124 AliDebug(1,Form("group %s is matching pattern %s : setting to responder",
1125 group->Type(),pattern));
1126 group->SetResponder(kTRUE);
1127 fResponderGroup = group;
1131 group->SetResponder(kFALSE);
1136 //_____________________________________________________________________________
1138 AliMUONVPainter::SetResponder(Int_t depth)
1140 /// Select as responder the *first* group that has a given depth
1142 AliDebug(1,Form("depth=%d",depth));
1144 if (!fPainterGroups)
1149 TIter next(fPainterGroups);
1152 fResponderGroup = 0x0;
1154 while ( ( str = static_cast<TObjString*>(next()) ) )
1156 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(str));
1157 if ( group->Depth() == depth )
1159 AliDebug(1,Form("group %s has correct depth = %d, using as responder",
1160 group->Type(),depth));
1161 group->SetResponder(kTRUE);
1162 fResponderGroup = group;
1167 group->SetResponder(kFALSE);
1172 //_____________________________________________________________________________
1174 AliMUONVPainter::SetVisible(const char* pattern, Bool_t flag)
1176 /// Decide whether the painters matching pattern should be visible or not
1177 AliDebug(1,Form("pattern=%s flag=%d",pattern,flag));
1179 if (!fPainterGroups)
1184 TIter next(fPainterGroups);
1187 while ( ( str = static_cast<TObjString*>(next()) ) )
1189 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(str));
1190 if ( group->Matches(pattern) )
1192 group->SetVisible(flag);
1197 //_____________________________________________________________________________
1199 AliMUONVPainter::UpdateGroupsFrom(const AliMUONVPainter& painter)
1201 /// (re)Create groups
1202 delete fPainterGroups;
1203 fPainterGroups = 0x0;
1207 // and copy the status of responder, plotter and visible
1208 if ( painter.ResponderGroup() )
1210 SetResponder(painter.ResponderGroup()->Type());
1213 if ( painter.PlotterGroup() )
1215 SetData(painter.PlotterGroup()->Type(),
1216 painter.PlotterGroup()->Data(),
1217 painter.PlotterGroup()->DataIndex());
1218 PlotterGroup()->SetDataRange(painter.PlotterGroup()->DataMin(),
1219 painter.PlotterGroup()->DataMax());
1223 painter.GetTypes(types);
1225 TObjString* groupName;
1227 while ( ( groupName = static_cast<TObjString*>(next()) ) )
1229 AliMUONPainterGroup* group = painter.Group(groupName->String().Data());
1230 if ( group->IsVisible() )
1232 SetVisible(group->Type(),kTRUE);
1236 SetVisible(group->Type(),kFALSE);
1239 if ( group->IsOutlined() )
1241 SetOutlined(group->Type(),kTRUE);
1245 SetOutlined(group->Type(),kFALSE);
1248 SetLine(group->Depth(),group->GetLineColor(),group->GetLineWidth());
1253 //_____________________________________________________________________________
1255 AliMUONVPainter::Include()
1257 /// Include this painter
1260 /// Update the global interactive read out configuration
1264 //_____________________________________________________________________________
1266 AliMUONVPainter::GetIROCManuList(TObjArray& manuList)
1268 /// Get the list of manus spanned by this painter AND by its dual
1270 FillManuList(manuList);
1273 AliMUONAttPainter att(Attributes());
1277 att.SetCathodeAndPlaneDisabled(kTRUE);
1279 AliMUONVPainter* p = AliMUONVPainter::CreatePainter(ClassName(),att,ID0(),ID1());
1283 p->FillManuList(manuList);
1289 //_____________________________________________________________________________
1291 AliMUONVPainter::WriteIROC(Double_t value)
1293 /// Update the interactive readout configuration
1296 GetIROCManuList(manuList);
1299 TIter nextm(&manuList);
1300 AliMUON2DMap store(true);
1302 while ((muid=static_cast<AliMpManuUID*>(nextm())))
1304 AliMUONVCalibParam* param = new AliMUONCalibParamND(1,64,
1306 muid->ManuId(),value);
1310 InteractiveReadOutConfig()->Replace(store);
1313 //_____________________________________________________________________________
1315 AliMUONVPainter::Exclude()
1317 /// Exclude this painter
1320 /// Update the global interactive read out configuration
1324 //_____________________________________________________________________________
1325 AliMUONVTrackerData*
1326 AliMUONVPainter::InteractiveReadOutConfig() const
1328 /// get the interactive readout config object
1329 return AliMUONPainterDataRegistry::Instance()->InteractiveReadOutConfig();
1332 //_____________________________________________________________________________
1334 AliMUONVPainter::CreatePainter(const char* className,
1335 const AliMUONAttPainter& att,
1336 Int_t id1, Int_t id2)
1338 /// Create a painter (factory method)
1340 TClass* c = TClass::GetClass(className);
1344 AliErrorClass(Form("Cannot get class %s",className));
1352 call.InitWithPrototype(c,className,"AliMUONAttPainter&,Int_t");
1354 if (call.IsValid()) n = 1;
1357 call.InitWithPrototype(c,className,"AliMUONAttPainter&,Int_t,Int_t");
1359 if ( call.IsValid() ) n = 2;
1362 Long_t returnLong(0x0);
1366 Long_t params[] = { (Long_t)(&att), (Long_t)(id1) };
1367 call.SetParamPtrs((void*)(params));
1368 call.Execute((void*)(0x0),returnLong);
1372 Long_t params[] = { (Long_t)(&att), (Long_t)(id1), (Long_t)(id2) };
1373 call.SetParamPtrs((void*)(params));
1374 call.Execute((void*)(0x0),returnLong);
1379 AliErrorClass(Form("Cannot create a painter of class %s",className));
1382 AliMUONVPainter* rv = reinterpret_cast<AliMUONVPainter*> (returnLong);
1386 AliErrorClass(Form("Painter of class %s is not valid",className));
1393 //_____________________________________________________________________________
1395 AliMUONVPainter::PaintArea(Int_t fillColor)
1397 AliMUONContourPainter::Paint(*(Contour()),-1,-1,fillColor);