Analysis Software
Documentation for sPHENIX simulation 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/G4String.hh> // for G4String
45 #include <Geant4/G4UIcmdWithAnInteger.hh>
46 #include <Geant4/G4UIdirectory.hh>
47 #include <Geant4/G4UImessenger.hh> // for G4UImessenger
48 
49 #include <sstream>
50 #include <string> // for basic_string
51 
52 class G4UIcommand;
53 
54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
55 
57  G4Pythia6Decayer* pythia6Decayer)
58  : G4UImessenger()
59  , fPythia6Decayer(pythia6Decayer)
60  , fDirectory(nullptr)
61  , fVerboseCmd(nullptr)
62  , fDecayTypeCmd(nullptr)
63 {
65 
66  fDirectory = new G4UIdirectory("/pythia6Decayer/");
67  fDirectory->SetGuidance("G4Pythia6Decayer control commands.");
68 
69  fVerboseCmd = new G4UIcmdWithAnInteger("/pythia6Decayer/verbose", this);
70  fVerboseCmd->SetGuidance("Set Pythia6Decayer verbose level");
71  fVerboseCmd->SetParameterName("VerboseLevel", false);
72  fVerboseCmd->SetRange("VerboseLevel >= 0 && VerboseLevel <= 1");
73  fVerboseCmd->AvailableForStates(G4State_Idle);
74 
75  fDecayTypeCmd = new G4UIcmdWithAnInteger("/pythia6Decayer/forceDecayType", this);
76  fDecayTypeCmd->SetGuidance("Force the specified decay type");
77  fDecayTypeCmd->SetParameterName("DecayType", false);
78  std::ostringstream os;
79  os << "DecayType >= " << kSemiElectronic
80  << " && DecayType <= " << kMaxDecay;
81  fDecayTypeCmd->SetRange(os.str().c_str());
82  fDecayTypeCmd->AvailableForStates(G4State_Idle);
83 }
84 
85 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
86 
88 {
90 
91  delete fDirectory;
92  delete fVerboseCmd;
93  delete fDecayTypeCmd;
94 }
95 
96 //
97 // public methods
98 //
99 
100 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
101 
102 void G4Pythia6DecayerMessenger::SetNewValue(G4UIcommand* command,
103  G4String newValue)
104 {
106 
107  if (command == fVerboseCmd)
108  {
110  ->SetVerboseLevel(fVerboseCmd->GetNewIntValue(newValue));
111  }
112  else if (command == fDecayTypeCmd)
113  {
115  ->ForceDecayType(EDecayType(fDecayTypeCmd->GetNewIntValue(newValue)));
116  }
117 }
118 
119 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......