Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Geant4/G4VFieldModel.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // Michael Kelsey  31 January 2019
0027 //
0028 // Class Description:
0029 //
0030 // Abstract base class to implement drawing vector field geometries
0031 // (e.g., electric, magnetic or gravity).  Implementation extracted
0032 // from G4MagneticFieldModel, with field-value access left pure
0033 // virtual for implementation by base classes.
0034 
0035 #ifndef G4VFIELDMODEL_HH
0036 #define G4VFIELDMODEL_HH
0037 
0038 #include "G4VModel.hh"
0039 #include "G4Point3D.hh"
0040 #include "G4PhysicalVolumesSearchScene.hh"
0041 
0042 #include <vector>
0043 
0044 class G4Field;
0045 
0046 class G4VFieldModel: public G4VModel {
0047 
0048 public: // With description
0049   
0050   enum Representation {fullArrow, lightArrow};
0051 
0052   G4VFieldModel
0053   (const G4String& typeOfField, const G4String& symbol="",
0054    const G4VisExtent& extentForField = G4VisExtent(),
0055    const std::vector<G4PhysicalVolumesSearchScene::Findings>& pvFindings
0056    = std::vector<G4PhysicalVolumesSearchScene::Findings>(),
0057    G4int nDataPointsPerHalfScene = 10,
0058    Representation representation = Representation::fullArrow,
0059    G4int arrow3DLineSegmentsPerCircle = 6);
0060   // typeOfField is "Electric" or "Magnetic" etc.
0061   // symbol is "E" or "B" etc.
0062 
0063   virtual ~G4VFieldModel();
0064 
0065   virtual void DescribeYourselfTo(G4VGraphicsScene& sceneHandler);
0066   // The main task of a model is to describe itself to the graphics scene.
0067   // Note: It is in this function that the extent for drawing the filed must
0068   // be calcualted. If fExtentForField is null, pick up the extent from
0069   // the sceneHandler.
0070 
0071 protected:
0072 
0073   // Subclasses MUST implement this for their particular kind of field
0074   virtual void GetFieldAtLocation(const G4Field* field,
0075                   const G4Point3D& position, G4double time,
0076                   G4Point3D& result) const = 0;
0077   // The appropriate output from GetFieldValue should be filled into result.
0078   // If (field==0), the function should do nothing; returning without error.
0079 
0080 private:
0081 
0082   // Private copy contructor and assignment to forbid use...
0083   G4VFieldModel(const G4VFieldModel&);
0084   G4VFieldModel& operator=(const G4VFieldModel&);
0085 
0086   G4VisExtent fExtentForField;
0087   // If null, get extent from scene handler in DescribeYourselfTo.
0088 
0089   std::vector<G4PhysicalVolumesSearchScene::Findings> fPVFindings;
0090   // If empty, use fExtentForField alone for sampling and drawing.
0091   // If non-empty, use fExtentForField alone for sampling, but only
0092   // draw if sampling point is in the specified physical volume(s).
0093 
0094   G4int fNDataPointsPerMaxHalfExtent;
0095   // No. of data points sampled per maximum half extent.
0096   // Note that total number of sampling points can be as high as
0097   // (2*n+1)^3, which can get very big. However, fields are usually
0098   // confined to only parts of the scene, so this may not be a problem.
0099   // Sampling can be further limited with fExtentForField and/or fPVFindings.
0100 
0101   Representation fRepresentation;       // Big arrows or just lines
0102   G4int fArrow3DLineSegmentsPerCircle;
0103   G4String fTypeOfField;                // "Electric" or "Magnetic" etc.
0104   G4String fArrowPrefix;                // For attaching text label to arrows
0105 };
0106 
0107 #endif