Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:31

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 ExGflashMessenger.cc
0028 /// \brief Implementation of the ExGflashMessenger class
0029 //
0030 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0031 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0032 
0033 #include "ExGflashMessenger.hh"
0034 
0035 #include "ExGflashDetectorConstruction.hh"
0036 
0037 #include "G4UIcmdWith3Vector.hh"
0038 #include "G4UIcmdWithADoubleAndUnit.hh"
0039 #include "G4UIcmdWithAString.hh"
0040 #include "G4UIcmdWithAnInteger.hh"
0041 #include "G4UIcmdWithoutParameter.hh"
0042 #include "G4UIdirectory.hh"
0043 
0044 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0045 
0046 ExGflashMessenger::ExGflashMessenger(ExGflashDetectorConstruction* Det) : fDetector(Det)
0047 {
0048   fExGflashDir = new G4UIdirectory("/exgflash/");
0049   fExGflashDir->SetGuidance(" Gflash example commands.");
0050 
0051   fVerbose = new G4UIcmdWithAnInteger("/exgflash/verbose", this);
0052   fVerbose->SetGuidance("set exglash verbosity");
0053   fVerbose->SetGuidance("0- silent, 1 - on exit, 2 - run , 3 - event");
0054   fVerbose->SetParameterName("ver", false);
0055   fVerbose->SetRange("ver >= 0");
0056   fVerbose->AvailableForStates(G4State_PreInit, G4State_Idle);
0057   fVerbose->SetToBeBroadcasted(false);
0058 
0059   fDetDir = new G4UIdirectory("/exgflash/det/");
0060   fDetDir->SetGuidance("detector construction commands");
0061 
0062   fMaterCmd = new G4UIcmdWithAString("/exgflash/det/setMat", this);
0063   fMaterCmd->SetGuidance("Select Material.");
0064   fMaterCmd->SetParameterName("material", false);
0065   fMaterCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0066   fMaterCmd->SetToBeBroadcasted(false);
0067 
0068   fLBinCmd = new G4UIcmdWith3Vector("/exgflash/det/setLbin", this);
0069   fLBinCmd->SetGuidance("set longitudinal bining");
0070   fLBinCmd->SetGuidance("nb of bins; bin thickness (in radl)");
0071   // must have omitable==true we use 2 values only
0072   fLBinCmd->SetParameterName("nLtot", "dLradl", " ", true);
0073   fLBinCmd->SetRange("nLtot>=1 && dLradl>0");
0074   fLBinCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0075   fLBinCmd->SetToBeBroadcasted(false);
0076 
0077   fRBinCmd = new G4UIcmdWith3Vector("/exgflash/det/setRbin", this);
0078   fRBinCmd->SetGuidance("set radial bining");
0079   fRBinCmd->SetGuidance("nb of bins; bin thickness (in radl)");
0080   fRBinCmd->SetParameterName("nRtot", "dRradl", " ", true);
0081   fRBinCmd->SetRange("nRtot>=1 && dRradl>0");
0082   fRBinCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0083   fRBinCmd->SetToBeBroadcasted(false);
0084 }
0085 
0086 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0087 
0088 ExGflashMessenger::~ExGflashMessenger()
0089 {
0090   delete fRBinCmd;
0091   delete fLBinCmd;
0092   delete fMaterCmd;
0093   delete fDetDir;
0094   delete fVerbose;
0095   delete fExGflashDir;
0096 }
0097 
0098 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0099 
0100 void ExGflashMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0101 {
0102   if (command == fMaterCmd) {
0103     fDetector->SetMaterial(newValue);
0104   }
0105 
0106   if (command == fVerbose) {
0107     fDetector->SetVerbose(fVerbose->GetNewIntValue(newValue));
0108   }
0109 
0110   if (command == fLBinCmd) {
0111     fDetector->SetLBining(fLBinCmd->GetNew3VectorValue(newValue));
0112   }
0113 
0114   if (command == fRBinCmd) {
0115     fDetector->SetRBining(fRBinCmd->GetNew3VectorValue(newValue));
0116   }
0117 }
0118 
0119 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......