Geant4 Cross Reference |
1 // 2 // ******************************************************************** 3 // * License and Disclaimer * 4 // * * 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. * 10 // * * 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitation of liability. * 17 // * * 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************************************** 25 // 26 #ifndef PRIMARYGENERATORMMESSENGER_HH 27 #define PRIMARYGENERATORMMESSENGER_HH 28 29 #include "G4UImessenger.hh" 30 31 class G4UIdirectory; 32 class G4UIcmdWithABool; 33 class G4UIcmdWithAnInteger; 34 class G4UIcmdWithAString; 35 class G4UIcmdWithADouble; 36 class G4UIcmdWithADoubleAndUnit; 37 class PrimaryGeneratorAction; 38 39 /** 40 * @brief Primary generator messenger 41 * 42 * Defines UI commands to set up the primary generator. 43 * 44 * By default particle gun is used as the primary generator. It can be 45 * controlled with standard UI commands (/gun/). 46 * 47 * "/HGCalTestbeam/generator/momentumSpread <VALUE>" to change constant 48 * particle energy to Gaussian distribution with sigma expressed in units of the 49 * initial energy (e.g. value 0.05 means sigma of 0.05 * E). 50 * By default it equals to 0 and constant energy value is used. 51 * "/HGCalTestbeam/generator/beamSpread <none/Gaussian/flat>" to define type of 52 * beam position spread. By default none is used. 53 * "/HGCalTestbeam/generator/beamSpreadX <SIZE>" to define size of beam spread 54 * along x axis. It is sigma of a Gaussian distribution, or half-width of a 55 * flat distribution. 56 * "/HGCalTestbeam/generator/beamSpreadY <SIZE>" to define size of beam spread 57 * along y axis. It is sigma of a Gaussian distribution, or half-width of a 58 * flat distribution. 59 * "/HGCalTestbeam/generator/beamZ0 <POSITION>" to define beam position along z 60 * axis. By default edge of the world volume is used. 61 * 62 * If installation was done with ROOT package (CMake was able to locate it), 63 * an additional option of input read from the ROOT file is enabled. 64 * It can be activated with "/HGCalTestbeam/generator/readInputFile true". 65 * "/HGCalTestbeam/generator/pathInputFile <FILE>" sets the path to the input 66 * file. 67 * "/HGCalTestbeam/generator/startFromEvent <N>" allows to start simulation from 68 * Nth event. 69 * Please note that in current implementation input from file needs to be 70 * executed in a non-multithreaded mode (or with 1 thread). 71 * 72 */ 73 74 class PrimaryGeneratorMessenger : public G4UImessenger { 75 public: 76 explicit PrimaryGeneratorMessenger(PrimaryGeneratorAction *aPrimaryGeneratorAction); 77 ~PrimaryGeneratorMessenger(); 78 79 public: 80 void SetNewValue(G4UIcommand *command, G4String newValues); 81 G4String GetCurrentValue(G4UIcommand *command); 82 83 private: 84 /// Pointer to the primmary generator 85 PrimaryGeneratorAction *fPrimaryGenerator; 86 87 private: 88 /// Directory for UI commands 89 G4UIdirectory *fDirectory; 90 #ifdef WITHROOT 91 /// Command specyfing if primary event should be read from file 92 G4UIcmdWithABool *fReadInputCmd; 93 /// Command to set the path to the input file 94 G4UIcmdWithAString *fPathInputCmd; 95 /// Command to set ID of the first event to be read from the file 96 G4UIcmdWithAnInteger *fStartFromEventCmd; 97 #endif 98 /// Command to set the sigma of the Gaussian momentum spread 99 G4UIcmdWithADouble *fMomentumSpreadCmd; 100 /// Command to set the type of transverse beam position spread 101 G4UIcmdWithAString *fBeamSpreadTypeCmd; 102 /// Command to set the size of beam position spread along X axis 103 G4UIcmdWithADoubleAndUnit *fBeamSpreadXCmd; 104 /// Command to set the size of beam position spread along Y axis 105 G4UIcmdWithADoubleAndUnit *fBeamSpreadYCmd; 106 /// Command to set the initial beam position size along Z axis 107 G4UIcmdWithADoubleAndUnit *fBeamZ0Cmd; 108 }; 109 110 #endif /*PRIMARYGENERATORMMESSENGER_HH */