Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
F04ElementField Class Referenceabstract

#include <Doxymodules_field.h>

Inheritance diagram for F04ElementField:
F04SimpleSolenoid F04FocusSolenoid

Public Member Functions

 F04ElementField (const G4ThreeVector, G4LogicalVolume *)
 Constructor.
 
void Construct ()
 the actual implementation constructs the F04ElementField
 
virtual ~F04ElementField ()=default
 Destructor.
 
void SetMaxStep (G4double stp)
 SetMaxStep(G4double) sets the max. step size.
 
G4double GetMaxStep ()
 GetMaxStep() returns the max. step size.
 
void SetColor (G4String c)
 SetColor(G4String) sets the color.
 
G4String GetColor ()
 GetColor() returns the color.
 
void SetGlobalPoint (const G4double point[4])
 SetGlobalPoint() ensures that the point is within the global bounding box of this ElementField's global coordinates.
 
bool IsInBoundingBox (const G4double point[4]) const
 IsInBoundingBox() returns true if the point is within the global bounding box - global coordinates.
 
virtual void AddFieldValue (const G4double point[4], G4double field[6]) const =0
 AddFieldValue() will add the field value for this element to field[].
 
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.
 

Protected Attributes

G4LogicalVolumefVolume = nullptr
 
G4AffineTransform fGlobal2local
 

Private Member Functions

F04ElementFieldoperator= (const F04ElementField &)
 

Private Attributes

G4String fColor = "1,1,1"
 
G4ThreeVector fCenter
 
G4double fMinX = -DBL_MAX
 
G4double fMinY = -DBL_MAX
 
G4double fMinZ = -DBL_MAX
 
G4double fMaxX = DBL_MAX
 
G4double fMaxY = DBL_MAX
 
G4double fMaxZ = DBL_MAX
 
G4double fMaxStep = 1. * CLHEP::mm
 
G4UserLimitsfUserLimits = nullptr
 

Static Private Attributes

static G4ThreadLocal G4NavigatorfNavigator = nullptr
 

Detailed Description

Definition at line 101 of file Doxymodules_field.h.

Constructor & Destructor Documentation

◆ F04ElementField()

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

Constructor.

Definition at line 43 of file F04ElementField.cc.

44 : fVolume(lv),
45 fCenter(c)
46{
48
50 fUserLimits->SetMaxAllowedStep(fMaxStep);
51 fUserLimits->SetUserMaxTrackLength(500.*m);
52 fUserLimits->SetUserMaxTime(10*ms);
53 fUserLimits->SetUserMinEkine(0.1*MeV);
54// fUserLimits->SetUserMinRange(1*mm);
55
56 fVolume->SetVisAttributes(GetVisAttribute(fColor));
57 fVolume->SetUserLimits(fUserLimits);
58}
G4ThreeVector fCenter
static G4VisAttributes * GetVisAttribute(G4String color)
GetVisAttribute() returns the appropriate G4VisAttributes.
G4LogicalVolume * fVolume
G4UserLimits * fUserLimits
static F04GlobalField * GetObject()
void AddElementField(F04ElementField *f)
AddElementField() adds the ElementField object for a single element to the global field.

◆ ~F04ElementField()

virtual F04ElementField::~F04ElementField ( )
virtualdefault

Destructor.

Member Function Documentation

◆ Construct()

void F04ElementField::Construct ( )

the actual implementation constructs the F04ElementField

Definition at line 62 of file F04ElementField.cc.

63{
64 G4Navigator* theNavigator =
65 G4TransportationManager::GetTransportationManager()->
66 GetNavigatorForTracking();
67 if (!fNavigator) {
68 fNavigator = new G4Navigator();
69 if ( theNavigator->GetWorldVolume() )
70 fNavigator->SetWorldVolume(theNavigator->GetWorldVolume());
71 }
72
73 fNavigator->LocateGlobalPointAndSetup(fCenter,nullptr,false);
74
75 G4TouchableHandle touchable = fNavigator->CreateTouchableHistoryHandle();
76
77 G4int depth = touchable->GetHistoryDepth();
78 for (G4int i = 0; i<depth; ++i) {
79 if(touchable->GetVolume()->GetLogicalVolume() == fVolume)break;
80 touchable->MoveUpHistory();
81 }
82
83 // set fGlobal2local transform
84 fGlobal2local = touchable->GetHistory()->GetTopTransform();
85
86 // set global bounding box
87 G4double local[4], global[4];
88
89 G4ThreeVector globalPosition;
90 local[3] = 0.0;
91 for (G4int i=0; i<2; ++i) {
92 local[0] = (i==0 ? -1.0 : 1.0) * GetWidth()/2.;
93 for (G4int j=0; j<2; ++j) {
94 local[1] = (j==0 ? -1.0 : 1.0) * GetHeight()/2.;
95 for (G4int k=0; k<2; ++k) {
96 local[2] = (k==0 ? -1.0 : 1.0) * GetLength()/2.;
97 G4ThreeVector localPosition(local[0],local[1],local[2]);
98 globalPosition =
99 fGlobal2local.Inverse().TransformPoint(localPosition);
100 global[0] = globalPosition.x();
101 global[1] = globalPosition.y();
102 global[2] = globalPosition.z();
103 SetGlobalPoint(global);
104 }
105 }
106 }
107}
G4AffineTransform fGlobal2local
virtual G4double GetLength()=0
static G4ThreadLocal G4Navigator * fNavigator
void SetGlobalPoint(const G4double point[4])
SetGlobalPoint() ensures that the point is within the global bounding box of this ElementField's glob...
virtual G4double GetWidth()=0
virtual G4double GetHeight()=0

◆ SetMaxStep()

void F04ElementField::SetMaxStep ( G4double  stp)
inline

SetMaxStep(G4double) sets the max. step size.

Definition at line 69 of file F04ElementField.hh.

70 {
71 fMaxStep = stp;
72 fUserLimits->SetMaxAllowedStep(fMaxStep);
73 fVolume->SetUserLimits(fUserLimits);
74 }

◆ GetMaxStep()

G4double F04ElementField::GetMaxStep ( )
inline

GetMaxStep() returns the max. step size.

Definition at line 77 of file F04ElementField.hh.

77{ return fMaxStep; }

◆ SetColor()

void F04ElementField::SetColor ( G4String  c)
inline

SetColor(G4String) sets the color.

Definition at line 80 of file F04ElementField.hh.

81 {
82 fColor = c;
83 fVolume->SetVisAttributes(GetVisAttribute(fColor));
84 }

◆ GetColor()

G4String F04ElementField::GetColor ( )
inline

GetColor() returns the color.

Definition at line 87 of file F04ElementField.hh.

87{ return fColor; }

◆ GetVisAttribute()

G4VisAttributes * F04ElementField::GetVisAttribute ( G4String  color)
static

GetVisAttribute() returns the appropriate G4VisAttributes.

Definition at line 111 of file F04ElementField.cc.

112{
113 G4VisAttributes* p = nullptr;
114 if(color.size() > 0 &&
115 (isdigit(color.c_str()[0]) || color.c_str()[0] == '.')) {
116 G4double red=0.0, green=0.0, blue=0.0;
117 if (sscanf(color.c_str(),"%lf,%lf,%lf",&red,&green,&blue) == 3) {
118 p = new G4VisAttributes(true,G4Color(red,green,blue));
119 } else {
120 G4cout << " Invalid color " << color << G4endl;
121 }
122 }
123
124 if (!p) p = new G4VisAttributes(G4VisAttributes::GetInvisible());
125 p->SetDaughtersInvisible(false);
126
127 return p;
128}

◆ 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 98 of file F04ElementField.hh.

99 {
100 if(fMinX == -DBL_MAX || fMinX > point[0]) fMinX = point[0];
101 if(fMinY == -DBL_MAX || fMinY > point[1]) fMinY = point[1];
102 if(fMinZ == -DBL_MAX || fMinZ > point[2]) fMinZ = point[2];
103 if(fMaxX == DBL_MAX || fMaxX < point[0]) fMaxX = point[0];
104 if(fMaxY == DBL_MAX || fMaxY < point[1]) fMaxY = point[1];
105 if(fMaxZ == DBL_MAX || fMaxZ < point[2]) fMaxZ = point[2];
106 }

◆ 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 110 of file F04ElementField.hh.

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

◆ 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 F04FocusSolenoid, and F04SimpleSolenoid.

◆ GetLength()

virtual G4double F04ElementField::GetLength ( )
pure virtual

Implemented in F04SimpleSolenoid.

◆ GetWidth()

virtual G4double F04ElementField::GetWidth ( )
pure virtual

Implemented in F04SimpleSolenoid.

◆ GetHeight()

virtual G4double F04ElementField::GetHeight ( )
pure virtual

Implemented in F04SimpleSolenoid.

◆ operator=()

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

Member Data Documentation

◆ fVolume

G4LogicalVolume* F04ElementField::fVolume = nullptr
protected

Definition at line 135 of file F04ElementField.hh.

◆ fGlobal2local

G4AffineTransform F04ElementField::fGlobal2local
protected

Definition at line 137 of file F04ElementField.hh.

◆ fNavigator

G4ThreadLocal G4Navigator * F04ElementField::fNavigator = nullptr
staticprivate

Definition at line 144 of file F04ElementField.hh.

◆ fColor

G4String F04ElementField::fColor = "1,1,1"
private

Definition at line 146 of file F04ElementField.hh.

◆ fCenter

G4ThreeVector F04ElementField::fCenter
private

Definition at line 148 of file F04ElementField.hh.

◆ fMinX

G4double F04ElementField::fMinX = -DBL_MAX
private

Definition at line 149 of file F04ElementField.hh.

◆ fMinY

G4double F04ElementField::fMinY = -DBL_MAX
private

Definition at line 150 of file F04ElementField.hh.

◆ fMinZ

G4double F04ElementField::fMinZ = -DBL_MAX
private

Definition at line 151 of file F04ElementField.hh.

◆ fMaxX

G4double F04ElementField::fMaxX = DBL_MAX
private

Definition at line 152 of file F04ElementField.hh.

◆ fMaxY

G4double F04ElementField::fMaxY = DBL_MAX
private

Definition at line 153 of file F04ElementField.hh.

◆ fMaxZ

G4double F04ElementField::fMaxZ = DBL_MAX
private

Definition at line 154 of file F04ElementField.hh.

◆ fMaxStep

G4double F04ElementField::fMaxStep = 1. * CLHEP::mm
private

Definition at line 156 of file F04ElementField.hh.

◆ fUserLimits

G4UserLimits* F04ElementField::fUserLimits = nullptr
private

Definition at line 157 of file F04ElementField.hh.


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

Applications | User Support | Publications | Collaboration