Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:20:47

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 biasing/ReverseMC01/src/RMC01DetectorMessenger.cc
0027 /// \brief Implementation of the RMC01DetectorMessenger class
0028 //
0029 //
0030 //////////////////////////////////////////////////////////////
0031 //      Class Name:        RMC01DetectorMessenger
0032 //        Author:               L. Desorgher
0033 //         Organisation:         SpaceIT GmbH
0034 //        Contract:        ESA contract 21435/08/NL/AT
0035 //         Customer:             ESA/ESTEC
0036 //////////////////////////////////////////////////////////////
0037 
0038 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0039 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0040 
0041 #include "RMC01DetectorMessenger.hh"
0042 
0043 #include "RMC01DetectorConstruction.hh"
0044 
0045 #include "G4UIcmdWith3VectorAndUnit.hh"
0046 #include "G4UIcmdWithADoubleAndUnit.hh"
0047 #include "G4UIdirectory.hh"
0048 
0049 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0050 
0051 RMC01DetectorMessenger::RMC01DetectorMessenger(RMC01DetectorConstruction* GeneralDet)
0052   : G4UImessenger(),
0053     fTheDetector(GeneralDet),
0054     fGeneralDir(0),
0055     fDetDir(0),
0056     fSetSensitiveVolumeHeightCmd(0),
0057     fSetSensitiveVolumeRadiusCmd(0),
0058     fSetShieldingThicknessCmd(0)
0059 {
0060   fGeneralDir = new G4UIdirectory("/RMC01/");
0061   fGeneralDir->SetGuidance("Control of the Geant4 Reverse Monte Carlo example1");
0062 
0063   fDetDir = new G4UIdirectory("/RMC01/geometry/");
0064   fDetDir->SetGuidance("Geometry control");
0065 
0066   fSetSensitiveVolumeHeightCmd =
0067     new G4UIcmdWithADoubleAndUnit("/RMC01/geometry/SetSensitiveVolumeHeight", this);
0068   fSetSensitiveVolumeHeightCmd->SetGuidance("Set the height of the sensitive cylinder");
0069   fSetSensitiveVolumeHeightCmd->AvailableForStates(G4State_PreInit);
0070 
0071   fSetSensitiveVolumeRadiusCmd =
0072     new G4UIcmdWithADoubleAndUnit("/RMC01/geometry/SetSensitiveVolumeRadius", this);
0073   fSetSensitiveVolumeRadiusCmd->SetGuidance("Set the radius of the sensitive cylinder");
0074   fSetSensitiveVolumeRadiusCmd->AvailableForStates(G4State_PreInit);
0075 
0076   fSetShieldingThicknessCmd =
0077     new G4UIcmdWithADoubleAndUnit("/RMC01/geometry/SetShieldingThickness", this);
0078   fSetShieldingThicknessCmd->SetGuidance("Set the thickness of the Aluminum Shielding sphere");
0079   fSetShieldingThicknessCmd->AvailableForStates(G4State_PreInit);
0080 }
0081 
0082 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0083 
0084 RMC01DetectorMessenger::~RMC01DetectorMessenger()
0085 {
0086   if (fGeneralDir) delete fGeneralDir;
0087   if (fDetDir) delete fDetDir;
0088   if (fSetSensitiveVolumeHeightCmd) delete fSetSensitiveVolumeHeightCmd;
0089   if (fSetSensitiveVolumeRadiusCmd) delete fSetSensitiveVolumeRadiusCmd;
0090   if (fSetShieldingThicknessCmd) delete fSetShieldingThicknessCmd;
0091 }
0092 
0093 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0094 
0095 void RMC01DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0096 {
0097   if (command == fSetSensitiveVolumeHeightCmd) {
0098     fTheDetector->SetSensitiveVolumeHeight(
0099       fSetSensitiveVolumeHeightCmd->GetNewDoubleValue(newValue));
0100   }
0101 
0102   else if (command == fSetSensitiveVolumeRadiusCmd) {
0103     fTheDetector->SetSensitiveVolumeRadius(
0104       fSetSensitiveVolumeRadiusCmd->GetNewDoubleValue(newValue));
0105   }
0106 
0107   else if (command == fSetShieldingThicknessCmd) {
0108     fTheDetector->SetShieldingThickness(fSetShieldingThicknessCmd->GetNewDoubleValue(newValue));
0109   }
0110 }
0111 
0112 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......