Geant4_10
F04ElementField.hh
Go to the documentation of this file.
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.hh 77884 2013-11-29 08:41:11Z gcosmo $
27 //
30 //
31 
32 #ifndef F04ElementField_h
33 #define F04ElementField_h 1
34 
35 class G4VPhysicalVolume;
36 
37 #include "globals.hh"
38 
39 #include "G4Navigator.hh"
41 
42 #include "G4UserLimits.hh"
43 #include "G4VisAttributes.hh"
44 
45 // class F04ElementField - interface for the EM field of one element
46 
47 // This is the interface class used by GlobalField to compute the field
48 // value at a given point[].
49 
50 // An element that represents an element with an EM field will
51 // derive a class from this one and implement the computation for the
52 // element. The Construct() function will add the derived object into
53 // GlobalField.
54 
56 {
57 
58  private:
59 
60  F04ElementField& operator=(const F04ElementField&);
61 
62  public:
63 
66 
68  void Construct(G4VPhysicalVolume* currentWorld);
69  void UpdateWorld(G4VPhysicalVolume* currentWorld);
70 
72  virtual ~F04ElementField() {}
73 
75  void SetMaxStep(G4double stp)
76  {
77  fMaxStep = stp;
78  fUserLimits->SetMaxAllowedStep(fMaxStep);
79  fVolume->SetUserLimits(fUserLimits);
80  }
81 
83  G4double GetMaxStep() { return fMaxStep; }
84 
87  {
88  fColor = c;
90  }
91 
93  G4String GetColor() { return fColor; }
94 
97 
104  void SetGlobalPoint(const G4double point[4])
105  {
106  if(fMinX == -DBL_MAX || fMinX > point[0]) fMinX = point[0];
107  if(fMinY == -DBL_MAX || fMinY > point[1]) fMinY = point[1];
108  if(fMinZ == -DBL_MAX || fMinZ > point[2]) fMinZ = point[2];
109  if(fMaxX == DBL_MAX || fMaxX < point[0]) fMaxX = point[0];
110  if(fMaxY == DBL_MAX || fMaxY < point[1]) fMaxY = point[1];
111  if(fMaxZ == DBL_MAX || fMaxZ < point[2]) fMaxZ = point[2];
112  }
113 
116  bool IsInBoundingBox(const G4double point[4]) const
117  {
118  if(point[2] < fMinZ || point[2] > fMaxZ) return false;
119  if(point[0] < fMinX || point[0] > fMaxX) return false;
120  if(point[1] < fMinY || point[1] > fMaxY) return false;
121  return true;
122  }
123 
132  virtual void
133  AddFieldValue(const G4double point[4], G4double field[6]) const = 0;
134 
135  virtual G4double GetLength() = 0;
136  virtual G4double GetWidth() = 0;
137  virtual G4double GetHeight() = 0;
138 
139  protected:
140 
142 
144 
145 // F04ElementField(const F04ElementField&);
146 
147  private:
148 
149  static G4ThreadLocal G4Navigator* fNavigator;
150 
151  G4String fColor;
152 
153  G4ThreeVector fCenter;
154  G4double fMinX, fMinY, fMinZ, fMaxX, fMaxY, fMaxZ;
155 
156  G4double fMaxStep;
157  G4UserLimits* fUserLimits;
158 
159 };
160 
161 #endif
void SetMaxStep(G4double stp)
SetMaxStep(G4double) sets the max. step size.
void Construct(G4VPhysicalVolume *currentWorld)
the actual implementation constructs the F04ElementField
virtual void SetMaxAllowedStep(G4double ustepMax)
void SetGlobalPoint(const G4double point[4])
F04ElementField(const G4ThreeVector, G4LogicalVolume *)
Constructor.
void SetUserLimits(G4UserLimits *pULimits)
virtual void AddFieldValue(const G4double point[4], G4double field[6]) const =0
static G4VisAttributes * GetVisAttribute(G4String color)
GetVisAttribute() returns the appropriate G4VisAttributes.
#define G4ThreadLocal
Definition: tls.hh:52
void SetColor(G4String c)
SetColor(G4String) sets the color.
virtual G4double GetLength()=0
virtual G4double GetWidth()=0
G4double GetMaxStep()
GetMaxStep() returns the max. step size.
G4String GetColor()
GetColor() returns the color.
virtual G4double GetHeight()=0
void UpdateWorld(G4VPhysicalVolume *currentWorld)
G4AffineTransform fGlobal2local
bool IsInBoundingBox(const G4double point[4]) const
G4LogicalVolume * fVolume
double G4double
Definition: G4Types.hh:76
tuple c
Definition: test.py:13
#define DBL_MAX
Definition: templates.hh:83
void SetVisAttributes(const G4VisAttributes *pVA)
virtual ~F04ElementField()
Destructor.