G4VisCommandSceneAddTrajectories Class Reference

#include <G4VisCommandsSceneAdd.hh>

Inheritance diagram for G4VisCommandSceneAddTrajectories:

G4VVisCommandScene G4VVisCommand G4UImessenger

Public Member Functions

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

Detailed Description

Definition at line 354 of file G4VisCommandsSceneAdd.hh.


Constructor & Destructor Documentation

G4VisCommandSceneAddTrajectories::G4VisCommandSceneAddTrajectories (  ) 

Definition at line 2280 of file G4VisCommandsSceneAdd.cc.

02280                                                                     {
02281   G4bool omitable;
02282   fpCommand = new G4UIcmdWithAString
02283     ("/vis/scene/add/trajectories", this);
02284   fpCommand -> SetGuidance
02285     ("Adds trajectories to current scene.");
02286   fpCommand -> SetGuidance
02287     ("Causes trajectories, if any, to be drawn at the end of processing an"
02288      "\nevent.  Switches on trajectory storing and sets the"
02289      "\ndefault trajectory type.");
02290   fpCommand -> SetGuidance
02291     ("The command line parameter list determines the default trajectory type."
02292      "\nIf it contains the string \"smooth\", auxiliary inter-step points will"
02293      "\nbe inserted to improve the smoothness of the drawing of a curved"
02294      "\ntrajectory."
02295      "\nIf it contains the string \"rich\", significant extra information will"
02296      "\nbe stored in the trajectory (G4RichTrajectory) amenable to modeling"
02297      "\nand filtering with \"/vis/modeling/trajectories/create/drawByAttribute\""
02298      "\nand \"/vis/filtering/trajectories/create/attributeFilter\" commands."
02299      "\nIt may contain both strings in any order.");
02300   fpCommand -> SetGuidance
02301     ("\nTo switch off trajectory storing: \"/tracking/storeTrajectory 0\"."
02302      "\nSee also \"/vis/scene/endOfEventAction\".");
02303   fpCommand -> SetGuidance
02304     ("Note:  This only sets the default.  Independently of the result of this"
02305      "\ncommand, a user may instantiate a trajectory that overrides this default"
02306      "\nin PreUserTrackingAction.");
02307   fpCommand -> SetParameterName ("default-trajectory-type", omitable = true);
02308   fpCommand -> SetDefaultValue ("");
02309 }

G4VisCommandSceneAddTrajectories::~G4VisCommandSceneAddTrajectories (  )  [virtual]

Definition at line 2311 of file G4VisCommandsSceneAdd.cc.

02311                                                                      {
02312   delete fpCommand;
02313 }


Member Function Documentation

G4String G4VisCommandSceneAddTrajectories::GetCurrentValue ( G4UIcommand command  )  [virtual]

Reimplemented from G4UImessenger.

Definition at line 2315 of file G4VisCommandsSceneAdd.cc.

02315                                                                         {
02316   return "";
02317 }

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

Reimplemented from G4UImessenger.

Definition at line 2319 of file G4VisCommandsSceneAdd.cc.

References G4UImanager::ApplyCommand(), G4VisManager::confirmations, G4VisManager::errors, G4VVisCommand::fpVisManager, G4cout, G4endl, G4VisManager::GetCurrentScene(), G4TransportationManager::GetTransportationManager(), G4UImanager::GetUIpointer(), G4UImanager::GetVerboseLevel(), G4VisManager::GetVerbosity(), G4PropagatorInField::SetTrajectoryFilter(), G4UImanager::SetVerboseLevel(), G4VVisCommand::UpdateVisManagerScene(), and G4VisManager::warnings.

02320                                                                        {
02321 
02322   G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
02323   G4bool warn = verbosity >= G4VisManager::warnings;
02324 
02325   G4Scene* pScene = fpVisManager->GetCurrentScene();
02326   if (!pScene) {
02327     if (verbosity >= G4VisManager::errors) {
02328       G4cout << "ERROR: No current scene.  Please create one." << G4endl;
02329     }
02330     return;
02331   }
02332 
02333   G4bool smooth = false, rich = false;
02334   if (newValue.find("smooth") != std::string::npos) smooth = true;
02335   if (newValue.find("rich") != std::string::npos) rich = true;
02336 
02337   G4UImanager* UImanager = G4UImanager::GetUIpointer();
02338   G4int keepVerbose = UImanager->GetVerboseLevel();
02339   G4int newVerbose = 2;
02340   UImanager->SetVerboseLevel(newVerbose);
02341   G4PropagatorInField* propagatorInField =
02342     G4TransportationManager::GetTransportationManager()->
02343     GetPropagatorInField();
02344   propagatorInField->SetTrajectoryFilter(0); // Switch off smooth trajectories.
02345   static G4IdentityTrajectoryFilter auxiliaryPointsFilter;
02346   G4String defaultTrajectoryType;
02347   G4bool i_mode_found = false;
02348   G4int i_mode = 0;
02349   if (smooth && rich) {
02350     UImanager->ApplyCommand("/tracking/storeTrajectory 3");
02351     propagatorInField->SetTrajectoryFilter(&auxiliaryPointsFilter);
02352     defaultTrajectoryType = "G4RichTrajectory configured for smooth steps";
02353   } else if (smooth) {
02354     UImanager->ApplyCommand("/tracking/storeTrajectory 2");
02355     propagatorInField->SetTrajectoryFilter(&auxiliaryPointsFilter);
02356     defaultTrajectoryType = "G4SmoothTrajectory";
02357   } else if (rich) {
02358     UImanager->ApplyCommand("/tracking/storeTrajectory 3");
02359     defaultTrajectoryType = "G4RichTrajectory";
02360   } else {
02361     if (!newValue.empty()) {
02362       std::istringstream iss(newValue);
02363       iss >> i_mode;
02364       if (iss) {
02365         i_mode_found = true;
02366         if (verbosity >= G4VisManager::warnings) {
02367           G4cout <<
02368   "WARNING: Integer parameter " << i_mode << " found."
02369   "\n  DEPRECATED - its use in this command will be removed at a future major"
02370   "\n  release.  Use \"/vis/modeling/trajectories\" commands."
02371                  << G4endl;
02372         }
02373       } else {
02374         if (verbosity >= G4VisManager::errors) {
02375           G4cout << "ERROR: Unrecognised parameter \"" << newValue << "\""
02376             "\n  No action taken."
02377                  << G4endl;
02378         }
02379         return;
02380       }
02381     }
02382     UImanager->ApplyCommand("/tracking/storeTrajectory 1");
02383     defaultTrajectoryType = "G4Trajectory";
02384   }
02385   UImanager->SetVerboseLevel(keepVerbose);
02386 
02387   if (verbosity >= G4VisManager::errors) {
02388     G4cout <<
02389       "Attributes available for modeling and filtering with"
02390       "\n  \"/vis/modeling/trajectories/create/drawByAttribute\" and"
02391       "\n  \"/vis/filtering/trajectories/create/attributeFilter\" commands:"
02392            << G4endl;
02393     G4cout << G4TrajectoriesModel().GetAttDefs();
02394     if (rich) {
02395       G4cout << G4RichTrajectory().GetAttDefs()
02396              << G4RichTrajectoryPoint().GetAttDefs();
02397     } else if (smooth) {
02398       G4cout << G4SmoothTrajectory().GetAttDefs()
02399              << G4SmoothTrajectoryPoint().GetAttDefs();
02400     } else {
02401       G4cout << G4Trajectory().GetAttDefs()
02402              << G4TrajectoryPoint().GetAttDefs();
02403     }
02404   }
02405 
02406   G4TrajectoriesModel* model = 0;
02407   if (i_mode_found) {
02408     model = new G4TrajectoriesModel(i_mode);
02409   } else {
02410     model = new G4TrajectoriesModel();
02411   }
02412   const G4String& currentSceneName = pScene -> GetName ();
02413   pScene -> AddEndOfEventModel (model, warn);
02414 
02415   if (verbosity >= G4VisManager::confirmations) {
02416     G4cout << "Default trajectory type " << defaultTrajectoryType
02417            << "\n  will be used to store trajectories for scene \""
02418            << currentSceneName << "\"."
02419            << G4endl;
02420   }
02421 
02422   if (verbosity >= G4VisManager::warnings) {
02423     G4cout <<
02424       "WARNING: Trajectory storing has been requested.  This action may be"
02425       "\n  reversed with \"/tracking/storeTrajectory 0\"."
02426            << G4endl;
02427   }
02428   UpdateVisManagerScene (currentSceneName);
02429 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:53:45 2013 for Geant4 by  doxygen 1.4.7