Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4RTSteppingAction.cc
이 파일의 문서화 페이지로 가기
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: G4RTSteppingAction.cc 104015 2017-05-08 07:28:08Z gcosmo $
28 //
29 //
30 //
31 
32 
33 #include "G4RTSteppingAction.hh"
34 
36 #include "G4SteppingManager.hh"
37 #include "G4VisManager.hh"
38 #include "G4VisAttributes.hh"
39 #include "G4Colour.hh"
40 #include "G4Track.hh"
41 #include "G4StepStatus.hh"
43 
45 
47 {}
48 
50 {
51  // Stop the ray particle if it reaches to the coloured volume with its alpha = 1
52  // or coloured volume and the user request to ignore transparency
53 
54  G4StepPoint* postStepPoint = aStep -> GetPostStepPoint();
55 
56  G4VPhysicalVolume* postVolume_phys=postStepPoint->GetPhysicalVolume();
57  if(!postVolume_phys) return; // Reach to out of the world
58 
60  G4RayTracerSceneHandler* sceneHandler =
61  static_cast<G4RayTracerSceneHandler*>(visManager->GetCurrentSceneHandler());
62 
63  // Make a path from the touchable
64  const G4VTouchable* postTouchable = postStepPoint->GetTouchable();
65  G4int postDepth = postTouchable->GetHistoryDepth();
66  G4ModelingParameters::PVPointerCopyNoPath localPostPVPointerCopyNoPath;
67  for (G4int i = postDepth; i >= 0; --i) {
68  localPostPVPointerCopyNoPath.push_back
70  (postTouchable->GetVolume(i),postTouchable->GetCopyNumber(i)));
71  }
72 
73  // Pick up the vis atts, if any, from the scene handler
74  const auto& sceneVisAttsMap = sceneHandler->GetSceneVisAttsMap();
75  auto postIterator = sceneVisAttsMap.find(localPostPVPointerCopyNoPath);
76  const G4VisAttributes* postVisAtts;
77  if (postIterator != sceneVisAttsMap.end()) {
78  postVisAtts = &postIterator->second;
79  } else {
80  postVisAtts = 0;
81  }
82 
83  if((!postVisAtts) || (!(postVisAtts->IsVisible()))) return; // Invisible volume, continue tracking
84 
85  if((postVisAtts->IsForceDrawingStyle())
86  &&(postVisAtts->GetForcedDrawingStyle()==G4VisAttributes::wireframe)) return;
87  // Wire frame volume, continue tracking
88 
89  G4double postAlpha=(postVisAtts->GetColour()).GetAlpha();
90 
91  if(postAlpha==1.0 || ignoreTransparency) // Stop stepping
92  {
93  G4Track* currentTrack = aStep -> GetTrack();
94  currentTrack -> SetTrackStatus(fStopAndKill);
95  }
96 }
97 
99 { ignoreTransparency = val; }
101 { return ignoreTransparency; }
const G4VTouchable * GetTouchable() const
static G4bool ignoreTransparency
ForcedDrawingStyle GetForcedDrawingStyle() const
static G4VisManager * GetInstance()
G4VPhysicalVolume * GetPhysicalVolume() const
G4bool IsVisible() const
virtual G4VPhysicalVolume * GetVolume(G4int depth=0) const
Definition: G4VTouchable.cc:44
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
Definition: G4Step.hh:76
G4int GetCopyNumber(G4int depth=0) const
static void SetIgnoreTransparency(G4bool val)
std::vector< PVPointerCopyNo > PVPointerCopyNoPath
virtual void UserSteppingAction(const G4Step *)
const std::map< G4ModelingParameters::PVPointerCopyNoPath, G4VisAttributes, PathLessThan > & GetSceneVisAttsMap() const
int G4int
Definition: G4Types.hh:78
G4bool IsForceDrawingStyle() const
virtual G4int GetHistoryDepth() const
Definition: G4VTouchable.cc:79
G4VSceneHandler * GetCurrentSceneHandler() const
static G4bool GetIgnoreTransparency()
const G4Colour & GetColour() const