Back to home page

EIC code displayed by LXR

 
 

    


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

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 exoticphysics/monopole/src/G4MonopolePhysicsMessenger.cc
0027 /// \brief Implementation of the G4MonopolePhysicsMessenger class
0028 //
0029 //
0030 //  12.07.10  S.Burdin (changed the magnetic and electric charge variables
0031 //            from integer to double)
0032 //
0033 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0034 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0035 
0036 #include "G4MonopolePhysicsMessenger.hh"
0037 
0038 #include "G4MonopolePhysics.hh"
0039 #include "G4UIcmdWithADouble.hh"
0040 #include "G4UIcmdWithADoubleAndUnit.hh"
0041 #include "G4UIcommand.hh"
0042 #include "G4UIdirectory.hh"
0043 
0044 #include <sstream>
0045 
0046 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0047 
0048 G4MonopolePhysicsMessenger::G4MonopolePhysicsMessenger(G4MonopolePhysics* p)
0049   : G4UImessenger(), fPhys(p)
0050 {
0051   fPhysicsDir = new G4UIdirectory("/monopole/");
0052   fPhysicsDir->SetGuidance("histograms control");
0053 
0054   fPhysicsCmd = new G4UIcommand("/monopole/setup", this);
0055   fPhysicsCmd->SetGuidance("Setup monopole");
0056   //
0057   G4UIparameter* qmag = new G4UIparameter("qmag", 'd', false);
0058   qmag->SetGuidance("Magnetic charge");
0059   qmag->SetDefaultValue("1");
0060   fPhysicsCmd->SetParameter(qmag);
0061 
0062   G4UIparameter* q = new G4UIparameter("qelec", 'd', false);
0063   q->SetGuidance("Electric charge charge");
0064   q->SetDefaultValue("0");
0065   fPhysicsCmd->SetParameter(q);
0066   //
0067   G4UIparameter* mass = new G4UIparameter("mass", 'd', false);
0068   mass->SetGuidance("mass");
0069   mass->SetParameterRange("mass>0.");
0070   qmag->SetDefaultValue("100");
0071   fPhysicsCmd->SetParameter(mass);
0072   //
0073   G4UIparameter* unit = new G4UIparameter("unit", 's', false);
0074   fPhysicsCmd->SetParameter(unit);
0075   qmag->SetDefaultValue("GeV");
0076   fPhysicsCmd->AvailableForStates(G4State_PreInit);
0077 }
0078 
0079 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0080 
0081 G4MonopolePhysicsMessenger::~G4MonopolePhysicsMessenger()
0082 {
0083   delete fPhysicsCmd;
0084   delete fPhysicsDir;
0085 }
0086 
0087 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0088 
0089 void G4MonopolePhysicsMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0090 {
0091   if (command == fPhysicsCmd) {
0092     G4double q, m;
0093     G4double mass;
0094     G4String unts;
0095     std::istringstream is(newValue);
0096     is >> m >> q >> mass >> unts;
0097     G4String unit = unts;
0098     G4double vUnit = G4UIcommand::ValueOf(unit);
0099     fPhys->SetMagneticCharge(m);
0100     fPhys->SetElectricCharge(q);
0101     fPhys->SetMonopoleMass(mass * vUnit);
0102   }
0103 }
0104 
0105 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......