bug fix
[u/mrichter/AliRoot.git] / FMD / scripts / CheckOverlaps.C
CommitLineData
d98fbfa5 1void
ed82d35e 2CheckOverlaps(const char* file="geometry.root",
3 Bool_t align=kFALSE, Bool_t sample=kTRUE)
d98fbfa5 4{
00f69754 5 TObjArray* checked = new TObjArray();
6
ed82d35e 7 AliGeomManager::LoadGeometry(file);
d98fbfa5 8 if (align)
9 AliGeomManager::ApplyAlignObjsToGeom("FMDfullMisalignment.root",
10 "FMDAlignment");
11 TObjArray* l = gGeoManager->GetListOfPhysicalNodes();
12 TIter next(l);
13 TGeoPhysicalNode* pn = 0;
14 TGeoVolume* v = 0;
15 while ((pn = static_cast<TGeoPhysicalNode*>(next()))) {
16 pn->cd();
00f69754 17 gGeoManager->CdUp();
d98fbfa5 18 v = gGeoManager->GetCurrentVolume();
00f69754 19 if (checked->FindObject(v)) continue;
20
d98fbfa5 21 std::cout << "Checking " << v->GetName() << std::endl;
22 v->CheckOverlaps(0.01);
00f69754 23 Int_t n = gGeoManager->GetListOfOverlaps()->GetEntriesFast();
24 if (n) {
d98fbfa5 25 gGeoManager->GetListOfOverlaps()->ls();
00f69754 26 }
27 checked->Add(v);
d98fbfa5 28
29 if (!sample) continue;
30
00f69754 31 // gGeoManager->ClearOverlaps();
d98fbfa5 32 gGeoManager->SetCheckingOverlaps();
33 TGeoNode* start = gGeoManager->GetCurrentNode();
34 TGeoVolume* vol = start->GetVolume();
35 TGeoIterator gnext(vol);
36 TGeoNode* node;
37 TString path;
38 while ((node = gnext())) {
39 gnext.GetPath(path);
40 // std::cout << " Checking: " << path.Data() << std::endl;
41 node->GetVolume()->CheckOverlaps(0.01,"s");
42 }
43 gGeoManager->SetCheckingOverlaps(kFALSE);
00f69754 44 n = gGeoManager->GetListOfOverlaps()->GetEntriesFast();
45 if (n) {
d98fbfa5 46 gGeoManager->GetListOfOverlaps()->ls();
47 pn->Print();
48 }
49 }
50}
51