Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:21:57

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 // $Id: G4TBFieldMessenger.cc,v 1.5 2012/07/10 16:48:20 pinkenbu Exp $
0028 // GEANT4 tag $Name:  $
0029 //
0030 //
0031 
0032 #include "G4TBFieldMessenger.hh"
0033 
0034 #include "G4TBMagneticFieldSetup.hh"
0035 
0036 #include <Geant4/G4ApplicationState.hh>
0037 #include <Geant4/G4String.hh>
0038 #include <Geant4/G4UIcmdWithADoubleAndUnit.hh>
0039 #include <Geant4/G4UIcmdWithAString.hh>
0040 #include <Geant4/G4UIcmdWithAnInteger.hh>
0041 #include <Geant4/G4UIcmdWithoutParameter.hh>
0042 #include <Geant4/G4UIdirectory.hh>
0043 
0044 //////////////////////////////////////////////////////////////////////////////
0045 
0046 G4TBFieldMessenger::G4TBFieldMessenger(G4TBMagneticFieldSetup* pEMfield)
0047   : fEFieldSetup(pEMfield)
0048   , G4TBdetDir(new G4UIdirectory("/field/"))
0049   , StepperCmd(new G4UIcmdWithAnInteger("/field/setStepperType", this))
0050   , ElFieldCmd(new G4UIcmdWithADoubleAndUnit("/field/setFieldZ", this))
0051   , MinStepCmd(new G4UIcmdWithADoubleAndUnit("/field/setMinStep", this))
0052   , UpdateCmd(new G4UIcmdWithoutParameter("/field/update", this))
0053   , AbsMaterCmd(new G4UIcmdWithAString("/field/setAbsMat", this))
0054 {
0055   G4TBdetDir->SetGuidance("G4TB field tracking control.");
0056 
0057   StepperCmd->SetGuidance("Select stepper type for electric field");
0058   StepperCmd->SetParameterName("choice", true);
0059   StepperCmd->SetDefaultValue(4);
0060   StepperCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0061 
0062   UpdateCmd->SetGuidance("Update calorimeter geometry.");
0063   UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
0064   UpdateCmd->SetGuidance("if you changed geometrical value(s).");
0065   UpdateCmd->AvailableForStates(G4State_Idle);
0066 
0067   ElFieldCmd->SetGuidance("Define uniform Electric field.");
0068   ElFieldCmd->SetGuidance("Electric field will be in Z direction.");
0069   ElFieldCmd->SetGuidance("Value of Electric field has to be given in volt/m");
0070   ElFieldCmd->SetParameterName("Ez", false, false);
0071   ElFieldCmd->SetDefaultUnit("volt/m");
0072   ElFieldCmd->AvailableForStates(G4State_Idle);
0073 
0074   MinStepCmd->SetGuidance("Define minimal step");
0075   MinStepCmd->SetParameterName("min step", false, false);
0076   MinStepCmd->SetDefaultUnit("mm");
0077   MinStepCmd->AvailableForStates(G4State_Idle);
0078 
0079   AbsMaterCmd->SetGuidance("Select Material of the Absorber.");
0080   AbsMaterCmd->SetParameterName("choice", true);
0081   AbsMaterCmd->SetDefaultValue("Xe");
0082   AbsMaterCmd->AvailableForStates(G4State_Idle);
0083 }
0084 
0085 ///////////////////////////////////////////////////////////////////////////////
0086 
0087 G4TBFieldMessenger::~G4TBFieldMessenger()
0088 {
0089   delete StepperCmd;
0090   delete ElFieldCmd;
0091   delete MinStepCmd;
0092   delete G4TBdetDir;
0093   delete UpdateCmd;
0094 
0095   delete AbsMaterCmd;
0096 }
0097 
0098 ////////////////////////////////////////////////////////////////////////////
0099 //
0100 //
0101 
0102 void G4TBFieldMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0103 {
0104   if (command == StepperCmd)
0105   {
0106     fEFieldSetup->SetStepperType(G4UIcmdWithAnInteger::GetNewIntValue(newValue));
0107   }
0108   if (command == UpdateCmd)
0109   {
0110     fEFieldSetup->UpdateField();
0111   }
0112   if (command == ElFieldCmd)
0113   {
0114     fEFieldSetup->SetFieldValue(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(newValue));
0115   }
0116   if (command == MinStepCmd)
0117   {
0118     fEFieldSetup->SetMinStep(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(newValue));
0119   }
0120 }
0121 
0122 //
0123 //
0124 /////////////////////////////////////////////////////////////////////////