LCOV - code coverage report
Current view: top level - MUON/MUONgraphics - AliMUONPainterMatrixFrame.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 274 0.4 %
Date: 2016-06-14 17:26:59 Functions: 1 30 3.3 %

          Line data    Source code
       1             : /**************************************************************************
       2             : * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       3             : *                                                                        *
       4             : * Author: The ALICE Off-line Project.                                    *
       5             : * Contributors are mentioned in the code where appropriate.              *
       6             : *                                                                        *
       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             : **************************************************************************/
      15             : 
      16             : // $Id$
      17             : 
      18             : #include "AliMUONPainterMatrixFrame.h"
      19             : 
      20             : #include "AliMUONPainterColorSlider.h"
      21             : #include "AliMUONPainterMatrix.h"
      22             : #include "AliMUONPainterGroup.h"
      23             : #include "AliMUONPainterHighlighter.h"
      24             : #include "AliMUONPainterInterfaceHelper.h"
      25             : #include "AliMUONPainterPlotSelector.h"
      26             : #include "AliMUONPainterRegistry.h"
      27             : #include "AliMUONVTrackerData.h"
      28             : #include "AliMUONVPainter.h"
      29             : #include "AliLog.h"
      30             : #include <Riostream.h>
      31             : #include <TCanvas.h>
      32             : #include <TEnv.h>
      33             : #include <TGButton.h>
      34             : #include <TGButtonGroup.h>
      35             : #include <TGFrame.h>
      36             : #include <TGListBox.h>
      37             : #include <TObjArray.h>
      38             : #include <TObjString.h>
      39             : #include <TRootEmbeddedCanvas.h>
      40             : #include <TString.h>
      41             : #include <cassert>
      42             : #include <float.h>
      43             : #include "AliMUONPainterEnv.h"
      44             : #include "AliMUONPainterHelper.h"
      45             : 
      46             : /// \class AliMUONPainterMatrixFrame
      47             : ///
      48             : /// A widget to draw a painter matrix, and the corresponding interface
      49             : /// to select what to outline or paint, and which part of the painter
      50             : /// is responding to mouse events
      51             : ///
      52             : /// \author Laurent Aphecetche, Subatech
      53             : 
      54             : ///\cond CLASSIMP
      55          12 : ClassImp(AliMUONPainterMatrixFrame)
      56             : ///\endcond
      57             : 
      58             : //_____________________________________________________________________________
      59             : AliMUONPainterMatrixFrame::AliMUONPainterMatrixFrame(const TGWindow* window, 
      60             :                                                    UInt_t w, UInt_t h)
      61           0 : : TGCompositeFrame(window,w,h,kVerticalFrame|kDoubleBorder),
      62           0 :   fPainterMatrix(0x0),
      63           0 :   fView(0x0),
      64           0 :   fInterface(0x0),
      65           0 :   fResponderButtons(0x0),
      66           0 :   fOutlineButtons(0x0),
      67           0 :   fPlotSelector(0x0),
      68           0 :   fPainterHighlighter(new AliMUONPainterHighlighter),
      69           0 :   fCanvasWidth(0),
      70           0 :   fCanvasHeight(0),
      71           0 :   fMainFrame(0x0),
      72           0 :   fColorSlider(0x0)
      73           0 : {
      74             :     /// ctor
      75             :     const Int_t kBorderSize = 10;
      76             : 
      77             :     UInt_t wi = w - kBorderSize*0;
      78           0 :     UInt_t hi = h - kBorderSize*1;
      79             :     
      80           0 :     fCanvasWidth = wi;
      81           0 :     fCanvasHeight = (UInt_t)(hi*0.75);
      82             :     
      83           0 :     fMainFrame = new TGHorizontalFrame(this,fCanvasWidth,hi);
      84             :     
      85             :     const Int_t kColorWidth = 100;
      86             :     
      87           0 :     fColorSlider = new AliMUONPainterColorSlider(fMainFrame,kColorWidth,fCanvasHeight);
      88             :     
      89           0 :     fView = new TRootEmbeddedCanvas("ec",fMainFrame,fCanvasWidth-kColorWidth,fCanvasHeight,kChildFrame);
      90             :     
      91           0 :     fInterface = new TGHorizontalFrame(this,fCanvasWidth);
      92             :     
      93           0 :     fMainFrame->AddFrame(fView, new TGLayoutHints(kLHintsExpandX));
      94           0 :     fMainFrame->AddFrame(fColorSlider,new TGLayoutHints(kLHintsTop|kLHintsRight|kLHintsCenterY,kBorderSize/2));
      95             : 
      96           0 :     AliMUONPainterInterfaceHelper::SetBackgroundColor("MatrixFrame.ColorSlider",*fColorSlider);
      97             :     
      98           0 :     fResponderButtons = new TGButtonGroup(fInterface,"Responder");
      99             :     
     100           0 :     fOutlineButtons = new TGButtonGroup(fInterface,"Outline");
     101             :     
     102           0 :     fInterface->AddFrame(fResponderButtons);
     103           0 :     fInterface->AddFrame(fOutlineButtons);
     104             : 
     105           0 :     fPlotSelector = 
     106           0 :       new AliMUONPainterPlotSelector(fInterface);//,wi,interfaceHeight);
     107             :     
     108           0 :     fInterface->AddFrame(fPlotSelector);//,new TGLayoutHints(kLHintsRight|kLHintsExpandX));
     109             : 
     110           0 :     fOutlineButtons->Show();
     111           0 :     fResponderButtons->Show();
     112             :         
     113           0 :     AddFrame(fMainFrame,new TGLayoutHints(kLHintsExpandX|kLHintsTop,
     114             :                                          0,0,0,0));
     115             : 
     116           0 :     AddFrame(fInterface,new TGLayoutHints(kLHintsExpandX|kLHintsBottom,
     117             :              0,0,kBorderSize,0));
     118             : 
     119             : 
     120             :     // Set the connections
     121             :     
     122           0 :     fPlotSelector->Connect("DataSourceWasChanged(const char*,AliMUONVTrackerData*,Int_t)",                                
     123             :                                  "AliMUONPainterMatrixFrame",
     124             :                                  this,
     125             :                                  "DataSourceWasChanged(const char*,AliMUONVTrackerData*,Int_t)");
     126             :     
     127           0 :     fColorSlider->Connect("DataRangeWasChanged(Double_t*)",
     128             :                           "AliMUONPainterMatrixFrame",
     129             :                          this,
     130             :                          "DataRangeWasChanged(Double_t*)");
     131             : 
     132           0 :     fColorSlider->Connect("DataRangeAutoRequested()",
     133             :                           "AliMUONPainterMatrixFrame",
     134             :                          this,
     135             :                          "DataRangeAutoRequested()");
     136             :   
     137           0 :     fColorSlider->Connect("DefaultButtonWasClicked()",
     138             :                           "AliMUONPainterMatrixFrame",
     139             :                           this,
     140             :                           "ColorSliderDefaultButtonWasClicked()");
     141             : 
     142           0 :   fColorSlider->Connect("SetDefaultButtonWasClicked(Double_t*)",
     143             :                         "AliMUONPainterMatrixFrame",
     144             :                         this,
     145             :                         "ColorSliderSetDefaultButtonWasClicked(Double_t*)");
     146             : 
     147             :     // Set the colors (mainly for debugging frame layout)
     148             : 
     149           0 :     AliMUONPainterInterfaceHelper::SetBackgroundColor("MatrixFrame.Main",*this);
     150             :     
     151           0 :     fMainFrame->HideFrame(fColorSlider);
     152             :     
     153           0 :     fMainFrame->Resize();
     154           0 : }
     155             : 
     156             : //_____________________________________________________________________________
     157           0 : AliMUONPainterMatrixFrame::~AliMUONPainterMatrixFrame()
     158           0 : {
     159             :   /// dtor
     160           0 :   delete fPainterHighlighter;
     161           0 :   AliError("Please write a decent dtor for this class !");
     162           0 : }
     163             : 
     164             : //_____________________________________________________________________________
     165             : void
     166             : AliMUONPainterMatrixFrame::ChangeTitle(const TString& title)
     167             : {
     168             :         /// Change title
     169           0 :     TitleHasChanged(title.Data());
     170           0 : }
     171             : 
     172             : //_____________________________________________________________________________
     173             : void
     174             : AliMUONPainterMatrixFrame::ChangeTitle(AliMUONVPainter* painter, 
     175             :                                        const char* basename,
     176             :                                        Double_t x, Double_t y)
     177             : {
     178             :   /// Change the title according to painter
     179             :   
     180           0 :   std::string name;
     181             :   
     182           0 :   if (painter) 
     183             :   {
     184             : 
     185           0 :     if ( basename ) name = basename;
     186           0 :     else name = painter->PathName();
     187             :     
     188           0 :     AliMUONVPainter* master = painter->Master();
     189             :     
     190           0 :     AliMUONPainterGroup* group = master->PlotterGroup();
     191             : 
     192           0 :     if ( group && group->Data() )
     193             :     {
     194           0 :       name += "\n";
     195           0 :       name += painter->Describe(*(group->Data()),group->DataIndex(),x,y);
     196           0 :     }
     197           0 :   }
     198             :   else
     199             :   {
     200           0 :     name = fPainterMatrix->GetName();
     201             :   }
     202             :   
     203           0 :   TitleHasChanged(name.c_str());
     204           0 : }
     205             : 
     206             : //_____________________________________________________________________________
     207             : void
     208             : AliMUONPainterMatrixFrame::Clear(Option_t*)
     209             : {
     210             :   /// Clear the view(s)
     211             :   
     212           0 :   fPainterMatrix = 0x0;
     213             : 
     214           0 :   AliMUONPainterInterfaceHelper::ClearButtons(*fOutlineButtons);
     215           0 :   AliMUONPainterInterfaceHelper::ClearButtons(*fResponderButtons);
     216             :   
     217           0 :   fView->GetCanvas()->SetEditable(kTRUE);
     218           0 :   fView->GetCanvas()->Clear();
     219           0 :   fView->GetCanvas()->Modified();
     220           0 :   fView->GetCanvas()->Update();
     221           0 :   fView->GetCanvas()->SetEditable(kFALSE);
     222             : 
     223           0 :   Layout();  
     224           0 : }
     225             : 
     226             : //_____________________________________________________________________________
     227             : void AliMUONPainterMatrixFrame::ColorSliderDefaultButtonWasClicked()
     228             : {
     229             :   /// Get here when the button "Default" under the color scale was clicked
     230             :   /// We must then reset the data range to its default (if available)
     231             :   
     232           0 :   AliMUONVTrackerData* data = fPainterMatrix->Data();
     233           0 :   if (!data)
     234             :   {
     235             :     // no data : nothing to do
     236           0 :     return;
     237             :   }
     238             :   
     239           0 :   TString dimName = data->DimensionName(fPainterMatrix->DataIndex());
     240             :   
     241           0 :   AliMUONPainterEnv* env = AliMUONPainterHelper::Instance()->Env();
     242             :   
     243           0 :   env->ForceDataSourceToDefaultRange(data->GetName(),dimName.Data());
     244             : 
     245           0 :   Double_t xmin, xmax;
     246             : 
     247           0 :   TString desc = env->DataSourceDescriptor(data->GetName());
     248             :   
     249           0 :   Bool_t ok = env->Ranges2DimensionRange(env->Descriptor2Ranges(desc),dimName.Data(),xmin,xmax);
     250             : 
     251           0 :   if (ok)
     252             :   {
     253           0 :     fColorSlider->SetRange(xmin,xmax);
     254             :   }
     255             :   else
     256             :   {
     257           0 :     AliError(Form("Could not get xmin,xmax for data source %s dimension %s",data->GetName(),dimName.Data()));
     258             :   }
     259           0 : }
     260             : 
     261             : //_____________________________________________________________________________
     262             : void AliMUONPainterMatrixFrame::ColorSliderSetDefaultButtonWasClicked(Double_t* range)
     263             : {
     264             :   /// Use the current values of the color slider as default range for the
     265             :   /// current dimension of the current data (if any)
     266             :   
     267           0 :   AliMUONVTrackerData* data = fPainterMatrix->Data();
     268           0 :   if (!data)
     269             :   {
     270             :     // no data : nothing to do
     271           0 :     return;
     272             :   }
     273             : 
     274           0 :   TString dimName = data->DimensionName(fPainterMatrix->DataIndex());
     275             :   
     276           0 :   AliMUONPainterEnv* env = AliMUONPainterHelper::Instance()->Env();
     277             :   
     278           0 :   TString dataSourceID = env->DataSourceID(data->GetName());
     279             :   
     280           0 :   TString dataSourceType = env->ID2Type(dataSourceID);
     281             :   
     282           0 :   env->SetDefaultRange(dataSourceType.Data(),dimName.Data(),range[0],range[1]);
     283             :   
     284           0 :   env->Save();
     285           0 : }
     286             : 
     287             : //_____________________________________________________________________________
     288             : void 
     289             : AliMUONPainterMatrixFrame::CreateButtons()
     290             : {
     291             :   /// Create the interface buttons
     292             :   
     293             :   /// create buttons    
     294           0 :   TObjArray types;
     295             :   
     296           0 :   fPainterMatrix->GetTypes(types);
     297             :   
     298           0 :   TIter nextType(&types);
     299             :   TObjString* str;
     300             :   
     301           0 :   while ( ( str = static_cast<TObjString*>(nextType()) ) )
     302             :   {
     303           0 :     AliMUONPainterInterfaceHelper::AddRadioButton(*fResponderButtons,str->String());
     304           0 :     AliMUONPainterInterfaceHelper::AddCheckButton(*fOutlineButtons,str->String());
     305             :   }
     306             :   
     307           0 :   fOutlineButtons->Connect("Clicked(Int_t)","AliMUONPainterMatrixFrame",
     308           0 :                         this,"OutlineButtonWasClicked(Int_t)");
     309             :   
     310           0 :   fResponderButtons->Connect("Clicked(Int_t)","AliMUONPainterMatrixFrame",
     311             :                              this,"ResponderButtonWasClicked(Int_t)");        
     312           0 : }
     313             : 
     314             : //_____________________________________________________________________________
     315             : void 
     316             : AliMUONPainterMatrixFrame::DataRangeAutoRequested()
     317             : {
     318             :   /// Get there when the "Auto" button below the color slider is clicked,
     319             :   /// to compute the data range actually painted.
     320             :   
     321           0 :   Double_t dataMin, dataMax;
     322             : 
     323           0 :   fPainterMatrix->ComputeDataRange();
     324             : 
     325           0 :   fPainterMatrix->GetDataRange(dataMin,dataMax);
     326             :   
     327             :   Bool_t emit(kTRUE);
     328             :   
     329           0 :   fColorSlider->SetRange(dataMin,dataMax,emit);
     330             :   
     331           0 :   Update();
     332           0 : }
     333             : 
     334             : //_____________________________________________________________________________
     335             : void 
     336             : AliMUONPainterMatrixFrame::DataRangeWasChanged(Double_t* range)
     337             : {
     338             :   /// Get there when the data range is changed
     339             :   
     340           0 :   fPainterMatrix->SetDataRange(range[0],range[1]);
     341             :   
     342           0 :   if ( !fColorSlider->IsLocked() )
     343             :   {
     344           0 :     Update();
     345           0 :   }
     346           0 : }
     347             : 
     348             : //_____________________________________________________________________________
     349             : void
     350             : AliMUONPainterMatrixFrame::DataSourceWasChanged(const char* type,
     351             :                                                AliMUONVTrackerData* data,
     352             :                                                Int_t indexInData)
     353             : {
     354             :   /// Update what to plot
     355             :  
     356           0 :   TString pattern(type);
     357             : 
     358             :   AliMUONVTrackerData* d = data;
     359             :   
     360           0 :   if ( !d || !data || indexInData < 0 || pattern == "" )
     361             :   {
     362           0 :     pattern = "*";
     363             :     d = 0;
     364             :     indexInData = -1;
     365           0 :   }
     366             :   
     367           0 :   fPainterMatrix->SetData(pattern,d,indexInData);
     368             :   
     369           0 :   Update();
     370             :   
     371           0 :   ChangeTitle(fPainterMatrix->Painter(0));
     372           0 : }
     373             : 
     374             : //_____________________________________________________________________________
     375             : void
     376             : AliMUONPainterMatrixFrame::EventInfo(Int_t event, Int_t px ,Int_t py, TObject* object)
     377             : {
     378             :   /// Used to detect entering/leaving a given painter 
     379             :   
     380           0 :   if (!gPad || !object) return;
     381             :   
     382           0 :   if ( event == 7 )
     383             :   {
     384           0 :     if ( object->InheritsFrom("AliMUONVPainter") )
     385             :     {
     386           0 :       AliMUONVPainter* p = static_cast<AliMUONVPainter*>(object);
     387           0 :       p->ExecuteEvent(7,px,py);
     388             :       return;
     389             :     }      
     390             :   }
     391             :   
     392           0 :   if ( event == kMouseLeave )
     393             :   {
     394           0 :     if ( object->InheritsFrom("AliMUONVPainter") )
     395             :     {
     396           0 :       AliMUONVPainter* p = static_cast<AliMUONVPainter*>(object);
     397           0 :       MouseLeave(p);
     398           0 :       fPainterHighlighter->SetPainter(0x0);
     399           0 :       gPad->Modified();
     400           0 :       gPad->Update();
     401           0 :     }
     402             :   }
     403             : 
     404           0 :   if ( event == kMouseEnter )
     405             :   {
     406           0 :     if ( object->InheritsFrom("AliMUONVPainter") )
     407             :     {
     408           0 :       AliMUONVPainter* painter = static_cast<AliMUONVPainter*>(object);
     409           0 :       if ( painter->IsResponder() && !painter->HandleMouseMotion() )
     410             :       {
     411           0 :         MouseEnter(static_cast<AliMUONVPainter*>(object));
     412           0 :         fPainterHighlighter->SetPainter(painter);
     413           0 :         gPad->Modified();
     414           0 :         gPad->Update();
     415           0 :       }
     416           0 :       else if ( !painter->HandleMouseMotion() )
     417             :       {
     418           0 :         MouseEnter(static_cast<AliMUONVPainter*>(object)); 
     419           0 :       }
     420           0 :     }
     421             :   }
     422             :   
     423           0 :    if ( event == kMouseMotion ) 
     424             :   {
     425           0 :     if ( object->InheritsFrom("AliMUONVPainter") )
     426             :     {
     427           0 :       AliMUONVPainter* painter = static_cast<AliMUONVPainter*>(object);
     428             : 
     429           0 :       if ( painter->HandleMouseMotion() && painter->IsResponder() )
     430             :       {
     431           0 :         Double_t pos[2];
     432           0 :         TVirtualPad* padsave = gPad;
     433           0 :         painter->Pad()->cd();
     434           0 :         painter->PixelToPad(px,py,pos[0],pos[1]);
     435           0 :         MouseMotion(static_cast<AliMUONVPainter*>(object),pos);
     436           0 :         fPainterHighlighter->SetPainter(painter,pos[0],pos[1]);
     437           0 :         gPad->Modified();
     438           0 :         gPad->Update();
     439           0 :         gPad = padsave;
     440           0 :       }
     441           0 :     }    
     442             :   }
     443           0 : }
     444             : 
     445             : //_____________________________________________________________________________
     446             : void
     447             : AliMUONPainterMatrixFrame::MouseEnter(AliMUONVPainter* painter)
     448             : {
     449             :   /// Emit a signal to notify that mouse pointer is entering a given painter
     450             : 
     451           0 :   ChangeTitle(painter);
     452             : 
     453           0 :   Long_t params[] = { (Long_t)painter };
     454             :   
     455           0 :   Emit("MouseEnter(AliMUONVPainter*)",params);  
     456           0 : }
     457             : 
     458             : 
     459             : //_____________________________________________________________________________
     460             : void
     461             : AliMUONPainterMatrixFrame::MouseLeave(const AliMUONVPainter* painter)
     462             : {
     463             :   /// Emit a signal to notify that mouse pointer is leaving a given painter
     464             :   
     465           0 :   ChangeTitle(fPainterMatrix->GetName());
     466             : 
     467           0 :   Long_t params[] = { (Long_t)painter };
     468             :   
     469           0 :   Emit("MouseLeave(AliMUONVPainter*)",params);
     470           0 : }
     471             : 
     472             : //_____________________________________________________________________________
     473             : void
     474             : AliMUONPainterMatrixFrame::MouseMotion(AliMUONVPainter* painter, Double_t* position)
     475             : {
     476             :   /// Emit a signal to notify that mouse pointer is moving within a given painter
     477             :   
     478           0 :   ChangeTitle(painter,painter->NameAtPosition(position[0],position[1]),
     479           0 :               position[0],position[1]);
     480             :   
     481           0 :   Long_t params[] = { (Long_t)painter, (Long_t)position };
     482             :   
     483           0 :   Emit("MouseMotion(AliMUONVPainter*,Double_t*)",params);
     484           0 : }
     485             : 
     486             : 
     487             : //_____________________________________________________________________________
     488             : void
     489             : AliMUONPainterMatrixFrame::ResponderButtonWasClicked(Int_t id)
     490             : {
     491             :   /// One responder button was clicked
     492             :   
     493           0 :   TGTextButton* button = static_cast<TGTextButton*>(fResponderButtons->GetButton(id));
     494           0 :   TString pattern = button->GetString();
     495             :   
     496             : //  AliInfo(Form("id=%d button=%d %s",id,button->IsOn(),pattern.Data()));
     497             : 
     498           0 :   assert(button->IsOn()==1);
     499             :   
     500           0 :   fPainterMatrix->SetResponder(pattern.Data());
     501           0 : }
     502             : 
     503             : //_____________________________________________________________________________
     504             : void
     505             : AliMUONPainterMatrixFrame::OutlineButtonWasClicked(Int_t id)
     506             : {
     507             :   /// One outline button was clicked
     508             :   
     509           0 :   TGTextButton* button = static_cast<TGTextButton*>(fOutlineButtons->GetButton(id));
     510           0 :   TString pattern = button->GetString();
     511             :   
     512           0 :   fPainterMatrix->SetOutlined(pattern.Data(),button->IsOn());
     513             :   
     514           0 :   ViewModified();
     515           0 :   fView->GetCanvas()->Update();
     516             :     
     517             :   // Update the interface (e.g. list of possible responders can have 
     518             :   // changed due to visibility change)
     519           0 :   UpdateInterface(kFALSE);
     520           0 : }
     521             : 
     522             : //_____________________________________________________________________________
     523             : void 
     524             : AliMUONPainterMatrixFrame::SaveAs(const char* filename, Option_t* option) const
     525             : {
     526             :   /// Save painter matrix (in the sense of "print") in filename
     527             :   
     528           0 :   TCanvas* d = fPainterMatrix->CreateCanvas();
     529             :   
     530           0 :   d->SaveAs(filename,option);
     531             :   
     532           0 :   delete d;
     533           0 : }
     534             : 
     535             : //_____________________________________________________________________________
     536             : void
     537             : AliMUONPainterMatrixFrame::TitleHasChanged(const char* title)
     538             : {
     539             :   /// Emit the TitleHasChanged signal
     540             :   
     541           0 :   Long_t params[] = { (Long_t)title };
     542           0 :   Emit("TitleHasChanged(const char*)",params);
     543           0 : }
     544             : 
     545             : //_____________________________________________________________________________
     546             : void
     547             : AliMUONPainterMatrixFrame::Update()
     548             : {
     549             :   /// Force update of all canvases
     550             : 
     551           0 :   Bool_t colorSlider = ( fPainterMatrix->Data() != 0x0 );
     552             :   
     553           0 :   if ( colorSlider )
     554             :   {
     555           0 :     UpdateDataRange();
     556           0 :   }
     557             :   
     558           0 :   fView->GetCanvas()->SetEditable(kTRUE);
     559             :   
     560           0 :   ViewModified();
     561             : 
     562           0 :   fView->GetCanvas()->SetEditable(kFALSE);
     563             :   
     564           0 :   if ( colorSlider )
     565             :   {
     566           0 :     fMainFrame->ShowFrame(fColorSlider);
     567           0 :   }
     568             :   else
     569             :   {
     570           0 :     fMainFrame->HideFrame(fColorSlider);
     571             :   }
     572             :   
     573           0 :   fMainFrame->Layout();
     574           0 :   Layout();
     575           0 : }
     576             : 
     577             : //_____________________________________________________________________________
     578             : void
     579             : AliMUONPainterMatrixFrame::UpdateDataRange()
     580             : {
     581             :   /// Update the data range
     582             : 
     583           0 :   if ( fColorSlider->IsLocked() )
     584             :   {
     585           0 :     fColorSlider->SetRange(0,0,kTRUE);
     586           0 :     return;
     587             :   }
     588             :   
     589           0 :   Double_t min, max;
     590             : 
     591           0 :   fPainterMatrix->GetDataRange(min,max);
     592             : 
     593           0 :   if ( min > max )
     594             :   {
     595             :     // range was not computed already
     596             :     
     597           0 :     fPainterMatrix->ComputeDataRange();
     598           0 :     fPainterMatrix->GetDataRange(min,max);
     599           0 :   }
     600             : 
     601           0 :   fColorSlider->SetRange(min,max,kFALSE);
     602           0 : }
     603             : 
     604             : //_____________________________________________________________________________
     605             : void 
     606             : AliMUONPainterMatrixFrame::UpdateInterface(Bool_t fromScratch)
     607             : {
     608             :   /// Update the full interface
     609             :   
     610           0 :   if ( fromScratch || fOutlineButtons->GetCount() == 0 ) 
     611             :   {
     612           0 :     CreateButtons();
     613           0 :   }
     614             :   
     615           0 :   AliMUONPainterInterfaceHelper::Unselect(*fResponderButtons,"*");
     616           0 :   AliMUONPainterInterfaceHelper::Unselect(*fOutlineButtons,"*");
     617             :   
     618           0 :   AliMUONVPainter* painter = fPainterMatrix->Painter(0);
     619             :   
     620           0 :   TObjArray types;
     621           0 :   types.SetOwner(kTRUE);
     622             :   
     623           0 :   fPainterMatrix->GetTypes(types);
     624             :   
     625             :   // update button states
     626           0 :   TIter next(&types);
     627             :   TObjString* otype;
     628             :   
     629           0 :   TString theResponder;
     630             :   
     631           0 :   while ( ( otype = static_cast<TObjString*>(next()) ) )
     632             :   {    
     633           0 :     AliMUONPainterGroup* group = painter->Group(otype->String());
     634             :     
     635           0 :     if ( group && group->IsOutlined() ) 
     636             :     {
     637           0 :       AliMUONPainterInterfaceHelper::Select(*fOutlineButtons,otype->String().Data());
     638           0 :     }    
     639             :   }
     640             :   
     641           0 :   if ( painter ) 
     642             :   {
     643           0 :     AliMUONPainterGroup* responderGroup = painter->ResponderGroup();
     644             :   
     645           0 :     if (responderGroup)
     646             :     {
     647           0 :       AliMUONPainterInterfaceHelper::Select(*fResponderButtons,responderGroup->Type());
     648           0 :     }
     649           0 :   }
     650             :   
     651             :   // update data source view
     652             :   
     653           0 :   fPlotSelector->Update(*fPainterMatrix);
     654             :     
     655           0 :   fResponderButtons->Show();
     656           0 :   fOutlineButtons->Show();
     657             : 
     658           0 :   Layout();
     659           0 : }
     660             : 
     661             : //_____________________________________________________________________________
     662             : void 
     663             : AliMUONPainterMatrixFrame::Use(AliMUONPainterMatrix* group)
     664             : {
     665             :   /// Change the matrix used
     666             :   
     667           0 :   Clear();
     668             :   
     669           0 :   fPainterMatrix = group;
     670             :   
     671           0 :   fView->GetCanvas()->SetEditable(kTRUE);
     672             :   
     673           0 :   fView->GetCanvas()->Divide(fPainterMatrix->Nx(),fPainterMatrix->Ny());
     674             :   
     675           0 :   for ( Int_t i = 0; i < fPainterMatrix->Size(); ++i ) 
     676             :   {
     677           0 :     AliMUONVPainter* painter = fPainterMatrix->Painter(i);
     678           0 :     fView->GetCanvas()->cd(i+1);
     679           0 :     painter->Draw("R");
     680           0 :     fPainterHighlighter->SetPainter(0x0);
     681           0 :     fPainterHighlighter->Draw();
     682             :   }  
     683             : 
     684           0 :   Update();
     685             :   
     686           0 :   UpdateInterface(kTRUE);
     687             :   
     688           0 :   ChangeTitle(fPainterMatrix->GetName());
     689             :   
     690           0 :   fView->GetCanvas()->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
     691           0 :                               "AliMUONPainterMatrixFrame",this, 
     692             :                               "EventInfo(Int_t,Int_t,Int_t,TObject*)"); 
     693             :   
     694           0 : }
     695             : 
     696             : //_____________________________________________________________________________
     697             : void 
     698             : AliMUONPainterMatrixFrame::ViewModified()
     699             : {
     700             :   /// Update our canvas
     701             :   
     702           0 :   for ( Int_t i = 0; i < fPainterMatrix->Size(); ++i ) 
     703             :   {
     704           0 :     fView->GetCanvas()->GetPad(i+1)->Modified();
     705             :   }
     706           0 :   fView->GetCanvas()->Modified();
     707           0 :   fView->GetCanvas()->Update();
     708           0 : }
     709             : 
     710             : 

Generated by: LCOV version 1.11