Back to home page

EIC code displayed by LXR

 
 

    


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

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/field03/src/F03DetectorMessenger.cc
0027 /// \brief Implementation of the F03DetectorMessenger class
0028 //
0029 //
0030 //
0031 //
0032 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0033 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0034 
0035 #include "F03DetectorMessenger.hh"
0036 
0037 #include "F03DetectorConstruction.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 F03DetectorMessenger::F03DetectorMessenger(F03DetectorConstruction* det) : fDetector(det)
0047 {
0048   fDetDir = new G4UIdirectory("/calor/");
0049   fDetDir->SetGuidance("F03 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("/field03/");
0106   fFieldDir->SetGuidance("F03 field control.");
0107 
0108   fMagFieldCmd = new G4UIcmdWith3VectorAndUnit("/field03/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   fLocalMagFieldCmd = new G4UIcmdWith3VectorAndUnit("/field03/setLocalField",this);
0115   fLocalMagFieldCmd->SetGuidance("Define magnetic field.");
0116   fLocalMagFieldCmd->SetParameterName("Bx", "By", "Bz" ,false,false);
0117   fLocalMagFieldCmd->SetDefaultUnit("tesla");
0118   fLocalMagFieldCmd->AvailableForStates(G4State_Idle);
0119 }
0120 
0121 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0122 
0123 F03DetectorMessenger::~F03DetectorMessenger()
0124 {
0125   delete fAbsMaterCmd;
0126   delete fAbsThickCmd;
0127   delete fAbsRadCmd;
0128   delete fAbsZposCmd;
0129   delete fWorldMaterCmd;
0130   delete fWorldZCmd;
0131   delete fWorldRCmd;
0132   delete fDetDir;
0133   delete fLocalMagFieldCmd;  
0134   delete fMagFieldCmd;  
0135   delete fFieldDir;
0136 }
0137 
0138 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0139 
0140 void F03DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0141 {
0142   if (command == fAbsMaterCmd) {
0143     fDetector->SetAbsorberMaterial(newValue);
0144   }
0145 
0146   if (command == fWorldMaterCmd) {
0147     fDetector->SetWorldMaterial(newValue);
0148   }
0149 
0150   if (command == fAbsThickCmd) {
0151     fDetector->SetAbsorberThickness(fAbsThickCmd->GetNewDoubleValue(newValue));
0152   }
0153 
0154   if (command == fAbsRadCmd) {
0155     fDetector->SetAbsorberRadius(fAbsRadCmd->GetNewDoubleValue(newValue));
0156   }
0157 
0158   if (command == fAbsZposCmd) {
0159     fDetector->SetAbsorberZpos(fAbsZposCmd->GetNewDoubleValue(newValue));
0160   }
0161 
0162   if (command == fWorldZCmd) {
0163     fDetector->SetWorldSizeZ(fWorldZCmd->GetNewDoubleValue(newValue));
0164   }
0165 
0166   if (command == fWorldRCmd) {
0167     fDetector->SetWorldSizeR(fWorldRCmd->GetNewDoubleValue(newValue));
0168   }
0169 
0170   if( command == fMagFieldCmd ) {
0171     fDetector->SetFieldValue(fMagFieldCmd->GetNew3VectorValue(newValue));
0172   }
0173 
0174   if( command == fLocalMagFieldCmd ) {
0175     fDetector->SetLocalFieldValue(fLocalMagFieldCmd->GetNew3VectorValue(newValue));
0176   }
0177 }
0178 
0179 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......