Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:21:08

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 /// \file eventgenerator/HepMC/HepMCEx02/src/H02PrimaryGeneratorMessenger.cc
0027 /// \brief Implementation of the H02PrimaryGeneratorMessenger class
0028 //
0029 //
0030 #include "H02PrimaryGeneratorMessenger.hh"
0031 
0032 #include "H02PrimaryGeneratorAction.hh"
0033 
0034 #include "G4UIcmdWithABool.hh"
0035 #include "G4UIcmdWithAString.hh"
0036 #include "G4UIcmdWithAnInteger.hh"
0037 #include "G4UIcmdWithoutParameter.hh"
0038 #include "G4UIcommand.hh"
0039 #include "G4UIdirectory.hh"
0040 #include "G4UIparameter.hh"
0041 
0042 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0043 H02PrimaryGeneratorMessenger::H02PrimaryGeneratorMessenger(H02PrimaryGeneratorAction* genaction)
0044   : G4UImessenger(), fPrimaryAction(genaction)
0045 {
0046   fDir = new G4UIdirectory("/generator/");
0047   fDir->SetGuidance("Control commands for primary generator");
0048 
0049   // verbose= new G4UIcmdWithAnInteger("/generator/verbose", this);
0050   // verbose-> SetGuidance("set verbose level (0,1,2)");
0051   // verbose-> SetParameterName("verbose", false, false);
0052   // verbose-> SetDefaultValue(0);
0053   // verbose-> SetRange("verbose>=0 && verbose<=2");
0054 
0055   fSelect = new G4UIcmdWithAString("/generator/select", this);
0056   fSelect->SetGuidance("fSelect generator type");
0057   fSelect->SetParameterName("generator_type", false, false);
0058   fSelect->SetCandidates("particleGun pythia hepmcAscii");
0059   fSelect->SetDefaultValue("particleGun");
0060 }
0061 
0062 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0063 H02PrimaryGeneratorMessenger::~H02PrimaryGeneratorMessenger()
0064 {
0065   // delete verbose;
0066   delete fSelect;
0067 
0068   delete fDir;
0069 }
0070 
0071 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0072 void H02PrimaryGeneratorMessenger::SetNewValue(G4UIcommand* command, G4String newValues)
0073 {
0074   if (command == fSelect) {
0075     fPrimaryAction->SetGenerator(newValues);
0076     G4cout << "current generator type: " << fPrimaryAction->GetGeneratorName() << G4endl;
0077   }
0078   else {
0079   }
0080 }
0081 
0082 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0083 G4String H02PrimaryGeneratorMessenger::GetCurrentValue(G4UIcommand* command)
0084 {
0085   G4String cv, st;
0086   if (command == fSelect) {
0087     cv = fPrimaryAction->GetGeneratorName();
0088   }
0089 
0090   return cv;
0091 }