Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-19 08:38:45

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 ExP01DetectorMessenger.cc
0027 /// \brief Implementation of the ExP01DetectorMessenger class
0028 
0029 #include "ExP01DetectorMessenger.hh"
0030 
0031 #include "ExP01DetectorConstruction.hh"
0032 
0033 #include "G4UIcmdWithADoubleAndUnit.hh"
0034 #include "G4UIcmdWithAString.hh"
0035 #include "G4UIdirectory.hh"
0036 #include "globals.hh"
0037 
0038 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0039 
0040 ExP01DetectorMessenger::ExP01DetectorMessenger(ExP01DetectorConstruction* myDet)
0041   : G4UImessenger(),
0042     fDetector(myDet),
0043     fN02Dir(0),
0044     fDetDir(0),
0045     fTargMatCmd(0),
0046     fChamMatCmd(0),
0047     fFieldCmd(0)
0048 {
0049   fN02Dir = new G4UIdirectory("/P01/");
0050   fN02Dir->SetGuidance("UI commands specific to this example.");
0051 
0052   fDetDir = new G4UIdirectory("/P01/det/");
0053   fDetDir->SetGuidance("detector control.");
0054 
0055   fTargMatCmd = new G4UIcmdWithAString("/P01/det/setTargetMate", this);
0056   fTargMatCmd->SetGuidance("Select Material of the Target.");
0057   fTargMatCmd->SetParameterName("choice", false);
0058   fTargMatCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0059 
0060   fChamMatCmd = new G4UIcmdWithAString("/P01/det/setChamberMate", this);
0061   fChamMatCmd->SetGuidance("Select Material of the Target.");
0062   fChamMatCmd->SetParameterName("choice", false);
0063   fChamMatCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0064 
0065   fFieldCmd = new G4UIcmdWithADoubleAndUnit("/P01/det/setField", this);
0066   fFieldCmd->SetGuidance("Define magnetic field.");
0067   fFieldCmd->SetGuidance("Magnetic field will be in X direction.");
0068   fFieldCmd->SetParameterName("Bx", false);
0069   fFieldCmd->SetUnitCategory("Magnetic flux density");
0070   fFieldCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0071 }
0072 
0073 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0074 
0075 ExP01DetectorMessenger::~ExP01DetectorMessenger()
0076 {
0077   delete fTargMatCmd;
0078   delete fChamMatCmd;
0079   delete fFieldCmd;
0080   delete fDetDir;
0081   delete fN02Dir;
0082 }
0083 
0084 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0085 
0086 void ExP01DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0087 {
0088   if (command == fTargMatCmd) {
0089     fDetector->SetTargetMaterial(newValue);
0090   }
0091 
0092   if (command == fChamMatCmd) {
0093     fDetector->SetChamberMaterial(newValue);
0094   }
0095 
0096   if (command == fFieldCmd) {
0097     fDetector->SetMagField(fFieldCmd->GetNewDoubleValue(newValue));
0098   }
0099 }
0100 
0101 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......