1 / 20

Geant4 Geometry 高度 (?) な構造記述の方法

Geant4 Geometry 高度 (?) な構造記述の方法. 浅井 慎 ( SLAC ). 内容. Solid BREP solid Boolean solid Physical volume Parameterized volume Replica Assembly Voxelisation CAD interface. G4VSolid. G4VSolid. G4LogicalVolume. G4VPhysicalVolume. G4Material. G4Box. G4VisAttributes. G4PVPlacement.

parson
Download Presentation

Geant4 Geometry 高度 (?) な構造記述の方法

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Geant4 Geometry高度(?)な構造記述の方法 浅井 慎 (SLAC)

  2. 内容 • Solid • BREP solid • Boolean solid • Physical volume • Parameterized volume • Replica • Assembly • Voxelisation • CAD interface Geant4 高度な構造記述の方法 - M.Asai (SLAC)

  3. G4VSolid G4VSolid G4LogicalVolume G4VPhysicalVolume G4Material G4Box G4VisAttributes G4PVPlacement G4VSensitiveDetector G4Tubs G4PVParameterised • G4VSolid • 形状(形・大きさ) • G4VSolid は abstract class • 継承する子供クラスを使う Geant4 高度な構造記述の方法 - M.Asai (SLAC)

  4. G4VSolid • Geant4が提供するSolid • CSG (Constructed Solid Geometry) solids • G4Box, G4Tubs, G4Cons, G4Trd, … • Specific solids (CSG like) • G4Polycone, G4Polyhedra, G4Hype, … • 使い方はCSG、中の実装はBREP • BREP (Boundary REPresented) solids • G4BREPSolidPolycone, G4BSplineSurface, … • Any order surface • Boolean solids • G4UnionSolid, G4SubtractionSolid, … • STEP interface • BREP solid models を CAD file から読み込む • STEP compliant solid modeler Geant4 高度な構造記述の方法 - M.Asai (SLAC)

  5. G4Polycone G4Polycone( const G4String& name, G4double phiStart, G4double phiTotal, G4int numZPlanes, const G4double zPlane[], const G4double rInner[], const G4double rOuter[] ); • name • Solidの名前 • phiStart, phiTotal • 始めの角度とカバーする角度 • numZPlanes • Z軸方向の面の数 • 図の例の場合は4 • zPlane • Z軸上の面の位置 • 中心がZ=0 • rInner, rOuter • 内径と外径 Geant4 高度な構造記述の方法 - M.Asai (SLAC)

  6. G4Polyhedra G4Polyhedra( const G4String& name, G4double phiStart, G4double phiTotal, G4int numSide, G4int numZPlanes, const G4double zPlane[], const G4double rInner[], const G4double rOuter[] ); • name • Solidの名前 • phiStart, phiTotal • 始めの角度とカバーする角度 • numSide • 側面の数 • numZPlanes • Z軸方向の面の数 • 図の例の場合は4 • zPlane • Z軸上の面の位置 • 中心がZ=0 • rInner, rOuter • 内径と外径 Geant4 高度な構造記述の方法 - M.Asai (SLAC)

  7. BREP solid • BREP = Boundary REPresented Solid • Solidを構成する全ての面を与える • 例えば立方体の場合は6つの平面 • BREPを構成する面 • 平面、2次曲面、高次の曲面 • Splines, B-Splines, • NURBS (Non-Uniform B-Splines) • 幾つかの簡単なBREPタイプは提供されている • box, cons, tubs, sphere, torus, polycone, polyhedra • CAD fileで用いられるsolidは全てBREP Geant4 高度な構造記述の方法 - M.Asai (SLAC)

  8. Boolean solid • 2個のsolidのboolean operationで新しい形を作る • G4UnionSolid, G4IntersectionSolid, G4SubtractionSolid • 1個目のsolidに対する2個目のsolidの相対位置を与える • Boolean operationの結果もsolidなので、繰り返してoperationできる • Tracking時には、boolean solidの全ての構成要素のprimitive solidに対して境界面までの距離の計算やtrackの位置がsolidに含まれるかの判定が行なわれるので、あまり多くのprimitive solidを組み合わせると遅くなる G4SubtractionSolid G4UnionSolid G4IntersectionSolid Geant4 高度な構造記述の方法 - M.Asai (SLAC)

  9. G4VPhysicalVolume G4VSolid G4LogicalVolume G4VPhysicalVolume G4Material G4Box G4VisAttributes G4PVPlacement G4VSensitiveDetector G4Tubs G4PVParameterised • G4VPhysicalVolume • G4LogicalVolume と、場所・回転 • G4VPhysicalVolume は abstract class • 継承する子供クラスを使う Geant4 高度な構造記述の方法 - M.Asai (SLAC)

  10. G4VPhysicalVolume • G4PVPlacement 1 Placement = One Volume • Logical volumeを1個置く • G4PVParameterized 1 Parameterized = Many Volumes • 1つのphysical volumeが複数個のvolumeを表す • CopyNoに応じて形状・大きさ・位置・回転角・材質・色・sensitivity等を変えられる • 全てが同じ形状・大きさでない限りparameterised volumeは子供volumeを持ってはならない • G4PVReplica 1 Replica = Many Volumes • 1つのphysical volumeが複数個のvolumeを表す • 同じ形状・大きさのvolumeが親volume内に隙間なくならぶ • 例外:tube,cone等のR方向 • メモリの節約 • 親volumeはplacement volumeとrepeated volumeのどちらか一方のみを持つ • Repeated volumeはCSG solidのみ Geant4 高度な構造記述の方法 - M.Asai (SLAC)

  11. G4PVParameterised • pName • Physical volume名 • pLogical • 子供のlogical volume • 形状・材質等のデフォルトとして使われる • pMotherLogical • 親のlogical volume • 親のphysical volumeを取る別のコンストラクタもある G4PVParameterised(const G4String& pName, G4LogicalVolume* pLogical, G4LogicalVolume* pMotherLogical, const EAxis pAxis, const G4int nReplicas, G4VPVParameterisation *pParam); • pAxis • 子供が最も多く並ぶ方向の軸を指定 • kXAxis,kYAxis,kZAxis • nReplicas • 子供の個数 • 子供のCopyNoは0~n-1 • このCopyNoでパラメタライズ • pParam • G4VPVParameterisation Geant4 高度な構造記述の方法 - M.Asai (SLAC)

  12. G4VPVParameterisation class G4VPVParameterisation { public: virtual void ComputeTransformation (const G4int, G4VPhysicalVolume *) const = 0; virtual G4VSolid* ComputeSolid (const G4int, G4VPhysicalVolume *); virtual G4Material*ComputeMaterial (const G4int, G4VPhysicalVolume *); virtual void ComputeDimensions (G4Box &,const G4int, const G4VPhysicalVolume *) const {} virtual void ComputeDimensions (G4Tubs &, const G4int, const G4VPhysicalVolume *) const {} • ComputeTransformation • CopyNoに応じてphysical volumeに位置やrotation matrixをセットする physVol->SetTranslation (G4ThreeVector(x,y,z)); physVol->SetRotation(pRotM); • Material, sensitivity, 色等のlogical volume のattributeを変更できる physVol->GetLogicalVolume()->Set…() • ComputeSolid • CopyNoに応じてsolidを返す • ComputeMaterial • CopyNoに応じてmaterialを返す • ComputeDimensions • 形状をparameteriseせずに大きさだけをparameteriseする場合に用いる • 対応する形状のオブジェクトが渡されるので、CopyNoに応じて直接サイズをセットする Geant4 高度な構造記述の方法 - M.Asai (SLAC)

  13. G4VPVParameterisationの注意事項 • Rotation matrix, solid等のポインタを渡す場合には、オブジェクトはコピーされない。これらのポインタは関数を抜けた後Navigatorに適宜使われるので、local scopeのオブジェクトのポインタを渡したり、渡した後オブジェクトを消したりしてはならない。 • このクラスの関数は各ステップ毎に呼ばれるので、関数中でsin, cos等の重い計算やファイルアクセスをすると、performanceが極端に悪くなる。 • これらのトラブルを避けるために、重い計算やファイルアクセス、オブジェクトの生成等はコンストラクタで行なうべき。 • コンパイル時にComputeDimensions関数に関してbase class virtual関数を隠すといったwarning messageが出る場合があるが、無視してよい。 Geant4 高度な構造記述の方法 - M.Asai (SLAC)

  14. G4PVReplica • 1次元に隙間なく並んだ子供を1個のG4PVReplicaで与える • 勝手に親volumeをスライスしてくれる訳ではないので、事前に子供のsolidとlogical volumeを作っておく • 勝手にparameterise関数を用意してくれると理解すればよい • pName • Physical volume名 • pLogical • 子供のlogical volume • pMotherLogical • 親のlogical volume • 親のphysical volumeを取る別のコンストラクタもある • nReplicas • 子供の個数 • 子供のCopyNoは0~n-1 G4PVReplica( const G4String& pName, G4LogicalVolume* pLogical, G4LogicalVolume* pMother, const EAxis pAxis, const G4int nReplicas, const G4double width, const G4double offset=0 ); Geant4 高度な構造記述の方法 - M.Asai (SLAC)

  15. G4PVReplica – pAxis, width, offset • pAxisが直交座標系の場合 • kXAxis, kYAxis, kZAxis • n番目の子供は指定した座標軸の • -width*(nReplicas-1)*0.5+n*width •  を中心とする • Offsetは指定しない • pAxisが半径方向の場合 • kRho • n番目の子供はwidth*n+offsetから • width*(n+1)+offsetの範囲を占める • pAxisがphi方向の場合 • kPhi • n番目の子供はwidth*n+offsetから • width*(n+1)+offsetの範囲を占める G4PVReplica( const G4String& pName, G4LogicalVolume* pLogical, G4LogicalVolume* pMother, const EAxis pAxis, const G4int nReplicas, const G4double width, const G4double offset=0 ); width offset width offset Geant4 高度な構造記述の方法 - M.Asai (SLAC)

  16. G4AssemblyVolume • 入り組んだgeometryの場合に、いくつかのvolumeをグループにして、まとめて置いていく • G4AssemblyVolumeを親に対して配置する • G4AssemblyVolume自体はphysical volumeではない • グループ単位でlogical volumeを用意してもそのlogical volumeが重なってしまう場合に用いると便利 • 実際には個々のvolumeのplacementとして実現されるので、メモリ上からはメリットは無い • 大規模はgeometryの場合にはparameterised volumeを使うべき Geant4 高度な構造記述の方法 - M.Asai (SLAC)

  17. G4AssemblyVolume • G4AssemblyVolume • コンストラクタ • AddPlacedVolume • G4AssemblyVolumeを親volumeに見立てて、それに対して要素のlogical volumeを置く • MakeImprint • G4AssemblyVolumeを子供のlogical volumeに見立てて、それを実際の親に配置 • 物体を回す(G4Transform3D)の代わりにtransform G4ThreeVectorとrotation matrixを渡して軸を回して定義する関数もある class G4AssemblyVolume { public: G4AssemblyVolume(); void AddPlacedVolume ( G4LogicalVolume* pPlacedVolume, G4Transform3D& transformation); void MakeImprint ( G4LogicalVolume* pMotherLV, G4Transform3D& transformation); }; Geant4 高度な構造記述の方法 - M.Asai (SLAC)

  18. Voxelisation • Run開始時にnavigationを最適化するために“smart voxel”を作る • これにより、trackingはユーザーのジオメトリの定義の仕方に依らずに最適化される • Binary search • とりあえず1つの軸方向にvoxelを作る • 隣り合ったvoxelが同じvolumeしか持たない場合にはmergeされる • 必要に応じて2つめ、3つめの軸に対してvoxeliseする • 個々のlogical volumeについてvoxelisationを行なう • Voxelisationに要する時間はユーザーのジオメトリの定義の仕方に依存する • できるだけ階層化された定義をする方が速い Geant4 高度な構造記述の方法 - M.Asai (SLAC)

  19. CAD interface • CAD file (STEP AP203 compliant)はsolidの形状と位置を定義している • 材質やsensitivityの情報は持っていないので、DetectorConstructionで補う必要がある • 個々のsolidが1個づつ位置を持っている • 全てplacement volumeになる • できるだけdetector component毎にCAD fileを用意して、別々の親volumeに入れる • G4PlacedSolid • 1個のSTEP solidに対応するGeant4 solidと位置 • G4Assembly • G4PlacedSolidを作る • G4AssemblyCreator • STEP fileを読んでG4AssemblyがG4PlacedSolidを作るための情報を用意する Geant4 高度な構造記述の方法 - M.Asai (SLAC)

  20. CAD interface G4AssemblyCreator MyAC("tracker.stp"); MyAC.ReadStepFile(); STEPentity* ent=0; MyAC.CreateG4Geometry(*ent); void *pl = MyAC.GetCreatedObject(); G4Assembly* assembly = new G4Assembly(); assembly->SetPlacedVector(*(G4PlacedVector*)pl); G4int solids = assembly->GetNumberOfSolids(); for(G4int c=0; c<solids; c++) { G4PlacedSolid* ps = assembly->GetPlacedSolid(c); G4LogicalVolume* lv = new G4LogicalVolume(ps->GetSolid(), Lead, "STEPlog"); G4RotationMatrix* hr = ps->GetRotation(); G4ThreeVector* tr = ps->GetTranslation(); G4VPhysicalVolume* pv = new G4PVPlacement(hr, *tr, ps->GetSolid()->GetName(), lv, experimentalHall_phys, false, c); } Geant4 高度な構造記述の方法 - M.Asai (SLAC)

More Related