18 #include <boost/bind.hpp>
20 #ifdef PERFTOOL_GEO_TABLE
21 #include <google/profiler.h>
32 #include "TGeoVolume.h"
33 #include "TGeoMatrix.h"
34 #include "TGeoShape.h"
36 #include "TGeoMatrix.h"
41 static const char*
redTxt =
"\033[01;31m";
53 std::string
x(m_level*3 ,
' ');
54 x += m_node->GetName();
66 gval.fMask = kGCForeground | kGCBackground | kGCStipple | kGCFillStyle | kGCGraphicsExposures;
67 gval.fStipple = gClient->GetResourcePool()->GetCheckeredBitmap();
68 gval.fGraphicsExposures = kFALSE;
69 gval.fBackground = gVirtualX->GetPixel(kGray);
70 m_colorContext = gClient->GetResourcePool()->GetGCPool()->GetGC(&gval,kTRUE);
76 gClient->GetResourcePool()->GetGCPool()->FreeGC(m_colorContext->GetGC());
81 m_color = gVirtualX->GetPixel(c);
93 m_colorContext->SetFillStyle(kFillSolid);
94 Pixel_t baq = m_colorContext->GetForeground();
95 m_colorContext->SetForeground(m_color);
96 gVirtualX->FillRectangle(iID, m_colorContext->GetGC(), iX, iY, iWidth, iHeight);
100 m_colorContext->SetFillStyle(kFillOpaqueStippled);
101 gVirtualX->FillRectangle(iID, m_colorContext->GetGC(), iX, iY, iWidth, iHeight);
103 m_colorContext->SetForeground(baq);
150 std::vector<std::string> returnValue;
154 returnValue.push_back(
"Volume Name");
156 returnValue.push_back(
"Node Name");
158 returnValue.push_back(
"Color");
159 returnValue.push_back(
"RnrSelf");
160 returnValue.push_back(
"RnrChildren");
161 returnValue.push_back(
"Material");
162 returnValue.push_back(
"X");
163 returnValue.push_back(
"Y");
164 returnValue.push_back(
"Z");
197 if (iRow < 0)
return;
213 static const TGGC* s_blackHighLight = 0;
214 if (!s_blackHighLight) {
216 gval.fMask = kGCForeground | kGCBackground | kGCStipple | kGCFillStyle | kGCGraphicsExposures;
217 gval.fForeground = 0xbbbbbb;
218 gval.fBackground = 0x000000;
219 gval.fFillStyle = kFillOpaqueStippled;
220 gval.fStipple = gClient->GetResourcePool()->GetCheckeredBitmap();
221 gval.fGraphicsExposures = kFALSE;
222 s_blackHighLight = gClient->GetGC(&gval, kTRUE);
242 static Cache mxCache;
245 m_renderer.
setData(std::string(
"FWGeometryTableManager::cellRenderer() Error!"),
false);
249 static char sval[12];
250 static std::string
zero =
"0.000";
256 TGeoNode& gn = *data.
m_node;
263 int nD = data.
m_node->GetNdaughters();
265 renderer->
setData(Form(
"%s [%d]", gn.GetVolume()->GetName(), nD), isSelected);
267 renderer->
setData(Form(
"%s [%d]", gn.GetName(), nD), isSelected);
275 if (data.
m_node->GetNdaughters())
305 renderer->
setData( gn.GetVolume()->GetMaterial()->GetName(), isSelected);
311 if (mxCache.row != iSortedRowNumber) {
312 mxCache.row = iSortedRowNumber;
313 mxCache.pos[0] = 0; mxCache.pos[1] = 0; mxCache.pos[2] = 0;
316 TGeoBBox* bb =
static_cast<TGeoBBox*
>(data.
m_node->GetVolume()->GetShape());
317 const double* origin = bb->GetOrigin();
318 mxCache.mtx.LocalToMaster(origin, mxCache.pos);
320 float val = mxCache.pos[iCol -
kPosX];
322 renderer->
setData(zero, isSelected);
325 snprintf(sval,
sizeof(sval),
"%.3f", val);
326 renderer->
setData(sval, isSelected);
334 TGeoBBox* gs =
static_cast<TGeoBBox*
>( gn.GetVolume()->GetShape());
335 float val = TMath::Sqrt(gs->GetDX()*gs->GetDX() + gs->GetDY()*gs->GetDY() +gs->GetDZ()*gs->GetDZ() );
338 renderer->
setData(zero, isSelected);
341 snprintf(sval,
sizeof(sval),
"%.3f", val);
342 renderer->
setData(sval, isSelected);
375 bool childMatches =
m_volumes[data.
m_node->GetVolume()].m_childMatches;
414 TGeoNode* parentNode =
m_entries[pIdx].m_node;
415 int nD = parentNode->GetNdaughters();
417 for (
int n = 0;
n != nD; ++
n)
419 int idx = pIdx + 1 +
n + dOff;
442 TGeoNode* parentNode =
m_entries[pIdx].m_node;
443 int nD = parentNode->GetNdaughters();
452 for (
int n = 0;
n != nD; ++
n)
454 int idx = pIdx + 1 +
n + dOff;
458 for (std::vector<int>::iterator u = vi.begin(); u != vi.end(); ++u )
460 TGeoVolume* neighbourVolume = parentNode->GetDaughter(*u)->GetVolume();
461 if (neighbourVolume == data.
m_node->GetVolume())
513 #ifdef PERFTOOL_GEO_TABLE
514 ProfilerStart(
"loadGeo");
526 boost::unordered_map<TGeoVolume*, Match> pipi(iVolumes->GetSize());
528 TIter next( iVolumes);
530 while ((v = (TGeoVolume*) next()) != 0)
540 topNodeInfo.
m_node = iGeoTopNode;
554 #ifdef PERFTOOL_GEO_TABLE
567 TGeoNode* parentGeoNode = parent.
m_node;
568 int parentLevel = parent.
m_level;
570 int nV = parentGeoNode->GetNdaughters();
572 for (
int n = 0;
n != nV; ++
n)
575 data.
m_node = parentGeoNode->GetDaughter(
n);
576 data.
m_level = parentLevel + 1;
600 for (
int d = 0; d < pn->GetNdaughters(); ++d )
602 if (
m_entries[
i].m_node == pn->GetDaughter(d))
608 if (!ok) printf(
"%s!!!!!! node %s has false parent %s \n",
redTxt,
m_entries[
i].
name(), pn->GetName());
617 for (std::vector<TGeoVolume*>::iterator
i = pstack.begin();
i!= pstack.end(); ++
i)
624 pstack.push_back(vol);
626 int nD = vol->GetNdaughters();
627 for (
int i = 0;
i!=nD; ++
i)
647 if (strcasestr(
i->first->GetMaterial()->GetName(), filterExp.c_str()) > 0) {
648 i->second.m_matches =
true;
652 i->second.m_matches =
false;
654 i->second.m_childMatches =
false;
657 std::vector<TGeoVolume*> pstack;
676 std::vector<std::string> relPath;
684 size_t ns = relPath.size();
685 for (
size_t i = 1;
i < ns; ++
i )
688 path += relPath[ns-
i -1];
747 int nD = parentNode->GetNdaughters();
748 for (
int n = 0;
n != nD; ++
n)
767 for (
int l = 0 ;
l < endl ; ++
l)
770 mtx.MultiplyLeft(
m_entries.at(pIdx).m_node->GetMatrix());
773 mtx.Multiply(data.
m_node->GetMatrix());
781 if (data.
m_node->GetVolume()->IsVisible() !=
x)
784 data.
m_node->GetVolume()->SetVisibility(x);
797 if (data.
m_node->GetVolume()->IsVisibleDaughters() !=
x)
800 data.
m_node->GetVolume()->VisibleDaughters(x);
814 return data.
m_node->GetVolume()->IsVisible();
823 return data.
m_node->GetVolume()->IsVisibleDaughters();
834 std::map<TGeoMaterial*, std::string> mlist;
837 int nLevel = it->m_level;
839 while (it->m_level > nLevel)
841 TGeoMaterial*
m = it->m_node->GetVolume()->GetMaterial();
842 if (mlist.find(m) == mlist.end())
844 mlist[
m] = m->GetName();
849 printf(
"size %d \n", (
int)mlist.size());
850 for(std::map<TGeoMaterial*, std::string>::iterator
i = mlist.begin();
i != mlist.end(); ++
i)
852 printf(
"material %s \n",
i->second.c_str());
void setDaughtersSelfVisibility(bool)
void setVisibility(NodeInfo &nodeInfo, bool)
FWGeometryTableView * m_browser
void loadGeometry(TGeoNode *, TObjArray *)
virtual UInt_t height() const
returns the minimum height of the cell to which the renderer is representing
virtual int unsortedRowNumber(int unsorted) const
when passed the index to the sorted order of the rows it returns the original row number from the und...
virtual ~ColorBoxRenderer()
virtual std::vector< std::string > getTitles() const
returns the title names for each column
void setBlackIcon(bool value)
bool getVisibilityChld(const NodeInfo &nodeInfo) const
virtual FWTableCellRendererBase * cellRenderer(int iSortedRowNumber, int iCol) const
FWGeometryTableManager(FWGeometryTableView *)
FWTextTreeCellRenderer m_renderer
void setVisibilityChld(NodeInfo &nodeInfo, bool)
void getNodePath(int, std::string &) const
void setIsOpen(bool value)
std::string getFilter() const
void dataChanged()
Classes which inherit from FWTableManagerBase must call this when their underlying data changes...
void topGeoNodeChanged(int)
virtual bool rowIsSelected(int row) const
std::vector< int > rowToIndex()
int getAutoExpand() const
void recalculateVisibilityNodeRec(int)
const char * name() const
ColorBoxRenderer m_colorBoxRenderer
std::vector< int > m_row_to_index
void setHighlightContext(const TGGC *context)
virtual const std::string title() const
void setBackgroundToWhite(bool)
void setBitVal(UChar_t f, bool x)
bool getVisibility(const NodeInfo &nodeInfo) const
static TGeoManager * getGeoMangeur()
static const TGGC & getDefaultHighlightGC()
virtual void draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight)
void assertNodeFilterCache(NodeInfo &data)
void setGraphicsContext(const TGGC *iContext)
void setIsParent(bool value)
bool testBit(UChar_t f) const
static const char * redTxt
bool testBitAny(UChar_t f) const
virtual void setIndentation(int indentation=0)
virtual ~FWGeometryTableManager()
int selectedColumn() const
void setSelection(int row, int column, int mask)
void setData(const std::string &, bool isSelected)
void setData(Color_t c, bool)
void getNodeMatrix(const NodeInfo &nodeInfo, TGeoHMatrix &mat) const
static void getNNodesTotal(TGeoNode *geoNode, int &off)
Entries_v::iterator Entries_i
void checkChildMatches(TGeoVolume *v, std::vector< TGeoVolume * > &)
void recalculateVisibilityVolumeRec(int)
bool getVolumeMode() const
virtual int numberOfColumns() const
Number of columns in the table.
void recalculateVisibility()
void visualPropertiesChanged()
Classes which inherit from FWTableManagerBase must call this when how the data is shown (e...
Volumes_t::iterator Volumes_i
const char * nameIndent() const
void printChildren(int) const
void firstColumnClicked(int row)
void importChildren(int parent_idx)
virtual int numberOfRows() const
Number of rows in the table.
void changeSelection(int iRow, int iColumn)
int getTopNodeIdx() const