Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-06 07:56:05

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 F01DetectorMessenger.cc
0027 /// \brief Implementation of the F01DetectorMessenger class
0028 
0029 #include "F01DetectorMessenger.hh"
0030 
0031 #include "F01DetectorConstruction.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 F01DetectorMessenger::F01DetectorMessenger(F01DetectorConstruction* det) : fDetector(det)
0041 {
0042   fDetDir = new G4UIdirectory("/calor/");
0043   fDetDir->SetGuidance("F01 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("/field01/");
0100   fFieldDir->SetGuidance("F01 field control.");
0101 
0102   fMagFieldCmd = new G4UIcmdWith3VectorAndUnit("/field01/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 }
0109 
0110 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0111 
0112 F01DetectorMessenger::~F01DetectorMessenger()
0113 {
0114   delete fAbsMaterCmd;
0115   delete fAbsThickCmd;
0116   delete fAbsRadCmd;
0117   delete fAbsZposCmd;
0118   delete fWorldMaterCmd;
0119   delete fWorldZCmd;
0120   delete fWorldRCmd;
0121   delete fDetDir;
0122   delete fMagFieldCmd;  
0123   delete fFieldDir;
0124 }
0125 
0126 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0127 
0128 void F01DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0129 {
0130   if (command == fAbsMaterCmd) {
0131     fDetector->SetAbsorberMaterial(newValue);
0132   }
0133 
0134   if (command == fWorldMaterCmd) {
0135     fDetector->SetWorldMaterial(newValue);
0136   }
0137 
0138   if (command == fAbsThickCmd) {
0139     fDetector->SetAbsorberThickness(fAbsThickCmd->GetNewDoubleValue(newValue));
0140   }
0141 
0142   if (command == fAbsRadCmd) {
0143     fDetector->SetAbsorberRadius(fAbsRadCmd->GetNewDoubleValue(newValue));
0144   }
0145 
0146   if (command == fAbsZposCmd) {
0147     fDetector->SetAbsorberZpos(fAbsZposCmd->GetNewDoubleValue(newValue));
0148   }
0149 
0150   if (command == fWorldZCmd) {
0151     fDetector->SetWorldSizeZ(fWorldZCmd->GetNewDoubleValue(newValue));
0152   }
0153 
0154   if (command == fWorldRCmd) {
0155     fDetector->SetWorldSizeR(fWorldRCmd->GetNewDoubleValue(newValue));
0156   }
0157 
0158   if( command == fMagFieldCmd ) {
0159     fDetector->SetFieldValue(fMagFieldCmd->GetNew3VectorValue(newValue));
0160   }
0161 }
0162 
0163 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......