22 #include "TEveQuadSet.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");
80 topNodeInfo.
m_node = gGeoManager->GetTopNode();
82 topNodeInfo.
m_color = gGeoManager->GetTopNode()->GetVolume()->GetLineColor();
83 topNodeInfo.
m_transparency = gGeoManager->GetTopNode()->GetVolume()->GetTransparency();
87 m_entries.resize(gGeoManager->GetNNodes());
90 m_entries.resize( gGeoManager->GetNNodes());
92 TGeoVolume* topVol = topNodeInfo.
m_node->GetVolume();
97 bool checkingOverlaps =
false;
98 TGeoManager *
geom = topVol->GetGeoManager();
99 ncheck = topNodeInfo.
m_node->CountDaughters(kFALSE);
100 timer =
new TStopwatch();
101 geom->ClearOverlaps();
102 geom->SetCheckingOverlaps(kTRUE);
106 geom->GetGeomPainter()->OpProgress(topVol->GetName(),icheck,ncheck,timer,kFALSE);
109 TGeoIterator git(topVol);
125 while ((node=git())) {
128 eit->m_color = node->GetVolume()->GetLineColor();
129 eit->m_transparency = node->GetVolume()->GetTransparency();
130 eit->m_level = git.GetLevel();
131 eit->m_parent = icheck;
133 if ((topNodeIdx )== icheck || !topNodeIdx ) {
135 checkingOverlaps=
true;
139 checkingOverlaps=
false;
147 if (pit->m_level < eit->m_level)
152 if ( checkingOverlaps) {
153 if (!node->GetVolume()->IsSelected()) {
154 geom->GetGeomPainter()->OpProgress(node->GetVolume()->GetName(),icheck+1,ncheck,timer,kFALSE);
155 node->GetVolume()->SelectVolume(kFALSE);
157 node->GetVolume()->CheckOverlaps(iPrecision);
159 if (oldS != gGeoManager->GetListOfOverlaps()->GetEntriesFast()) {
166 TGeoHMatrix* motherm =
new TGeoHMatrix(*geom->GetCurrentMatrix());
168 TGeoNode* ni = topNodeInfo.
m_node;
169 for (Int_t i=1; i<=git.GetLevel(); i++) {
170 ni = ni->GetDaughter(git.GetIndex(i));
171 motherm->Multiply(ni->GetMatrix());
175 int newCnt = gGeoManager->GetListOfOverlaps()->GetEntriesFast();
177 for (
int i=oldS; i<newCnt; ++
i)
180 addOverlapEntry((TGeoOverlap*)gGeoManager->GetListOfOverlaps()->At(i),
i, icheck, motherm);
193 topVol->SelectVolume(kTRUE);
194 geom->SetCheckingOverlaps(kFALSE);
196 TObjArray *
overlaps = geom->GetListOfOverlaps();
197 Int_t novlps = overlaps->GetEntriesFast();
199 for (i=0; i<novlps; i++) {
200 obj = (TNamed*)overlaps->At(i);
201 obj->SetName(Form(
"ov%05d",i));
203 geom->GetGeomPainter()->OpProgress(
"Check overlaps:",icheck,ncheck,timer,kTRUE);
204 Info(
"CheckOverlaps",
"Number of illegal overlaps/extrusions : %d\n", novlps);
222 int pcnt = parentIdx+1;
224 TGeoNode* mothern =
m_entries[parentIdx].m_node;
228 for (
int i = 0;
i < mothern->GetNdaughters(); ++
i)
230 TGeoNode*
n = mothern->GetDaughter(
i);
232 int cnt = pcnt +
i+dOff;
234 if (ovl->IsOverlap()) {
235 if (n->GetVolume() == ovl->GetFirstVolume() && (*(ovl->GetFirstMatrix()) == *(n->GetMatrix())))
243 int nno; n->GetOverlaps(nno);
244 nno |= BIT(1); n->SetOverlaps(0, nno);
249 if (n->GetVolume() == ovl->GetSecondVolume() && (*(ovl->GetSecondMatrix()) == *(n->GetMatrix())))
259 int nno; n->GetOverlaps(nno);
260 nno |= (ovl->IsOverlap() ? BIT(1) : BIT(2));
261 n->SetOverlaps(0, nno);
271 TPolyMarker3D* pm = ovl->GetPolyMarker();
272 for (
int j=0;
j<pm->GetN(); ++
j )
276 pm->GetPoint(
j, pl[0], pl[1], pl[2]);
277 motherm->LocalToMaster(pl, pg);
282 fwLog(
fwlog::kInfo) << Form(
"WARNING [%s], overlap size = %.1f \n", ovl->GetTitle(), dx);
285 float dy = dx, dz = 0;
286 float fp[3]; fp[0] = pg[0];fp[1] = pg[1];fp[2] = pg[2];
288 fp[0] +dx, fp[1] -dy, fp[2] -dz,
289 fp[0] +dx, fp[1] +dy, fp[2] +dz,
290 fp[0] -dx, fp[1] +dy, fp[2] +dz,
291 fp[0] -dx, fp[1] -dy, fp[2] -dz
298 int aIdx = parentIdx;
int aLev =
m_entries[aIdx].m_level;
301 while(aIdx > topNodeIdx)
330 TGeoNode* parentNode =
m_entries[pIdx].m_node;
331 int nD = parentNode->GetNdaughters();
333 for (
int n = 0;
n != nD; ++
n)
335 int idx = pIdx + 1 +
n + dOff;
361 std::pair<std::multimap<int, int>::const_iterator, std::multimap<int, int>::const_iterator> ppp;
363 for (std::multimap<int, int>::const_iterator it2 = ppp.first;it2 != ppp.second;++it2) {
364 const TGeoOverlap* ovl = (
const TGeoOverlap*) gGeoManager->GetListOfOverlaps()->At((*it2).second);
365 if (ovl) ovl->Print();
373 std::pair<std::multimap<int, int>::const_iterator, std::multimap<int, int>::const_iterator> ppp;
375 for (std::multimap<int, int>::const_iterator it2 = ppp.first;it2 != ppp.second;++it2) {
376 const TGeoOverlap* ovl = (
const TGeoOverlap*) gGeoManager->GetListOfOverlaps()->At((*it2).second);
381 txt += Form(
"%s: %g, ", ovl->IsOverlap() ?
"Ovl" :
"Extr", ovl->GetOverlap());
382 txt += ovl->GetTitle();
417 if (unsortedRow < 0) printf(
"!!!!!!!!!!!!!!!! error %d %d \n",unsortedRow, iSortedRowNumber);
453 TIter next_ovl(gGeoManager->GetListOfOverlaps());
454 const TGeoOverlap* ovl;
455 while((ovl = (TGeoOverlap*)next_ovl()))
456 ovl->IsOverlap() ? no++ :
ne++;
483 std::pair<std::multimap<int, int>::const_iterator, std::multimap<int, int>::const_iterator> ppp;
488 for (std::multimap<int, int>::const_iterator it2 = ppp.first;it2 != ppp.second;++it2) {
489 const TGeoOverlap* ovl = (
const TGeoOverlap*) gGeoManager->GetListOfOverlaps()->At((*it2).second);
491 x += Form(
"%s: %g ", ovl->IsOverlap() ?
"Ovl" :
"Extr", ovl->GetOverlap());
524 std::cerr <<
"This shoud not happen! \n" ;
537 TGeoNode* parentNode =
m_entries[selectedIdx].m_node;
538 int nD = parentNode->GetNdaughters();
539 for (
int n = 0;
n != nD; ++
n)
541 int idx = selectedIdx + 1 +
n + dOff;
std::multimap< int, int > m_mapNodeOverlaps
const char * name() const
std::vector< int > m_row_to_index
void setIsOpen(bool value)
FWEveDigitSetScalableMarker * getMarker()
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)
std::vector< int > m_nodes
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()
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
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)