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"
45 std::vector<std::string> returnValue;
48 returnValue.push_back(
"Name");
49 returnValue.push_back(
"Color");
50 returnValue.push_back(
"Opcty");
51 returnValue.push_back(
"RnrSelf");
52 returnValue.push_back(
"RnrChildren");
53 returnValue.push_back(
"Overlap");
54 returnValue.push_back(
"RnrMarker");
67 topNodeInfo.
m_node = gGeoManager->GetTopNode();
69 topNodeInfo.
m_color = gGeoManager->GetTopNode()->GetVolume()->GetLineColor();
70 topNodeInfo.
m_transparency = gGeoManager->GetTopNode()->GetVolume()->GetTransparency();
74 m_entries.resize(gGeoManager->GetNNodes());
77 m_entries.resize(gGeoManager->GetNNodes());
79 TGeoVolume* topVol = topNodeInfo.
m_node->GetVolume();
84 bool checkingOverlaps =
false;
85 TGeoManager*
geom = topVol->GetGeoManager();
86 ncheck = topNodeInfo.
m_node->CountDaughters(kFALSE);
87 timer =
new TStopwatch();
88 geom->ClearOverlaps();
89 geom->SetCheckingOverlaps(kTRUE);
93 geom->GetGeomPainter()->OpProgress(topVol->GetName(), icheck, ncheck, timer, kFALSE);
96 TGeoIterator git(topVol);
112 while ((node = git())) {
116 eit->m_color = node->GetVolume()->GetLineColor();
117 eit->m_transparency = node->GetVolume()->GetTransparency();
118 eit->m_level = git.GetLevel();
119 eit->m_parent = icheck;
121 if ((topNodeIdx) == icheck || !topNodeIdx) {
123 checkingOverlaps =
true;
125 checkingOverlaps =
false;
132 if (pit->m_level < eit->m_level)
137 if (checkingOverlaps) {
138 if (!node->GetVolume()->IsSelected()) {
139 geom->GetGeomPainter()->OpProgress(node->GetVolume()->GetName(), icheck + 1, ncheck, timer, kFALSE);
140 node->GetVolume()->SelectVolume(kFALSE);
142 node->GetVolume()->CheckOverlaps(iPrecision);
144 if (oldS != gGeoManager->GetListOfOverlaps()->GetEntriesFast()) {
151 TGeoHMatrix* motherm =
new TGeoHMatrix(*geom->GetCurrentMatrix());
153 TGeoNode* ni = topNodeInfo.
m_node;
154 for (Int_t i = 1; i <= git.GetLevel(); i++) {
155 ni = ni->GetDaughter(git.GetIndex(i));
156 motherm->Multiply(ni->GetMatrix());
160 int newCnt = gGeoManager->GetListOfOverlaps()->GetEntriesFast();
162 for (
int i = oldS; i < newCnt; ++
i) {
164 addOverlapEntry((TGeoOverlap*)gGeoManager->GetListOfOverlaps()->At(i),
i, icheck, motherm);
177 topVol->SelectVolume(kTRUE);
178 geom->SetCheckingOverlaps(kFALSE);
180 TObjArray*
overlaps = geom->GetListOfOverlaps();
181 Int_t novlps = overlaps->GetEntriesFast();
183 for (i = 0; i < novlps; i++) {
184 obj = (TNamed*)overlaps->At(i);
185 obj->SetName(Form(
"ov%05d", i));
187 geom->GetGeomPainter()->OpProgress(
"Check overlaps:", icheck, ncheck, timer, kTRUE);
188 Info(
"CheckOverlaps",
"Number of illegal overlaps/extrusions : %d\n", novlps);
202 int pcnt = parentIdx + 1;
204 TGeoNode* mothern =
m_entries[parentIdx].m_node;
208 for (
int i = 0;
i < mothern->GetNdaughters(); ++
i) {
209 TGeoNode*
n = mothern->GetDaughter(
i);
211 int cnt = pcnt +
i + dOff;
213 if (ovl->IsOverlap()) {
214 if (n->GetVolume() == ovl->GetFirstVolume() && (*(ovl->GetFirstMatrix()) == *(n->GetMatrix()))) {
224 n->SetOverlaps(
nullptr, nno);
229 if (n->GetVolume() == ovl->GetSecondVolume() && (*(ovl->GetSecondMatrix()) == *(n->GetMatrix()))) {
240 nno |= (ovl->IsOverlap() ? BIT(1) : BIT(2));
241 n->SetOverlaps(
nullptr, nno);
249 TPolyMarker3D* pm = ovl->GetPolyMarker();
250 for (
int j = 0;
j < pm->GetN(); ++
j) {
253 pm->GetPoint(
j, pl[0], pl[1], pl[2]);
254 motherm->LocalToMaster(pl, pg);
266 float bb[12] = {fp[0] +
dx,
282 int aIdx = parentIdx;
286 while (aIdx > topNodeIdx) {
310 TGeoNode* parentNode =
m_entries[pIdx].m_node;
311 int nD = parentNode->GetNdaughters();
313 for (
int n = 0;
n != nD; ++
n) {
314 int idx = pIdx + 1 +
n + dOff;
335 std::pair<std::multimap<int, int>::const_iterator, std::multimap<int, int>::const_iterator> ppp;
337 for (std::multimap<int, int>::const_iterator it2 = ppp.first; it2 != ppp.second; ++it2) {
338 const TGeoOverlap* ovl = (
const TGeoOverlap*)gGeoManager->GetListOfOverlaps()->At((*it2).second);
346 std::pair<std::multimap<int, int>::const_iterator, std::multimap<int, int>::const_iterator> ppp;
348 for (std::multimap<int, int>::const_iterator it2 = ppp.first; it2 != ppp.second; ++it2) {
349 const TGeoOverlap* ovl = (
const TGeoOverlap*)gGeoManager->GetListOfOverlaps()->At((*it2).second);
354 txt += Form(
"%s: %g, ", ovl->IsOverlap() ?
"Ovl" :
"Extr", ovl->GetOverlap());
355 txt += ovl->GetTitle();
391 printf(
"!!!!!!!!!!!!!!!! error %d %d \n", unsortedRow, iSortedRowNumber);
419 TIter next_ovl(gGeoManager->GetListOfOverlaps());
420 const TGeoOverlap* ovl;
421 while ((ovl = (TGeoOverlap*)next_ovl()))
422 ovl->IsOverlap() ? no++ : ne++;
444 std::pair<std::multimap<int, int>::const_iterator, std::multimap<int, int>::const_iterator> ppp;
449 for (std::multimap<int, int>::const_iterator it2 = ppp.first; it2 != ppp.second; ++it2) {
450 const TGeoOverlap* ovl = (
const TGeoOverlap*)gGeoManager->GetListOfOverlaps()->At((*it2).second);
452 x += Form(
"%s: %g ", ovl->IsOverlap() ?
"Ovl" :
"Extr", ovl->GetOverlap());
464 }
else if (iCol == 2) {
466 }
else if (iCol == 3) {
469 }
else if (iCol == 4) {
472 }
else if (iCol == 6) {
473 std::cerr <<
"This shoud not happen! \n";
483 TGeoNode* parentNode =
m_entries[selectedIdx].m_node;
484 int nD = parentNode->GetNdaughters();
485 for (
int n = 0;
n != nD; ++
n) {
486 int idx = selectedIdx + 1 +
n + dOff;
~FWOverlapTableManager() override
std::vector< std::string > getTitles() const override
returns the title names for each column
std::multimap< int, int > m_mapNodeOverlaps
const char * name() const
std::vector< int > m_row_to_index
void setIsOpen(bool value)
void setDaughtersSelfVisibility(int i, bool v) override
bool nodeIsParent(const NodeInfo &) const override
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
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
void setIsParent(bool value)
int m_editTransparencyIdx
FWTableCellRendererBase * cellRenderer(int iSortedRowNumber, int iCol) const override
FWOverlapTableManager(FWOverlapTableView *)
virtual void setIndentation(int indentation=0)
static void getNNodesTotal(TGeoNode *geoNode, int &off)
int numberOfColumns() const override
Number of columns in the table.
void setData(const std::string &, bool isSelected)
void recalculateVisibility() override
bool isSelected(const std::vector< L1HPSPFTauQualityCut > &qualityCuts, const l1t::PFCandidate &pfCand, float_t primaryVertexZ)
static TGeoManager * getGeoMangeur()
char data[epos_bytes_allocation]
int getTopNodeIdx() const
void setBitVal(UChar_t f, bool x)
Entries_v::iterator Entries_i
FWTextTreeCellRenderer m_renderer
bool testBitAny(UChar_t f) const
ColorBoxRenderer m_colorBoxRenderer
bool testBit(UChar_t f) const
void importOverlaps(std::string path, double precision)
FWOverlapTableView * m_browser
virtual void showEditor(bool value)