+//_____________________________________________________________________________
+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 = 0;
+ 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;
+}
+
+//_____________________________________________________________________________
+Int_t AliGeomManager::GetNalignable(const char* module)
+{
+ // Get number of declared alignable volumes for given detector in current geometry
+ //
+
+ // return the detector index corresponding to detector
+ Int_t index = -1 ;
+ for (index = 0; index < fgkNDetectors ; index++) {
+ if ( strcmp(module, fgkDetectorName[index]) == 0 )
+ break ;
+ }
+ return fgNalignable[index];
+}
+
+//_____________________________________________________________________________
+void AliGeomManager::InitNalignable()
+{
+ // Set number of declared alignable volumes for given detector in current geometry
+ // by looping on the list of PNEntries
+ //
+
+ Int_t nAlE = gGeoManager->GetNAlignable(); // total number of alignable entries
+ TGeoPNEntry *pne = 0;
+ TString *pneName = 0;
+ const char* detName;
+
+ for (Int_t iDet = 0; iDet < fgkNDetectors ; iDet++) {
+ detName = fgkDetectorName[iDet];
+ Int_t nAlDet = 0;
+
+ for(Int_t iE = 0; iE < nAlE; iE++)
+ {
+ pne = gGeoManager->GetAlignableEntry(iE);
+ pneName = new TString(pne->GetName());
+ if(pneName->Contains(detName)) nAlDet++;
+ if(!strcmp(detName,"GRP")) if(pneName->Contains("ABSO") || pneName->Contains("DIPO") || pneName->Contains("FRAME") || pneName->Contains("PIPE") || pneName->Contains("SHIL")) nAlDet++;
+ }
+ fgNalignable[iDet] = nAlDet;
+ }
+
+}
+