Logo ROOT   6.08/07
Reference Guide
TEveDigitSetEditor.cxx
Go to the documentation of this file.
1 // @(#)root/eve:$Id$
2 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #include "TEveDigitSetEditor.h"
13 #include "TEveDigitSet.h"
14 
15 #include "TEveGValuators.h"
16 //#include "TEveTransEditor.h"
17 #include "TEveRGBAPaletteEditor.h"
18 #include "TEveGedEditor.h"
19 
20 #include "TVirtualPad.h"
21 #include "TColor.h"
22 #include "TH1F.h"
23 #include "TStyle.h"
24 
25 #include "TGLabel.h"
26 #include "TG3DLine.h"
27 #include "TGButton.h"
28 #include "TGNumberEntry.h"
29 #include "TGColorSelect.h"
30 #include "TGDoubleSlider.h"
31 
32 /** \class TEveDigitSetEditor
33 \ingroup TEve
34 Editor for TEveDigitSet class.
35 */
36 
38 
39 ////////////////////////////////////////////////////////////////////////////////
40 /// Constructor.
41 
43  UInt_t options, Pixel_t back) :
44  TGedFrame(p, width, height, options | kVerticalFrame, back),
45  fM (0),
46  fPalette (0),
47 
48  fHistoButtFrame(0),
49  fInfoFrame(0)
50 {
51  MakeTitle("Palette controls");
52 
53  fPalette = new TEveRGBAPaletteSubEditor(this);
54  AddFrame(fPalette, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 0, 0, 0));
55  fPalette->Connect("Changed()", "TEveDigitSetEditor", this, "Update()");
56 
57  CreateInfoTab();
58 }
59 
60 ////////////////////////////////////////////////////////////////////////////////
61 /// Create information tab.
62 
64 {
66 
67  TGCompositeFrame *title1 = new TGCompositeFrame(fInfoFrame, 180, 10,
70  kFixedWidth |
72 
73  title1->AddFrame(new TGLabel(title1, "TEveDigitSet Info"),
74  new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
75  title1->AddFrame(new TGHorizontal3DLine(title1),
76  new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
77  fInfoFrame->AddFrame(title1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
78 
79 
81  TGTextButton* b = 0;
82  b = new TGTextButton(fHistoButtFrame, "Histo");
83  b->SetToolTipText("Show histogram over full range.");
85  b->Connect("Clicked()", "TEveDigitSetEditor", this, "DoHisto()");
86 
87  b = new TGTextButton(fHistoButtFrame, "Range Histo");
88  b->SetToolTipText("Show histogram over selected range.");
90  b->Connect("Clicked()", "TEveDigitSetEditor", this, "DoRangeHisto()");
92 }
93 
94 ////////////////////////////////////////////////////////////////////////////////
95 /// Set model object.
96 
98 {
99  fM = dynamic_cast<TEveDigitSet*>(obj);
100 
101  if (fM->fValueIsColor || fM->fPalette == 0) {
103  } else {
105  fPalette->MapWindow();
106  }
107 
108  if (fM->fHistoButtons)
110  else
112 }
113 
114 ////////////////////////////////////////////////////////////////////////////////
115 /// Show histogram slot.
116 
118 {
119  Int_t min, max;
120  if (fM->fPalette) {
121  min = fM->fPalette->GetLowLimit();
122  max = fM->fPalette->GetHighLimit();
123  } else {
124  fM->ScanMinMaxValues(min, max);
125  }
126  PlotHisto(min, max);
127 }
128 
129 ////////////////////////////////////////////////////////////////////////////////
130 /// Show ranged histogram slot.
131 
133 {
134  Int_t min, max;
135  if (fM->fPalette) {
136  min = fM->fPalette->GetMinVal();
137  max = fM->fPalette->GetMaxVal();
138  } else {
139  fM->ScanMinMaxValues(min, max);
140  }
141  PlotHisto(min, max);
142 }
143 
144 ////////////////////////////////////////////////////////////////////////////////
145 /// Plots a histogram from digit vales with given range.
146 
148 {
149  Int_t nbins = max-min+1;
150  while (nbins > 200)
151  nbins /= 2;
152 
153  TH1F* h = new TH1F(fM->GetName(), fM->GetTitle(), nbins, min-0.5, max+0.5);
154  h->SetDirectory(0);
155  h->SetBit(kCanDelete);
157  while (qi.next())
158  h->Fill(((TEveDigitSet::DigitBase_t*)qi())->fValue);
159 
160  gStyle->SetOptStat(1111111);
161  h->Draw();
162  gPad->Modified();
163  gPad->Update();
164 }
TEveChunkManager fPlex
Definition: TEveDigitSet.h:65
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
void PlotHisto(Int_t min, Int_t max)
Plots a histogram from digit vales with given range.
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
Definition: TH1.cxx:3125
void DoHisto()
Show histogram slot.
virtual void SetDirectory(TDirectory *dir)
By default when an histogram is created, it is added to the list of histogram objects in the current ...
Definition: TH1.cxx:8051
R__EXTERN TStyle * gStyle
Definition: TStyle.h:418
THist< 1, float, THistStatContent, THistStatUncertainty > TH1F
Definition: THist.hxx:302
TH1 * h
Definition: legend2.C:5
tomato 1-D histogram with a float per channel (see TH1 documentation)}
Definition: TH1.h:575
Editor for TEveDigitSet class.
int Int_t
Definition: RtypesCore.h:41
int nbins[3]
void CreateInfoTab()
Create information tab.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:739
if object in a list can be deleted
Definition: TObject.h:56
Int_t GetMinVal() const
TGHorizontalFrame * fHistoButtFrame
ULong_t Pixel_t
Definition: GuiTypes.h:41
Bool_t fHistoButtons
Definition: TEveDigitSet.h:76
TGCompositeFrame(const TGCompositeFrame &)
virtual TGVerticalFrame * CreateEditorTabSubFrame(const char *name)
Create a vertical frame to be used by &#39;owner&#39; in extra tab &#39;name&#39;.
Definition: TGedFrame.cxx:123
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot...
Definition: TQObject.cxx:1137
Sub-editor for TEveRGBAPalette class.
virtual void Draw(Option_t *option="")
Draw this histogram with options.
Definition: TH1.cxx:2851
PyObject * fValue
Bool_t fValueIsColor
Definition: TEveDigitSet.h:61
unsigned int UInt_t
Definition: RtypesCore.h:42
TEveRGBAPalette * fPalette
Definition: TEveDigitSet.h:71
virtual void SetModel(TObject *obj)
Set model object.
void SetModel(TEveRGBAPalette *p)
Set model object.
Int_t GetMaxVal() const
Int_t GetLowLimit() const
TEveRGBAPaletteSubEditor * fPalette
void DoRangeHisto()
Show ranged histogram slot.
#define ClassImp(name)
Definition: Rtypes.h:279
Int_t GetHighLimit() const
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1099
std::string MakeTitle(std::string_view version, std::string_view histname, std::string_view title, std::string_view axis)
Definition: speedtest.cxx:115
Mother of all ROOT objects.
Definition: TObject.h:37
virtual void UnmapWindow()
Definition: TGFrame.h:269
Bool_t next()
Go to next atom.
virtual void MapWindow()
Definition: TGFrame.h:267
void ScanMinMaxValues(Int_t &min, Int_t &max)
Iterate over the digits and determine min and max signal values.
TGVerticalFrame * fInfoFrame
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
void SetOptStat(Int_t stat=1)
The type of information printed in the histogram statistics box can be selected via the parameter mod...
Definition: TStyle.cxx:1257
#define gPad
Definition: TVirtualPad.h:289
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition: TGButton.cxx:395
Base-class for storage of digit collections; provides transformation matrix (TEveTrans), signal to color mapping (TEveRGBAPalette) and visual grouping (TEveFrameBox).
Definition: TEveDigitSet.h:29
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:52