Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:17:01

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 // Please cite the following paper if you use this software
0027 // Nucl.Instrum.Meth.B260:20-27, 2007
0028 
0029 #include "DetectorMessenger.hh"
0030 #include "DetectorConstruction.hh"
0031 
0032 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0033 
0034 DetectorMessenger::DetectorMessenger(DetectorConstruction * Det)
0035 :fDetector(Det)
0036 { 
0037   fQuadDir = new G4UIdirectory("/quad/");
0038   fQuadDir->SetGuidance("Quadrupole control.");
0039   
0040   fModelCmd = new G4UIcmdWithAnInteger("/quad/setModel",this);
0041   fModelCmd->SetGuidance("Select magnetic field model.");
0042   fModelCmd->SetParameterName("model",false);
0043   fModelCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0044   
0045   fProfileCmd = new G4UIcmdWithAnInteger("/displayProfile",this);
0046   fProfileCmd->SetGuidance("Display beam profile.");
0047   fProfileCmd->SetParameterName("profile",false);
0048   fProfileCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0049   
0050   fGridCmd = new G4UIcmdWithAnInteger("/setGrid",this);
0051   fGridCmd->SetGuidance("Put grid and shadow plane.");
0052   fGridCmd->SetParameterName("grid",false);
0053   fGridCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0054   
0055   fCoefCmd = new G4UIcmdWithAnInteger("/setCoef",this);
0056   fCoefCmd->SetGuidance("Calculate aberration coefficients.");
0057   fCoefCmd->SetParameterName("coef",false);
0058   fCoefCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0059   
0060   fG1Cmd = new G4UIcmdWithADouble("/quad/setG1",this);
0061   fG1Cmd->SetGuidance("Set G1.");
0062   fG1Cmd->SetParameterName("G1",false);
0063   fG1Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0064   
0065   fG2Cmd = new G4UIcmdWithADouble("/quad/setG2",this);
0066   fG2Cmd->SetGuidance("Set G2.");
0067   fG2Cmd->SetParameterName("G2",false);
0068   fG2Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0069   
0070   fG3Cmd = new G4UIcmdWithADouble("/quad/setG3",this);
0071   fG3Cmd->SetGuidance("Set G3.");
0072   fG3Cmd->SetParameterName("G3",false);
0073   fG3Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0074   
0075   fG4Cmd = new G4UIcmdWithADouble("/quad/setG4",this);
0076   fG4Cmd->SetGuidance("Set G4.");
0077   fG4Cmd->SetParameterName("G4",false);
0078   fG4Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0079   
0080 }
0081 
0082 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0083 
0084 DetectorMessenger::~DetectorMessenger()
0085 {
0086   delete fG1Cmd;
0087   delete fG2Cmd;
0088   delete fG3Cmd;
0089   delete fG4Cmd;
0090   delete fQuadDir;  
0091   delete fModelCmd;
0092   delete fProfileCmd;
0093   delete fGridCmd;
0094   delete fCoefCmd;
0095 }
0096 
0097 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0098 
0099 void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
0100 { 
0101   if( command == fModelCmd )
0102    { fDetector->SetModel(fModelCmd->GetNewIntValue(newValue));}
0103 
0104   if( command == fProfileCmd )
0105    { fDetector->SetProfile(fProfileCmd->GetNewIntValue(newValue));}
0106 
0107   if( command == fGridCmd )
0108    { fDetector->SetGrid(fGridCmd->GetNewIntValue(newValue));}
0109 
0110   if( command == fCoefCmd )
0111    { fDetector->SetCoef(fGridCmd->GetNewIntValue(newValue));}
0112 
0113   if( command == fG1Cmd )
0114    { fDetector->SetG1(fG1Cmd->GetNewDoubleValue(newValue));}
0115    
0116   if( command == fG2Cmd )
0117    { fDetector->SetG2(fG1Cmd->GetNewDoubleValue(newValue));}
0118    
0119   if( command == fG3Cmd )
0120    { fDetector->SetG3(fG1Cmd->GetNewDoubleValue(newValue));}
0121    
0122   if( command == fG4Cmd )
0123    { fDetector->SetG4(fG1Cmd->GetNewDoubleValue(newValue));}
0124    
0125 }