Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Geant4/G4UIcmdWith3VectorAndUnit.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 // G4UIcmdWith3VectorAndUnit
0027 //
0028 // Class description:
0029 //
0030 // A concrete class of G4UIcommand. The command defined by this class
0031 // takes three double values and a unit.
0032 // General information of G4UIcommand is given in G4UIcommand.hh
0033 
0034 // Author: M.Asai, 1998
0035 // --------------------------------------------------------------------
0036 #ifndef G4UIcmdWith3VectorAndUnit_hh
0037 #define G4UIcmdWith3VectorAndUnit_hh 1
0038 
0039 #include "G4ThreeVector.hh"
0040 #include "G4UIcommand.hh"
0041 
0042 class G4UIcmdWith3VectorAndUnit : public G4UIcommand
0043 {
0044   public:
0045     // Constructor. The command string with full path directory
0046     // and the pointer to the messenger must be given
0047     G4UIcmdWith3VectorAndUnit(const char* theCommandPath, G4UImessenger* theMessenger);
0048 
0049     G4int DoIt(const G4String& parameterList) override;
0050 
0051     // Convert a 3 vector value to a string of digits and unit. Best unit is
0052     // chosen from the unit category of default unit (in case SetDefaultUnit()
0053     // is defined) or category defined by SetUnitCategory()
0054     G4String ConvertToStringWithBestUnit(const G4ThreeVector& vec);
0055 
0056     // Convert a 3 vector value to a string of digits and unit. Best unit is
0057     // chosen from the category defined by SetUnitCategory() in case default
0058     // unit is not defined
0059     G4String ConvertToStringWithDefaultUnit(const G4ThreeVector& vec);
0060 
0061     // Set the parameter names for three parameters. Names are used by
0062     // the range checking routine.
0063     // If "omittable" is set as true, the user of this command can omit
0064     // the value(s) when the command is applied. If "omittable" is false,
0065     // the user must supply all three values.
0066     // "currentAsDefault" flag is valid only if "omittable" is true. If this
0067     // flag is true, the current values are used as the default values when
0068     // the user omit some of the parameters. If this flag is false, the values
0069     // given by the next SetDefaultValue() method are used
0070     void SetParameterName(const char* theNameX, const char* theNameY, const char* theNameZ,
0071                           G4bool omittable, G4bool currentAsDefault = false);
0072 
0073     // Set the default values of the parameters. These default values are used
0074     // when the user of this command omits some of the parameter values, and
0075     // "omittable" is true and "currentAsDefault" is false
0076     void SetDefaultValue(const G4ThreeVector& defVal);
0077 
0078     // These three methods must be used alternatively.
0079     // The user cannot omit the unit as the fourth parameter of the command
0080     // if SetUnitCategory() or SetUnitCandidates() is used, while the unit
0081     // defined by SetDefaultUnit() method is used as the default unit so that
0082     // the user can omit the fourth parameter.
0083     // SetUnitCategory() defines the category of the units which will be
0084     // accepted.
0085     // The available categories can be found in G4SystemOfUnits.hh in 'global'
0086     // category. Only the units categorized in the given category are accepted
0087     // as the fourth parameter of the command.
0088     // SetUnitCandidates() defines the candidates of units. Units listed in
0089     // the argument of this method must be separated by space(s). Only the
0090     // units listed in the candidate list are accepted as the fourth parameter
0091     // of the command.
0092     // SetDefaultUnit() defines the default unit and also defines the category
0093     // of the allowed units. Thus only the units categorized as the given
0094     // default unit will be accepted.
0095     void SetUnitCategory(const char* unitCategory);
0096     void SetUnitCandidates(const char* candidateList);
0097     void SetDefaultUnit(const char* defUnit);
0098 
0099     // Convert string which represents three double values and a unit to
0100     // G4ThreeVector. Values are converted to the Geant4 internal unit
0101     static G4ThreeVector GetNew3VectorValue(const char* paramString);
0102 
0103     // Convert string which represents three double values and a unit to
0104     // G4ThreeVector. Values are NOT converted to the Geant4 internal unit
0105     // but just as the given string
0106     static G4ThreeVector GetNew3VectorRawValue(const char* paramString);
0107 
0108     // Convert the unit string to the value of the unit. "paramString"
0109     // must contain three double values AND a unit string
0110     static G4double GetNewUnitValue(const char* paramString);
0111 };
0112 
0113 #endif