Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VisCommandSceneAddTrajectories Class Reference

#include <G4VisCommandsSceneAdd.hh>

Inheritance diagram for G4VisCommandSceneAddTrajectories:

Public Member Functions

 G4VisCommandSceneAddTrajectories ()
virtual ~G4VisCommandSceneAddTrajectories ()
G4String GetCurrentValue (G4UIcommand *command)
void SetNewValue (G4UIcommand *command, G4String newValue)
Public Member Functions inherited from G4VVisCommandScene
 G4VVisCommandScene ()
virtual ~G4VVisCommandScene ()
Public Member Functions inherited from G4VVisCommand
 G4VVisCommand ()
virtual ~G4VVisCommand ()
Public Member Functions inherited from G4UImessenger
 G4UImessenger ()=default
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
virtual ~G4UImessenger ()
G4bool CommandsShouldBeInMaster () const

Additional Inherited Members

Static Public Member Functions inherited from G4VVisCommand
static G4VisManagerGetVisManager ()
static void SetVisManager (G4VisManager *pVisManager)
static const G4ColourGetCurrentTextColour ()
Protected Member Functions inherited from G4VVisCommandScene
G4String CurrentSceneName ()
Protected Member Functions inherited from G4VVisCommand
void SetViewParameters (G4VViewer *viewer, const G4ViewParameters &viewParams)
void RefreshIfRequired (G4VViewer *viewer)
void InterpolateViews (G4VViewer *currentViewer, const std::vector< G4ViewParameters > &viewVector, const G4int nInterpolationPoints=50, const G4int waitTimePerPointmilliseconds=20, const G4String &exportString="")
void InterpolateToNewView (G4VViewer *currentViewer, const G4ViewParameters &oldVP, const G4ViewParameters &newVP, const G4int nInterpolationPoints=50, const G4int waitTimePerPointmilliseconds=20, const G4String &exportString="")
void Twinkle (G4VViewer *currentViewer, const G4ViewParameters &baseVP, const std::vector< std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > > &paths)
const G4StringConvertToColourGuidance ()
void ConvertToColour (G4Colour &colour, const G4String &redOrString, G4double green, G4double blue, G4double opacity)
G4bool ProvideValueOfUnit (const G4String &where, const G4String &unit, const G4String &category, G4double &value)
void CopyCameraParameters (G4ViewParameters &target, const G4ViewParameters &from)
void CheckSceneAndNotifyHandlers (G4Scene *=nullptr)
G4bool CheckView ()
void G4VisCommandsSceneAddUnsuccessful (G4VisManager::Verbosity verbosity)
void CopyGuidanceFrom (const G4UIcommand *fromCmd, G4UIcommand *toCmd, G4int startLine=0)
void CopyParametersFrom (const G4UIcommand *fromCmd, G4UIcommand *toCmd)
void DrawExtent (const G4VisExtent &)
Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
G4String LtoS (G4long l)
G4String DtoS (G4double a)
G4String BtoS (G4bool b)
G4int StoI (const G4String &s)
G4long StoL (const G4String &s)
G4double StoD (const G4String &s)
G4bool StoB (const G4String &s)
void AddUIcommand (G4UIcommand *newCommand)
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
template<typename T>
T * CreateCommand (const G4String &cname, const G4String &dsc)
Static Protected Member Functions inherited from G4VVisCommand
static G4String ConvertToString (G4double x, G4double y, const char *unitName)
static G4bool ConvertToDoublePair (const G4String &paramString, G4double &xval, G4double &yval)
Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir = nullptr
G4String baseDirName = ""
G4bool commandsShouldBeInMaster = false
Static Protected Attributes inherited from G4VVisCommand
static G4VisManagerfpVisManager = nullptr
static G4int fCurrentArrow3DLineSegmentsPerCircle = 6
static G4Colour fCurrentColour = G4Colour::White()
static G4double fCurrentLineWidth = 1.
static G4Colour fCurrentTextColour = G4Colour::Blue()
static G4Text::Layout fCurrentTextLayout = G4Text::left
static G4double fCurrentTextSize = 12.
static G4PhysicalVolumeModel::TouchableProperties fCurrentTouchableProperties
static G4VisExtent fCurrentExtentForField
static std::vector< G4PhysicalVolumesSearchScene::FindingsfCurrrentPVFindingsForField
static G4bool fThereWasAViewer = false
static G4ViewParameters fExistingVP
static G4SceneTreeItem fExistingSceneTree

Detailed Description

Definition at line 468 of file G4VisCommandsSceneAdd.hh.

Constructor & Destructor Documentation

◆ G4VisCommandSceneAddTrajectories()

G4VisCommandSceneAddTrajectories::G4VisCommandSceneAddTrajectories ( )

Definition at line 2829 of file G4VisCommandsSceneAdd.cc.

2829 {
2830 G4bool omitable;
2831 fpCommand = new G4UIcmdWithAString
2832 ("/vis/scene/add/trajectories", this);
2833 fpCommand -> SetGuidance
2834 ("Adds trajectories to current scene.");
2835 fpCommand -> SetGuidance
2836 ("Causes trajectories, if any, to be drawn at the end of processing an"
2837 "\nevent. Switches on trajectory storing and sets the"
2838 "\ndefault trajectory type.");
2839 fpCommand -> SetGuidance
2840 ("The command line parameter list determines the default trajectory type."
2841 "\nIf it contains the string \"smooth\", auxiliary inter-step points will"
2842 "\nbe inserted to improve the smoothness of the drawing of a curved"
2843 "\ntrajectory."
2844 "\nIf it contains the string \"rich\", significant extra information will"
2845 "\nbe stored in the trajectory (G4RichTrajectory) amenable to modeling"
2846 "\nand filtering with \"/vis/modeling/trajectories/create/drawByAttribute\""
2847 "\nand \"/vis/filtering/trajectories/create/attributeFilter\" commands."
2848 "\nIt may contain both strings in any order.");
2849 fpCommand -> SetGuidance
2850 ("\nTo switch off trajectory storing: \"/tracking/storeTrajectory 0\"."
2851 "\nSee also \"/vis/scene/endOfEventAction\".");
2852 fpCommand -> SetGuidance
2853 ("Note: This only sets the default. Independently of the result of this"
2854 "\ncommand, a user may instantiate a trajectory that overrides this default"
2855 "\nin PreUserTrackingAction.");
2856 fpCommand -> SetParameterName ("default-trajectory-type", omitable = true);
2857 fpCommand -> SetDefaultValue ("");
2858}
bool G4bool
Definition G4Types.hh:86

◆ ~G4VisCommandSceneAddTrajectories()

G4VisCommandSceneAddTrajectories::~G4VisCommandSceneAddTrajectories ( )
virtual

Definition at line 2860 of file G4VisCommandsSceneAdd.cc.

2860 {
2861 delete fpCommand;
2862}

Member Function Documentation

◆ GetCurrentValue()

G4String G4VisCommandSceneAddTrajectories::GetCurrentValue ( G4UIcommand * command)
virtual

Reimplemented from G4UImessenger.

Definition at line 2864 of file G4VisCommandsSceneAdd.cc.

2864 {
2865 return "";
2866}

◆ SetNewValue()

void G4VisCommandSceneAddTrajectories::SetNewValue ( G4UIcommand * command,
G4String newValue )
virtual

Reimplemented from G4UImessenger.

Definition at line 2868 of file G4VisCommandsSceneAdd.cc.

2869 {
2870
2871 G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
2872 G4bool warn = verbosity >= G4VisManager::warnings;
2873
2874 G4Scene* pScene = fpVisManager->GetCurrentScene();
2875 if (!pScene) {
2876 if (verbosity >= G4VisManager::errors) {
2877 G4warn << "ERROR: No current scene. Please create one." << G4endl;
2878 }
2879 return;
2880 }
2881 const G4String& currentSceneName = pScene -> GetName ();
2882
2883 G4bool smooth = false;
2884 G4bool rich = false;
2885 if (newValue.find("smooth") != std::string::npos) smooth = true;
2886 if (newValue.find("rich") != std::string::npos) rich = true;
2887 if (newValue.size() && !(rich || smooth)) {
2888 if (verbosity >= G4VisManager::errors) {
2889 G4warn << "ERROR: Unrecognised parameter \"" << newValue << "\""
2890 "\n No action taken."
2891 << G4endl;
2892 }
2893 return;
2894 }
2895
2896 G4UImanager* UImanager = G4UImanager::GetUIpointer();
2897 G4String defaultTrajectoryType;
2898 if (smooth && rich) {
2899 UImanager->ApplyCommand("/tracking/storeTrajectory 4");
2900 defaultTrajectoryType = "G4RichTrajectory configured for smooth steps";
2901 } else if (smooth) {
2902 UImanager->ApplyCommand("/tracking/storeTrajectory 2");
2903 defaultTrajectoryType = "G4SmoothTrajectory";
2904 } else if (rich) {
2905 UImanager->ApplyCommand("/tracking/storeTrajectory 3");
2906 defaultTrajectoryType = "G4RichTrajectory";
2907 } else {
2908 UImanager->ApplyCommand("/tracking/storeTrajectory 1");
2909 defaultTrajectoryType = "G4Trajectory";
2910 }
2911
2912 if (verbosity >= G4VisManager::errors) {
2913 G4warn <<
2914 "Attributes available for modeling and filtering with"
2915 "\n \"/vis/modeling/trajectories/create/drawByAttribute\" and"
2916 "\n \"/vis/filtering/trajectories/create/attributeFilter\" commands:"
2917 << G4endl;
2918 G4warn << *G4TrajectoriesModel().GetAttDefs();
2919 if (rich) {
2920 G4warn << *G4RichTrajectory().GetAttDefs()
2921 << *G4RichTrajectoryPoint().GetAttDefs();
2922 } else if (smooth) {
2923 G4warn << *G4SmoothTrajectory().GetAttDefs()
2924 << *G4SmoothTrajectoryPoint().GetAttDefs();
2925 } else {
2926 G4warn << *G4Trajectory().GetAttDefs()
2927 << *G4TrajectoryPoint().GetAttDefs();
2928 }
2929 }
2930
2931 const auto& eoeList = pScene->GetEndOfEventModelList();
2932 auto eoeModel = eoeList.begin();
2933 for (; eoeModel != eoeList.end(); ++eoeModel) {
2934 const auto* actualModel = eoeModel->fpModel;
2935 if (dynamic_cast<const G4TrajectoriesModel*>(actualModel)) break;
2936 }
2937 if (eoeModel == eoeList.end()) {
2938 // No trajectories model exists in the scene so create a new one...
2939 G4VModel* model = new G4TrajectoriesModel();
2940 pScene -> AddEndOfEventModel (model, warn);
2941 } // ...else it already exists and there is no need to add a new one
2942 // because G4TrajectoriesModel simply describes trajectories in the
2943 // trajectories store whatever the type.
2944
2945 if (verbosity >= G4VisManager::confirmations) {
2946 G4cout << "Default trajectory type " << defaultTrajectoryType
2947 << "\n will be used to store trajectories for scene \""
2948 << currentSceneName << "\"."
2949 << G4endl;
2950 }
2951
2952 if (verbosity >= G4VisManager::warnings) {
2953 G4warn <<
2954 "WARNING: Trajectory storing has been requested. This action may be"
2955 "\n reversed with \"/tracking/storeTrajectory 0\"."
2956 << G4endl;
2957 }
2958
2960}
#define G4warn
Definition G4Scene.cc:41
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
const std::vector< Model > & GetEndOfEventModelList() const
G4int ApplyCommand(const char *aCommand)
static G4UImanager * GetUIpointer()
void CheckSceneAndNotifyHandlers(G4Scene *=nullptr)
static G4VisManager * fpVisManager

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