Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:21: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 field/field04/src/F04DetectorMessenger.cc
0028 /// \brief Implementation of the F04DetectorMessenger class
0029 //
0030 
0031 #include "F04DetectorMessenger.hh"
0032 
0033 #include "G4UIcmdWithADoubleAndUnit.hh"
0034 #include "G4UIcmdWithAString.hh"
0035 #include "G4UIcmdWithAnInteger.hh"
0036 #include "G4UIcmdWithoutParameter.hh"
0037 #include "G4UIdirectory.hh"
0038 
0039 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0040 
0041 F04DetectorMessenger::F04DetectorMessenger(F04DetectorConstruction* detector) : fDetector(detector)
0042 {
0043   fDetDir = new G4UIdirectory("/field04/");
0044   fDetDir->SetGuidance(" field04 Simulation ");
0045 
0046   fWorldMaterCmd = new G4UIcmdWithAString("/field04/SetWorldMat", this);
0047   fWorldMaterCmd->SetGuidance("Select Material of the World");
0048   fWorldMaterCmd->SetParameterName("wchoice", true);
0049   fWorldMaterCmd->SetDefaultValue("Air");
0050   fWorldMaterCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0051   fWorldMaterCmd->SetToBeBroadcasted(false);
0052 
0053   fWorldRCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetWorldR", this);
0054   fWorldRCmd->SetGuidance("Set Radius of the World");
0055   fWorldRCmd->SetParameterName("WSizeR", false, false);
0056   fWorldRCmd->SetDefaultUnit("cm");
0057   fWorldRCmd->SetRange("WSizeR>0.");
0058   fWorldRCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0059   fWorldRCmd->SetToBeBroadcasted(false);
0060 
0061   fWorldZCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetWorldZ", this);
0062   fWorldZCmd->SetGuidance("Set Length of the World");
0063   fWorldZCmd->SetParameterName("WSizeZ", false, false);
0064   fWorldZCmd->SetDefaultUnit("cm");
0065   fWorldZCmd->SetRange("WSizeZ>0.");
0066   fWorldZCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0067   fWorldZCmd->SetToBeBroadcasted(false);
0068 
0069   fCaptureRCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetCaptureR", this);
0070   fCaptureRCmd->SetGuidance("Set Radius of the Capture Magnet");
0071   fCaptureRCmd->SetParameterName("CSizeR", false, false);
0072   fCaptureRCmd->SetDefaultUnit("cm");
0073   fCaptureRCmd->SetRange("CSizeR>0.");
0074   fCaptureRCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0075   fCaptureRCmd->SetToBeBroadcasted(false);
0076 
0077   fCaptureZCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetCaptureZ", this);
0078   fCaptureZCmd->SetGuidance("Set Length of the Capture Magnet");
0079   fCaptureZCmd->SetParameterName("CSizeZ", false, false);
0080   fCaptureZCmd->SetDefaultUnit("cm");
0081   fCaptureZCmd->SetRange("CSizeZ>0.");
0082   fCaptureZCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0083   fCaptureZCmd->SetToBeBroadcasted(false);
0084 
0085   fTransferRCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTransferR", this);
0086   fTransferRCmd->SetGuidance("Set Radius of the Transfer Magnet");
0087   fTransferRCmd->SetParameterName("TSizeR", false, false);
0088   fTransferRCmd->SetDefaultUnit("cm");
0089   fTransferRCmd->SetRange("TSizeR>0.");
0090   fTransferRCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0091   fTransferRCmd->SetToBeBroadcasted(false);
0092 
0093   fTransferZCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTransferZ", this);
0094   fTransferZCmd->SetGuidance("Set Length of the Transfer Magnet");
0095   fTransferZCmd->SetParameterName("TSizeZ", false, false);
0096   fTransferZCmd->SetDefaultUnit("cm");
0097   fTransferZCmd->SetRange("TSizeZ>0.");
0098   fTransferZCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0099   fTransferZCmd->SetToBeBroadcasted(false);
0100 
0101   fTransferPCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTransferP", this);
0102   fTransferPCmd->SetGuidance("Set Z pos of the T-Mgnt from end of C-Mgnt");
0103   fTransferPCmd->SetParameterName("TSizeP", false, false);
0104   fTransferPCmd->SetDefaultUnit("cm");
0105   fTransferPCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0106   fTransferPCmd->SetToBeBroadcasted(false);
0107 
0108   fTgtMaterCmd = new G4UIcmdWithAString("/field04/SetTgtMat", this);
0109   fTgtMaterCmd->SetGuidance("Select Material of the Target");
0110   fTgtMaterCmd->SetParameterName("tchoice", true);
0111   fTgtMaterCmd->SetDefaultValue("Tungsten");
0112   fTgtMaterCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0113   fTgtMaterCmd->SetToBeBroadcasted(false);
0114 
0115   fTgtRadCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTgtRad", this);
0116   fTgtRadCmd->SetGuidance("Set Radius of the Target");
0117   fTgtRadCmd->SetParameterName("TgtSizeR", false, false);
0118   fTgtRadCmd->SetDefaultUnit("cm");
0119   fTgtRadCmd->SetRange("TgtSizeR>0.");
0120   fTgtRadCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0121   fTgtRadCmd->SetToBeBroadcasted(false);
0122 
0123   fTgtThickCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTgtThick", this);
0124   fTgtThickCmd->SetGuidance("Set Thickness of the Target");
0125   fTgtThickCmd->SetParameterName("TgtSizeZ", false, false);
0126   fTgtThickCmd->SetDefaultUnit("cm");
0127   fTgtThickCmd->SetRange("TgtSizeZ>0.");
0128   fTgtThickCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0129   fTgtThickCmd->SetToBeBroadcasted(false);
0130 
0131   fTgtPosCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetTgtPos", this);
0132   fTgtPosCmd->SetGuidance("Set Z pos of the tgt relative to C-Mgnt centre");
0133   fTgtPosCmd->SetParameterName("TgtSizeP", false, false);
0134   fTgtPosCmd->SetDefaultUnit("cm");
0135   fTgtPosCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0136   fTgtPosCmd->SetToBeBroadcasted(false);
0137 
0138   fTgtAngCmd = new G4UIcmdWithAnInteger("/field04/SetTgtAng", this);
0139   fTgtAngCmd->SetGuidance("Set the angle [in deg] of the Tgt relative to C-Mgnt centre");
0140   fTgtAngCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0141   fTgtAngCmd->SetToBeBroadcasted(false);
0142 
0143   fDgrMaterCmd = new G4UIcmdWithAString("/field04/SetDgrMat", this);
0144   fDgrMaterCmd->SetGuidance("Select Material of the Degrader");
0145   fDgrMaterCmd->SetParameterName("dchoice", true);
0146   fDgrMaterCmd->SetDefaultValue("Lead");
0147   fDgrMaterCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0148   fDgrMaterCmd->SetToBeBroadcasted(false);
0149 
0150   fDgrRadCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetDgrRad", this);
0151   fDgrRadCmd->SetGuidance("Set Radius of the Degrader");
0152   fDgrRadCmd->SetParameterName("DrgSizeR", false, false);
0153   fDgrRadCmd->SetDefaultUnit("cm");
0154   fDgrRadCmd->SetRange("DrgSizeR>0.");
0155   fDgrRadCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0156   fDgrRadCmd->SetToBeBroadcasted(false);
0157 
0158   fDgrThickCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetDgrThick", this);
0159   fDgrThickCmd->SetGuidance("Set Thickness of the Degrader");
0160   fDgrThickCmd->SetParameterName("DgrSizeZ", false, false);
0161   fDgrThickCmd->SetDefaultUnit("cm");
0162   fDgrThickCmd->SetRange("DgrSizeZ>0.");
0163   fDgrThickCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0164   fDgrThickCmd->SetToBeBroadcasted(false);
0165 
0166   fDgrPosCmd = new G4UIcmdWithADoubleAndUnit("/field04/SetDgrPos", this);
0167   fDgrPosCmd->SetGuidance("Set Z pos of the Dgr relative to T-Mgnt centre");
0168   fDgrPosCmd->SetParameterName("DgrSizeP", false, false);
0169   fDgrPosCmd->SetDefaultUnit("cm");
0170   fDgrPosCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0171   fDgrPosCmd->SetToBeBroadcasted(false);
0172 }
0173 
0174 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0175 
0176 F04DetectorMessenger::~F04DetectorMessenger()
0177 {
0178   delete fDetDir;
0179 
0180   delete fWorldMaterCmd;
0181   delete fWorldRCmd;
0182   delete fWorldZCmd;
0183 
0184   delete fCaptureRCmd;
0185   delete fCaptureZCmd;
0186 
0187   delete fTransferRCmd;
0188   delete fTransferZCmd;
0189   delete fTransferPCmd;
0190 
0191   delete fTgtMaterCmd;
0192   delete fTgtRadCmd;
0193   delete fTgtThickCmd;
0194   delete fTgtPosCmd;
0195   delete fTgtAngCmd;
0196 
0197   delete fDgrMaterCmd;
0198   delete fDgrRadCmd;
0199   delete fDgrThickCmd;
0200   delete fDgrPosCmd;
0201 }
0202 
0203 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0204 
0205 void F04DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0206 {
0207   if (command == fWorldMaterCmd) {
0208     fDetector->SetWorldMaterial(newValue);
0209   }
0210 
0211   if (command == fTgtMaterCmd) {
0212     fDetector->SetTargetMaterial(newValue);
0213   }
0214 
0215   if (command == fDgrMaterCmd) {
0216     fDetector->SetDegraderMaterial(newValue);
0217   }
0218 
0219   if (command == fWorldRCmd) {
0220     fDetector->SetWorldSizeR(fWorldRCmd->GetNewDoubleValue(newValue));
0221   }
0222 
0223   if (command == fWorldZCmd) {
0224     fDetector->SetWorldSizeZ(fWorldZCmd->GetNewDoubleValue(newValue));
0225   }
0226 
0227   if (command == fCaptureRCmd)
0228     fDetector->SetCaptureMgntRadius(fCaptureRCmd->GetNewDoubleValue(newValue));
0229 
0230   if (command == fCaptureZCmd)
0231     fDetector->SetCaptureMgntLength(fCaptureZCmd->GetNewDoubleValue(newValue));
0232 
0233   if (command == fTransferRCmd)
0234     fDetector->SetTransferMgntRadius(fTransferRCmd->GetNewDoubleValue(newValue));
0235 
0236   if (command == fTransferZCmd)
0237     fDetector->SetTransferMgntLength(fTransferZCmd->GetNewDoubleValue(newValue));
0238 
0239   if (command == fTransferPCmd)
0240     fDetector->SetTransferMgntPos(fTransferPCmd->GetNewDoubleValue(newValue));
0241 
0242   if (command == fTgtRadCmd) fDetector->SetTargetRadius(fTgtRadCmd->GetNewDoubleValue(newValue));
0243 
0244   if (command == fTgtThickCmd)
0245     fDetector->SetTargetThickness(fTgtThickCmd->GetNewDoubleValue(newValue));
0246 
0247   if (command == fTgtPosCmd) fDetector->SetTargetPos(fTgtPosCmd->GetNewDoubleValue(newValue));
0248 
0249   if (command == fTgtAngCmd) fDetector->SetTargetAngle(fTgtAngCmd->GetNewIntValue(newValue));
0250 
0251   if (command == fDgrRadCmd) fDetector->SetDegraderRadius(fDgrRadCmd->GetNewDoubleValue(newValue));
0252 
0253   if (command == fDgrThickCmd)
0254     fDetector->SetDegraderThickness(fDgrThickCmd->GetNewDoubleValue(newValue));
0255 
0256   if (command == fDgrPosCmd) fDetector->SetDegraderPos(fDgrPosCmd->GetNewDoubleValue(newValue));
0257 
0258   if (command == fWorldZCmd) fDetector->SetWorldSizeZ(fWorldZCmd->GetNewDoubleValue(newValue));
0259 
0260   if (command == fWorldRCmd) fDetector->SetWorldSizeR(fWorldRCmd->GetNewDoubleValue(newValue));
0261 }