Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:19:40

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: CCalPrimaryGeneratorMessenger.cc
0028 // Description: CCalPrimaryGeneratorMessenger adds new commands for
0029 //              primary generator action
0030 ///////////////////////////////////////////////////////////////////////////////
0031 #include "CCalPrimaryGeneratorMessenger.hh"
0032 #include "CCalPrimaryGeneratorAction.hh"
0033 
0034 #include "globals.hh"
0035 #include "G4PhysicalConstants.hh"
0036 #include "G4UImanager.hh"
0037 #include "G4UIcmdWithAString.hh"
0038 #include "G4UIcmdWithADoubleAndUnit.hh"
0039 #include "G4UIcmdWithADouble.hh"
0040 #include "G4UIcmdWithABool.hh"
0041 #include "G4UIcmdWithAnInteger.hh"
0042 
0043 CCalPrimaryGeneratorMessenger::CCalPrimaryGeneratorMessenger(CCalPrimaryGeneratorAction* myGun) : myAction(myGun) {
0044 
0045   verboseCmd = new G4UIcmdWithAnInteger("/CCal/generator/verbose",this);
0046   verboseCmd->SetGuidance("set Verbosity level ");
0047   verboseCmd->SetParameterName("value",true);
0048   verboseCmd->SetDefaultValue(0);
0049   verboseCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0050 
0051   rndmCmd = new G4UIcmdWithAString("/CCal/generator/random",this);
0052   rndmCmd->SetGuidance("Choose randomly energy and direction of the incident particle.");
0053   rndmCmd->SetGuidance("  Choice : on,off(default)");
0054   rndmCmd->SetParameterName("choice",true);
0055   rndmCmd->SetDefaultValue("off");
0056   rndmCmd->SetCandidates("on off ON OFF");
0057   rndmCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0058 
0059   scanCmd = new G4UIcmdWithAString("/CCal/generator/scan",this);
0060   scanCmd->SetGuidance("Scan eta and phi ranges with single incident particle");
0061   scanCmd->SetGuidance("  Choice : on,off(default)");
0062   scanCmd->SetGuidance("  Ranges : etamin/max, phimin/max are set by other commands ");
0063   scanCmd->SetParameterName("choice",true);
0064   scanCmd->SetDefaultValue("off");
0065   scanCmd->SetCandidates("on off ON OFF");
0066   scanCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0067 
0068   minEnergyCmd = new G4UIcmdWithADoubleAndUnit("/CCal/generator/minEnergy",this);
0069   minEnergyCmd->SetGuidance("Set minimum Energy for the incident particle.");
0070   minEnergyCmd->SetParameterName("value",true);
0071   minEnergyCmd->SetDefaultValue(1.);
0072   minEnergyCmd->SetDefaultUnit("GeV");
0073   minEnergyCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0074   
0075   maxEnergyCmd = new G4UIcmdWithADoubleAndUnit("/CCal/generator/maxEnergy",this);
0076   maxEnergyCmd->SetGuidance("Set maximum Energy for the incident particle.");
0077   maxEnergyCmd->SetParameterName("value",true);
0078   maxEnergyCmd->SetDefaultValue(1.);
0079   maxEnergyCmd->SetDefaultUnit("TeV");
0080   maxEnergyCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0081 
0082   minPhiCmd = new G4UIcmdWithADoubleAndUnit("/CCal/generator/minPhi",this);
0083   minPhiCmd->SetGuidance("Set minimum Phi angle for the incident particle direction");
0084   minPhiCmd->SetGuidance("  Choice : from 0 to 2*pi ");
0085   minPhiCmd->SetParameterName("value",true);
0086   minPhiCmd->SetDefaultValue(0);
0087   minPhiCmd->SetDefaultUnit("radian");
0088   minPhiCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0089 
0090   maxPhiCmd = new G4UIcmdWithADoubleAndUnit("/CCal/generator/maxPhi",this);
0091   maxPhiCmd->SetGuidance("Set maximum Phi angle for the incident particle direction");
0092   maxPhiCmd->SetGuidance("  Choice : from 0 to 2*pi ");
0093   maxPhiCmd->SetParameterName("value",true);
0094   maxPhiCmd->SetDefaultValue(2.*pi);
0095   maxPhiCmd->SetDefaultUnit("radian");
0096   maxPhiCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0097 
0098   stepsPhiCmd = new G4UIcmdWithAnInteger("/CCal/generator/stepsPhi",this);
0099   stepsPhiCmd->SetGuidance("number of steps along Phi for scan ");
0100   stepsPhiCmd->SetParameterName("value",true);
0101   stepsPhiCmd->SetDefaultValue(1);
0102   stepsPhiCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0103 
0104   minEtaCmd = new G4UIcmdWithADouble("/CCal/generator/minEta",this);
0105   minEtaCmd->SetGuidance("Set minimum Eta angle for the incident particle direction");
0106   minEtaCmd->SetGuidance("  Choice : from 0 to infinity");
0107   minEtaCmd->SetParameterName("value",true);
0108   minEtaCmd->SetDefaultValue(0);
0109   minEtaCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0110 
0111   maxEtaCmd = new G4UIcmdWithADouble("/CCal/generator/maxEta",this);
0112   maxEtaCmd->SetGuidance("Set maximum Eta angle for the incident particle direction");
0113   maxEtaCmd->SetGuidance("  Choice : from 0 to infinity");
0114   maxEtaCmd->SetParameterName("value",true);
0115   maxEtaCmd->SetDefaultValue(3.5);
0116   maxEtaCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0117 
0118   stepsEtaCmd = new G4UIcmdWithAnInteger("/CCal/generator/stepsEta",this);
0119   stepsEtaCmd->SetGuidance("number of steps along Eta for scan ");
0120   stepsEtaCmd->SetParameterName("value",true);
0121   stepsEtaCmd->SetDefaultValue(1);
0122   stepsEtaCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0123 
0124   runNoCmd = new G4UIcmdWithAnInteger("/CCal/generator/runNo",this);
0125   runNoCmd->SetGuidance("set the run number ");
0126   runNoCmd->SetParameterName("value",true);
0127   runNoCmd->SetDefaultValue(0);
0128   runNoCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0129 
0130 }
0131 
0132 CCalPrimaryGeneratorMessenger::~CCalPrimaryGeneratorMessenger() {
0133 
0134   if (verboseCmd)
0135     delete verboseCmd;
0136   if (scanCmd)
0137     delete rndmCmd;
0138   if (scanCmd)
0139     delete scanCmd;
0140   if (minEnergyCmd)
0141     delete minEnergyCmd;
0142   if (maxEnergyCmd)
0143     delete maxEnergyCmd;
0144   if (minPhiCmd)
0145     delete minPhiCmd;
0146   if (maxPhiCmd)
0147     delete maxPhiCmd;
0148   if (stepsPhiCmd)
0149     delete stepsPhiCmd;
0150   if (minEtaCmd)
0151     delete minEtaCmd;
0152   if (maxEtaCmd)
0153     delete maxEtaCmd;
0154   if (stepsEtaCmd)
0155     delete stepsEtaCmd;
0156   if (runNoCmd)
0157     delete runNoCmd;
0158 
0159 }
0160 
0161 void CCalPrimaryGeneratorMessenger::SetNewValue(G4UIcommand * command,
0162                                                 G4String newValues)    { 
0163   if (command == verboseCmd)
0164     myAction->SetVerboseLevel(verboseCmd->GetNewIntValue(newValues));
0165   else if (command == rndmCmd)
0166     myAction->SetRandom(newValues);
0167   else if (command == scanCmd)
0168     myAction->SetScan(newValues);
0169   else if (command == minEnergyCmd)
0170     myAction->SetMinimumEnergy(minEnergyCmd->GetNewDoubleValue(newValues));
0171   else if (command == maxEnergyCmd)
0172     myAction->SetMaximumEnergy(maxEnergyCmd->GetNewDoubleValue(newValues));
0173   else if (command == minPhiCmd)
0174     myAction->SetMinimumPhi(minPhiCmd->GetNewDoubleValue(newValues));
0175   else if (command == maxPhiCmd)
0176     myAction->SetMaximumPhi(maxPhiCmd->GetNewDoubleValue(newValues));
0177   else if (command == stepsPhiCmd)
0178     myAction->SetStepsPhi(stepsPhiCmd->GetNewIntValue(newValues));
0179   else if (command == minEtaCmd)
0180     myAction->SetMinimumEta(minEtaCmd->GetNewDoubleValue(newValues));
0181   else if (command == maxEtaCmd)
0182     myAction->SetMaximumEta(maxEtaCmd->GetNewDoubleValue(newValues));
0183   else if (command == stepsEtaCmd)
0184     myAction->SetStepsEta(stepsEtaCmd->GetNewIntValue(newValues));
0185   else if (command == runNoCmd)
0186     myAction->SetRunNo(runNoCmd->GetNewIntValue(newValues));
0187  
0188 }