CMS 3D CMS Logo

FWOverlapTableView.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Core
4 // Class : FWOverlapTableView
5 //
6 // Implementation:
7 // [Notes on implementation]
8 //
9 // Original Author:
10 // Created: Wed Jan 4 00:06:35 CET 2012
11 //
12 
13 // system include files
14 #include <functional>
15 
16 // user include files
25 
29 
30 #include "TEveScene.h"
31 #include "TEveSceneInfo.h"
32 #include "TEveWindow.h"
33 #include "TEveManager.h"
34 
35 #include "TGeoVolume.h"
36 #include "TGeoMatrix.h"
37 #include "TGeoShape.h"
38 #include "TGeoBBox.h"
39 #include "TGeoMatrix.h"
40 #include "TGeoManager.h"
41 
42 #include "TGLViewer.h"
43 #include "KeySymbols.h"
44 #include "TGLabel.h"
45 #include "TGNumberEntry.h"
46 #include "TGListBox.h"
47 #include "TGButton.h"
48 #include "TEveViewer.h"
49 #include "TGeoOverlap.h"
50 #include "TGClient.h"
51 
52 static const std::string sUpdateMsg = "Please press Apply button to update overlaps.\n";
53 
54 FWOverlapTableView::FWOverlapTableView(TEveWindowSlot* iParent, FWColorManager* colMng)
55  : FWGeometryTableViewBase(iParent, FWViewType::kOverlapTable, colMng),
56  m_applyButton(nullptr),
57  m_listOptionButton(nullptr),
58  m_tableManager(nullptr),
59  m_numEntry(nullptr),
60  m_runChecker(true),
61  m_path(this, "Path:", std::string("/cms:World_1/cms:CMSE_1")),
62  m_precision(this, "Precision", 0.05, 0.000001, 10),
63  m_listAllNodes(this, "ListAllNodes", true),
64  m_rnrOverlap(this, "Overlap", true),
65  m_rnrExtrusion(this, "Extrusion", true),
66  m_drawPoints(this, "DrawPoints", true),
67  m_pointSize(this, "PointSize", 4l, 0l, 10l),
68  m_extrusionMarkerColor(this, "ExtrusionMarkerColor", 0l, 0l, 20l),
69  m_overlapMarkerColor(this, "OverlapMarkerColor", 9l, 0l, 20l) {
70  // top row
71  TGHorizontalFrame* hp = new TGHorizontalFrame(m_frame);
72 
73  {
74  m_viewBox = new FWViewCombo(hp, this);
75  hp->AddFrame(m_viewBox, new TGLayoutHints(kLHintsExpandY, 2, 2, 0, 0));
76  }
77 
78  {
79  TGTextButton* rb = new TGTextButton(hp, "CdTop");
80  hp->AddFrame(rb, new TGLayoutHints(kLHintsNormal, 2, 2, 0, 0));
81  rb->Connect("Clicked()", "FWGeometryTableViewBase", this, "cdTop()");
82  }
83 
84  {
85  TGTextButton* rb = new TGTextButton(hp, "CdUp");
86  hp->AddFrame(rb, new TGLayoutHints(kLHintsNormal, 2, 2, 0, 0));
87  rb->Connect("Clicked()", "FWGeometryTableViewBase", this, "cdUp()");
88  }
89  {
90  hp->AddFrame(new TGLabel(hp, "Precision:"), new TGLayoutHints(kLHintsBottom, 10, 0, 0, 2));
91  m_numEntry = new TGNumberEntry(hp,
93  5,
94  -1,
95  TGNumberFormat::kNESReal,
96  TGNumberFormat::kNEAAnyNumber,
97  TGNumberFormat::kNELLimitMinMax,
98  m_precision.min(),
99  m_precision.max());
100  hp->AddFrame(m_numEntry, new TGLayoutHints(kLHintsNormal, 2, 2, 0, 0));
101  m_numEntry->Connect("ValueSet(Long_t)", "FWOverlapTableView", this, "precisionCallback(Long_t)");
102  }
103 
104  {
105  m_listOptionButton = new TGCheckButton(hp, m_listAllNodes.name().c_str());
106  m_listOptionButton->SetState(m_listAllNodes.value() ? kButtonDown : kButtonUp);
107  m_listOptionButton->Connect("Clicked()", "FWOverlapTableView", this, "setListAllNodes()");
108  hp->AddFrame(m_listOptionButton, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 0, 1, 1));
109  }
110  {
111  m_applyButton = new TGTextButton(hp, "Apply");
112  hp->AddFrame(m_applyButton, new TGLayoutHints(kLHintsNormal, 2, 2, 0, 0));
113  m_applyButton->Connect("Clicked()", "FWOverlapTableView", this, "recalculate()");
114  }
115 
116  m_frame->AddFrame(hp, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 4, 2, 2, 0));
118 
119  // std::cerr << " FWOverlapTableView::initGeometry \n";
120 
121  FWGeoTopNodeGLScene* gls = new FWGeoTopNodeGLScene(nullptr);
122 #if ROOT_VERSION_CODE < ROOT_VERSION(5, 32, 0)
123  m_eveScene = new FWGeoTopNodeEveScene(gls, "TopGeoNodeScene", "");
124 #else
125  m_eveScene = new TEveScene(gls, "TopGeoNodeScene", "");
126 #endif
127 
128  gEve->GetScenes()->AddElement(m_eveScene);
129 
130  m_eveTopNode = new FWEveOverlap(this);
131  m_eveTopNode->SetElementNameTitle("overlapNode", "opverlapNodetitle");
132  m_eveTopNode->IncDenyDestroy();
133  m_eveTopNode->SetPickable(true);
134  m_eveScene->AddElement(m_eveTopNode);
135 
136  gls->m_eveTopNode = m_eveTopNode;
137  m_eveTopNode->m_scene = gls;
138 
140  m_marker->SetMainColor(kRed);
141  m_marker->IncDenyDestroy();
142  m_marker->Reset(TEveQuadSet::kQT_FreeQuad, kFALSE, 32);
143  m_marker->SetOwnIds(kTRUE);
144  m_marker->SetAlwaysSecSelect(kTRUE);
145  m_marker->SetPickable(kTRUE);
146  m_marker->SetOwnIds(kTRUE);
147 
148  m_drawPoints.changed_.connect(std::bind(&FWOverlapTableView::drawPoints, this));
149  m_pointSize.changed_.connect(std::bind(&FWOverlapTableView::pointSize, this));
150  m_rnrOverlap.changed_.connect(std::bind(&FWOverlapTableView::refreshTable3D, this));
154 
155  postConst();
156 }
157 //______________________________________________________________________________
158 
160  if (m_marker)
161  m_marker->DecDenyDestroy();
162 }
163 
164 //______________________________________________________________________________
166 
167 //______________________________________________________________________________
169 
170 //______________________________________________________________________________
173  refreshTable3D();
174 }
175 //______________________________________________________________________________
176 
177 TEveElement* FWOverlapTableView::getEveGeoElement() const { return m_eveTopNode; }
178 
179 //______________________________________________________________________________
181  // std::cout << " ----------------------------- PRECISION \n" << m_numEntry->GetNumber();
182  setCheckerState(true);
183  m_precision.set(m_numEntry->GetNumber());
185 }
186 
188  //m_path.set(m_pathEntry->GetText());
189  // m_precision.set(m_numEntry->GetNumber());
190  // std::cout << " $$$$ " << m_path.value() << std::endl;
193  getTableManager()->setLevelOffset(getTableManager()->refEntries().at(getTopNodeIdx()).m_level);
194  refreshTable3D();
195 
196  setCheckerState(false);
197 }
198 
199 //______________________________________________________________________________
201  m_enableRedraw = false;
202 
203  for (const_iterator it = begin(), itEnd = end(); it != itEnd; ++it) {
204  (*it)->setFrom(iFrom);
205  }
206 
207  m_viewersConfig = iFrom.valueForKey("Viewers");
208  m_numEntry->SetNumber(m_precision.value());
209 
210  // refreshTable3D();
211  m_enableRedraw = true;
212  recalculate();
213 }
214 
215 //______________________________________________________________________________
217  gui.requestTab("Style")
218  .
219  // addParam(&m_enableHighlight).
220  // separator().
221  addParam(&m_rnrOverlap)
223  .separator()
227 
229 }
230 
231 //______________________________________________________________________________
233  m_marker->SetRnrSelf(m_drawPoints.value());
234  m_marker->ElementChanged();
235  gEve->Redraw3D();
236 }
237 
238 //______________________________________________________________________________
240  m_marker->SetMarkerSize(m_pointSize.value());
241  m_marker->ElementChanged();
242  gEve->Redraw3D();
243 }
244 
245 //______________________________________________________________________________
247  setCheckerState(true);
249 }
250 //______________________________________________________________________________
252  if (m_topNodeIdx.value() == -1)
253  return;
254 
255  setCheckerState(true);
257 }
258 //______________________________________________________________________________
260  m_runChecker = x;
261  m_applyButton->SetForegroundColor(x ? 0xff0000 : 0x000000);
262  gClient->NeedRedraw(m_applyButton);
263 }
264 //______________________________________________________________________________
265 
267  // printf(" FWOverlapTableView::chosenItem chosen item %s \n", ni->name());
268 
269  switch (menuIdx) {
271  std::cout << "=============================================================================" << std::endl
272  << std::endl;
274  break;
275  }
276  default:
278  }
279 }
280 
281 //______________________________________________________________________________
283  using namespace TMath;
284  if (!m_enableRedraw)
285  return;
287 
288  for (int i = 0; i < m_marker->GetPlex()->Size(); ++i) {
290  TEveQuadSet::QFreeQuad_t* q = (TEveQuadSet::QFreeQuad_t*)m_marker->GetDigit(i);
291  q->fValue = -1;
292 
293  // check if any of the overlaping nodes is visible -> is in the subtree
294  bool rnr = false;
295 
296  for (std::vector<int>::iterator j = id->m_nodes.begin(); j < id->m_nodes.end(); ++j) {
297  if ((id->m_ovl->IsExtrusion() && m_rnrExtrusion.value()) || (id->m_ovl->IsOverlap() && m_rnrOverlap.value())) {
299  rnr = true;
300  break;
301  }
302  }
303  }
304 
305  if (rnr) {
306  q->fValue = (id->m_ovl->IsOverlap()) ? m_overlapMarkerColor.value() : m_extrusionMarkerColor.value();
307  q->fValue += 1000;
308  }
309  }
310 
311  m_marker->ElementChanged();
312  gEve->FullRedraw3D(false, true);
313 }
FWOverlapTableManager::importOverlaps
void importOverlaps(std::string path, double precision)
Definition: FWOverlapTableManager.cc:59
FWOverlapTableView::getEveGeoElement
virtual TEveElement * getEveGeoElement() const
Definition: FWOverlapTableView.cc:177
FWParameterizable::const_iterator
std::vector< FWParameterBase * >::const_iterator const_iterator
Definition: FWParameterizable.h:34
FWOverlapTableView::m_extrusionMarkerColor
FWLongParameter m_extrusionMarkerColor
Definition: FWOverlapTableView.h:86
FWOverlapTableView::m_precision
FWDoubleParameter m_precision
Definition: FWOverlapTableView.h:77
mps_fire.i
i
Definition: mps_fire.py:428
FWGeometryTableViewBase::m_viewersConfig
const FWConfiguration * m_viewersConfig
Definition: FWGeometryTableViewBase.h:133
FWGeometryTableViewBase::chosenItem
virtual void chosenItem(int)
Definition: FWGeometryTableViewBase.cc:452
FWOverlapTableView::cdTop
void cdTop() override
Definition: FWOverlapTableView.cc:251
FWGeometryTableViewBase::m_eveTopNode
FWGeoTopNode * m_eveTopNode
Definition: FWGeometryTableViewBase.h:138
FWGenericParameterWithRange::max
T max() const
Definition: FWGenericParameterWithRange.h:47
ViewerParameterGUI
Definition: CmsShowViewPopup.h:49
FWGeoTopNode::getFirstSelectedTableIndex
int getFirstSelectedTableIndex()
Definition: FWGeoTopNode.cc:164
FWOverlapTableView::m_listAllNodes
FWBoolParameter m_listAllNodes
Definition: FWOverlapTableView.h:79
gather_cfg.cout
cout
Definition: gather_cfg.py:144
FWOverlapTableView::m_drawPoints
FWBoolParameter m_drawPoints
Definition: FWOverlapTableView.h:84
FWGeometryTableViewBase::refreshTable3D
virtual void refreshTable3D()
Definition: FWGeometryTableViewBase.cc:535
FWOverlapTableView::setFrom
void setFrom(const FWConfiguration &) override
Definition: FWOverlapTableView.cc:200
FWEveDigitSetScalableMarker.h
FWOverlapTableView::pointSize
void pointSize()
Definition: FWOverlapTableView.cc:239
FWGeometryTableViewBase::postConst
void postConst()
Definition: FWGeometryTableViewBase.cc:183
FWOverlapTableManager::printOverlaps
void printOverlaps(int) const
Definition: FWOverlapTableManager.cc:333
FWParameterizable::end
const_iterator end() const
Definition: FWParameterizable.h:38
FWOverlapTableView::precisionCallback
void precisionCallback(Long_t)
Definition: FWOverlapTableView.cc:180
FWGenericParameter::set
void set(T iValue)
Definition: FWGenericParameter.h:70
DDAxes::x
FWOverlapTableView::m_runChecker
bool m_runChecker
Definition: FWOverlapTableView.h:72
FWOverlapTableView::~FWOverlapTableView
~FWOverlapTableView() override
Definition: FWOverlapTableView.cc:159
FWGeoTopNodeGLScene::m_eveTopNode
FWGeoTopNode * m_eveTopNode
Definition: FWGeoTopNodeScene.h:16
FWParameterizable::begin
const_iterator begin() const
Definition: FWParameterizable.h:36
FWOverlapTableView::m_path
FWStringParameter m_path
Definition: FWOverlapTableView.h:76
FWGeometryTableViewBase::checkExpandLevel
void checkExpandLevel()
Definition: FWGeometryTableViewBase.cc:266
FWGeometryTableManagerBase::setLevelOffset
void setLevelOffset(int x)
Definition: FWGeometryTableManagerBase.h:152
FWGeometryTableViewBase::m_marker
FWEveDigitSetScalableMarker * m_marker
Definition: FWGeometryTableViewBase.h:137
FWGeometryTableManagerBase
Definition: FWGeometryTableManagerBase.h:36
FWOverlapTableView::m_listOptionButton
TGCheckButton * m_listOptionButton
Definition: FWOverlapTableView.h:64
FWOverlapTableView::m_rnrOverlap
FWBoolParameter m_rnrOverlap
Definition: FWOverlapTableView.h:81
FWGenericParameterWithRange::min
T min() const
Definition: FWGenericParameterWithRange.h:46
FWGenericParameter::changed_
sigc::signal< void, T > changed_
Definition: FWGenericParameter.h:75
FWGeometryTableViewBase::cdTop
virtual void cdTop()
Definition: FWGeometryTableViewBase.cc:237
ViewerParameterGUI::separator
ViewerParameterGUI & separator()
Definition: CmsShowViewPopup.cc:232
trackingPlots.hp
hp
Definition: trackingPlots.py:1248
FWGeometryTableViewManager.h
FWGUIValidatingTextEntry.h
FWGeometryTableViewBase
Definition: FWGeometryTableViewBase.h:41
FWOverlapTableManager::QuadId
Definition: FWOverlapTableManager.h:35
FWConfiguration::valueForKey
const FWConfiguration * valueForKey(const std::string &iKey) const
Definition: FWConfiguration.cc:122
FWGeometryTableViewBase::m_frame
TGCompositeFrame * m_frame
Definition: FWGeometryTableViewBase.h:129
FWGeometryTableViewBase::populateController
void populateController(ViewerParameterGUI &) const override
Definition: FWGeometryTableViewBase.cc:607
FWGeometryTableManagerBase::isNodeRendered
bool isNodeRendered(int idx, int top_node_idx) const
Definition: FWGeometryTableManagerBase.cc:310
FWGeometryTableViewBase::m_eveScene
TEveScene * m_eveScene
Definition: FWGeometryTableViewBase.h:139
FWOverlapTableView::setCheckerState
void setCheckerState(bool)
Definition: FWOverlapTableView.cc:259
FWOverlapTableView::getTableManager
FWGeometryTableManagerBase * getTableManager() override
Definition: FWOverlapTableView.cc:165
FWOverlapTableView::chosenItem
void chosenItem(int x) override
Definition: FWOverlapTableView.cc:266
FWGeoTopNode::kPrintOverlap
Definition: FWGeoTopNode.h:57
FWOverlapTableView::drawPoints
void drawPoints()
Definition: FWOverlapTableView.cc:232
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
funct::true
true
Definition: Factorize.h:173
FWGeometryTableViewBase::m_topNodeIdx
FWLongParameter m_topNodeIdx
Definition: FWGeometryTableViewBase.h:111
FWGeoTopNode::m_scene
FWGeoTopNodeGLScene * m_scene
Definition: FWGeoTopNode.h:66
FWOverlapTableView::refreshTable3D
void refreshTable3D() override
Definition: FWOverlapTableView.cc:282
FWOverlapTableView::recalculate
void recalculate()
Definition: FWOverlapTableView.cc:187
FWPopupMenu.cc
FWGeometryTableViewBase::m_enableRedraw
bool m_enableRedraw
Definition: FWGeometryTableViewBase.h:135
FWParameterBase::name
const std::string & name() const
Definition: FWParameterBase.h:39
FWOverlapTableView::m_tableManager
FWOverlapTableManager * m_tableManager
Definition: FWOverlapTableView.h:69
submitPVResolutionJobs.q
q
Definition: submitPVResolutionJobs.py:84
fwLog.h
FWGeometryTableViewBase::cdUp
virtual void cdUp()
Definition: FWGeometryTableViewBase.cc:243
FWColorManager
Definition: FWColorManager.h:45
FWOverlapTableView::m_pointSize
FWLongParameter m_pointSize
Definition: FWOverlapTableView.h:85
FWValidatorBase.h
FWGeometryTableViewBase::getTopNodeIdx
int getTopNodeIdx() const
Definition: FWGeometryTableViewBase.h:97
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
FWEveOverlap.h
FWGenericParameter::value
T value() const
Definition: FWGenericParameter.h:50
std
Definition: JetResolutionObject.h:76
FWOverlapTableView::FWOverlapTableView
FWOverlapTableView(TEveWindowSlot *iParent, FWColorManager *colMng)
Definition: FWOverlapTableView.cc:54
FWOverlapTableView::m_overlapMarkerColor
FWLongParameter m_overlapMarkerColor
Definition: FWOverlapTableView.h:87
FWOverlapTableView::m_applyButton
TGTextButton * m_applyButton
Definition: FWOverlapTableView.h:63
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
genVertex_cff.x
x
Definition: genVertex_cff.py:12
CmsShowViewPopup.h
FWOverlapTableManager
Definition: FWOverlapTableManager.h:31
FWOverlapTableView::m_rnrExtrusion
FWBoolParameter m_rnrExtrusion
Definition: FWOverlapTableView.h:82
sUpdateMsg
static const std::string sUpdateMsg
Definition: FWOverlapTableView.cc:52
FWEveOverlap
Definition: FWEveOverlap.h:10
FWOverlapTableManager.h
FWOverlapTableView.h
FWGeometryTableViewBase::m_viewBox
FWViewCombo * m_viewBox
Definition: FWGeometryTableViewBase.h:131
FWConfiguration
Definition: FWConfiguration.h:31
FWOverlapTableView::listAllNodes
bool listAllNodes() const
Definition: FWOverlapTableView.cc:168
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
FWGeoTopNodeGLScene
Definition: FWGeoTopNodeScene.h:9
FWViewType
Definition: FWViewType.h:22
FWOverlapTableView::m_numEntry
TGNumberEntry * m_numEntry
Definition: FWOverlapTableView.h:70
FWGeoTopNodeScene.h
FWEveDigitSetScalableMarker
Definition: FWEveDigitSetScalableMarker.h:9
FWOverlapTableView::populateController
void populateController(ViewerParameterGUI &) const override
Definition: FWOverlapTableView.cc:216
FWGeometryTableViewBase::FWViewCombo
Definition: FWGeometryTableViewBase.h:48
ViewerParameterGUI::addParam
ViewerParameterGUI & addParam(const FWParameterBase *)
Definition: CmsShowViewPopup.cc:212
FWOverlapTableView::cdUp
void cdUp() override
Definition: FWOverlapTableView.cc:246
ViewerParameterGUI::requestTab
ViewerParameterGUI & requestTab(const char *)
Definition: CmsShowViewPopup.cc:197
FWOverlapTableView::setListAllNodes
void setListAllNodes()
Definition: FWOverlapTableView.cc:171