Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:37

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