LCOV - code coverage report
Current view: top level - MUON/MUONgraphics - AliMUONTrackerDataCompareDialog.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 83 1.2 %
Date: 2016-06-14 17:26:59 Functions: 1 11 9.1 %

          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 "AliMUONTrackerDataCompareDialog.h"
      19             : 
      20             : /// \class AliMUONTrackerDataCompareDialog
      21             : ///
      22             : /// Widget to select 2 VTrackerData objects (D1,D2) to be compared
      23             : ///
      24             : /// The type of differences that can be used are : 
      25             : ///
      26             : /// - Difference = plain difference D1-D2
      27             : /// - Absolute difference = absolute value of the preceeding = |D1-D2|
      28             : /// - Relative difference = relative difference = (D1-D2)/D1
      29             : /// - Absolute relative difference = absolute value of preceeding = |(D1-D2)/D1|
      30             : ///
      31             : /// \author Laurent Aphecetche, Subatech
      32             : ///
      33             : 
      34             : #include "AliLog.h"
      35             : #include "AliMUON2DMap.h"
      36             : #include "AliMUONCalibParamND.h"
      37             : #include "AliMUONPainterDataRegistry.h"
      38             : #include "AliMUONTrackerData.h"
      39             : #include "AliMUONTrackerDataWrapper.h"
      40             : #include "AliMUONVTrackerData.h"
      41             : #include "AliMpConstants.h"
      42             : #include "AliMpDDLStore.h"
      43             : #include "AliMpDetElement.h"
      44             : #include "AliMpManuIterator.h"
      45             : #include <TGComboBox.h>
      46             : #include <TGLabel.h>
      47             : #include <TGTextEntry.h>
      48             : #include <TTimer.h>
      49             : 
      50             : /// \cond CLASSIMP
      51          12 : ClassImp(AliMUONTrackerDataCompareDialog)
      52             : /// \endcond
      53             : 
      54             : 
      55             : 
      56             : //_____________________________________________________________________________
      57             : AliMUONTrackerDataCompareDialog::AliMUONTrackerDataCompareDialog(const TGWindow* p, const TGWindow* main, UInt_t w, UInt_t h)
      58           0 : : TGTransientFrame(p,main,w,h),
      59           0 : fF1(new TGHorizontalFrame(this)),
      60           0 : fData1(new TGComboBox(fF1)),
      61           0 : fF2(new TGHorizontalFrame(this)),
      62           0 : fData2(new TGComboBox(fF2)),
      63           0 : fF3(new TGHorizontalFrame(this)),
      64           0 : fDiffType(new TGComboBox(fF3)),
      65           0 : fF4(new TGHorizontalFrame(this)),
      66           0 : fBasename(new TGTextEntry(fF4)),
      67           0 : fButtonFrame(new TGHorizontalFrame(this)),
      68           0 : fOK(new TGTextButton(fButtonFrame,"OK")),
      69           0 : fCancel(new TGTextButton(fButtonFrame,"Cancel"))
      70           0 : {
      71             :   /// ctor
      72             :   
      73           0 :   SetCleanup(kDeepCleanup);
      74             :   
      75           0 :   AliMUONPainterDataRegistry* reg = AliMUONPainterDataRegistry::Instance();
      76             :   
      77           0 :   for ( Int_t i = 0; i < reg->NumberOfDataSources(); ++i ) 
      78             :   {
      79           0 :     AliMUONVTrackerData* data = reg->DataSource(i);
      80           0 :     fData1->AddEntry(data->GetName(),i);
      81           0 :     fData2->AddEntry(data->GetName(),i);
      82             :   }
      83             :   
      84           0 :   fDiffType->AddEntry("Difference",AliMUONTrackerData::kDifference);
      85           0 :   fDiffType->AddEntry("Absolute difference",AliMUONTrackerData::kAbsoluteDifference);
      86           0 :   fDiffType->AddEntry("Relative difference",AliMUONTrackerData::kRelativeDifference);
      87           0 :   fDiffType->AddEntry("Absolute relative difference",AliMUONTrackerData::kAbsoluteRelativeDifference);
      88           0 :   fDiffType->AddEntry("All four",AliMUONTrackerData::kAll);
      89             : 
      90           0 :   fData1->Select(0);
      91           0 :   fData2->Select(0);
      92           0 :   fDiffType->Select(4);
      93             :   
      94           0 :   fF1->AddFrame(new TGLabel(fF1,"First data"),new TGLayoutHints(kLHintsLeft|kLHintsTop,5,5,5,5));
      95           0 :   fF1->AddFrame(fData1,new TGLayoutHints(kLHintsRight|kLHintsExpandX|kLHintsTop,5,5,5,5));
      96             : 
      97           0 :   fF2->AddFrame(new TGLabel(fF2,"Second data"),new TGLayoutHints(kLHintsLeft|kLHintsTop,5,5,5,5));
      98           0 :   fF2->AddFrame(fData2,new TGLayoutHints(kLHintsRight|kLHintsExpandX|kLHintsTop,5,5,5,5));
      99             : 
     100           0 :   fF3->AddFrame(new TGLabel(fF3,"Difference type"),new TGLayoutHints(kLHintsLeft|kLHintsTop,5,5,5,5));
     101           0 :   fF3->AddFrame(fDiffType,new TGLayoutHints(kLHintsRight|kLHintsExpandX|kLHintsTop,5,5,5,5));
     102             : 
     103           0 :   fF4->AddFrame(new TGLabel(fF4,"Output basename"),new TGLayoutHints(kLHintsLeft|kLHintsTop,5,5,5,5));
     104           0 :   fF4->AddFrame(fBasename,new TGLayoutHints(kLHintsRight|kLHintsExpandX|kLHintsTop,5,5,5,5));
     105             : 
     106           0 :   AddFrame(fF1,new TGLayoutHints(kLHintsLeft|kLHintsExpandX|kLHintsTop,5,5,5,5));
     107           0 :   AddFrame(fF2,new TGLayoutHints(kLHintsLeft|kLHintsExpandX|kLHintsTop,5,5,5,5));
     108           0 :   AddFrame(fF3,new TGLayoutHints(kLHintsLeft|kLHintsExpandX|kLHintsTop,5,5,5,5));
     109           0 :   AddFrame(fF4,new TGLayoutHints(kLHintsLeft|kLHintsExpandX|kLHintsTop,5,5,5,5));
     110             :   
     111           0 :   fButtonFrame->AddFrame(fOK,new TGLayoutHints(kLHintsLeft|kLHintsTop,5,5,5,5));
     112           0 :   fButtonFrame->AddFrame(fCancel,new TGLayoutHints(kLHintsRight|kLHintsTop,5,5,5,5));
     113             : 
     114           0 :   AddFrame(fButtonFrame,new TGLayoutHints(kLHintsLeft|kLHintsExpandX|kLHintsTop,5,5,5,5));
     115             :   
     116           0 :   fData1->Resize(200,20);
     117           0 :   fData2->Resize(200,20);
     118           0 :   fDiffType->Resize(200,20);
     119             :   
     120           0 :   fOK->Connect("Clicked()", "AliMUONTrackerDataCompareDialog",this,"DoOK()");
     121           0 :   fCancel->Connect("Clicked()","AliMUONTrackerDataCompareDialog",this,"DoCancel()");
     122           0 : }
     123             : 
     124             : //_____________________________________________________________________________
     125           0 : AliMUONTrackerDataCompareDialog::~AliMUONTrackerDataCompareDialog()
     126           0 : {
     127             :   /// dtor
     128           0 : }
     129             : 
     130             : //______________________________________________________________________________
     131             : void
     132             : AliMUONTrackerDataCompareDialog::DoOK()
     133             : {
     134             :   /// Do the job.
     135             :   
     136           0 :   TGTextLBEntry* t1 = static_cast<TGTextLBEntry*>(fData1->GetSelectedEntry());
     137           0 :   TString s1 = t1->GetText()->GetString();
     138           0 :   TGTextLBEntry* t2 = static_cast<TGTextLBEntry*>(fData2->GetSelectedEntry());
     139           0 :   TString s2 = t2->GetText()->GetString();
     140             :   
     141           0 :   AliMUONTrackerData::EDiffType nd = static_cast<AliMUONTrackerData::EDiffType>(fDiffType->GetSelected());
     142             :   
     143           0 :   if ( nd == AliMUONTrackerData::kAll )
     144             :   {
     145           0 :     CompareData(s1.Data(),s2.Data(),AliMUONTrackerData::kDifference);
     146           0 :     CompareData(s1.Data(),s2.Data(),AliMUONTrackerData::kRelativeDifference);
     147           0 :     CompareData(s1.Data(),s2.Data(),AliMUONTrackerData::kAbsoluteDifference);
     148           0 :     CompareData(s1.Data(),s2.Data(),AliMUONTrackerData::kAbsoluteRelativeDifference);
     149             :   }
     150             :   else
     151             :   {
     152           0 :     CompareData(s1.Data(),s2.Data(),nd);
     153             :   }
     154             :   
     155           0 :   TTimer::SingleShot(150,"AliMUONTrackerDataCompareDialog",this,"CloseWindow()");
     156           0 : }
     157             : 
     158             : //______________________________________________________________________________
     159             : void
     160             : AliMUONTrackerDataCompareDialog::DoCancel()
     161             : {
     162             :   /// Kills the dialog
     163           0 :   TTimer::SingleShot(150,"AliMUONTrackerDataCompareDialog",this,"CloseWindow()");
     164           0 : }
     165             : 
     166             : //______________________________________________________________________________
     167             : void
     168             : AliMUONTrackerDataCompareDialog::CompareData(const char* d1name,
     169             :                                              const char* d2name,
     170             :                                              AliMUONTrackerData::EDiffType difftype) const
     171             : {
     172             :   /// Compare two data sources
     173             :   
     174           0 :   AliMUONPainterDataRegistry* reg = AliMUONPainterDataRegistry::Instance();
     175             :   
     176           0 :   AliMUONVTrackerData* d1 = reg->DataSource(d1name);
     177           0 :   if (!d1)
     178             :   {
     179           0 :     AliError(Form("Cannot find data source %s",d1name));
     180           0 :     return;
     181             :   }
     182             :   
     183           0 :   AliMUONVTrackerData* d2 = reg->DataSource(d2name);
     184           0 :   if (!d2)
     185             :   {
     186           0 :     AliError(Form("Cannot find data source %s",d2name));
     187           0 :     return;
     188             :   }
     189             :   
     190           0 :   TString basename = fBasename->GetText();
     191             :   
     192           0 :   AliMUONVTrackerData* d = AliMUONTrackerData::CompareData(*d1,*d2,basename.Data(),difftype);
     193             :   
     194           0 :   if (d)
     195             :   {
     196           0 :     AliMUONVTrackerDataMaker* dw = new AliMUONTrackerDataWrapper(d);
     197             :     
     198           0 :     AliMUONPainterDataRegistry::Instance()->Register(dw);
     199           0 :   }
     200           0 : }

Generated by: LCOV version 1.11