Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:18:52

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 // $Id: G4Pythia6DecayerMessenger.cc,v 1.2 2014/10/07 03:06:54 mccumber Exp $
0027 //
0028 /// \file eventgenerator/pythia/decayer6/src/G4Pythia6DecayerMessenger.cc
0029 /// \brief Implementation of the G4Pythia6DecayerMessenger class
0030 
0031 // ----------------------------------------------------------------------------
0032 // Messenger class that defines commands for G4Pythia6Decayer.
0033 //
0034 // Implements command
0035 // - /pythia6Decayer/verbose [level]
0036 // - /pythia6Decayer/forceDecayType [decayType]
0037 // ----------------------------------------------------------------------------
0038 
0039 #include "G4Pythia6DecayerMessenger.hh"
0040 #include "EDecayType.hh"
0041 #include "G4Pythia6Decayer.hh"
0042 
0043 #include <Geant4/G4ApplicationState.hh>  // for G4State_Idle
0044 #include <Geant4/G4String.hh>            // for G4String
0045 #include <Geant4/G4UIcmdWithAnInteger.hh>
0046 #include <Geant4/G4UIdirectory.hh>
0047 #include <Geant4/G4UImessenger.hh>  // for G4UImessenger
0048 
0049 #include <sstream>
0050 #include <string>  // for basic_string
0051 
0052 class G4UIcommand;
0053 
0054 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0055 
0056 G4Pythia6DecayerMessenger::G4Pythia6DecayerMessenger(
0057     G4Pythia6Decayer* pythia6Decayer)
0058   : G4UImessenger()
0059   , fPythia6Decayer(pythia6Decayer)
0060   , fDirectory(nullptr)
0061   , fVerboseCmd(nullptr)
0062   , fDecayTypeCmd(nullptr)
0063 {
0064   /// Standard constructor
0065 
0066   fDirectory = new G4UIdirectory("/pythia6Decayer/");
0067   fDirectory->SetGuidance("G4Pythia6Decayer control commands.");
0068 
0069   fVerboseCmd = new G4UIcmdWithAnInteger("/pythia6Decayer/verbose", this);
0070   fVerboseCmd->SetGuidance("Set Pythia6Decayer verbose level");
0071   fVerboseCmd->SetParameterName("VerboseLevel", false);
0072   fVerboseCmd->SetRange("VerboseLevel >= 0 && VerboseLevel <= 1");
0073   fVerboseCmd->AvailableForStates(G4State_Idle);
0074 
0075   fDecayTypeCmd = new G4UIcmdWithAnInteger("/pythia6Decayer/forceDecayType", this);
0076   fDecayTypeCmd->SetGuidance("Force the specified decay type");
0077   fDecayTypeCmd->SetParameterName("DecayType", false);
0078   std::ostringstream os;
0079   os << "DecayType >=  " << kSemiElectronic
0080      << " && DecayType <= " << kMaxDecay;
0081   fDecayTypeCmd->SetRange(os.str().c_str());
0082   fDecayTypeCmd->AvailableForStates(G4State_Idle);
0083 }
0084 
0085 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0086 
0087 G4Pythia6DecayerMessenger::~G4Pythia6DecayerMessenger()
0088 {
0089   /// Destructor
0090 
0091   delete fDirectory;
0092   delete fVerboseCmd;
0093   delete fDecayTypeCmd;
0094 }
0095 
0096 //
0097 // public methods
0098 //
0099 
0100 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0101 
0102 void G4Pythia6DecayerMessenger::SetNewValue(G4UIcommand* command,
0103                                             G4String newValue)
0104 {
0105   /// Apply command to the associated object.
0106 
0107   if (command == fVerboseCmd)
0108   {
0109     fPythia6Decayer
0110         ->SetVerboseLevel(fVerboseCmd->GetNewIntValue(newValue));
0111   }
0112   else if (command == fDecayTypeCmd)
0113   {
0114     fPythia6Decayer
0115         ->ForceDecayType(EDecayType(fDecayTypeCmd->GetNewIntValue(newValue)));
0116   }
0117 }
0118 
0119 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......