Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /geant4/examples/extended/field/field03/src/F03DetectorMessenger.cc was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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 F03DetectorMessenger.cc
0027 /// \brief Implementation of the F03DetectorMessenger class
0028 
0029 #include "F03DetectorMessenger.hh"
0030 
0031 #include "F03DetectorConstruction.hh"
0032 
0033 #include "G4UIcmdWithADoubleAndUnit.hh"
0034 #include "G4UIcmdWithAString.hh"
0035 #include "G4UIcmdWith3VectorAndUnit.hh"
0036 #include "G4UIcmdWithoutParameter.hh"
0037 
0038 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0039 
0040 F03DetectorMessenger::F03DetectorMessenger(F03DetectorConstruction* det) : fDetector(det)
0041 {
0042   fDetDir = new G4UIdirectory("/calor/");
0043   fDetDir->SetGuidance("F03 detector control.");
0044 
0045   fAbsMaterCmd = new G4UIcmdWithAString("/calor/setAbsMat", this);
0046   fAbsMaterCmd->SetGuidance("Select Material of the Absorber.");
0047   fAbsMaterCmd->SetParameterName("choice", true);
0048   fAbsMaterCmd->SetDefaultValue("Lead");
0049   fAbsMaterCmd->AvailableForStates(G4State_Idle);
0050   fAbsMaterCmd->SetToBeBroadcasted(false);
0051 
0052   fWorldMaterCmd = new G4UIcmdWithAString("/calor/setWorldMat", this);
0053   fWorldMaterCmd->SetGuidance("Select Material of the World.");
0054   fWorldMaterCmd->SetParameterName("wchoice", true);
0055   fWorldMaterCmd->SetDefaultValue("Air");
0056   fWorldMaterCmd->AvailableForStates(G4State_Idle);
0057   fWorldMaterCmd->SetToBeBroadcasted(false);
0058 
0059   fAbsThickCmd = new G4UIcmdWithADoubleAndUnit("/calor/setAbsThick", this);
0060   fAbsThickCmd->SetGuidance("Set Thickness of the Absorber");
0061   fAbsThickCmd->SetParameterName("SizeZ", false, false);
0062   fAbsThickCmd->SetDefaultUnit("mm");
0063   fAbsThickCmd->SetRange("SizeZ>0.");
0064   fAbsThickCmd->AvailableForStates(G4State_Idle);
0065   fAbsThickCmd->SetToBeBroadcasted(false);
0066 
0067   fAbsRadCmd = new G4UIcmdWithADoubleAndUnit("/calor/setAbsRad", this);
0068   fAbsRadCmd->SetGuidance("Set radius of the Absorber");
0069   fAbsRadCmd->SetParameterName("SizeR", false, false);
0070   fAbsRadCmd->SetDefaultUnit("mm");
0071   fAbsRadCmd->SetRange("SizeR>0.");
0072   fAbsRadCmd->AvailableForStates(G4State_Idle);
0073   fAbsRadCmd->SetToBeBroadcasted(false);
0074 
0075   fAbsZposCmd = new G4UIcmdWithADoubleAndUnit("/calor/setAbsZpos", this);
0076   fAbsZposCmd->SetGuidance("Set Z pos. of the Absorber");
0077   fAbsZposCmd->SetParameterName("Zpos", false, false);
0078   fAbsZposCmd->SetDefaultUnit("mm");
0079   fAbsZposCmd->AvailableForStates(G4State_Idle);
0080   fAbsZposCmd->SetToBeBroadcasted(false);
0081 
0082   fWorldZCmd = new G4UIcmdWithADoubleAndUnit("/calor/setWorldZ", this);
0083   fWorldZCmd->SetGuidance("Set Z size of the World");
0084   fWorldZCmd->SetParameterName("WSizeZ", false, false);
0085   fWorldZCmd->SetDefaultUnit("mm");
0086   fWorldZCmd->SetRange("WSizeZ>0.");
0087   fWorldZCmd->AvailableForStates(G4State_Idle);
0088   fWorldZCmd->SetToBeBroadcasted(false);
0089 
0090   fWorldRCmd = new G4UIcmdWithADoubleAndUnit("/calor/setWorldR", this);
0091   fWorldRCmd->SetGuidance("Set R size of the World");
0092   fWorldRCmd->SetParameterName("WSizeR", false, false);
0093   fWorldRCmd->SetDefaultUnit("mm");
0094   fWorldRCmd->SetRange("WSizeR>0.");
0095   fWorldRCmd->AvailableForStates(G4State_Idle);
0096   fWorldRCmd->SetToBeBroadcasted(false);
0097 
0098   // moved from FieldSetup (depends on the user field)
0099   fFieldDir = new G4UIdirectory("/field03/");
0100   fFieldDir->SetGuidance("F03 field control.");
0101 
0102   fMagFieldCmd = new G4UIcmdWith3VectorAndUnit("/field03/setField",this);
0103   fMagFieldCmd->SetGuidance("Define magnetic field.");
0104   fMagFieldCmd->SetParameterName("Bx", "By", "Bz" ,false,false);
0105   fMagFieldCmd->SetDefaultUnit("tesla");
0106   fMagFieldCmd->AvailableForStates(G4State_Idle);
0107 
0108   fLocalMagFieldCmd = new G4UIcmdWith3VectorAndUnit("/field03/setLocalField",this);
0109   fLocalMagFieldCmd->SetGuidance("Define magnetic field.");
0110   fLocalMagFieldCmd->SetParameterName("Bx", "By", "Bz" ,false,false);
0111   fLocalMagFieldCmd->SetDefaultUnit("tesla");
0112   fLocalMagFieldCmd->AvailableForStates(G4State_Idle);
0113 }
0114 
0115 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0116 
0117 F03DetectorMessenger::~F03DetectorMessenger()
0118 {
0119   delete fAbsMaterCmd;
0120   delete fAbsThickCmd;
0121   delete fAbsRadCmd;
0122   delete fAbsZposCmd;
0123   delete fWorldMaterCmd;
0124   delete fWorldZCmd;
0125   delete fWorldRCmd;
0126   delete fDetDir;
0127   delete fLocalMagFieldCmd;  
0128   delete fMagFieldCmd;  
0129   delete fFieldDir;
0130 }
0131 
0132 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0133 
0134 void F03DetectorMessenger::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   if( command == fLocalMagFieldCmd ) {
0169     fDetector->SetLocalFieldValue(fLocalMagFieldCmd->GetNew3VectorValue(newValue));
0170   }
0171 }
0172 
0173 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......