Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-20 08:29:34

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