9 #include "GeoModelKernel/GeoLogVol.h"
10 #include "GeoModelKernel/GeoFullPhysVol.h"
12 #include "G4LogicalVolume.hh"
13 #include "G4Material.hh"
18 typedef std::map<const GeoLogVol*, G4LogicalVolume*, std::less<const GeoLogVol*> >
leafVMap;
19 typedef std::map<const GeoVPhysVol*, G4LogicalVolume*, std::less<const GeoVPhysVol*> >
branchVMap;
21 typedef std::map<const GeoFullPhysVol*, G4LogicalVolume*, std::less<const GeoFullPhysVol*> >
fullPVMap;
37 const GeoFullPhysVol* fullPV =
dynamic_cast<const GeoFullPhysVol*
>(&(*thePhys));
38 const GeoFullPhysVol* clonePV=0;
40 const GeoLogVol*
theLog = thePhys->getLogVol();
41 G4LogicalVolume *theG4Log=0;
42 G4Material* theG4Mat=0;
43 G4VSolid* theG4Solid=0;
47 bool putBranch =
false;
48 bool putFullPV =
false;
51 if(thePhys->getNChildVols() == 0)
55 if(sharedLeafLV.find(
theLog) != sharedLeafLV.end())
56 return sharedLeafLV[
theLog];
63 clonePV = fullPV->cloneOrigin();
64 if (clonedLV.find(clonePV)==clonedLV.end())
66 if(clonePV) putFullPV =
true;
71 return clonedLV[clonePV];
76 if(sharedBranchLV.find(&(*thePhys)) == sharedBranchLV.end())
81 return sharedBranchLV[&(*thePhys)];
86 theG4Mat=theMaterialFactory.
Build(
theLog->getMaterial());
87 theG4Solid = theSolidFactory.Build(
theLog->getShape(),
theLog->getName());
89 theG4Log =
new G4LogicalVolume(theG4Solid,
94 if(putLeaf) sharedLeafLV[
theLog] = theG4Log;
95 if(putBranch) sharedBranchLV[&(*thePhys)] = theG4Log;
96 if(putFullPV) clonedLV[clonePV] = theG4Log;