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/F04FieldMessenger.cc
0028 /// \brief Implementation of the F04FieldMessenger class
0029 //
0030 
0031 #include "F04FieldMessenger.hh"
0032 
0033 #include "F04DetectorConstruction.hh"
0034 #include "F04GlobalField.hh"
0035 
0036 #include "G4UIcmdWithADoubleAndUnit.hh"
0037 #include "G4UIcmdWithAString.hh"
0038 #include "G4UIcmdWithAnInteger.hh"
0039 #include "G4UIcmdWithoutParameter.hh"
0040 #include "G4UIdirectory.hh"
0041 
0042 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0043 
0044 F04FieldMessenger::F04FieldMessenger(F04GlobalField* pEMfield, F04DetectorConstruction* detector)
0045   : fGlobalField(pEMfield)
0046 {
0047   fDetector = detector;
0048 
0049   fDetDir = new G4UIdirectory("/field/");
0050   fDetDir->SetGuidance(" Field tracking control ");
0051 
0052   fCaptureB1Cmd = new G4UIcmdWithADoubleAndUnit("/field/SetCaptureB1", this);
0053   fCaptureB1Cmd->SetGuidance("Set B1 of the Capture Magnet");
0054   fCaptureB1Cmd->SetParameterName("CSizeB1", false, false);
0055   fCaptureB1Cmd->SetDefaultUnit("tesla");
0056   fCaptureB1Cmd->SetRange("CSizeB1>0.");
0057   fCaptureB1Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0058 
0059   fCaptureB2Cmd = new G4UIcmdWithADoubleAndUnit("/field/SetCaptureB2", this);
0060   fCaptureB2Cmd->SetGuidance("Set B2 of the Capture Magnet");
0061   fCaptureB2Cmd->SetParameterName("CSizeB2", false, false);
0062   fCaptureB2Cmd->SetDefaultUnit("tesla");
0063   fCaptureB2Cmd->SetRange("CSizeB2>0.");
0064   fCaptureB2Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0065 
0066   fTransferBCmd = new G4UIcmdWithADoubleAndUnit("/field/SetTransferB", this);
0067   fTransferBCmd->SetGuidance("Set B of the Transfer Magnet");
0068   fTransferBCmd->SetParameterName("TSizeB", false, false);
0069   fTransferBCmd->SetDefaultUnit("tesla");
0070   fTransferBCmd->SetRange("TSizeB>0.");
0071   fTransferBCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0072 
0073   fStepperCMD = new G4UIcmdWithAnInteger("/field/setStepperType", this);
0074   fStepperCMD->SetGuidance("Select stepper type for field");
0075   fStepperCMD->SetParameterName("choice", true);
0076   fStepperCMD->SetDefaultValue(4);
0077   fStepperCMD->AvailableForStates(G4State_PreInit, G4State_Idle);
0078 
0079   fMinStepCMD = new G4UIcmdWithADoubleAndUnit("/field/setMinStep", this);
0080   fMinStepCMD->SetGuidance("Define minimal step");
0081   fMinStepCMD->SetParameterName("min step", false, false);
0082   fMinStepCMD->SetDefaultUnit("mm");
0083   fMinStepCMD->AvailableForStates(G4State_PreInit, G4State_Idle);
0084 
0085   fDeltaChordCMD = new G4UIcmdWithADoubleAndUnit("/field/setDeltaChord", this);
0086   fDeltaChordCMD->SetGuidance("Define delta chord");
0087   fDeltaChordCMD->SetParameterName("delta chord", false, false);
0088   fDeltaChordCMD->SetDefaultUnit("mm");
0089   fDeltaChordCMD->AvailableForStates(G4State_PreInit, G4State_Idle);
0090 
0091   fDeltaOneStepCMD = new G4UIcmdWithADoubleAndUnit("/field/setDeltaOneStep", this);
0092   fDeltaOneStepCMD->SetGuidance("Define delta one step");
0093   fDeltaOneStepCMD->SetParameterName("delta one step", false, false);
0094   fDeltaOneStepCMD->SetDefaultUnit("mm");
0095   fDeltaOneStepCMD->AvailableForStates(G4State_PreInit, G4State_Idle);
0096 
0097   fDeltaIntersectionCMD = new G4UIcmdWithADoubleAndUnit("/field/setDeltaIntersection", this);
0098   fDeltaIntersectionCMD->SetGuidance("Define delta intersection");
0099   fDeltaIntersectionCMD->SetParameterName("delta intersection", false, false);
0100   fDeltaIntersectionCMD->SetDefaultUnit("mm");
0101   fDeltaIntersectionCMD->AvailableForStates(G4State_PreInit, G4State_Idle);
0102 
0103   fEpsMinCMD = new G4UIcmdWithADoubleAndUnit("/field/setEpsMin", this);
0104   fEpsMinCMD->SetGuidance("Define eps min");
0105   fEpsMinCMD->SetParameterName("eps min", false, false);
0106   fEpsMinCMD->SetDefaultUnit("mm");
0107   fEpsMinCMD->AvailableForStates(G4State_PreInit, G4State_Idle);
0108 
0109   fEpsMaxCMD = new G4UIcmdWithADoubleAndUnit("/field/setEpsMax", this);
0110   fEpsMaxCMD->SetGuidance("Define eps max");
0111   fEpsMaxCMD->SetParameterName("eps max", false, false);
0112   fEpsMaxCMD->SetDefaultUnit("mm");
0113   fEpsMaxCMD->AvailableForStates(G4State_PreInit, G4State_Idle);
0114 }
0115 
0116 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0117 
0118 F04FieldMessenger::~F04FieldMessenger()
0119 {
0120   delete fDetDir;
0121 
0122   delete fCaptureB1Cmd;
0123   delete fCaptureB2Cmd;
0124   delete fTransferBCmd;
0125 
0126   delete fStepperCMD;
0127   delete fMinStepCMD;
0128   delete fDeltaChordCMD;
0129   delete fDeltaOneStepCMD;
0130   delete fDeltaIntersectionCMD;
0131   delete fEpsMinCMD;
0132   delete fEpsMaxCMD;
0133 }
0134 
0135 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0136 
0137 void F04FieldMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0138 {
0139   if (command == fCaptureB1Cmd)
0140     fDetector->SetCaptureMgntB1(fCaptureB1Cmd->GetNewDoubleValue(newValue));
0141 
0142   if (command == fCaptureB2Cmd)
0143     fDetector->SetCaptureMgntB2(fCaptureB2Cmd->GetNewDoubleValue(newValue));
0144 
0145   if (command == fTransferBCmd)
0146     fDetector->SetTransferMgntB(fTransferBCmd->GetNewDoubleValue(newValue));
0147 
0148   if (command == fStepperCMD) {
0149     fGlobalField->SetStepperType(fStepperCMD->GetNewIntValue(newValue));
0150   }
0151   if (command == fMinStepCMD) {
0152     fGlobalField->SetMinStep(fMinStepCMD->GetNewDoubleValue(newValue));
0153   }
0154   if (command == fDeltaChordCMD) {
0155     fGlobalField->SetDeltaChord(fDeltaChordCMD->GetNewDoubleValue(newValue));
0156   }
0157   if (command == fDeltaOneStepCMD) {
0158     fGlobalField->SetDeltaOneStep(fDeltaOneStepCMD->GetNewDoubleValue(newValue));
0159   }
0160   if (command == fDeltaIntersectionCMD) {
0161     fGlobalField->SetDeltaIntersection(fDeltaIntersectionCMD->GetNewDoubleValue(newValue));
0162   }
0163   if (command == fEpsMinCMD) {
0164     fGlobalField->SetEpsMin(fEpsMinCMD->GetNewDoubleValue(newValue));
0165   }
0166   if (command == fEpsMaxCMD) {
0167     fGlobalField->SetEpsMax(fEpsMaxCMD->GetNewDoubleValue(newValue));
0168   }
0169 }