CMS 3D CMS Logo

FWDoubleParameterSetter.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Core
4 // Class : FWDoubleParameterSetter
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones
10 // Created: Mon Mar 10 11:22:32 CDT 2008
11 //
12 
13 // system include files
14 #include "TGLabel.h"
15 #include "TGNumberEntry.h"
16 #include <cassert>
17 #include <iostream>
18 
19 // user include files
21 
22 //
23 // constants, enums and typedefs
24 //
25 
26 //
27 // static data member definitions
28 //
29 
30 //
31 // constructors and destructor
32 //
33 FWDoubleParameterSetter::FWDoubleParameterSetter() : m_param(nullptr), m_widget(nullptr) {}
34 
35 // FWDoubleParameterSetter::FWDoubleParameterSetter(const FWDoubleParameterSetter& rhs)
36 // {
37 // // do actual copying here;
38 // }
39 
41 
42 //
43 // assignment operators
44 //
45 // const FWDoubleParameterSetter& FWDoubleParameterSetter::operator=(const FWDoubleParameterSetter& rhs)
46 // {
47 // //An exception safe implementation is
48 // FWDoubleParameterSetter temp(rhs);
49 // swap(rhs);
50 //
51 // return *this;
52 // }
53 
54 //
55 // member functions
56 //
57 
59  m_param = dynamic_cast<FWDoubleParameter*>(iParam);
60  assert(nullptr != m_param);
61 }
62 
63 TGFrame* FWDoubleParameterSetter::build(TGFrame* iParent, bool) {
64  TGCompositeFrame* frame = new TGHorizontalFrame(iParent);
65 
66  // number entry widget
67  TGNumberFormat::ELimit limits =
68  m_param->min() == m_param->max()
69  ? TGNumberFormat::kNELNoLimits
70  : (m_param->min() > m_param->max() ? TGNumberFormat::kNELLimitMin : TGNumberFormat::kNELLimitMinMax);
71  double min = 0;
72  double max = 1;
73  if (m_param->min() != m_param->max()) {
74  min = m_param->min();
75  max = m_param->max();
76  }
77  m_widget = new TGNumberEntry(frame,
78  m_param->value(),
79  5, // number of digits
80  0, // widget ID
81  TGNumberFormat::kNESReal, // style
82  TGNumberFormat::kNEAAnyNumber, // input value filter
83  limits, // specify limits
84  min, // min value
85  max); // max value
86 
87  frame->AddFrame(m_widget, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 8, 2, 2));
88  m_widget->Connect("ValueSet(Long_t)", "FWDoubleParameterSetter", this, "doUpdate(Long_t)");
89 
90  // label
91  frame->AddFrame(new TGLabel(frame, m_param->name().c_str()), new TGLayoutHints(kLHintsLeft | kLHintsCenterY));
92  return frame;
93 }
94 
96  //std::cout <<"doUpdate called"<<std::endl;
97  assert(nullptr != m_param);
98  assert(nullptr != m_widget);
99  //std::cout <<m_widget->GetNumberEntry()->GetNumber()<<std::endl;
100  m_param->set(m_widget->GetNumberEntry()->GetNumber());
101  update();
102 }
103 
105 //
106 // const member functions
107 //
108 
109 //
110 // static member functions
111 //
FWGenericParameterWithRange::max
T max() const
Definition: FWGenericParameterWithRange.h:47
FWDoubleParameterSetter::build
TGFrame * build(TGFrame *iParent, bool labelBack=true) override
Definition: FWDoubleParameterSetter.cc:63
min
T min(T a, T b)
Definition: MathUtil.h:58
FWParameterBase
Definition: FWParameterBase.h:31
cms::cuda::assert
assert(be >=bs)
FWGenericParameter::set
void set(T iValue)
Definition: FWGenericParameter.h:70
DDAxes::x
FWGenericParameterWithRange::min
T min() const
Definition: FWGenericParameterWithRange.h:46
FWDoubleParameterSetter::m_param
FWDoubleParameter * m_param
Definition: FWDoubleParameterSetter.h:54
FWParameterSetterBase::update
void update() const
Definition: FWParameterSetterBase.cc:74
FWDoubleParameterSetter::FWDoubleParameterSetter
FWDoubleParameterSetter()
Definition: FWDoubleParameterSetter.cc:33
FWDoubleParameterSetter::doUpdate
void doUpdate(Long_t)
Definition: FWDoubleParameterSetter.cc:95
FWDoubleParameterSetter::m_widget
TGNumberEntry * m_widget
Definition: FWDoubleParameterSetter.h:55
FWDoubleParameterSetter::~FWDoubleParameterSetter
~FWDoubleParameterSetter() override
Definition: FWDoubleParameterSetter.cc:40
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
FWDoubleParameterSetter::attach
void attach(FWParameterBase *) override
Definition: FWDoubleParameterSetter.cc:58
FWParameterBase::name
const std::string & name() const
Definition: FWParameterBase.h:39
TH2PolyOfflineMaps.limits
limits
Definition: TH2PolyOfflineMaps.py:45
FWGenericParameter::value
T value() const
Definition: FWGenericParameter.h:50
FWParameterSetterBase::frame
FWParameterSetterEditorBase * frame() const
Definition: FWParameterSetterBase.h:51
FWDoubleParameterSetter::setEnabled
void setEnabled(bool) override
Definition: FWDoubleParameterSetter.cc:104
genVertex_cff.x
x
Definition: genVertex_cff.py:12
FWDoubleParameterSetter.h