Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 //
28 //
29 //
30 #ifndef F04ElementField_h
31 #define F04ElementField_h 1
32 
33 #include "globals.hh"
34 
35 #include "G4Navigator.hh"
37 
38 #include "G4UserLimits.hh"
39 #include "G4VisAttributes.hh"
40 
41 // class F04ElementField - interface for the EM field of one element
42 
43 // This is the interface class used by GlobalField to compute the field
44 // value at a given point[].
45 
46 // An element that represents an element with an EM field will
47 // derive a class from this one and implement the computation for the
48 // element. The Construct() function will add the derived object into
49 // GlobalField.
50 
52 {
53 
54  private:
55 
56  F04ElementField& operator=(const F04ElementField&);
57 
58  public:
59 
62 
64  void Construct();
65 
67  virtual ~F04ElementField() { if (fNavigator) delete fNavigator; }
68 
70  void SetMaxStep(G4double stp)
71  {
72  fMaxStep = stp;
73  fUserLimits->SetMaxAllowedStep(fMaxStep);
74  fVolume->SetUserLimits(fUserLimits);
75  }
76 
78  G4double GetMaxStep() { return fMaxStep; }
79 
82  {
83  fColor = c;
85  }
86 
88  G4String GetColor() { return fColor; }
89 
92 
99  void SetGlobalPoint(const G4double point[4])
100  {
101  if(fMinX == -DBL_MAX || fMinX > point[0]) fMinX = point[0];
102  if(fMinY == -DBL_MAX || fMinY > point[1]) fMinY = point[1];
103  if(fMinZ == -DBL_MAX || fMinZ > point[2]) fMinZ = point[2];
104  if(fMaxX == DBL_MAX || fMaxX < point[0]) fMaxX = point[0];
105  if(fMaxY == DBL_MAX || fMaxY < point[1]) fMaxY = point[1];
106  if(fMaxZ == DBL_MAX || fMaxZ < point[2]) fMaxZ = point[2];
107  }
108 
111  bool IsInBoundingBox(const G4double point[4]) const
112  {
113  if(point[2] < fMinZ || point[2] > fMaxZ) return false;
114  if(point[0] < fMinX || point[0] > fMaxX) return false;
115  if(point[1] < fMinY || point[1] > fMaxY) return false;
116  return true;
117  }
118 
127  virtual void
128  AddFieldValue(const G4double point[4], G4double field[6]) const = 0;
129 
130  virtual G4double GetLength() = 0;
131  virtual G4double GetWidth() = 0;
132  virtual G4double GetHeight() = 0;
133 
134  protected:
135 
137 
139 
140 // F04ElementField(const F04ElementField&);
141 
142  private:
143 
144  static G4Navigator* fNavigator;
145 
146  G4String fColor;
147 
148  G4ThreeVector fCenter;
149  G4double fMinX, fMinY, fMinZ, fMaxX, fMaxY, fMaxZ;
150 
151  G4double fMaxStep;
152  G4UserLimits* fUserLimits;
153 
154 };
155 
156 #endif