Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4Pythia6DecayerMessenger.cc
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 //
26 // $Id: G4Pythia6DecayerMessenger.cc 72244 2013-07-12 08:49:56Z gcosmo $
27 //
28 /// \file eventgenerator/pythia/decayer6/src/G4Pythia6DecayerMessenger.cc
29 /// \brief Implementation of the G4Pythia6DecayerMessenger class
30 
31 // ----------------------------------------------------------------------------
32 // Messenger class that defines commands for G4Pythia6Decayer.
33 //
34 // Implements command
35 // - /pythia6Decayer/verbose [level]
36 // - /pythia6Decayer/forceDecayType [decayType]
37 // ----------------------------------------------------------------------------
38 
40 #include "G4Pythia6Decayer.hh"
41 #include "EDecayType.hh"
42 
43 #include <G4UIdirectory.hh>
44 #include <G4UIcmdWithAnInteger.hh>
45 
46 #include <sstream>
47 
48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
49 
51  G4Pythia6Decayer* pythia6Decayer)
52  : G4UImessenger(),
53  fPythia6Decayer(pythia6Decayer),
54  fDirectory(0),
55  fVerboseCmd(0),
56  fDecayTypeCmd(0)
57 {
58 /// Standard constructor
59 
60  fDirectory = new G4UIdirectory("/pythia6Decayer/");
61  fDirectory->SetGuidance("G4Pythia6Decayer control commands.");
62 
63  fVerboseCmd
64  = new G4UIcmdWithAnInteger("/pythia6Decayer/verbose", this);
65  fVerboseCmd->SetGuidance("Set Pythia6Decayer verbose level");
66  fVerboseCmd->SetParameterName("VerboseLevel", false);
67  fVerboseCmd->SetRange("VerboseLevel >= 0 && VerboseLevel <= 1");
68  fVerboseCmd->AvailableForStates(G4State_Idle);
69 
70  fDecayTypeCmd
71  = new G4UIcmdWithAnInteger("/pythia6Decayer/forceDecayType", this);
72  fDecayTypeCmd->SetGuidance("Force the specified decay type");
73  fDecayTypeCmd->SetParameterName("DecayType", false);
74  std::ostringstream os;
75  os << "DecayType >= " << kSemiElectronic
76  << " && DecayType <= " << kMaxDecay;
77  fDecayTypeCmd->SetRange(os.str().c_str());
78  fDecayTypeCmd->AvailableForStates(G4State_Idle);
79 }
80 
81 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
82 
84 {
85 /// Destructor
86 
87  delete fDirectory;
88  delete fVerboseCmd;
89  delete fDecayTypeCmd;
90 }
91 
92 //
93 // public methods
94 //
95 
96 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
97 
99  G4String newValue)
100 {
101 /// Apply command to the associated object.
102 
103  if(command == fVerboseCmd) {
104  fPythia6Decayer
105  ->SetVerboseLevel(fVerboseCmd->GetNewIntValue(newValue));
106  }
107  else if(command == fDecayTypeCmd) {
108  fPythia6Decayer
109  ->ForceDecayType(EDecayType(fDecayTypeCmd->GetNewIntValue(newValue)));
110  }
111 }
112 
113 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
static G4int GetNewIntValue(const char *paramString)
Definition of the G4Pythia6Decayer class.
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:225
void SetVerboseLevel(G4int verboseLevel)
virtual void SetNewValue(G4UIcommand *command, G4String string)
G4Pythia6DecayerMessenger(G4Pythia6Decayer *pythia6Decayer)
EDecayType
Definition: EDecayType.hh:41
void ForceDecayType(EDecayType decayType)
Definition of the EDecayType enumeration.
Definition of the G4Pythia6DecayerMessenger class.