Back to home page

EIC code displayed by LXR

 
 

    


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