Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:21:16

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 field/field01/src/F01DetectorMessenger.cc
0027 /// \brief Implementation of the F01DetectorMessenger class
0028 //
0029 //
0030 //
0031 //
0032 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0033 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0034 
0035 #include "F01DetectorMessenger.hh"
0036 
0037 #include "F01DetectorConstruction.hh"
0038 
0039 #include "G4UIcmdWithADoubleAndUnit.hh"
0040 #include "G4UIcmdWithAString.hh"
0041 #include "G4UIcmdWith3VectorAndUnit.hh"
0042 #include "G4UIcmdWithoutParameter.hh"
0043 
0044 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0045 
0046 F01DetectorMessenger::F01DetectorMessenger(F01DetectorConstruction* det) : fDetector(det)
0047 {
0048   fDetDir = new G4UIdirectory("/calor/");
0049   fDetDir->SetGuidance("F01 detector control.");
0050 
0051   fAbsMaterCmd = new G4UIcmdWithAString("/calor/setAbsMat", this);
0052   fAbsMaterCmd->SetGuidance("Select Material of the Absorber.");
0053   fAbsMaterCmd->SetParameterName("choice", true);
0054   fAbsMaterCmd->SetDefaultValue("Lead");
0055   fAbsMaterCmd->AvailableForStates(G4State_Idle);
0056   fAbsMaterCmd->SetToBeBroadcasted(false);
0057 
0058   fWorldMaterCmd = new G4UIcmdWithAString("/calor/setWorldMat", this);
0059   fWorldMaterCmd->SetGuidance("Select Material of the World.");
0060   fWorldMaterCmd->SetParameterName("wchoice", true);
0061   fWorldMaterCmd->SetDefaultValue("Air");
0062   fWorldMaterCmd->AvailableForStates(G4State_Idle);
0063   fWorldMaterCmd->SetToBeBroadcasted(false);
0064 
0065   fAbsThickCmd = new G4UIcmdWithADoubleAndUnit("/calor/setAbsThick", this);
0066   fAbsThickCmd->SetGuidance("Set Thickness of the Absorber");
0067   fAbsThickCmd->SetParameterName("SizeZ", false, false);
0068   fAbsThickCmd->SetDefaultUnit("mm");
0069   fAbsThickCmd->SetRange("SizeZ>0.");
0070   fAbsThickCmd->AvailableForStates(G4State_Idle);
0071   fAbsThickCmd->SetToBeBroadcasted(false);
0072 
0073   fAbsRadCmd = new G4UIcmdWithADoubleAndUnit("/calor/setAbsRad", this);
0074   fAbsRadCmd->SetGuidance("Set radius of the Absorber");
0075   fAbsRadCmd->SetParameterName("SizeR", false, false);
0076   fAbsRadCmd->SetDefaultUnit("mm");
0077   fAbsRadCmd->SetRange("SizeR>0.");
0078   fAbsRadCmd->AvailableForStates(G4State_Idle);
0079   fAbsRadCmd->SetToBeBroadcasted(false);
0080 
0081   fAbsZposCmd = new G4UIcmdWithADoubleAndUnit("/calor/setAbsZpos", this);
0082   fAbsZposCmd->SetGuidance("Set Z pos. of the Absorber");
0083   fAbsZposCmd->SetParameterName("Zpos", false, false);
0084   fAbsZposCmd->SetDefaultUnit("mm");
0085   fAbsZposCmd->AvailableForStates(G4State_Idle);
0086   fAbsZposCmd->SetToBeBroadcasted(false);
0087 
0088   fWorldZCmd = new G4UIcmdWithADoubleAndUnit("/calor/setWorldZ", this);
0089   fWorldZCmd->SetGuidance("Set Z size of the World");
0090   fWorldZCmd->SetParameterName("WSizeZ", false, false);
0091   fWorldZCmd->SetDefaultUnit("mm");
0092   fWorldZCmd->SetRange("WSizeZ>0.");
0093   fWorldZCmd->AvailableForStates(G4State_Idle);
0094   fWorldZCmd->SetToBeBroadcasted(false);
0095 
0096   fWorldRCmd = new G4UIcmdWithADoubleAndUnit("/calor/setWorldR", this);
0097   fWorldRCmd->SetGuidance("Set R size of the World");
0098   fWorldRCmd->SetParameterName("WSizeR", false, false);
0099   fWorldRCmd->SetDefaultUnit("mm");
0100   fWorldRCmd->SetRange("WSizeR>0.");
0101   fWorldRCmd->AvailableForStates(G4State_Idle);
0102   fWorldRCmd->SetToBeBroadcasted(false);
0103 
0104   // moved from FieldSetup (depends on the user field)
0105   fFieldDir = new G4UIdirectory("/field01/");
0106   fFieldDir->SetGuidance("F01 field control.");
0107 
0108   fMagFieldCmd = new G4UIcmdWith3VectorAndUnit("/field01/setField",this);
0109   fMagFieldCmd->SetGuidance("Define magnetic field.");
0110   fMagFieldCmd->SetParameterName("Bx", "By", "Bz" ,false,false);
0111   fMagFieldCmd->SetDefaultUnit("tesla");
0112   fMagFieldCmd->AvailableForStates(G4State_Idle);
0113 
0114 }
0115 
0116 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0117 
0118 F01DetectorMessenger::~F01DetectorMessenger()
0119 {
0120   delete fAbsMaterCmd;
0121   delete fAbsThickCmd;
0122   delete fAbsRadCmd;
0123   delete fAbsZposCmd;
0124   delete fWorldMaterCmd;
0125   delete fWorldZCmd;
0126   delete fWorldRCmd;
0127   delete fDetDir;
0128   delete fMagFieldCmd;  
0129   delete fFieldDir;
0130 }
0131 
0132 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0133 
0134 void F01DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0135 {
0136   if (command == fAbsMaterCmd) {
0137     fDetector->SetAbsorberMaterial(newValue);
0138   }
0139 
0140   if (command == fWorldMaterCmd) {
0141     fDetector->SetWorldMaterial(newValue);
0142   }
0143 
0144   if (command == fAbsThickCmd) {
0145     fDetector->SetAbsorberThickness(fAbsThickCmd->GetNewDoubleValue(newValue));
0146   }
0147 
0148   if (command == fAbsRadCmd) {
0149     fDetector->SetAbsorberRadius(fAbsRadCmd->GetNewDoubleValue(newValue));
0150   }
0151 
0152   if (command == fAbsZposCmd) {
0153     fDetector->SetAbsorberZpos(fAbsZposCmd->GetNewDoubleValue(newValue));
0154   }
0155 
0156   if (command == fWorldZCmd) {
0157     fDetector->SetWorldSizeZ(fWorldZCmd->GetNewDoubleValue(newValue));
0158   }
0159 
0160   if (command == fWorldRCmd) {
0161     fDetector->SetWorldSizeR(fWorldRCmd->GetNewDoubleValue(newValue));
0162   }
0163 
0164   if( command == fMagFieldCmd ) {
0165     fDetector->SetFieldValue(fMagFieldCmd->GetNew3VectorValue(newValue));
0166   }
0167 }
0168 
0169 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......