Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
F04ElementField.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 // $Id: F04ElementField.cc 101905 2016-12-07 11:34:39Z gunter $
27 //
30 //
31 
32 #include "F04ElementField.hh"
33 
34 #include "F04GlobalField.hh"
35 
36 #include "G4SystemOfUnits.hh"
37 
38 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
39 
41 
42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
43 
45 {
46  fCenter = c;
47 
48  fMinX = fMinY = fMinZ = -DBL_MAX;
49  fMaxX = fMaxY = fMaxZ = DBL_MAX;
50 
52 
53  fColor = "1,1,1";
54 
55  fUserLimits = new G4UserLimits();
56 
57  fVolume = lv;
59 
60  fMaxStep = 1*mm;
61 
63 
67 // fUserLimits->SetUserMinRange(1*mm);
68 
70 }
71 
72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
73 
75 {
76  G4Navigator* theNavigator =
78  GetNavigatorForTracking();
79 
80  if (!fNavigator) {
81  fNavigator = new G4Navigator();
82  if ( theNavigator->GetWorldVolume() )
83  fNavigator->SetWorldVolume(theNavigator->GetWorldVolume());
84  }
85 
87 
89  CreateTouchableHistoryHandle();
90 
91  G4int depth = touchable->GetHistoryDepth();
92  for (G4int i = 0; i<depth; ++i) {
93  if(touchable->GetVolume()->GetLogicalVolume() == fVolume)break;
94  touchable->MoveUpHistory();
95  }
96 
97  // set fGlobal2local transform
98  fGlobal2local = touchable->GetHistory()->GetTopTransform();
99 
100  // set global bounding box
101  G4double local[4], global[4];
102 
103  G4ThreeVector globalPosition;
104  local[3] = 0.0;
105  for (int i=0; i<2; ++i) {
106  local[0] = (i==0 ? -1.0 : 1.0) * GetWidth()/2.;
107  for (int j=0; j<2; ++j) {
108  local[1] = (j==0 ? -1.0 : 1.0) * GetHeight()/2.;
109  for (int k=0; k<2; ++k) {
110  local[2] = (k==0 ? -1.0 : 1.0) * GetLength()/2.;
111  G4ThreeVector localPosition(local[0],local[1],local[2]);
112  globalPosition =
113  fGlobal2local.Inverse().TransformPoint(localPosition);
114  global[0] = globalPosition.x();
115  global[1] = globalPosition.y();
116  global[2] = globalPosition.z();
117  SetGlobalPoint(global);
118  }
119  }
120  }
121 }
122 
123 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
124 
126 {
127  G4VisAttributes* p = NULL;
128  if(color.size() > 0 &&
129  (isdigit(color.c_str()[0]) || color.c_str()[0] == '.')) {
130  G4double red=0.0, green=0.0, blue=0.0;
131  if (sscanf(color.c_str(),"%lf,%lf,%lf",&red,&green,&blue) == 3) {
132  p = new G4VisAttributes(true,G4Color(red,green,blue));
133  } else {
134  G4cout << " Invalid color " << color << G4endl;
135  }
136  }
137 
139  p->SetDaughtersInvisible(false);
140 
141  return p;
142 }
G4LogicalVolume * GetLogicalVolume() const
Definition: test07.cc:36
static constexpr double MeV
Definition: G4SIunits.hh:214
virtual G4double GetHeight()=0
void Construct()
the actual implementation constructs the F04ElementField
static G4ThreadLocal G4Navigator * fNavigator
static constexpr double mm
Definition: G4SIunits.hh:115
#define G4endl
Definition: G4ios.hh:61
const char * p
Definition: xmltok.h:285
Definition of the F04ElementField class.
double z() const
G4int GetHistoryDepth() const
#define G4ThreadLocal
Definition: tls.hh:69
Definition: test07.cc:36
G4AffineTransform fGlobal2local
static const G4VisAttributes & GetInvisible()
virtual void SetUserMaxTime(G4double utimeMax)
G4Colour G4Color
Definition: G4Color.hh:42
static constexpr double m
Definition: G4SIunits.hh:129
double G4double
Definition: G4Types.hh:76
G4LogicalVolume * fVolume
const G4NavigationHistory * GetHistory() const
#define local
Definition: gzguts.h:114
G4VPhysicalVolume * GetVolume(G4int depth=0) const
G4ThreeVector fCenter
void SetWorldVolume(G4VPhysicalVolume *pWorld)
const G4AffineTransform & GetTopTransform() const
void SetVisAttributes(const G4VisAttributes *pVA)
static constexpr double ms
Definition: G4SIunits.hh:170
static F04GlobalField * GetObject()
void SetUserLimits(G4UserLimits *pULimits)
void AddElementField(F04ElementField *f)
virtual void SetUserMaxTrackLength(G4double utrakMax)
static G4TransportationManager * GetTransportationManager()
int G4int
Definition: G4Types.hh:78
G4UserLimits * fUserLimits
Definition of the F04GlobalField class.
static G4VisAttributes * GetVisAttribute(G4String color)
GetVisAttribute() returns the appropriate G4VisAttributes.
void SetDaughtersInvisible(G4bool=true)
virtual G4double GetLength()=0
G4GLOB_DLL std::ostream G4cout
double x() const
G4AffineTransform Inverse() const
void SetGlobalPoint(const G4double point[4])
virtual void SetUserMinEkine(G4double uekinMin)
G4int MoveUpHistory(G4int num_levels=1)
virtual G4VPhysicalVolume * LocateGlobalPointAndSetup(const G4ThreeVector &point, const G4ThreeVector *direction=0, const G4bool pRelativeSearch=true, const G4bool ignoreDirection=true)
Definition: G4Navigator.cc:131
double y() const
virtual void SetMaxAllowedStep(G4double ustepMax)
virtual G4double GetWidth()=0
G4VPhysicalVolume * GetWorldVolume() const
G4ThreeVector TransformPoint(const G4ThreeVector &vec) const
#define DBL_MAX
Definition: templates.hh:83
F04ElementField(const G4ThreeVector, G4LogicalVolume *)
Constructor.