Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:31:10

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 medical/dna/AuNP/src/DetectorMessenger.cc
0027 /// \brief Implementation of the DetectorMessenger class
0028 //
0029 // $Id: DetectorMessenger.cc 78723 2014-01-20 10:32:17Z gcosmo $
0030 //
0031 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0032 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0033 
0034 #include "DetectorMessenger.hh"
0035 
0036 #include "DetectorConstruction.hh"
0037 
0038 #include "G4UIcmdWithADoubleAndUnit.hh"
0039 #include "G4UIcmdWithAString.hh"
0040 #include "G4UIcmdWithAnInteger.hh"
0041 #include "G4UIdirectory.hh"
0042 
0043 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0044 
0045 DetectorMessenger::DetectorMessenger(DetectorConstruction* Det)
0046   : G4UImessenger(),
0047     fDetector(Det),
0048     fTestemDir(0),
0049     fDetDir(0),
0050     fNPMaterCmd(0),
0051     fNReplicaRCmd(0),
0052     fNReplicaAzmCmd(0),
0053     fAbsRadiusCmd(0),
0054     fNPRadiusCmd(0),
0055     fTrackingCutCmd(0)
0056 {
0057   fTestemDir = new G4UIdirectory("/AuNP/");
0058   fTestemDir->SetGuidance("Detector control.");
0059 
0060   fDetDir = new G4UIdirectory("/AuNP/det/");
0061   fDetDir->SetGuidance("Detector construction commands");
0062 
0063   fNPMaterCmd = new G4UIcmdWithAString("/AuNP/det/setNPMat", this);
0064   fNPMaterCmd->SetGuidance("Select material of the sphere.");
0065   fNPMaterCmd->SetParameterName("choice", false);
0066   fNPMaterCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0067   fNPMaterCmd->SetToBeBroadcasted(false);
0068 
0069   fNReplicaRCmd = new G4UIcmdWithAnInteger("/AuNP/det/setNReplicaR", this);
0070   fNReplicaRCmd->SetGuidance("Set Number of Replica in R direction");
0071   fNReplicaRCmd->SetParameterName("NR", false);
0072   fNReplicaRCmd->SetRange("NR>0");
0073   fNReplicaRCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0074   fNReplicaRCmd->SetToBeBroadcasted(false);
0075 
0076   fNReplicaAzmCmd = new G4UIcmdWithAnInteger("/AuNP/det/setNReplicaAzm", this);
0077   fNReplicaAzmCmd->SetGuidance("Set Number of Replica in Azimuthal direction");
0078   fNReplicaAzmCmd->SetParameterName("NAzm", false);
0079   fNReplicaAzmCmd->SetRange("NAzm>0");
0080   fNReplicaAzmCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0081   fNReplicaAzmCmd->SetToBeBroadcasted(false);
0082 
0083   fAbsRadiusCmd = new G4UIcmdWithADoubleAndUnit("/AuNP/det/setAbsRadius", this);
0084   fAbsRadiusCmd->SetGuidance("Set radius of the absorber");
0085   fAbsRadiusCmd->SetParameterName("Radius", false);
0086   fAbsRadiusCmd->SetRange("Radius>0.");
0087   fAbsRadiusCmd->SetUnitCategory("Length");
0088   fAbsRadiusCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0089   fAbsRadiusCmd->SetToBeBroadcasted(false);
0090 
0091   fNPRadiusCmd = new G4UIcmdWithADoubleAndUnit("/AuNP/det/setNPRadius", this);
0092   fNPRadiusCmd->SetGuidance("Set radius of the nano particle");
0093   fNPRadiusCmd->SetParameterName("Radius", false);
0094   fNPRadiusCmd->SetRange("Radius>0.");
0095   fNPRadiusCmd->SetUnitCategory("Length");
0096   fNPRadiusCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0097   fNPRadiusCmd->SetToBeBroadcasted(false);
0098 
0099   fTrackingCutCmd = new G4UIcmdWithADoubleAndUnit("/AuNP/det/setTrackingCut", this);
0100   fTrackingCutCmd->SetGuidance("Set tracking cut in the absorber");
0101   fTrackingCutCmd->SetParameterName("Cut", false);
0102   fTrackingCutCmd->SetRange("Cut>0.");
0103   fTrackingCutCmd->SetUnitCategory("Energy");
0104   fTrackingCutCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0105   fTrackingCutCmd->SetToBeBroadcasted(false);
0106 }
0107 
0108 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0109 
0110 DetectorMessenger::~DetectorMessenger()
0111 {
0112   delete fNPMaterCmd;
0113   delete fNReplicaRCmd;
0114   delete fNReplicaAzmCmd;
0115   delete fAbsRadiusCmd;
0116   delete fNPRadiusCmd;
0117   delete fTrackingCutCmd;
0118   delete fDetDir;
0119   delete fTestemDir;
0120 }
0121 
0122 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0123 
0124 void DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0125 {
0126   if (command == fNPMaterCmd) {
0127     fDetector->SetNPMaterial(newValue);
0128   }
0129 
0130   if (command == fNReplicaRCmd) {
0131     fDetector->SetNReplicaR(fNReplicaRCmd->GetNewIntValue(newValue));
0132   }
0133 
0134   if (command == fNReplicaAzmCmd) {
0135     fDetector->SetNReplicaAzm(fNReplicaAzmCmd->GetNewIntValue(newValue));
0136   }
0137 
0138   if (command == fAbsRadiusCmd) {
0139     fDetector->SetAbsRadius(fAbsRadiusCmd->GetNewDoubleValue(newValue));
0140   }
0141 
0142   if (command == fNPRadiusCmd) {
0143     fDetector->SetNPRadius(fNPRadiusCmd->GetNewDoubleValue(newValue));
0144   }
0145 
0146   if (command == fTrackingCutCmd) {
0147     fDetector->SetTrackingCut(fTrackingCutCmd->GetNewDoubleValue(newValue));
0148   }
0149 }
0150 
0151 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......