/scratch0/jsnuveri/BDSIM/BDSIMgit/bdsim/include/BDSGeometryComponent.hh

00001 #ifndef BDSGEOMETRYCOMPONENT_H
00002 #define BDSGEOMETRYCOMPONENT_H
00003 
00004 #include "globals.hh"           // geant4 globals / types
00005 #include "G4VSolid.hh"
00006 #include "G4LogicalVolume.hh"
00007 #include <utility>              //for std::pair
00008 #include <vector>
00009 
00019 class BDSGeometryComponent
00020 {
00021 public:
00022   BDSGeometryComponent(G4VSolid*        containerSolidIn,
00023                        G4LogicalVolume* containerLVIn);
00024   BDSGeometryComponent(G4VSolid*        containerSolidIn,
00025                        G4LogicalVolume* containerLVIn,
00026                        std::pair<G4double,G4double> extentXIn,
00027                        std::pair<G4double,G4double> extentYIn,
00028                        std::pair<G4double,G4double> extentZIn,
00029                        G4ThreeVector                placementOffset = G4ThreeVector(0,0,0));
00030   ~BDSGeometryComponent();
00031 
00033   G4String          GetName() const;
00034   
00036   G4VSolid*         GetContainerSolid() const;
00037   
00039   G4LogicalVolume*  GetContainerLogicalVolume() const;
00040 
00042   G4ThreeVector     GetPlacementOffset() const;
00043 
00045   void SetPlacementOffset(G4ThreeVector& offsetIn);
00046   
00047   std::pair<G4double,G4double> GetExtentX() const;   
00048   std::pair<G4double,G4double> GetExtentY() const;   
00049   std::pair<G4double,G4double> GetExtentZ() const;   
00050   
00052   G4ThreeVector GetExtentPositive() const;
00053 
00055   G4ThreeVector GetExtentNegative() const;
00056   
00057   void SetExtentX(G4double lowerX, G4double upperX); 
00058   void SetExtentY(G4double lowerY, G4double upperY); 
00059   void SetExtentZ(G4double lowerZ, G4double upperZ); 
00060   void SetExtentX(std::pair<G4double, G4double> extentXIn); 
00061   void SetExtentY(std::pair<G4double, G4double> extentYIn); 
00062   void SetExtentZ(std::pair<G4double, G4double> extentZIn); 
00063 
00066   void RegisterLogicalVolume(G4LogicalVolume* logicalVolume);
00067 
00069   void RegisterLogicalVolumes(std::vector<G4LogicalVolume*> logicalVolumes);
00070 
00074   void RegisterSensitiveVolume(G4LogicalVolume* sensitiveVolume);
00075 
00077   void RegisterSensitiveVolumes(std::vector<G4LogicalVolume*> sensitiveVolumes);
00078 
00080   std::vector<G4LogicalVolume*> GetAllLogicalVolumes() const;
00081   
00083   std::vector<G4LogicalVolume*> GetAllSensitiveVolumes() const;
00084 
00085 protected:
00087   BDSGeometryComponent(BDSGeometryComponent& component);
00088   
00089   G4VSolid*                 containerSolid;
00090   G4LogicalVolume*          containerLogicalVolume;
00091   std::pair<G4double, G4double> extentX;  //local -ve,+ve
00092   std::pair<G4double, G4double> extentY;
00093   std::pair<G4double, G4double> extentZ;
00094   std::vector<G4LogicalVolume*> allLogicalVolumes;
00095   // we have to keep a registry of all logical volumes to be able to associate
00096   // information with them at construction time - for example S position - that
00097   // can't be stored in the Logical Volume class itself without modifying geant
00098   
00100   std::vector<G4LogicalVolume*> allSensitiveVolumes;
00101   G4ThreeVector                 placementOffset;
00102 };
00103 
00104 inline G4String  BDSGeometryComponent::GetName() const
00105 {return containerLogicalVolume->GetName();}
00106 
00107 inline G4VSolid* BDSGeometryComponent::GetContainerSolid() const
00108 {return containerSolid;}
00109 
00110 inline G4LogicalVolume* BDSGeometryComponent::GetContainerLogicalVolume() const
00111 {return containerLogicalVolume;}
00112 
00113 inline G4ThreeVector BDSGeometryComponent::GetPlacementOffset() const
00114 {return placementOffset;}
00115 
00116 inline void BDSGeometryComponent::SetPlacementOffset(G4ThreeVector& offsetIn)
00117 {placementOffset = G4ThreeVector(offsetIn);}
00118 
00119 inline std::pair<G4double,G4double> BDSGeometryComponent::GetExtentX() const
00120 {return extentX;}
00121 
00122 inline std::pair<G4double,G4double> BDSGeometryComponent::GetExtentY() const
00123 {return extentY;}
00124 
00125 inline std::pair<G4double,G4double> BDSGeometryComponent::GetExtentZ() const
00126 {return extentZ;}
00127 
00128 inline G4ThreeVector BDSGeometryComponent::GetExtentPositive() const
00129 {return G4ThreeVector(extentX.second, extentY.second, extentZ.second);}
00130 
00131 inline G4ThreeVector BDSGeometryComponent::GetExtentNegative() const
00132 {return G4ThreeVector(extentX.first, extentY.first, extentZ.first);}
00133 
00134 inline void BDSGeometryComponent::SetExtentX(G4double lowerX, G4double upperX)
00135 {extentX = std::make_pair(lowerX,upperX);}
00136 
00137 inline void BDSGeometryComponent::SetExtentY(G4double lowerY, G4double upperY)
00138 {extentY = std::make_pair(lowerY,upperY);}
00139 
00140 inline void BDSGeometryComponent::SetExtentZ(G4double lowerZ, G4double upperZ)
00141 {extentZ = std::make_pair(lowerZ,upperZ);}
00142 
00143 inline  void BDSGeometryComponent::SetExtentX(std::pair<G4double, G4double> extentXIn)
00144 {extentX = extentXIn;}
00145 
00146 inline  void BDSGeometryComponent::SetExtentY(std::pair<G4double, G4double> extentYIn)
00147 {extentY = extentYIn;}
00148 
00149 inline  void BDSGeometryComponent::SetExtentZ(std::pair<G4double, G4double> extentZIn)
00150 {extentZ = extentZIn;}
00151 
00152 inline std::vector<G4LogicalVolume*> BDSGeometryComponent::GetAllLogicalVolumes() const
00153 {return allLogicalVolumes;}
00154 
00155 inline std::vector<G4LogicalVolume*> BDSGeometryComponent::GetAllSensitiveVolumes() const
00156 {return allSensitiveVolumes;}
00157 
00158 #endif

Generated on 28 Jun 2015 for BDSIM by  doxygen 1.4.7