Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-15 08:29:44

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 G02DetectorMessenger.cc
0027 /// \brief Implementation of the G02DetectorMessenger class
0028 
0029 // Class G02DetectorMessenger implementation
0030 //
0031 // ----------------------------------------------------------------------------
0032 
0033 #include "G02DetectorMessenger.hh"
0034 
0035 #include "G02DetectorConstruction.hh"
0036 
0037 #include "G4UIcmdWithAString.hh"
0038 #include "G4UIcmdWithAnInteger.hh"
0039 #include "G4UIdirectory.hh"
0040 #include "globals.hh"
0041 
0042 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0043 
0044 G02DetectorMessenger::G02DetectorMessenger(G02DetectorConstruction* myDet)
0045   : G4UImessenger(),
0046     fTheDetector(myDet),
0047     fTheDetectorDir(0),
0048     fTheReadCommand(0),
0049     fTheWriteCommand(0),
0050     fTheStepCommand(0)
0051 {
0052   fTheDetectorDir = new G4UIdirectory("/mydet/");
0053   fTheDetectorDir->SetGuidance("Detector control.");
0054 
0055   fTheReadCommand = new G4UIcmdWithAString("/mydet/readFile", this);
0056   fTheReadCommand->SetGuidance("READ GDML file with given name");
0057   fTheReadCommand->SetParameterName("FileRead", false);
0058   fTheReadCommand->SetDefaultValue("test.gdml");
0059   fTheReadCommand->AvailableForStates(G4State_PreInit);
0060 
0061   fTheWriteCommand = new G4UIcmdWithAString("/mydet/writeFile", this);
0062   fTheWriteCommand->SetGuidance("WRITE geometry to GDML file with given name");
0063   fTheWriteCommand->SetParameterName("FileWrite", false);
0064   fTheWriteCommand->SetDefaultValue("wtest.gdml");
0065   fTheWriteCommand->AvailableForStates(G4State_PreInit);
0066 
0067   fTheStepCommand = new G4UIcmdWithAString("/mydet/StepFile", this);
0068   fTheStepCommand->SetGuidance("Read STEP Tools files (name without extension)");
0069   fTheStepCommand->SetParameterName("STEPFile", false);
0070   fTheStepCommand->SetDefaultValue("mbb");
0071   fTheStepCommand->AvailableForStates(G4State_PreInit);
0072 }
0073 
0074 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0075 
0076 G02DetectorMessenger::~G02DetectorMessenger()
0077 {
0078   delete fTheReadCommand;
0079   delete fTheWriteCommand;
0080   delete fTheStepCommand;
0081   delete fTheDetectorDir;
0082 }
0083 
0084 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0085 
0086 void G02DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0087 {
0088   if (command == fTheReadCommand) {
0089     fTheDetector->SetReadFile(newValue);
0090   }
0091   if (command == fTheWriteCommand) {
0092     fTheDetector->SetWriteFile(newValue);
0093   }
0094   if (command == fTheStepCommand) {
0095     fTheDetector->SetStepFile(newValue);
0096   }
0097 }