2 #include <boost/bind.hpp>
3 #include <boost/regex.hpp>
20 #include "TGFileDialog.h"
22 #include "TGeoMatrix.h"
23 #include "TGStatusBar.h"
27 #include "TGComboBox.h"
28 #include "KeySymbols.h"
31 #include "TGeoShape.h"
33 #include "TEveManager.h"
34 #include "TEveGeoNode.h"
35 #include "TEveScene.h"
36 #include "TEveSceneInfo.h"
37 #include "TEveViewer.h"
38 #include "TGLViewer.h"
39 #include "TGLCamera.h"
40 #ifdef PERFTOOL_BROWSER
41 #include <google/profiler.h>
65 Material( TGeoMaterial*
x) {
g=
x;
n = x ? x->GetName() :
"<show-all>";}
69 mutable std::vector<Material>
m_list;
75 virtual void fillOptions(
const char* iBegin,
const char* iEnd, std::vector<std::pair<boost::shared_ptr<std::string>, std::string> >& oOptions)
const
78 std::string
part(iBegin,iEnd);
79 unsigned int part_size = part.size();
85 int nLevel = it->m_level;
87 while (it->m_level > nLevel)
89 TGeoMaterial*
g = it->m_node->GetVolume()->GetMaterial();
90 bool duplicate =
false;
91 for (std::vector<Material>::iterator
j =
m_list.begin();
j!=
m_list.end(); ++
j) {
102 std::vector<Material>::iterator startIt =
m_list.begin();
107 oOptions.push_back(std::make_pair(boost::shared_ptr<std::string>(
new std::string(
m_list.begin()->n)),
h));
108 for (std::vector<Material>::iterator
i = startIt;
i!=
m_list.end(); ++
i) {
109 if(part == (*i).n.substr(0,part_size) )
112 oOptions.push_back(std::make_pair(boost::shared_ptr<std::string>(
new std::string((*i).n)), (*i).n.substr(part_size, (*i).n.size()-part_size)));
120 if (exp.empty())
return true;
122 for (std::vector<Material>::iterator
i =
m_list.begin();
i!=
m_list.end(); ++
i) {
141 TGTextButton(p,
"Select Views", -1, TGButton::GetDefaultGC()(), TGTextButton::GetDefaultFontStruct(), kRaisedFrame | kDoubleBorder ),
m_tableView(t),
m_el(0) {}
147 if (event->fType == kButtonPress)
153 TEveElementList* views = gEve->GetViewers();
156 for (TEveElement::List_i it = views->BeginChildren(); it != views->EndChildren(); ++it)
158 TEveViewer*
v = ((TEveViewer*)(*it));
159 if (strstr( v->GetElementName(),
"3D") )
162 m_viewPopup->AddEntry(v->GetElementName(), idx);
163 TEveSceneInfo* si = ( TEveSceneInfo*)v->FindChild(Form(
"SI - EventScene %s",v->GetElementName() ));
165 for (TEveElement::List_i it =
m_el->BeginParents(); it !=
m_el->EndParents(); ++it ){
166 if (*it == si->GetScene()) {
174 m_viewPopup->CheckEntry(idx);
183 gVirtualX->TranslateCoordinates(GetId(),
184 gClient->GetDefaultRoot()->GetId(),
185 event->fX,
event->fY,
190 m_viewPopup->PlaceMenu(ax, ay,
true,
true);
191 m_viewPopup->Connect(
"Activated(Int_t)",
192 "FWGeometryTableView",
194 "selectView(Int_t)");
213 m_mode(this,
"Mode:", 0
l, 0
l, 1
l),
214 m_filter(this,
"Materials:",std::string()),
215 m_autoExpand(this,
"ExpandList:", 1
l, 0
l, 100
l),
216 m_visLevel(this,
"VisLevel:", 3
l, 1
l, 100
l),
217 m_visLevelFilter(this,
"IgnoreVisLevelOnFilter",
true),
218 m_topNodeIdx(this,
"TopNodeIndex", -1
l, 0, 1e7),
219 m_colorManager(colMng),
227 m_filterValidator(0),
231 TGCompositeFrame* xf =
m_eveWindow->GetGUICompositeFrame();
233 m_frame =
new TGVerticalFrame(xf);
234 xf->AddFrame(
m_frame,
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
248 TGHorizontalFrame* hp =
new TGHorizontalFrame(
m_frame);
250 if (0) { TGTextButton* fileOpen =
new TGTextButton (hp,
"Open Geometry File");
251 hp->AddFrame(fileOpen);
252 fileOpen->Connect(
"Clicked()",
"FWGeometryTableView",
this,
"browse()");
255 TGTextButton* rb =
new TGTextButton (hp,
"CdTop");
256 hp->AddFrame(rb,
new TGLayoutHints(kLHintsNormal, 2, 2, 0, 0) );
257 rb->Connect(
"Clicked()",
"FWGeometryTableView",
this,
"cdTop()");
259 TGTextButton* rb =
new TGTextButton (hp,
"CdUp");
260 hp->AddFrame(rb,
new TGLayoutHints(kLHintsNormal, 2, 2, 0, 0));
261 rb->Connect(
"Clicked()",
"FWGeometryTableView",
this,
"cdUp()");
266 hp->AddFrame(
m_viewBox,
new TGLayoutHints(kLHintsExpandY, 2, 2, 0, 0));
269 hp->AddFrame(
new TGLabel(hp,
"Filter:"),
new TGLayoutHints(kLHintsBottom, 10, 0, 0, 2));
274 hp->AddFrame(
m_filterEntry,
new TGLayoutHints(kLHintsExpandX, 1, 2, 1, 0));
277 m_filterEntry->Connect(
"ReturnPressed()",
"FWGeometryTableView",
this,
"filterTextEntryCallback()");
279 gVirtualX->GrabKey(
m_filterEntry->GetId(),gVirtualX->KeysymToKeycode((
int)kKey_A), kKeyControlMask,
true);
281 m_frame->AddFrame(hp,
new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 4, 2, 2, 0));
293 m_tableWidget->Connect(
"cellClicked(Int_t,Int_t,Int_t,Int_t,Int_t,Int_t)",
294 "FWGeometryTableView",
this,
295 "cellClicked(Int_t,Int_t,Int_t,Int_t,Int_t,Int_t)");
323 TGCompositeFrame *frame =
m_eveWindow->GetGUICompositeFrame();
344 TEveScene* scene =
dynamic_cast<TEveScene*
>(*it);
345 std::string
n = scene->GetElementName();
358 (*it)->setFrom(iFrom);
372 TEveElementList* scenes = gEve->GetScenes();
378 TString sname = it->first;
379 TEveElement*
s = scenes->FindChild(sname);
403 TGFrameElement *el = (TGFrameElement*)
m_settersFrame->GetList()->First();
404 TGHorizontalFrame*
f = (TGHorizontalFrame*) el->fFrame;
409 m_settersFrame->AddFrame(frame,
new TGLayoutHints(kLHintsExpandX,4,2,2,2) );
423 ptr->attach(param,
this);
425 TGFrame*
m_frame = ptr->build(frame,
false);
426 frame->AddFrame(m_frame,
new TGLayoutHints(kLHintsExpandX));
437 TEveElement::List_i it = gEve->GetViewers()->BeginChildren();
438 std::advance(it, idx);
439 TEveViewer*
v = (TEveViewer*)(*it);
440 TEveSceneInfo* si = (TEveSceneInfo*)v->FindChild(Form(
"SI - EventScene %s",v->GetElementName()));
451 if (*it == si->GetScene()) {
457 printf(
"add node %s \n", si->GetElementName());
477 if (iButton == kButton1)
486 std::vector<Color_t>
colors;
492 m_colorPopup->Connect(
"ColorSelected(Color_t)",
"FWGeometryTableView", const_cast<FWGeometryTableView*>(
this),
"nodeColorChangeRequested(Color_t)");
501 bool elementChanged =
false;
505 elementChanged =
true;
510 elementChanged =
true;
517 gEve->RegisterRedraw3D();
528 m_nodePopup->AddEntry(
"Set As Top Node",
kSetTopNode);
529 m_nodePopup->AddEntry(
"Set As Top Node And Camera Center",
kSetTopNodeCam);
530 m_nodePopup->AddSeparator();
531 m_nodePopup->AddEntry(
"Rnr Off For All Children",
kVisOff);
532 m_nodePopup->AddEntry(
"Rnr On For All Children",
kVisOn);
533 m_nodePopup->AddSeparator();
534 m_nodePopup->AddEntry(
"Set Camera Center",
kCamera);
535 m_nodePopup->AddSeparator();
540 m_nodePopup->PlaceMenu(x,y,
true,
true);
541 m_nodePopup->Connect(
"Activated(Int_t)",
542 "FWGeometryTableView",
543 const_cast<FWGeometryTableView*>(
this),
544 "chosenItem(Int_t)");
551 TGeoVolume* gv = ni.
m_node->GetVolume();
553 bool resetHome =
false;
565 gv->InspectMaterial();
590 static double pnt[3];
591 TGeoBBox* bb =
static_cast<TGeoBBox*
>( ni.
m_node->GetVolume()->GetShape());
592 const double* origin = bb->GetOrigin();
593 mtx.LocalToMaster(origin, pnt);
595 TEveElementList* vl = gEve->GetViewers();
596 for (TEveElement::List_i it = vl->BeginChildren(); it != vl->EndChildren(); ++it)
598 TEveViewer*
v = ((TEveViewer*)(*it));
599 TString
name = v->GetElementName();
600 if (name.Contains(
"3D"))
602 v->GetGLViewer()->SetDrawCameraCenter(
true);
603 TGLCamera& cam = v->GetGLViewer()->CurrentCamera();
604 cam.SetExternalCenter(
true);
605 cam.SetCenterVec(pnt[0], pnt[1], pnt[2]);
608 if (resetHome) gEve->FullRedraw3D(
true,
true);
618 if(backgroundIsWhite) {
633 ni.
m_node->GetVolume()->SetLineColor(col);
656 std::string
path =
"/" ;
675 #ifdef PERFTOOL_BROWSER
676 ProfilerStart(Form(
"cdPath%d.prof", parentIdx));
689 gEve->FullRedraw3D(
false,
true);
692 #ifdef PERFTOOL_BROWSER
717 list->GetSelectedEntries(&selected);
718 if (selected.GetEntries() == 1)
720 const TGLBEntry*
entry =
dynamic_cast<TGLBEntry*
> (selected.First());
781 gEve->FullRedraw3D(
false,
true);
void setDaughtersSelfVisibility(bool)
void setVisibility(NodeInfo &nodeInfo, bool)
std::vector< std::pair< std::string, FWConfiguration > > KeyValues
void loadGeometry(TGeoNode *, TObjArray *)
std::vector< FWParameterBase * >::const_iterator const_iterator
const KeyValues * keyValues() const
bool getVisibilityChld(const NodeInfo &nodeInfo) const
const_iterator begin() const
TGCompositeFrame * m_frame
virtual void setFrom(const FWConfiguration &)
void updateFilter(std::string &)
void setElement(TEveElement *x)
FWGeoMaterialValidator * m_filterValidator
void populate3DViewsFromConfig()
void setVisibilityChld(NodeInfo &nodeInfo, bool)
void getNodePath(int, std::string &) const
std::vector< Color_t > colors
void fillLimitedColors(std::vector< Color_t > &cv) const
FWGeometryTableView(TEveWindowSlot *, FWColorManager *, TGeoNode *, TObjArray *)
static boost::shared_ptr< FWParameterSetterBase > makeSetterFor(FWParameterBase *)
void cellClicked(Int_t iRow, Int_t iColumn, Int_t iButton, Int_t iKeyMod, Int_t iGlobalX, Int_t iGlobalY)
Exp< T >::type exp(const T &t)
FWGeometryTableManager * m_table
void dataChanged()
Classes which inherit from FWTableManagerBase must call this when their underlying data changes...
FWViewCombo(const TGWindow *p, FWGeometryTableView *t)
sigc::signal< void, T > changed_
FWColorManager * m_colorManager
void topGeoNodeChanged(int)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
FWTableWidget * m_tableWidget
bool operator<(const Material &x) const
FWLongParameter m_visLevel
std::pair< std::string, MonitorElement * > entry
BackgroundColorIndex backgroundColorIndex() const
FWStringParameter m_filter
virtual Bool_t HandleButton(Event_t *event)
void setValidator(FWValidatorBase *)
const_iterator end() const
bool addEntry(Long_t id, const std::string &txt)
void setBackgroundToWhite(bool)
bool getVisibility(const NodeInfo &nodeInfo) const
void setBackgroundColor()
TGListBox * getListBox() const
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
FWGeometryTableManager * m_tableManager
FWGeoTopNode * m_eveTopNode
FWConfiguration & addKeyValue(const std::string &, const FWConfiguration &)
bool isStringValid(std::string &exp)
void setMaxListBoxHeight(UInt_t x)
FWLongParameter m_autoExpand
void setSelection(int row, int column, int mask)
void getNodeMatrix(const NodeInfo &nodeInfo, TGeoHMatrix &mat) const
std::vector< boost::shared_ptr< FWParameterSetterBase > > m_setters
const FWConfiguration * m_viewersConfig
std::vector< Material > m_list
Entries_v::iterator Entries_i
virtual void addTo(FWConfiguration &) const
KeyValues::const_iterator KeyValuesIt
Material(TGeoMaterial *x)
void makeSetter(TGCompositeFrame *frame, FWParameterBase *param)
FWColorPopup * m_colorPopup
FWBoolParameter m_visLevelFilter
void nodeColorChangeRequested(Color_t)
const FWConfiguration * valueForKey(const std::string &iKey) const
void filterTextEntryCallback()
void printChildren(int) const
void firstColumnClicked(int row)
FWLongParameter m_topNodeIdx
FWGUIValidatingTextEntry * m_filterEntry
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
void filterListCallback()
void setPath(int, std::string &)
virtual void fillOptions(const char *iBegin, const char *iEnd, std::vector< std::pair< boost::shared_ptr< std::string >, std::string > > &oOptions) const
virtual ~FWGeoMaterialValidator()
virtual ~FWGeometryTableView()
FWGeoMaterialValidator(FWGeometryTableManager *t)
FWGeometryTableView * m_tableView
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
int getTopNodeIdx() const
TEveWindowFrame * m_eveWindow
virtual void addTo(FWConfiguration &) const
TGCompositeFrame * m_settersFrame