Command-based scoring Notice As of Geant4 release 9.1, this functionality of command-based scoring is still in alpha release and functionality offered is preliminary. We do not guarantee the correctness of the code. Also, we may change any of the commands / methods in the near future release. We appreciate your feedback. Command-based scoring This new command-based scoring utilizes the parallel world described in the previous section. With UI interactive commands, the user can define : A parallel world for scoring and three-dimensional mesh in it Arbitrary number of physics quantities to be scored and filters After scoring (i.e. a run), the user can visualize the score and dump scores into a file. All available UI commands are listed in List of built-in commands. For the time being of the alpha release, this command-based scoring is an optional functionality and the user has to explicity define its use in his/her main(). To do this, the method G4ScoringManager::GetScoringManager() must be invoked right after the instantiation of G4RunManager. A user <literal>main()</literal> to use the command-based scoring #include "G4RunManager.hh" #include "G4ScoringManager.hh" int main(int argc,char** argv) { // Construct the run manager G4RunManager * runManager = new G4RunManager; // Activate command-based scorer G4ScoringManager::GetScoringManager(); ... } Defining a scoring mesh To define a scoring mesh, the user has to specify the followings. Shape and name of the 3D scoring mesh. Currently, box is the only available shape. Size of the scoring mesh. Mesh size must be specified as "half width" similar to the arguments of G4Box. Number of bins for each axes. Note that too hugh number causes immense memory consumption. Optionally, position and rotation of the mesh. If not specified, the mesh is positioned at the center of the world volume without rotation. For a scoring mesh the user can have arbitrary number of quantities to be scored for each cell of the mesh. For each scoring quantity, the use can set one filter. Please note that /score/filter affects on the preceding scorer. Names of scorers and filters must be unique for the mesh. The user can define more than one scorers of same kind with different names (and most likely with different filters). Defining a scoring mesh and scores in thiat mesh should terminate with /score/close command. The following sample UI commands define a scoring mesh named boxMesh_1, size of which is 2 m * 2 m * 2 m, and sliced into 30 cells along each axes. For each cell energy deposition, number of steps of gamma, number of steps of electron and number of steps of positron are scored. UI commands to define a scoring mesh and scorers # # define scoring mesh # /score/create/boxMesh boxMesh_1 /score/mesh/boxSize 100. 100. 100. cm /score/mesh/nBin 30 30 30 # # define scorers and filters # /score/quantity/energyDeposit eDep /score/quantity/nOfStep nOfStepGamma /score/filter/particle gammaFilter gamma /score/quantity/nOfStep nOfStepEMinus /score/filter/particle eMinusFilter e- /score/quantity/nOfStep nOfStepEPlus /score/filter/particle ePlusFilter e+ # /score/close # Drawing scores Once scores are filled, the user can visualize the scores. The score is drawn on top of the mass geometry with the current visualization settings.
Drawing scores in slices (left) and projection (right)
By default, entries are linearly mapped to colors (gray - blue - green - red). This color mapping is implemented in G4DefaultLinearColorMap class, and registered to G4ScoringManager with the color map name "defaultLinearColorMap". The user may alternate color map by implementing his/her own color map class derived from G4VScoreColorMap and register it to G4ScoringManager. Then, for each draw command, the user can specify the color map of his/her own.
Writing scores to a file The user may dump a score in a mesh (/score/dumpQuantityToFile command) or all scores in a mesh (/score/dumpAllQuantitiesToFile command) to a file. The default file format is the simple CSV. To alternate the file format, the user should overwrite G4VScoreWriter class and register it to G4ScoringManager. Please refer to /examples/extended/runAndEvent/RE03 for the detail.