Back to home page

EIC code displayed by LXR

 
 

    


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

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 medical/GammaTherapy/src/DetectorMessenger.cc
0028 /// \brief Implementation of the DetectorMessenger class
0029 //
0030 // -------------------------------------------------------------
0031 //      GEANT4  test  IBREM
0032 //
0033 // Authors: V.Grichine, V.Ivanchenko
0034 //
0035 // Modified:
0036 //
0037 // 18-02-03 V.Ivanchenko create
0038 //
0039 // -------------------------------------------------------------
0040 
0041 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0042 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0043 
0044 #include "DetectorMessenger.hh"
0045 
0046 #include "DetectorConstruction.hh"
0047 
0048 #include "G4UIcmdWithABool.hh"
0049 #include "G4UIcmdWithADoubleAndUnit.hh"
0050 #include "G4UIcmdWithAString.hh"
0051 #include "G4UIcmdWithAnInteger.hh"
0052 #include "G4UIcmdWithoutParameter.hh"
0053 #include "G4UIdirectory.hh"
0054 
0055 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0056 
0057 DetectorMessenger::DetectorMessenger(DetectorConstruction* h) : fDetector(h)
0058 {
0059   fDetDir = new G4UIdirectory("/testem/");
0060   fDetDir->SetGuidance("General  commands");
0061   fDetDir1 = new G4UIdirectory("/testem/physics/");
0062   fDetDir1->SetGuidance(" commands to define physics");
0063   fDetDir2 = new G4UIdirectory("/testem/gun/");
0064   fDetDir2->SetGuidance(" commands to define gun");
0065 
0066   fAbsMaterCmd = new G4UIcmdWithAString("/testem/target1Material", this);
0067   fAbsMaterCmd->SetGuidance("Select Material of the target1.");
0068   fAbsMaterCmd->SetParameterName("Material1", false);
0069   fAbsMaterCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0070 
0071   fWorldMaterCmd = new G4UIcmdWithAString("/testem/target2Material", this);
0072   fWorldMaterCmd->SetGuidance("Select Material of the target2.");
0073   fWorldMaterCmd->SetParameterName("Material2", false);
0074   fWorldMaterCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0075 
0076   fAbsThickCmd = new G4UIcmdWithADoubleAndUnit("/testem/mylarZ", this);
0077   fAbsThickCmd->SetGuidance("Set mylarZ");
0078   fAbsThickCmd->SetParameterName("mylarZ", false);
0079   fAbsThickCmd->SetUnitCategory("Length");
0080   fAbsThickCmd->AvailableForStates(G4State_PreInit);
0081 
0082   fAbsGapCmd = new G4UIcmdWithADoubleAndUnit("/testem/delta", this);
0083   fAbsGapCmd->SetGuidance("Set gap between absorbers");
0084   fAbsGapCmd->SetParameterName("delta", false);
0085   fAbsGapCmd->SetUnitCategory("Length");
0086   fAbsGapCmd->AvailableForStates(G4State_PreInit);
0087 
0088   fAbsSizYZCmd = new G4UIcmdWithADoubleAndUnit("/testem/target1Z", this);
0089   fAbsSizYZCmd->SetGuidance("Set targeet1Z");
0090   fAbsSizYZCmd->SetParameterName("target1Z", false);
0091   fAbsSizYZCmd->SetUnitCategory("Length");
0092   fAbsSizYZCmd->AvailableForStates(G4State_PreInit);
0093 
0094   fWorldXCmd = new G4UIcmdWithADoubleAndUnit("/testem/target2Z", this);
0095   fWorldXCmd->SetGuidance("Set target2Z");
0096   fWorldXCmd->SetParameterName("target2Z", false);
0097   fWorldXCmd->SetUnitCategory("Length");
0098   fWorldXCmd->AvailableForStates(G4State_PreInit);
0099 
0100   fXMagFieldCmd = new G4UIcmdWithADoubleAndUnit("/testem/checkShiftZ", this);
0101   fXMagFieldCmd->SetGuidance("Define checkShftZ");
0102   fXMagFieldCmd->SetParameterName("CheckSZ", false);
0103   fXMagFieldCmd->SetUnitCategory("Length");
0104   fXMagFieldCmd->AvailableForStates(G4State_PreInit);
0105 
0106   fYMagFieldCmd = new G4UIcmdWithADoubleAndUnit("/testem/sdZ", this);
0107   fYMagFieldCmd->SetGuidance("Define sensitive detector Z");
0108   fYMagFieldCmd->SetParameterName("sdZ", false);
0109   fYMagFieldCmd->SetUnitCategory("Length");
0110   fYMagFieldCmd->AvailableForStates(G4State_PreInit);
0111 
0112   fZMagFieldCmd = new G4UIcmdWithADoubleAndUnit("/testem/sdShiftZ", this);
0113   fZMagFieldCmd->SetGuidance("Define shift of sensitive detector");
0114   fZMagFieldCmd->SetParameterName("sdShiftZ", false);
0115   fZMagFieldCmd->SetUnitCategory("Length");
0116   fZMagFieldCmd->AvailableForStates(G4State_PreInit);
0117 
0118   fNumOfAbsCmd = new G4UIcmdWithAnInteger("/testem/numberDivR", this);
0119   fNumOfAbsCmd->SetGuidance("Set number divisions R");
0120   fNumOfAbsCmd->SetParameterName("NR", false);
0121   fNumOfAbsCmd->AvailableForStates(G4State_PreInit);
0122 
0123   fNumOfEvt = new G4UIcmdWithAnInteger("/testem/numberDivZ", this);
0124   fNumOfEvt->SetGuidance("Set number of divisions Z");
0125   fNumOfEvt->SetParameterName("NZ", false);
0126   fNumOfEvt->AvailableForStates(G4State_PreInit);
0127 
0128   fVerbCmd = new G4UIcmdWithAnInteger("/testem/verbose", this);
0129   fVerbCmd->SetGuidance("Set verbose for ");
0130   fVerbCmd->SetParameterName("verb", false);
0131   fVerbCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0132 
0133   fIntCmd = new G4UIcmdWithAnInteger("/testem/numberDivE", this);
0134   fIntCmd->SetGuidance("Set number of divisions E");
0135   fIntCmd->SetParameterName("NZ", false);
0136   fIntCmd->AvailableForStates(G4State_PreInit);
0137 
0138   fDeltaECmd = new G4UIcmdWithADoubleAndUnit("/testem/maxEnergy", this);
0139   fDeltaECmd->SetGuidance("Define scale of secondary energy histogram");
0140   fDeltaECmd->SetParameterName("DeltaE", false);
0141   fDeltaECmd->SetUnitCategory("Energy");
0142   fDeltaECmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0143 }
0144 
0145 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0146 
0147 DetectorMessenger::~DetectorMessenger()
0148 {
0149   delete fDetDir;
0150   delete fDetDir1;
0151   delete fDetDir2;
0152 
0153   delete fAbsMaterCmd;
0154   delete fAbsThickCmd;
0155   delete fAbsGapCmd;
0156   delete fAbsSizYZCmd;
0157   delete fWorldMaterCmd;
0158   delete fWorldXCmd;
0159   delete fXMagFieldCmd;
0160   delete fYMagFieldCmd;
0161   delete fZMagFieldCmd;
0162   delete fNumOfAbsCmd;
0163   delete fNumOfEvt;
0164   delete fVerbCmd;
0165   delete fIntCmd;
0166   delete fDeltaECmd;
0167 }
0168 
0169 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0170 
0171 void DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0172 {
0173   if (command == fAbsMaterCmd) {
0174     fDetector->SetTarget1Material(newValue);
0175   }
0176 
0177   if (command == fWorldMaterCmd) {
0178     fDetector->SetTarget2Material(newValue);
0179   }
0180 
0181   if (command == fAbsThickCmd) {
0182     fDetector->SetMylarZ(fAbsThickCmd->GetNewDoubleValue(newValue));
0183   }
0184 
0185   if (command == fAbsGapCmd) {
0186     fDetector->SetGap(fAbsGapCmd->GetNewDoubleValue(newValue));
0187   }
0188 
0189   if (command == fAbsSizYZCmd) {
0190     fDetector->SetTarget1Z(fAbsSizYZCmd->GetNewDoubleValue(newValue));
0191   }
0192 
0193   if (command == fWorldXCmd) {
0194     fDetector->SetTarget2Z(fWorldXCmd->GetNewDoubleValue(newValue));
0195   }
0196 
0197   if (command == fXMagFieldCmd) {
0198     fDetector->SetCheckShiftZ(fXMagFieldCmd->GetNewDoubleValue(newValue));
0199   }
0200 
0201   if (command == fYMagFieldCmd) {
0202     G4double x = fYMagFieldCmd->GetNewDoubleValue(newValue);
0203     fDetector->SetAbsorberZ(x);
0204   }
0205 
0206   if (command == fZMagFieldCmd) {
0207     fDetector->SetAbsorberShiftZ(fZMagFieldCmd->GetNewDoubleValue(newValue));
0208   }
0209 
0210   if (command == fNumOfAbsCmd) {
0211     fDetector->SetNumberDivR(fNumOfAbsCmd->GetNewIntValue(newValue));
0212   }
0213 
0214   if (command == fNumOfEvt) {
0215     fDetector->SetNumberDivZ(fNumOfEvt->GetNewIntValue(newValue));
0216   }
0217 
0218   if (command == fIntCmd) {
0219     fDetector->SetNumberDivE(fIntCmd->GetNewIntValue(newValue));
0220   }
0221   if (command == fDeltaECmd) {
0222     fDetector->SetMaxEnergy(fDeltaECmd->GetNewDoubleValue(newValue));
0223   }
0224 
0225   if (command == fVerbCmd) {
0226     G4int ver = fVerbCmd->GetNewIntValue(newValue);
0227     fDetector->SetVerbose(ver);
0228   }
0229 }
0230 
0231 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......