22 #include "TEvePointSet.h"
23 #include "TGeoVolume.h"
24 #include "TGeoMatrix.h"
25 #include "TGeoShape.h"
27 #include "TGeoMatrix.h"
29 #include "TObjString.h"
31 #include "TGeoOverlap.h"
32 #include "TGeoManager.h"
33 #include "TPolyMarker3D.h"
35 #include "TStopwatch.h"
37 #include "TGeoPainter.h"
54 std::vector<std::string> returnValue;
57 returnValue.push_back(
"Name");
58 returnValue.push_back(
"Color");
59 returnValue.push_back(
"Opcty");
60 returnValue.push_back(
"RnrSelf");
61 returnValue.push_back(
"RnrChildren");
62 returnValue.push_back(
"Overlap");
63 returnValue.push_back(
"RnrMarker");
81 topNodeInfo.
m_node = gGeoManager->GetTopNode();
83 topNodeInfo.
m_color = gGeoManager->GetTopNode()->GetVolume()->GetLineColor();
84 topNodeInfo.
m_transparency = gGeoManager->GetTopNode()->GetVolume()->GetTransparency();
88 m_entries.resize(gGeoManager->GetNNodes());
91 m_entries.resize( gGeoManager->GetNNodes());
93 TGeoVolume* topVol = topNodeInfo.
m_node->GetVolume();
98 bool checkingOverlaps =
false;
99 TGeoManager *
geom = topVol->GetGeoManager();
100 ncheck = topNodeInfo.
m_node->CountDaughters(kFALSE);
101 timer =
new TStopwatch();
102 geom->ClearOverlaps();
103 geom->SetCheckingOverlaps(kTRUE);
107 geom->GetGeomPainter()->OpProgress(topVol->GetName(),icheck,ncheck,timer,kFALSE);
110 TGeoIterator git(topVol);
126 while ((node=git())) {
129 eit->m_color = node->GetVolume()->GetLineColor();
130 eit->m_transparency = node->GetVolume()->GetTransparency();
131 eit->m_level = git.GetLevel();
132 eit->m_parent = icheck;
134 if ((topNodeIdx )== icheck || !topNodeIdx ) {
136 checkingOverlaps=
true;
140 checkingOverlaps=
false;
148 if (pit->m_level < eit->m_level)
153 if ( checkingOverlaps) {
154 if (!node->GetVolume()->IsSelected()) {
155 geom->GetGeomPainter()->OpProgress(node->GetVolume()->GetName(),icheck+1,ncheck,timer,kFALSE);
156 node->GetVolume()->SelectVolume(kFALSE);
158 node->GetVolume()->CheckOverlaps(iPrecision);
160 if (oldS != gGeoManager->GetListOfOverlaps()->GetEntriesFast()) {
167 TGeoHMatrix* motherm =
new TGeoHMatrix(*geom->GetCurrentMatrix());
169 TGeoNode* ni = topNodeInfo.
m_node;
170 for (Int_t i=1; i<=git.GetLevel(); i++) {
171 ni = ni->GetDaughter(git.GetIndex(i));
172 motherm->Multiply(ni->GetMatrix());
176 int newCnt = gGeoManager->GetListOfOverlaps()->GetEntriesFast();
178 for (
int i=oldS; i<newCnt; ++
i)
181 addOverlapEntry((TGeoOverlap*)gGeoManager->GetListOfOverlaps()->At(i),
i, icheck, motherm);
192 topVol->SelectVolume(kTRUE);
193 geom->SetCheckingOverlaps(kFALSE);
195 TObjArray *
overlaps = geom->GetListOfOverlaps();
196 Int_t novlps = overlaps->GetEntriesFast();
198 for (i=0; i<novlps; i++) {
199 obj = (TNamed*)overlaps->At(i);
200 obj->SetName(Form(
"ov%05d",i));
202 geom->GetGeomPainter()->OpProgress(
"Check overlaps:",icheck,ncheck,timer,kTRUE);
203 Info(
"CheckOverlaps",
"Number of illegal overlaps/extrusions : %d\n", novlps);
221 int pcnt = parentIdx+1;
223 TGeoNode* mothern =
m_entries[parentIdx].m_node;
225 for (
int i = 0;
i < mothern->GetNdaughters(); ++
i)
227 TGeoNode*
n = mothern->GetDaughter(
i);
229 int cnt = pcnt +
i+dOff;
231 if (ovl->IsOverlap()) {
232 if (n->GetVolume() == ovl->GetFirstVolume() && (*(ovl->GetFirstMatrix()) == *(n->GetMatrix())))
240 int nno; n->GetOverlaps(nno);
241 nno |= BIT(1); n->SetOverlaps(0, nno);
246 if (n->GetVolume() == ovl->GetSecondVolume() && (*(ovl->GetSecondMatrix()) == *(n->GetMatrix())))
256 int nno; n->GetOverlaps(nno);
257 nno |= (ovl->IsOverlap() ? BIT(1) : BIT(2));
258 n->SetOverlaps(0, nno);
266 TPolyMarker3D* pm = ovl->GetPolyMarker();
267 for (
int j=0;
j<pm->GetN(); ++
j )
271 pm->GetPoint(
j, pl[0], pl[1], pl[2]);
272 motherm->LocalToMaster(pl, pg);
281 int aIdx = parentIdx;
285 while(aIdx > topNodeIdx)
314 TGeoNode* parentNode =
m_entries[pIdx].m_node;
315 int nD = parentNode->GetNdaughters();
317 for (
int n = 0;
n != nD; ++
n)
319 int idx = pIdx + 1 +
n + dOff;
345 std::pair<std::multimap<int, int>::const_iterator, std::multimap<int, int>::const_iterator> ppp;
347 for (std::multimap<int, int>::const_iterator it2 = ppp.first;it2 != ppp.second;++it2) {
348 const TGeoOverlap* ovl = (
const TGeoOverlap*) gGeoManager->GetListOfOverlaps()->At((*it2).second);
349 if (ovl) ovl->Print();
357 std::pair<std::multimap<int, int>::const_iterator, std::multimap<int, int>::const_iterator> ppp;
359 for (std::multimap<int, int>::const_iterator it2 = ppp.first;it2 != ppp.second;++it2) {
360 const TGeoOverlap* ovl = (
const TGeoOverlap*) gGeoManager->GetListOfOverlaps()->At((*it2).second);
365 txt += Form(
"%s: %g, ", ovl->IsOverlap() ?
"Ovl" :
"Extr", ovl->GetOverlap());
366 txt += ovl->GetTitle();
401 if (unsortedRow < 0) printf(
"!!!!!!!!!!!!!!!! error %d %d \n",unsortedRow, iSortedRowNumber);
437 TIter next_ovl(gGeoManager->GetListOfOverlaps());
438 const TGeoOverlap* ovl;
439 while((ovl = (TGeoOverlap*)next_ovl()))
440 ovl->IsOverlap() ? no++ :
ne++;
467 std::pair<std::multimap<int, int>::const_iterator, std::multimap<int, int>::const_iterator> ppp;
472 for (std::multimap<int, int>::const_iterator it2 = ppp.first;it2 != ppp.second;++it2) {
473 const TGeoOverlap* ovl = (
const TGeoOverlap*) gGeoManager->GetListOfOverlaps()->At((*it2).second);
475 x += Form(
"%s: %g ", ovl->IsOverlap() ?
"Ovl" :
"Extr", ovl->GetOverlap());
508 bool motherV =
false;
513 if (TMath::Abs(*
i) == unsortedRow) {
533 TGeoNode* parentNode =
m_entries[selectedIdx].m_node;
534 int nD = parentNode->GetNdaughters();
535 for (
int n = 0;
n != nD; ++
n)
537 int idx = selectedIdx + 1 +
n + dOff;
std::multimap< int, int > m_mapNodeOverlaps
const char * name() const
std::vector< int > m_row_to_index
std::vector< float > m_markerVertices
std::vector< int > m_markerIndices
void setIsOpen(bool value)
TGGC * m_highlightContext
void addOverlapEntry(TGeoOverlap *, int, int, TGeoHMatrix *)
void printOverlaps(int) const
void setData(Color_t c, bool)
bool listAllNodes() const
virtual void recalculateVisibilityNodeRec(int)
void getOverlapTitles(int, TString &) const
virtual std::vector< std::string > getTitles() const
returns the title names for each column
FWTableCellRendererBase * cellRenderer(int iSortedRowNumber, int iCol) const
void setIsParent(bool value)
int m_editTransparencyIdx
FWOverlapTableManager(FWOverlapTableView *)
virtual void setIndentation(int indentation=0)
static void getNNodesTotal(TGeoNode *geoNode, int &off)
void setData(const std::string &, bool isSelected)
virtual void recalculateVisibility()
void setDaughtersSelfVisibility(int i, bool v)
virtual int numberOfColumns() const
Number of columns in the table.
static TGeoManager * getGeoMangeur()
char data[epos_bytes_allocation]
int getTopNodeIdx() const
void setBitVal(UChar_t f, bool x)
virtual ~FWOverlapTableManager()
Entries_v::iterator Entries_i
FWTextTreeCellRenderer m_renderer
bool testBitAny(UChar_t f) const
ColorBoxRenderer m_colorBoxRenderer
bool testBit(UChar_t f) const
virtual bool nodeIsParent(const NodeInfo &) const
void importOverlaps(std::string path, double precision)
FWOverlapTableView * m_browser
virtual void showEditor(bool value)