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 "AliMUON2DMap.h"
23 #include "AliMUONCalibParamND.h"
24 #include "AliMUONPainterRegistry.h"
25 #include "AliMpManuUID.h"
26 #include "AliMUONObjectPair.h"
27 #include "AliMUONPainterContour.h"
28 #include "AliMUONPainterGroup.h"
29 #include "AliMUONPainterHelper.h"
30 #include "AliMUONTrackerDataHistogrammer.h"
31 #include "AliMUONVTrackerData.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().Position(),Area().Dimensions()*fBorderFactor);
571 x1 = area.LeftBorder();
572 y1 = area.DownBorder();
573 x2 = area.RightBorder();
574 y2 = area.UpBorder();
577 //_____________________________________________________________________________
579 AliMUONVPainter::GetObjectInfo(Int_t, Int_t) const
581 /// See TObject::GetObjectInfo
582 return const_cast<char*>(GetName());
585 //_____________________________________________________________________________
587 AliMUONVPainter::GetPainter(Int_t px, Int_t py, Double_t& x, Double_t& y) const
589 /// Get the responder painter at integer position (px,py), and get back its
590 /// absolute position (x,y)
592 PixelToPad(px,py,x,y);
594 if ( !IsInside(x,y) ) return 0x0;
596 if ( fGroup->IsResponder() ) return const_cast<AliMUONVPainter*>(this);
600 TIter next(fChildren);
601 AliMUONVPainter* painter;
603 while ( ( painter = static_cast<AliMUONVPainter*>(next()) ) )
605 AliMUONVPainter* p = painter->GetPainter(px,py,x,y);
613 //_____________________________________________________________________________
615 AliMUONVPainter::GetTypes(TObjArray& types) const
617 /// Get the list of types (as a TObjArray of TObjString)
618 /// of our hierarchy, sorted alphabetically
620 types.SetOwner(kTRUE);
624 tmp.SetOwner(kFALSE);
626 TIter next(fPainterGroups);
629 while ( ( str = static_cast<TObjString*>(next()) ) )
631 AliMUONPainterGroup* group = Group(str->String().Data());
637 Int_t n = tmp.GetLast()+1;
639 Int_t* index = new Int_t[n];
641 Int_t* a = new Int_t[n];
643 for ( Int_t i = 0; i < n; ++i )
645 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(tmp.At(i));
646 a[i] = group->Depth();
649 TMath::Sort(n,a,index,kFALSE);
651 for ( Int_t i = 0; i < n; ++i )
653 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(tmp.At(index[i]));
654 types.AddLast(new TObjString(group->Type()));
661 //_____________________________________________________________________________
663 AliMUONVPainter::Group(const char* type) const
665 /// Returns a group of a given type
666 if (!fPainterGroups) return 0x0;
667 return static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(type));
670 //_____________________________________________________________________________
672 AliMUONVPainter::Group(Int_t depth) const
674 /// Returns a group of a given depth
675 if (!fPainterGroups) return 0x0;
676 TIter next(fPainterGroups);
677 TObjString* groupName;
678 while ( ( groupName = static_cast<TObjString*>(next()) ) )
680 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>
681 (fPainterGroups->GetValue(groupName->String().Data()));
682 if ( group->Depth() == depth )
690 //_____________________________________________________________________________
692 AliMUONVPainter::IsInside(Double_t x, Double_t y) const
694 /// Whether point (x,y) is inside our contour
695 if (!fContour) return kFALSE;
696 return fContour->IsInside(x,y);
699 //_____________________________________________________________________________
701 AliMUONVPainter::IsResponder() const
703 /// Whether we're responding to mouse events
704 return MotherGroup()->IsResponder();
707 //_____________________________________________________________________________
709 AliMUONVPainter::Master() const
711 /// Return the top of the hierarchy
713 /// if we get no mother, we are the master
715 if ( Mother() == 0x0 ) return const_cast<AliMUONVPainter*>(this);
717 AliMUONVPainter* p = Mother();
719 while ( p->Mother() )
727 //_____________________________________________________________________________
729 AliMUONVPainter::Paint(Option_t*)
731 /// Paint ourselves of screen
732 /// If we have some data (i.e. we're belonging to the plotter group)
733 /// we use PaintArea.
734 /// And if must be outlined, then we do that too.
736 if ( !MotherGroup()->IsVisible() ) return;
738 if ( MotherGroup()->IsPlotter() )
740 PaintArea(*(MotherGroup()->Data()),
741 MotherGroup()->DataIndex(),
742 MotherGroup()->DataMin(),
743 MotherGroup()->DataMax());
746 if ( MotherGroup()->IsOutlined() )
753 fContour->PaintArea(2);
754 fContour->PaintOutline(1,1);
758 //_____________________________________________________________________________
760 AliMUONVPainter::Describe(const AliMUONVTrackerData&, Int_t, Double_t, Double_t)
762 /// Default implementation (must be overriden)
763 AliError(Form("%s : implement me",GetName()));
767 //_____________________________________________________________________________
769 AliMUONVPainter::PaintArea(const AliMUONVTrackerData&, Int_t, Double_t, Double_t)
771 /// Default implementation (must be overriden)
772 AliError(Form("%s : implement me",GetName()));
776 //_____________________________________________________________________________
778 AliMUONVPainter::PaintOutline(Int_t color, Int_t width, Double_t /*x*/, Double_t /*y*/)
780 /// Default implementation is simply a drawing of the contour lines,
781 /// not using the optional (x,y)
782 Int_t c = color >= 0 ? color : GetLineColor();
783 Int_t w = width >= 0 ? width : GetLineWidth();
785 fContour->PaintOutline(c,w);
788 //_____________________________________________________________________________
790 AliMUONVPainter::PixelToPad(Int_t px, Int_t py, Double_t& x, Double_t& y)
792 /// convert (px,py) into pad position (x,y)
794 x = gPad->PadtoX(gPad->AbsPixeltoX(px));
795 y = gPad->PadtoY(gPad->AbsPixeltoY(py));
798 //_____________________________________________________________________________
800 AliMUONVPainter::Print(Option_t* opt) const
803 for ( Int_t i = 0; i < Depth()*4; ++i )
808 if ( !IsValid() ) cout << "!!!INVALID!!!" << endl;
810 cout << Form("%p Name %s Depth %d ContourName %s ID=(%d,%d)",
811 this,GetName(),Depth(),ContourName().Data(),ID0(),ID1());
813 if ( fResponderGroup )
815 cout << Form(" Responder group %p %s",fResponderGroup,fResponderGroup->Type());
819 cout << Form(" Plotter group %p %s",fPlotterGroup,fPlotterGroup->Type());
823 cout << Form(" Mother %p %s",Mother(),Mother()->GetName());
827 cout << Form(" Group %p %s ",MotherGroup(),MotherGroup()->Type());
832 cout << Form(" %d children",fChildren->GetLast()+1);
840 if ( fChildren && ( sopt == "FULL" || sopt == "CHILD" ) )
842 TIter next(fChildren);
843 AliMUONVPainter* painter;
844 while ( ( painter = static_cast<AliMUONVPainter*>(next()) ) )
850 if ( fPainterGroups && ( sopt == "FULL" || sopt == "GROUP" ) )
852 TIter next(fPainterGroups);
853 TObjString* groupName;
854 while ( ( groupName = static_cast<TObjString*>(next()) ) )
856 AliMUONPainterGroup* group = Group(groupName->String().Data());
862 //_____________________________________________________________________________
864 AliMUONVPainter::SetAttributes(const AliMUONAttPainter& attributes)
866 /// Set our attributes
867 fAttributes = attributes;
870 //_____________________________________________________________________________
872 AliMUONVPainter::SetContour(AliMUONPainterContour* contour)
877 AliError(Form("Setting a null contour for painter %s : bad idea !",PathName().Data()));
882 //_____________________________________________________________________________
884 AliMUONVPainter::SetData(const char* pattern, AliMUONVTrackerData* data,
887 /// Tell all painters which type matches pattern that they should
888 /// monitor a given data source
890 if ( !fPainterGroups )
897 data->Connect("Destroyed()",ClassName(),this,Form("SetData(=\"%s\",0x0,-1)",pattern));
900 TIter next(fPainterGroups);
905 while ( ( str = static_cast<TObjString*>(next()) ) )
907 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(str));
909 if ( group->Matches(pattern) )
911 group->SetData(data,dataIndex);
914 fPlotterGroup = group;
919 group->SetData(0x0,-1);
923 // Update context menus
930 AliMUONPainterGroup* group = Master()->PlotterGroup();
932 while ( ( p = static_cast<AliMUONVPainter*>(pnext()) ) )
934 TList* l = p->IsA()->GetMenuList();
938 TClassMenuItem* n(0x0);
940 l->Add(new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
941 "Include","Include",p,"",-1,kTRUE));
942 l->Add(new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
943 "Exclude","Exclude",p,"",-1,kTRUE));
947 if ( data && data->IsHistogrammed(0) )
949 // Add histo drawing to the popup menu
950 TString name("Draw histogram of ");
952 name += data->ExternalDimensionName(0);
954 n = new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
955 name.Data(),"DrawHistogram0",p,"",-1,kTRUE);
960 n = new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
961 name.Data(),"DrawHistogramClone0",p,"",-1,kTRUE);
965 Int_t nd = data->IsSingleEvent() ? data->ExternalDimension() : data->ExternalDimension()*2;
967 for ( Int_t i = 0; i < nd; ++i )
969 n = new TClassMenuItem(TClassMenuItem::kPopupUserFunction,p->IsA(),
970 Form("Draw %s clone",data->DimensionName(i).Data()),
971 Form("DrawInternalHistogramClone%d",i),p,"",-1,kTRUE);
978 //_____________________________________________________________________________
980 AliMUONVPainter::DrawInternalHistogram(Int_t dim) const
982 /// Draw histogram (and delete the previous one)
987 DrawInternalHistogramClone(dim);
990 //_____________________________________________________________________________
992 AliMUONVPainter::DrawInternalHistogramClone(Int_t dim) const
996 fHistogram = AliMUONTrackerDataHistogrammer::CreateHisto(*this,-1,dim);
1005 //_____________________________________________________________________________
1007 AliMUONVPainter::DrawHistogram(Double_t* values) const
1009 /// Draw histogram (and delete the previous one)
1014 DrawHistogramClone(values);
1017 //_____________________________________________________________________________
1019 AliMUONVPainter::DrawHistogramClone(Double_t*) const
1023 fHistogram = AliMUONTrackerDataHistogrammer::CreateHisto(*this,0,-1);
1032 //_____________________________________________________________________________
1034 AliMUONVPainter::FillManuList(TObjArray& manuList) const
1036 /// Append to manulist
1037 /// This is the default implementation, which just calls the FillManuList
1038 /// of all our children.
1039 /// Some derived class might need to override this in order to exclude
1040 /// some children from the fill.
1042 TIter next(Children());
1046 while ( ( p = static_cast<AliMUONVPainter*>(next()) ) )
1048 p->FillManuList(manuList);
1052 //_____________________________________________________________________________
1054 AliMUONVPainter::SetLine(Int_t depth, Int_t lineColor, Int_t lineWidth)
1056 /// Set the line attributes of painters at a given depth
1057 AliMUONPainterGroup* group = Group(depth);
1060 group->SetLine(lineColor,lineWidth);
1064 //_____________________________________________________________________________
1066 AliMUONVPainter::SetMother(AliMUONVPainter* painter)
1072 //_____________________________________________________________________________
1074 AliMUONVPainter::SetOutlined(const char* pattern, Bool_t flag)
1076 /// Decide whether or not painters which type matches pattern
1077 /// should be outlined
1079 AliDebug(1,Form("pattern=%s flag=%d",pattern,flag));
1081 if (!fPainterGroups)
1086 TIter next(fPainterGroups);
1089 while ( ( str = static_cast<TObjString*>(next()) ) )
1091 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(str));
1092 if ( group->Matches(pattern) )
1094 group->SetOutlined(flag);
1099 //_____________________________________________________________________________
1101 AliMUONVPainter::SetResponder(const char* pattern)
1103 /// Set the painters matching pattern to be the responder
1105 AliDebug(1,Form("pattern=%s",pattern));
1107 if (!fPainterGroups)
1112 TIter next(fPainterGroups);
1115 fResponderGroup = 0x0;
1117 while ( ( str = static_cast<TObjString*>(next()) ) )
1119 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(str));
1120 if ( group->Matches(pattern) )
1122 AliDebug(1,Form("group %s is matching pattern %s : setting to responder",
1123 group->Type(),pattern));
1124 group->SetResponder(kTRUE);
1125 fResponderGroup = group;
1129 group->SetResponder(kFALSE);
1134 //_____________________________________________________________________________
1136 AliMUONVPainter::SetResponder(Int_t depth)
1138 /// Select as responder the *first* group that has a given depth
1140 AliDebug(1,Form("depth=%d",depth));
1142 if (!fPainterGroups)
1147 TIter next(fPainterGroups);
1150 fResponderGroup = 0x0;
1152 while ( ( str = static_cast<TObjString*>(next()) ) )
1154 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(str));
1155 if ( group->Depth() == depth )
1157 AliDebug(1,Form("group %s has correct depth = %d, using as responder",
1158 group->Type(),depth));
1159 group->SetResponder(kTRUE);
1160 fResponderGroup = group;
1165 group->SetResponder(kFALSE);
1170 //_____________________________________________________________________________
1172 AliMUONVPainter::SetVisible(const char* pattern, Bool_t flag)
1174 /// Decide whether the painters matching pattern should be visible or not
1175 AliDebug(1,Form("pattern=%s flag=%d",pattern,flag));
1177 if (!fPainterGroups)
1182 TIter next(fPainterGroups);
1185 while ( ( str = static_cast<TObjString*>(next()) ) )
1187 AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(str));
1188 if ( group->Matches(pattern) )
1190 group->SetVisible(flag);
1195 //_____________________________________________________________________________
1197 AliMUONVPainter::UpdateGroupsFrom(const AliMUONVPainter& painter)
1199 /// (re)Create groups
1200 delete fPainterGroups;
1201 fPainterGroups = 0x0;
1205 // and copy the status of responder, plotter and visible
1206 if ( painter.ResponderGroup() )
1208 SetResponder(painter.ResponderGroup()->Type());
1211 if ( painter.PlotterGroup() )
1213 SetData(painter.PlotterGroup()->Type(),
1214 painter.PlotterGroup()->Data(),
1215 painter.PlotterGroup()->DataIndex());
1216 PlotterGroup()->SetDataRange(painter.PlotterGroup()->DataMin(),
1217 painter.PlotterGroup()->DataMax());
1221 painter.GetTypes(types);
1223 TObjString* groupName;
1225 while ( ( groupName = static_cast<TObjString*>(next()) ) )
1227 AliMUONPainterGroup* group = painter.Group(groupName->String().Data());
1228 if ( group->IsVisible() )
1230 SetVisible(group->Type(),kTRUE);
1234 SetVisible(group->Type(),kFALSE);
1237 if ( group->IsOutlined() )
1239 SetOutlined(group->Type(),kTRUE);
1243 SetOutlined(group->Type(),kFALSE);
1246 SetLine(group->Depth(),group->GetLineColor(),group->GetLineWidth());
1251 //_____________________________________________________________________________
1253 AliMUONVPainter::Include()
1255 /// Include this painter
1258 /// Update the global interactive read out configuration
1262 //_____________________________________________________________________________
1264 AliMUONVPainter::GetIROCManuList(TObjArray& manuList)
1266 /// Get the list of manus spanned by this painter AND by its dual
1268 FillManuList(manuList);
1271 AliMUONAttPainter att(Attributes());
1275 att.SetCathodeAndPlaneDisabled(kTRUE);
1277 AliMUONVPainter* p = AliMUONVPainter::CreatePainter(ClassName(),att,ID0(),ID1());
1281 p->FillManuList(manuList);
1287 //_____________________________________________________________________________
1289 AliMUONVPainter::WriteIROC(Double_t value)
1291 /// Update the interactive readout configuration
1294 GetIROCManuList(manuList);
1297 TIter nextm(&manuList);
1298 AliMUON2DMap store(true);
1300 while ((muid=static_cast<AliMpManuUID*>(nextm())))
1302 AliMUONVCalibParam* param = new AliMUONCalibParamND(1,64,
1304 muid->ManuId(),value);
1308 InteractiveReadOutConfig()->Replace(store);
1311 //_____________________________________________________________________________
1313 AliMUONVPainter::Exclude()
1315 /// Exclude this painter
1318 /// Update the global interactive read out configuration
1322 //_____________________________________________________________________________
1323 AliMUONVTrackerData*
1324 AliMUONVPainter::InteractiveReadOutConfig() const
1326 /// get the interactive readout config object
1327 return AliMUONPainterRegistry::Instance()->InteractiveReadOutConfig();
1330 //_____________________________________________________________________________
1332 AliMUONVPainter::CreatePainter(const char* className,
1333 const AliMUONAttPainter& att,
1334 Int_t id1, Int_t id2)
1336 /// Create a painter (factory method)
1338 TClass* c = TClass::GetClass(className);
1342 AliErrorClass(Form("Cannot get class %s",className));
1350 call.InitWithPrototype(c,className,"AliMUONAttPainter&,Int_t");
1352 if (call.IsValid()) n = 1;
1355 call.InitWithPrototype(c,className,"AliMUONAttPainter&,Int_t,Int_t");
1357 if ( call.IsValid() ) n = 2;
1360 Long_t returnLong(0x0);
1364 Long_t params[] = { (Long_t)(&att), (Long_t)(id1) };
1365 call.SetParamPtrs((void*)(params));
1366 call.Execute((void*)(0x0),returnLong);
1370 Long_t params[] = { (Long_t)(&att), (Long_t)(id1), (Long_t)(id2) };
1371 call.SetParamPtrs((void*)(params));
1372 call.Execute((void*)(0x0),returnLong);
1377 AliErrorClass(Form("Cannot create a painter of class %s",className));
1380 AliMUONVPainter* rv = reinterpret_cast<AliMUONVPainter*> (returnLong);
1384 AliErrorClass(Form("Painter of class %s is not valid",className));