]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - Flugg/FGeometryInit.cxx
Calculation of new variables needed for Non-id HBT added. (Z. Chajecki)
[u/mrichter/AliRoot.git] / Flugg / FGeometryInit.cxx
index 65010044506193d060010d78e426ae30a45a109f..c5e38d4e479c4e1121e6126bbec6b378f294b11c 100644 (file)
@@ -289,6 +289,13 @@ void FGeometryInit::UpdateHistories(const G4NavigationHistory * history,
 }
 
 //*****************************************************************************
+int FGeometryInit::GetLastMaterialIndex() const
+{
+// Get last material index as known by FLUKA
+   const FlukaMaterialsTable *matTable = FlukaMaterial::GetMaterialTable();
+   int matsize = matTable->size();
+   return matsize+2;
+}   
 
 void FGeometryInit::createFlukaMatFile() {
   // last modification Sara Vanini 1/III/99
@@ -807,9 +814,23 @@ void FGeometryInit::PrintMagneticField(std::ostream& os) {
 
 int FGeometryInit::CurrentVolID(int ir, int& copyNo)
 {
+    if (ir == 0) 
+    {
+       copyNo = -1;
+       return -1;
+    }
+    
     G4PhysicalVolumeStore * pVolStore = G4PhysicalVolumeStore::GetInstance();
-    G4VPhysicalVolume * physicalvol = (*pVolStore)[ir- 1];
-    copyNo =  physicalvol->GetCopyNo();
+    G4VPhysicalVolume   * physicalvol = (*pVolStore)[ir- 1];
+    
+    if (physicalvol) {
+       copyNo =  physicalvol->GetCopyNo();
+    } else {
+       copyNo = -1;
+       return -1;
+    }
+    
+    
     int id = fVolIdVolumeMap[physicalvol];
     return id;
 }