EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4Pythia6DecayerMessenger.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4Pythia6DecayerMessenger.cc
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,v 1.2 2014/10/07 03:06:54 mccumber Exp $
27 //
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 "EDecayType.hh"
41 #include "G4Pythia6Decayer.hh"
42 
43 #include <Geant4/G4ApplicationState.hh> // for G4State_Idle
44 #include <Geant4/G4UIcmdWithAnInteger.hh>
45 #include <Geant4/G4UIdirectory.hh>
46 #include <Geant4/G4UImessenger.hh> // for G4UImessenger
47 
48 #include <sstream>
49 #include <string> // for basic_string
50 
51 class G4UIcommand;
52 
53 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
54 
56  G4Pythia6Decayer* pythia6Decayer)
57  : G4UImessenger()
58  , fPythia6Decayer(pythia6Decayer)
59  , fDirectory(0)
60  , fVerboseCmd(0)
61  , fDecayTypeCmd(0)
62 {
64 
65  fDirectory = new G4UIdirectory("/pythia6Decayer/");
66  fDirectory->SetGuidance("G4Pythia6Decayer control commands.");
67 
68  fVerboseCmd = new G4UIcmdWithAnInteger("/pythia6Decayer/verbose", this);
69  fVerboseCmd->SetGuidance("Set Pythia6Decayer verbose level");
70  fVerboseCmd->SetParameterName("VerboseLevel", false);
71  fVerboseCmd->SetRange("VerboseLevel >= 0 && VerboseLevel <= 1");
72  fVerboseCmd->AvailableForStates(G4State_Idle);
73 
74  fDecayTypeCmd = new G4UIcmdWithAnInteger("/pythia6Decayer/forceDecayType", this);
75  fDecayTypeCmd->SetGuidance("Force the specified decay type");
76  fDecayTypeCmd->SetParameterName("DecayType", false);
77  std::ostringstream os;
78  os << "DecayType >= " << kSemiElectronic
79  << " && DecayType <= " << kMaxDecay;
80  fDecayTypeCmd->SetRange(os.str().c_str());
81  fDecayTypeCmd->AvailableForStates(G4State_Idle);
82 }
83 
84 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
85 
87 {
89 
90  delete fDirectory;
91  delete fVerboseCmd;
92  delete fDecayTypeCmd;
93 }
94 
95 //
96 // public methods
97 //
98 
99 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
100 
101 void G4Pythia6DecayerMessenger::SetNewValue(G4UIcommand* command,
102  G4String newValue)
103 {
105 
106  if (command == fVerboseCmd)
107  {
109  ->SetVerboseLevel(fVerboseCmd->GetNewIntValue(newValue));
110  }
111  else if (command == fDecayTypeCmd)
112  {
114  ->ForceDecayType(EDecayType(fDecayTypeCmd->GetNewIntValue(newValue)));
115  }
116 }
117 
118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......