]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Methods needed for TFluka added.
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 31 Jan 2003 13:59:02 +0000 (13:59 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 31 Jan 2003 13:59:02 +0000 (13:59 +0000)
Flugg/FGeometryInit.cxx
Flugg/FGeometryInit.hh

index 6d44811bf3e42e7202ac501629b9a5013b4f14b9..c469adefad9b581dda48a4d5bcb73b9c280ad2aa 100644 (file)
@@ -408,7 +408,7 @@ G4int FGeometryInit::GetMedium(int region) const
 }
 
 
-void  FGeometryInit::SetMediumFromName(const char* volName, int medium) 
+void  FGeometryInit::SetMediumFromName(const char* volName, int medium, int volid
  {
   char name4[5];
   char tmp[5];
@@ -432,7 +432,10 @@ void  FGeometryInit::SetMediumFromName(const char* volName, int medium)
            break;
        }
     }
-    if (! strncmp(name4, tmp, 4)) fMediumVolumeMap[ptrVol] = medium;
+    if (! strncmp(name4, tmp, 4)) {
+       fMediumVolumeMap[ptrVol] = medium;
+       fVolIdVolumeMap[ptrVol]  = volid;
+    }
   }
 }
 
@@ -790,3 +793,39 @@ void FGeometryInit::PrintMagneticField(G4std::ostream& os) {
   G4cout << "<== Flugg FGeometryInit::PrintMagneticField()" << G4endl;
 #endif
 }
+
+int FGeometryInit::CurrentVolID(int ir, int& copyNo)
+{
+    G4PhysicalVolumeStore * pVolStore = G4PhysicalVolumeStore::GetInstance();
+    G4VPhysicalVolume * physicalvol = (*pVolStore)[ir- 1];
+    copyNo =  physicalvol->GetCopyNo();
+    int id = fVolIdVolumeMap[physicalvol];
+    return id;
+}
+
+int FGeometryInit::CurrentVolOffID(int ir, int off, int& copyNo)
+{
+    if (off == 0) return CurrentVolID(ir, copyNo);
+    
+    G4PhysicalVolumeStore* pVolStore = G4PhysicalVolumeStore::GetInstance();
+    G4VPhysicalVolume*     physicalvol = (*pVolStore)[ir- 1];
+    G4VPhysicalVolume*     mother = physicalvol; 
+
+    int level = off;
+    while (level > 0) { 
+       if (mother) mother = mother->GetMother();
+       level--;
+    }
+    
+    int id;
+    
+    if (!mother) {
+       G4cout << "Flugg FGeometryInit::CurrentVolOffID mother not found" << G4endl;
+       id = -1;
+       copyNo = -1;
+    } else {
+       copyNo =  mother ->GetCopyNo();
+       id =  fVolIdVolumeMap[mother];
+    }
+    return id;
+}
index 8c5057487120a886525d1bff677677b014f87a77..80993fcaf6ef4644294f8ef1c5847827db9f093c 100644 (file)
@@ -69,9 +69,11 @@ public:
 
   //Map access methods
   void  BuildMediaMap();
-  void  SetMediumFromName(const char* volName, int med);
+  void  SetMediumFromName(const char* volName, int med, int volid);
     //G4int GetRegionFromName(const char* volName) const;
   G4int GetMedium(int) const;
+  int CurrentVolID(int ir, int& copyNo);
+  int CurrentVolOffID(int ir, int off, int& copyNo);
     
 
 protected:
@@ -110,6 +112,7 @@ private:
     
   G4std::map<G4VPhysicalVolume*, int, G4std::less<G4VPhysicalVolume*> > fRegionVolumeMap;
   G4std::map<G4VPhysicalVolume*, int, G4std::less<G4VPhysicalVolume*> > fMediumVolumeMap;
+  G4std::map<G4VPhysicalVolume*, int, G4std::less<G4VPhysicalVolume*> > fVolIdVolumeMap;
 
   G4std::map<G4Material*, FlukaMaterial*, G4std::less<G4Material*> > G4FlukaMaterialMap;
   G4std::map<G4Material*, FlukaCompound*, G4std::less<G4Material*> > G4FlukaCompoundMap;