Geant4  10.02.p03
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
 

Private Member Functions

F04ElementFieldoperator= (const F04ElementField &)
 

Private Attributes

G4String fColor
 
G4ThreeVector fCenter
 
G4double fMinX
 
G4double fMinY
 
G4double fMinZ
 
G4double fMaxX
 
G4double fMaxY
 
G4double fMaxZ
 
G4double fMaxStep
 
G4UserLimitsfUserLimits
 

Static Private Attributes

static G4ThreadLocal G4NavigatorfNavigator = 0
 

Detailed Description

Definition at line 53 of file F04ElementField.hh.

Constructor & Destructor Documentation

◆ F04ElementField()

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 
63 
67 // fUserLimits->SetUserMinRange(1*mm);
68 
70 }
static const double MeV
Definition: G4SIunits.hh:211
virtual void SetMaxAllowedStep(G4double ustepMax)
void SetUserLimits(G4UserLimits *pULimits)
virtual void SetUserMinEkine(G4double uekinMin)
static G4VisAttributes * GetVisAttribute(G4String color)
GetVisAttribute() returns the appropriate G4VisAttributes.
G4UserLimits * fUserLimits
G4ThreeVector fCenter
virtual void SetUserMaxTrackLength(G4double utrakMax)
static const double ms
Definition: G4SIunits.hh:169
static F04GlobalField * GetObject()
static const double m
Definition: G4SIunits.hh:128
G4LogicalVolume * fVolume
#define DBL_MAX
Definition: templates.hh:83
static const double mm
Definition: G4SIunits.hh:114
void AddElementField(F04ElementField *f)
virtual void SetUserMaxTime(G4double utimeMax)
void SetVisAttributes(const G4VisAttributes *pVA)
Here is the call graph for this function:

◆ ~F04ElementField()

virtual F04ElementField::~F04ElementField ( )
inlinevirtual

Destructor.

Definition at line 69 of file F04ElementField.hh.

69 {}

Member Function Documentation

◆ AddFieldValue()

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:

◆ Construct()

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 
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 }
void SetGlobalPoint(const G4double point[4])
G4ThreeVector TransformPoint(const G4ThreeVector &vec) const
#define local
Definition: adler32.cc:10
int G4int
Definition: G4Types.hh:78
virtual G4double GetLength()=0
G4ThreeVector fCenter
virtual G4double GetWidth()=0
G4AffineTransform Inverse() const
double x() const
static G4TransportationManager * GetTransportationManager()
virtual G4double GetHeight()=0
G4AffineTransform fGlobal2local
double y() const
double z() const
void SetWorldVolume(G4VPhysicalVolume *pWorld)
virtual G4VPhysicalVolume * LocateGlobalPointAndSetup(const G4ThreeVector &point, const G4ThreeVector *direction=0, const G4bool pRelativeSearch=true, const G4bool ignoreDirection=true)
Definition: G4Navigator.cc:125
G4LogicalVolume * fVolume
double G4double
Definition: G4Types.hh:76
static G4ThreadLocal G4Navigator * fNavigator
G4VPhysicalVolume * GetWorldVolume() const
Here is the call graph for this function:

◆ GetColor()

G4String F04ElementField::GetColor ( )
inline

GetColor() returns the color.

Definition at line 90 of file F04ElementField.hh.

90 { return fColor; }
Here is the call graph for this function:

◆ GetHeight()

virtual G4double F04ElementField::GetHeight ( )
pure virtual

Implemented in F04SimpleSolenoid.

Here is the caller graph for this function:

◆ GetLength()

virtual G4double F04ElementField::GetLength ( )
pure virtual

Implemented in F04SimpleSolenoid.

Here is the caller graph for this function:

◆ GetMaxStep()

G4double F04ElementField::GetMaxStep ( )
inline

GetMaxStep() returns the max. step size.

Definition at line 80 of file F04ElementField.hh.

80 { return fMaxStep; }

◆ GetVisAttribute()

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
Definition: test07.cc:36
G4GLOB_DLL std::ostream G4cout
G4Colour G4Color
Definition: G4Color.hh:42
static const G4VisAttributes Invisible
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void SetDaughtersInvisible(G4bool)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetWidth()

virtual G4double F04ElementField::GetWidth ( )
pure virtual

Implemented in F04SimpleSolenoid.

Here is the caller graph for this function:

◆ IsInBoundingBox()

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 call graph for this function:
Here is the caller graph for this function:

◆ operator=()

F04ElementField& F04ElementField::operator= ( const F04ElementField )
private

◆ SetColor()

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
void SetVisAttributes(const G4VisAttributes *pVA)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetGlobalPoint()

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:

◆ SetMaxStep()

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;
77  }
virtual void SetMaxAllowedStep(G4double ustepMax)
void SetUserLimits(G4UserLimits *pULimits)
G4UserLimits * fUserLimits
G4LogicalVolume * fVolume
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ fCenter

G4ThreeVector F04ElementField::fCenter
private

Definition at line 150 of file F04ElementField.hh.

◆ fColor

G4String F04ElementField::fColor
private

Definition at line 148 of file F04ElementField.hh.

◆ fGlobal2local

G4AffineTransform F04ElementField::fGlobal2local
protected

Definition at line 140 of file F04ElementField.hh.

◆ fMaxStep

G4double F04ElementField::fMaxStep
private

Definition at line 153 of file F04ElementField.hh.

◆ fMaxX

G4double F04ElementField::fMaxX
private

Definition at line 151 of file F04ElementField.hh.

◆ fMaxY

G4double F04ElementField::fMaxY
private

Definition at line 151 of file F04ElementField.hh.

◆ fMaxZ

G4double F04ElementField::fMaxZ
private

Definition at line 151 of file F04ElementField.hh.

◆ fMinX

G4double F04ElementField::fMinX
private

Definition at line 151 of file F04ElementField.hh.

◆ fMinY

G4double F04ElementField::fMinY
private

Definition at line 151 of file F04ElementField.hh.

◆ fMinZ

G4double F04ElementField::fMinZ
private

Definition at line 151 of file F04ElementField.hh.

◆ fNavigator

G4ThreadLocal G4Navigator * F04ElementField::fNavigator = 0
staticprivate

Definition at line 146 of file F04ElementField.hh.

◆ fUserLimits

G4UserLimits* F04ElementField::fUserLimits
private

Definition at line 154 of file F04ElementField.hh.

◆ fVolume

G4LogicalVolume* F04ElementField::fVolume
protected

Definition at line 138 of file F04ElementField.hh.


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