Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
F04ElementField Class Referenceabstract

#include <F04ElementField.hh>

Inheritance diagram for F04ElementField:
Collaboration diagram for F04ElementField:

Public Member Functions

 F04ElementField (const G4ThreeVector, G4LogicalVolume *)
 Constructor. More...
 
void Construct ()
 the actual implementation constructs the F04ElementField More...
 
virtual ~F04ElementField ()
 Destructor. More...
 
void SetMaxStep (G4double stp)
 SetMaxStep(G4double) sets the max. step size. More...
 
G4double GetMaxStep ()
 GetMaxStep() returns the max. step size. More...
 
void SetColor (G4String c)
 SetColor(G4String) sets the color. More...
 
G4String GetColor ()
 GetColor() returns the color. More...
 
void SetGlobalPoint (const G4double point[4])
 
bool IsInBoundingBox (const G4double point[4]) const
 
virtual void AddFieldValue (const G4double point[4], G4double field[6]) const =0
 
virtual G4double GetLength ()=0
 
virtual G4double GetWidth ()=0
 
virtual G4double GetHeight ()=0
 

Static Public Member Functions

static G4VisAttributesGetVisAttribute (G4String color)
 GetVisAttribute() returns the appropriate G4VisAttributes. More...
 

Protected Attributes

G4LogicalVolumefVolume
 
G4AffineTransform fGlobal2local
 

Detailed Description

Definition at line 53 of file F04ElementField.hh.

Constructor & Destructor Documentation

F04ElementField::F04ElementField ( const G4ThreeVector  c,
G4LogicalVolume lv 
)

Constructor.

Definition at line 44 of file F04ElementField.cc.

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 
62  fUserLimits->SetMaxAllowedStep(fMaxStep);
63 
64  fUserLimits->SetUserMaxTrackLength(500.*m);
65  fUserLimits->SetUserMaxTime(10*ms);
66  fUserLimits->SetUserMinEkine(0.1*MeV);
67 // fUserLimits->SetUserMinRange(1*mm);
68 
69  fVolume->SetUserLimits(fUserLimits);
70 }
virtual void SetMaxAllowedStep(G4double ustepMax)
static constexpr double mm
Definition: G4SIunits.hh:115
void SetUserLimits(G4UserLimits *pULimits)
virtual void SetUserMinEkine(G4double uekinMin)
static G4VisAttributes * GetVisAttribute(G4String color)
GetVisAttribute() returns the appropriate G4VisAttributes.
virtual void SetUserMaxTrackLength(G4double utrakMax)
static F04GlobalField * GetObject()
static constexpr double m
Definition: G4SIunits.hh:129
static constexpr double MeV
Definition: G4SIunits.hh:214
G4LogicalVolume * fVolume
static constexpr double ms
Definition: G4SIunits.hh:170
tuple c
Definition: test.py:13
#define DBL_MAX
Definition: templates.hh:83
void AddElementField(F04ElementField *f)
virtual void SetUserMaxTime(G4double utimeMax)
void SetVisAttributes(const G4VisAttributes *pVA)

Here is the call graph for this function:

virtual F04ElementField::~F04ElementField ( )
inlinevirtual

Destructor.

Definition at line 69 of file F04ElementField.hh.

69 {}

Member Function Documentation

virtual void F04ElementField::AddFieldValue ( const G4double  point[4],
G4double  field[6] 
) const
pure virtual

AddFieldValue() will add the field value for this element to field[]. Implementations must be sure to verify that point[] is within the field region, and do nothing if not. point[] is in global coordinates and geant4 units; x,y,z,t. field[] is in geant4 units; Bx,By,Bz,Ex,Ey,Ez. For efficiency, the caller may (but need not) call IsInBoundingBox(point), and only call this function if that returns true.

Implemented in F04SimpleSolenoid, and F04FocusSolenoid.

Here is the caller graph for this function:

void F04ElementField::Construct ( void  )

the actual implementation constructs the F04ElementField

Definition at line 74 of file F04ElementField.cc.

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 
86  fNavigator->LocateGlobalPointAndSetup(fCenter,0,false);
87 
88  G4TouchableHistoryHandle touchable = fNavigator->
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 }
G4int GetHistoryDepth() const
void SetGlobalPoint(const G4double point[4])
G4VPhysicalVolume * GetVolume(G4int depth=0) const
double x() const
G4AffineTransform Inverse() const
#define local
Definition: adler32.cc:10
int G4int
Definition: G4Types.hh:78
double z() const
virtual G4double GetLength()=0
virtual G4double GetWidth()=0
static G4TransportationManager * GetTransportationManager()
G4ThreeVector TransformPoint(const G4ThreeVector &vec) const
virtual G4double GetHeight()=0
G4AffineTransform fGlobal2local
G4LogicalVolume * GetLogicalVolume() const
void SetWorldVolume(G4VPhysicalVolume *pWorld)
double y() const
virtual G4VPhysicalVolume * LocateGlobalPointAndSetup(const G4ThreeVector &point, const G4ThreeVector *direction=0, const G4bool pRelativeSearch=true, const G4bool ignoreDirection=true)
Definition: G4Navigator.cc:125
const G4AffineTransform & GetTopTransform() const
const G4NavigationHistory * GetHistory() const
G4LogicalVolume * fVolume
G4int MoveUpHistory(G4int num_levels=1)
double G4double
Definition: G4Types.hh:76
G4VPhysicalVolume * GetWorldVolume() const

Here is the call graph for this function:

G4String F04ElementField::GetColor ( )
inline

GetColor() returns the color.

Definition at line 90 of file F04ElementField.hh.

90 { return fColor; }
virtual G4double F04ElementField::GetHeight ( )
pure virtual

Implemented in F04SimpleSolenoid.

Here is the caller graph for this function:

virtual G4double F04ElementField::GetLength ( )
pure virtual

Implemented in F04SimpleSolenoid.

Here is the caller graph for this function:

G4double F04ElementField::GetMaxStep ( )
inline

GetMaxStep() returns the max. step size.

Definition at line 80 of file F04ElementField.hh.

80 { return fMaxStep; }
G4VisAttributes * F04ElementField::GetVisAttribute ( G4String  color)
static

GetVisAttribute() returns the appropriate G4VisAttributes.

Definition at line 125 of file F04ElementField.cc.

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 }
Definition: test07.cc:36
const char * p
Definition: xmltok.h:285
Definition: test07.cc:36
G4GLOB_DLL std::ostream G4cout
G4Colour G4Color
Definition: G4Color.hh:42
void SetDaughtersInvisible(G4bool=true)
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
static const G4VisAttributes & GetInvisible()

Here is the call graph for this function:

Here is the caller graph for this function:

virtual G4double F04ElementField::GetWidth ( )
pure virtual

Implemented in F04SimpleSolenoid.

Here is the caller graph for this function:

bool F04ElementField::IsInBoundingBox ( const G4double  point[4]) const
inline

IsInBoundingBox() returns true if the point is within the global bounding box - global coordinates.

Definition at line 113 of file F04ElementField.hh.

114  {
115  if(point[2] < fMinZ || point[2] > fMaxZ) return false;
116  if(point[0] < fMinX || point[0] > fMaxX) return false;
117  if(point[1] < fMinY || point[1] > fMaxY) return false;
118  return true;
119  }

Here is the caller graph for this function:

void F04ElementField::SetColor ( G4String  c)
inline

SetColor(G4String) sets the color.

Definition at line 83 of file F04ElementField.hh.

84  {
85  fColor = c;
87  }
static G4VisAttributes * GetVisAttribute(G4String color)
GetVisAttribute() returns the appropriate G4VisAttributes.
G4LogicalVolume * fVolume
tuple c
Definition: test.py:13
void SetVisAttributes(const G4VisAttributes *pVA)

Here is the call graph for this function:

Here is the caller graph for this function:

void F04ElementField::SetGlobalPoint ( const G4double  point[4])
inline

SetGlobalPoint() ensures that the point is within the global bounding box of this ElementField's global coordinates. Normally called 8 times for the corners of the local bounding box, after a local->global coordinate transform. If never called, the global bounding box is infinite. BEWARE: if called only once, the bounding box is just a point.

Definition at line 101 of file F04ElementField.hh.

102  {
103  if(fMinX == -DBL_MAX || fMinX > point[0]) fMinX = point[0];
104  if(fMinY == -DBL_MAX || fMinY > point[1]) fMinY = point[1];
105  if(fMinZ == -DBL_MAX || fMinZ > point[2]) fMinZ = point[2];
106  if(fMaxX == DBL_MAX || fMaxX < point[0]) fMaxX = point[0];
107  if(fMaxY == DBL_MAX || fMaxY < point[1]) fMaxY = point[1];
108  if(fMaxZ == DBL_MAX || fMaxZ < point[2]) fMaxZ = point[2];
109  }
#define DBL_MAX
Definition: templates.hh:83

Here is the caller graph for this function:

void F04ElementField::SetMaxStep ( G4double  stp)
inline

SetMaxStep(G4double) sets the max. step size.

Definition at line 72 of file F04ElementField.hh.

73  {
74  fMaxStep = stp;
75  fUserLimits->SetMaxAllowedStep(fMaxStep);
76  fVolume->SetUserLimits(fUserLimits);
77  }
virtual void SetMaxAllowedStep(G4double ustepMax)
void SetUserLimits(G4UserLimits *pULimits)
G4LogicalVolume * fVolume

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

G4AffineTransform F04ElementField::fGlobal2local
protected

Definition at line 140 of file F04ElementField.hh.

G4LogicalVolume* F04ElementField::fVolume
protected

Definition at line 138 of file F04ElementField.hh.


The documentation for this class was generated from the following files: