Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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"
17#include "TEveGedEditor.h"
18
19#include "TVirtualPad.h"
20#include "TH1F.h"
21#include "TStyle.h"
22
23#include "TGLabel.h"
24#include "TG3DLine.h"
25
26/** \class TEveDigitSetEditor
27\ingroup TEve
28Editor for TEveDigitSet class.
29*/
30
31
32////////////////////////////////////////////////////////////////////////////////
33/// Constructor.
34
36 UInt_t options, Pixel_t back) :
37 TGedFrame(p, width, height, options | kVerticalFrame, back),
38 fM (nullptr),
39 fPalette (nullptr),
40
41 fHistoButtFrame(nullptr),
42 fInfoFrame(nullptr)
43{
44 MakeTitle("Palette controls");
45
48 fPalette->Connect("Changed()", "TEveDigitSetEditor", this, "Update()");
49
51}
52
53////////////////////////////////////////////////////////////////////////////////
54/// Create information tab.
55
57{
59
62 kFitWidth |
65
66 title1->AddFrame(new TGLabel(title1, "TEveDigitSet Info"),
67 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
68 title1->AddFrame(new TGHorizontal3DLine(title1),
69 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
71
72
75 b->SetToolTipText("Show histogram over full range.");
77 b->Connect("Clicked()", "TEveDigitSetEditor", this, "DoHisto()");
78
79 b = new TGTextButton(fHistoButtFrame, "Range Histo");
80 b->SetToolTipText("Show histogram over selected range.");
82 b->Connect("Clicked()", "TEveDigitSetEditor", this, "DoRangeHisto()");
84}
85
86////////////////////////////////////////////////////////////////////////////////
87/// Set model object.
88
90{
91 fM = dynamic_cast<TEveDigitSet*>(obj);
92
93 if (fM->fValueIsColor || fM->fPalette == nullptr) {
95 } else {
98 }
99
100 if (fM->fHistoButtons)
102 else
104}
105
106////////////////////////////////////////////////////////////////////////////////
107/// Show histogram slot.
108
110{
111 Int_t min, max;
112 if (fM->fPalette) {
113 min = fM->fPalette->GetLowLimit();
114 max = fM->fPalette->GetHighLimit();
115 } else {
116 fM->ScanMinMaxValues(min, max);
117 }
118 PlotHisto(min, max);
119}
120
121////////////////////////////////////////////////////////////////////////////////
122/// Show ranged histogram slot.
123
125{
126 Int_t min, max;
127 if (fM->fPalette) {
128 min = fM->fPalette->GetMinVal();
129 max = fM->fPalette->GetMaxVal();
130 } else {
131 fM->ScanMinMaxValues(min, max);
132 }
133 PlotHisto(min, max);
134}
135
136////////////////////////////////////////////////////////////////////////////////
137/// Plots a histogram from digit vales with given range.
138
140{
141 Int_t nbins = max-min+1;
142 while (nbins > 200)
143 nbins /= 2;
144
145 TH1F* h = new TH1F(fM->GetName(), fM->GetTitle(), nbins, min-0.5, max+0.5);
146 h->SetDirectory(nullptr);
147 h->SetBit(kCanDelete);
149 while (qi.next())
150 h->Fill(((TEveDigitSet::DigitBase_t*)qi())->fValue);
151
152 gStyle->SetOptStat(1111111);
153 h->Draw();
154 gPad->Modified();
155 gPad->Update();
156}
@ kVerticalFrame
Definition GuiTypes.h:381
@ kFixedWidth
Definition GuiTypes.h:387
@ kFitWidth
Definition GuiTypes.h:386
@ kHorizontalFrame
Definition GuiTypes.h:382
@ kOwnBackground
Definition GuiTypes.h:391
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
#define b(i)
Definition RSha256.hxx:100
#define h(i)
Definition RSha256.hxx:106
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsTop
Definition TGLayout.h:27
@ kLHintsExpandX
Definition TGLayout.h:30
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
@ kCanDelete
Definition TObject.h:370
R__EXTERN TStyle * gStyle
Definition TStyle.h:442
#define gPad
void PlotHisto(Int_t min, Int_t max)
Plots a histogram from digit vales with given range.
void DoHisto()
Show histogram slot.
void SetModel(TObject *obj) override
Set model object.
TEveDigitSetEditor(const TEveDigitSetEditor &)
TEveRGBAPaletteSubEditor * fPalette
TGHorizontalFrame * fHistoButtFrame
void CreateInfoTab()
Create information tab.
TGVerticalFrame * fInfoFrame
void DoRangeHisto()
Show ranged histogram slot.
Base-class for storage of digit collections; provides transformation matrix (TEveTrans),...
void ScanMinMaxValues(Int_t &min, Int_t &max)
Iterate over the digits and determine min and max signal values.
TEveRGBAPalette * fPalette
Bool_t fHistoButtons
TEveChunkManager fPlex
Bool_t fValueIsColor
Sub-editor for TEveRGBAPalette class.
void SetModel(TEveRGBAPalette *p)
Set model object.
Int_t GetMinVal() const
Int_t GetHighLimit() const
Int_t GetMaxVal() const
Int_t GetLowLimit() const
The base class for composite widgets (menu bars, list boxes, etc.).
Definition TGFrame.h:289
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1109
TGCompositeFrame(const TGCompositeFrame &)=delete
void MapWindow() override
map window
Definition TGFrame.h:206
void UnmapWindow() override
unmap window
Definition TGFrame.h:208
A horizontal 3D line is a line that typically separates a toolbar from the menubar.
Definition TG3DLine.h:18
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:387
This class handles GUI labels.
Definition TGLabel.h:24
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
Yield an action as soon as it is clicked.
Definition TGButton.h:142
ROOT GUI Window base class.
Definition TGWindow.h:23
Base frame for implementing GUI - a service class.
Definition TGedFrame.h:27
virtual TGVerticalFrame * CreateEditorTabSubFrame(const char *name)
Create a vertical frame to be used by 'owner' in extra tab 'name'.
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition TGedFrame.cxx:94
1-D histogram with a float per channel (see TH1 documentation)
Definition TH1.h:879
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
const char * GetTitle() const override
Returns title of object.
Definition TNamed.h:50
Mother of all ROOT objects.
Definition TObject.h:41
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:865
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:1641