+//_____________________________________________________________________________
+void AliGeomManager::CheckOverlapsOverPNs(Double_t threshold)
+{
+ // Check for overlaps/extrusions on physical nodes only;
+ // this overlap-checker is meant to be used to check overlaps/extrusions
+ // originated by the application of alignment objects.
+ //
+
+ TObjArray* ovexlist = new TObjArray(64);
+
+ AliInfoClass("********* Checking overlaps/extrusions over physical nodes only *********");
+ TObjArray* pnList = gGeoManager->GetListOfPhysicalNodes();
+ TGeoVolume* mvol;
+ TGeoPhysicalNode* pn;
+ TObjArray* overlaps = new TObjArray(64);
+ overlaps->SetOwner();
+
+ TStopwatch timer2;
+ timer2.Start();
+ for(Int_t pni=0; pni<pnList->GetEntriesFast(); pni++){
+ pn = (TGeoPhysicalNode*) pnList->UncheckedAt(pni);
+ // checking the volume of the mother (go upper in the tree in case it is an assembly)
+ Int_t levup=1;
+ while(((TGeoVolume*)pn->GetVolume(pn->GetLevel()-levup))->IsAssembly()) levup++;
+ //Printf("Going to upper level");
+ mvol = pn->GetVolume(pn->GetLevel()-levup);
+ if(!mvol->IsSelected()){
+ AliInfoClass(Form("Checking overlaps for volume %s",mvol->GetName()));
+ mvol->CheckOverlaps(threshold);
+ ovexlist = gGeoManager->GetListOfOverlaps();
+ TIter next(ovexlist);
+ TGeoOverlap *ov;
+ while ((ov=(TGeoOverlap*)next())) overlaps->Add(ov->Clone());
+ mvol->SelectVolume();
+ }
+ }
+ mvol->SelectVolume(kTRUE); // clears the list of selected volumes
+
+ AliInfoClass(Form("Number of overlapping/extruding PNs: %d",overlaps->GetEntriesFast()));
+ timer2.Stop();
+ timer2.Print();
+
+ TIter nextN(overlaps);
+ TGeoOverlap *ovlp;
+ while ((ovlp=(TGeoOverlap*)nextN())) ovlp->PrintInfo();
+
+ overlaps->Delete();
+ delete overlaps;
+}
+