Back to home page

EIC code displayed by LXR

 
 

    


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

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 //
0027 /// \file B2bDetectorMessenger.cc
0028 /// \brief Implementation of the B2bDetectorMessenger class
0029 
0030 #include "B2bDetectorMessenger.hh"
0031 
0032 #include "B2bDetectorConstruction.hh"
0033 
0034 #include "G4UIcmdWithADoubleAndUnit.hh"
0035 #include "G4UIcmdWithAString.hh"
0036 #include "G4UIdirectory.hh"
0037 
0038 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0039 
0040 B2bDetectorMessenger::B2bDetectorMessenger(B2bDetectorConstruction* Det)
0041   : G4UImessenger(), fDetectorConstruction(Det)
0042 {
0043   fB2Directory = new G4UIdirectory("/B2/");
0044   fB2Directory->SetGuidance("UI commands specific to this example.");
0045 
0046   fDetDirectory = new G4UIdirectory("/B2/det/");
0047   fDetDirectory->SetGuidance("Detector construction control");
0048 
0049   fTargMatCmd = new G4UIcmdWithAString("/B2/det/setTargetMaterial", this);
0050   fTargMatCmd->SetGuidance("Select Material of the Target.");
0051   fTargMatCmd->SetParameterName("choice", false);
0052   fTargMatCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0053 
0054   fChamMatCmd = new G4UIcmdWithAString("/B2/det/setChamberMaterial", this);
0055   fChamMatCmd->SetGuidance("Select Material of the Chamber.");
0056   fChamMatCmd->SetParameterName("choice", false);
0057   fChamMatCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0058 
0059   fStepMaxCmd = new G4UIcmdWithADoubleAndUnit("/B2/det/stepMax", this);
0060   fStepMaxCmd->SetGuidance("Define a step max");
0061   fStepMaxCmd->SetParameterName("stepMax", false);
0062   fStepMaxCmd->SetUnitCategory("Length");
0063   fStepMaxCmd->AvailableForStates(G4State_Idle);
0064 }
0065 
0066 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0067 
0068 B2bDetectorMessenger::~B2bDetectorMessenger()
0069 {
0070   delete fTargMatCmd;
0071   delete fChamMatCmd;
0072   delete fStepMaxCmd;
0073   delete fB2Directory;
0074   delete fDetDirectory;
0075 }
0076 
0077 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0078 
0079 void B2bDetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0080 {
0081   if (command == fTargMatCmd) {
0082     fDetectorConstruction->SetTargetMaterial(newValue);
0083   }
0084 
0085   if (command == fChamMatCmd) {
0086     fDetectorConstruction->SetChamberMaterial(newValue);
0087   }
0088 
0089   if (command == fStepMaxCmd) {
0090     fDetectorConstruction->SetMaxStep(fStepMaxCmd->GetNewDoubleValue(newValue));
0091   }
0092 }
0093 
0094 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......