commit d6ebd65d0c3c6c448cfbb021ccaadec10a0a09eb Author: YiHui Liu Date: Fri Apr 29 13:24:29 2022 +0800 initialize diff --git a/.README.txt b/.README.txt new file mode 100644 index 0000000..dd432f5 --- /dev/null +++ b/.README.txt @@ -0,0 +1,197 @@ + +///\file "B1/.README.txt" +///\brief Example B1 README page + +/*! \page ExampleB1 Example %B1 + + This example demonstrates a very simple application where an energy + deposit is accounted in user actions and their associated objects + and a dose in a selected volume is calculated. + +\section B1_s1 GEOMETRY DEFINITION + + The geometry is constructed in the B1::DetectorConstruction class. + The setup consists of a an envelope of box shape containing two + volumes: a spherical cone and a trapezoid. + + In this example we use some common materials materials for medical + applications. The envelope is made of water and the two inner volumes + are made from tissue and bone materials. + The materials are created with the help of the G4NistManager class, + which allows to build a material from the NIST database using their + names. Available materials and their compositions can be found in + + the Geant4 User's Guide for Application Developers, Appendix 10: + Geant4 Materials Database + . + +\section B1_s2 PHYSICS LIST + + The particle's type and the physic processes which will be available + in this example are set in the QBBC physics list. This physics list + requires data files for electromagnetic and hadronic processes. + See more on installation of the datasets in + + Geant4 Installation Guide, Chapter 3.3: Note On Geant4 Datasets . + The following datasets: G4LEDATA, G4LEVELGAMMADATA, G4NEUTRONXSDATA, + G4SAIDXSDATA and G4ENSDFSTATEDATA are mandatory for this example. + + In addition the build-in interactive command: +\verbatim +/process/(in)activate processName +\endverbatim + allows to activate/inactivate the processes one by one. + +\section B1_s3 ACTION INITALIZATION + + A newly introduced class, B1::ActionInitialization, instantiates and registers + to Geant4 kernel all user action classes. + + While in sequential mode the action classes are instatiated just once, + via invoking the method: + B1::ActionInitialization::Build() + in multi-threading mode the same method is invoked for each thread worker + and so all user action classes are defined thread-local. + + A run action class is instantiated both thread-local + and global that's why its instance is created also in the method + B1::ActionInitialization::BuildForMaster() + which is invoked only in multi-threading mode. + +\section B1_s4 PRIMARY GENERATOR + + The primary generator is defined in the B1::PrimaryGeneratorAction class. + The default kinematics is a 6 MeV gamma, randomly distributed in front + of the envelope across 80% of the transverse (X,Y) envelope size. + This default setting can be changed via the Geant4 built-in commands + of the G4ParticleGun class. + +\section B1_s5 DETECTOR RESPONSE + + This example demonstrates a simple scoring implemented directly + in the user action classes. Alternative ways of scoring via Geant4 classes + can be found in the other examples. + + The energy deposited is collected step by step for a selected volume + in B1::SteppingAction and accumulated event by event in B1::EventAction. + + At end of event, the value acummulated in B1::EventAction is added in B1::RunAction + and summed over the whole run (see B1::EventAction::EndOfevent()). + + Total dose deposited is computed at B1::RunAction::EndOfRunAction(), + and printed together with informations about the primary particle. + In multi-threading mode the energy accumulated in G4Accumulable objects per + workers is merged to the master in B1::RunAction::EndOfRunAction() and the final + result is printed on the screen. + + G4Accumulable type instead of G4double type is used for the B1::RunAction + data members in order to facilitate merging of the values accumulated on workers + to the master. Currently the accumulables have to be registered to G4AccumulablesManager + and G4AccumulablesManager::Merge() has to be called from the users code. This is planned + to be further simplified with a closer integration of G4Accumulable classes in + the Geant4 kernel next year. + + An example of creating and computing new units (e.g., dose) is also shown + in the class constructor. + +
+ +The following paragraphs are common to all basic examples + +\section B1_A VISUALISATION + + The visualization manager is set via the G4VisExecutive class + in the main() function in exampleB1.cc. + The initialisation of the drawing is done via a set of /vis/ commands + in the macro vis.mac. This macro is automatically read from + the main function when the example is used in interactive running mode. + + By default, vis.mac opens an OpenGL viewer (/vis/open OGL). + The user can change the initial viewer by commenting out this line + and instead uncommenting one of the other /vis/open statements, such as + HepRepFile or DAWNFILE (which produce files that can be viewed with the + HepRApp and DAWN viewers, respectively). Note that one can always + open new viewers at any time from the command line. For example, if + you already have a view in, say, an OpenGL window with a name + "viewer-0", then +\verbatim +/vis/open DAWNFILE +\endverbatim + then to get the same view +\verbatim +/vis/viewer/copyView viewer-0 +\endverbatim + or to get the same view *plus* scene-modifications +\verbatim +/vis/viewer/set/all viewer-0 +\endverbatim + then to see the result +\verbatim +/vis/viewer/flush +\endverbatim + + The DAWNFILE, HepRepFile drivers are always available + (since they require no external libraries), but the OGL driver requires + that the Geant4 libraries have been built with the OpenGL option. + + From Release 9.6 the vis.mac macro in example B1 has additional commands + that demonstrate additional functionality of the vis system, such as + displaying text, axes, scales, date, logo and shows how to change + viewpoint and style. Consider copying these to other examples or + your application. To see even more commands use help or + ls or browse the available UI commands in the Application + Developers Guide, Section 7.1. + + For more information on visualization, including information on how to + install and run DAWN, OpenGL and HepRApp, see the visualization tutorials, + for example,\n + - + OpenGL Tutorial + - + DAWN Tutorial + - + HepRApp Tutorial + + The tracks are automatically drawn at the end of each event, accumulated + for all events and erased at the beginning of the next run. + + +\section B1_B USER INTERFACES + + The user command interface is set via the G4UIExecutive class + in the main() function in exampleB1.cc + The selection of the user command interface is then done automatically + according to the Geant4 configuration or it can be done explicitly via + the third argument of the G4UIExecutive constructor (see exampleB4a.cc). + +\section B1_C HOW TO RUN + + - Execute exampleB1 in the 'interactive mode' with visualization +\verbatim +% exampleB1 +and type in the commands from run1.mac line by line: +Idle> /control/verbose 2 +Idle> /tracking/verbose 1 +Idle> /run/beamOn 10 +Idle> ... +Idle> exit +\endverbatim + or +\verbatim +Idle> /control/execute run1.mac +.... +Idle> exit +\endverbatim + + - Execute exampleB1 in the 'batch' mode from macro files + (without visualization) +\verbatim +% exampleB1 run2.mac +% exampleB1 exampleB1.in > exampleB1.out +\endverbatim + +*/ + + diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..0ffa701 --- /dev/null +++ b/.clang-format @@ -0,0 +1,212 @@ +--- +Language: Cpp +# BasedOnStyle: Google +AccessModifierOffset: -4 +AlignAfterOpenBracket: Align +AlignArrayOfStructures: None +AlignConsecutiveMacros: None +AlignConsecutiveAssignments: None +AlignConsecutiveBitFields: None +AlignConsecutiveDeclarations: None +AlignEscapedNewlines: Left +AlignOperands: Align +AlignTrailingComments: true +AllowAllArgumentsOnNextLine: true +AllowAllConstructorInitializersOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortEnumsOnASingleLine: true +AllowShortBlocksOnASingleLine: Never +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: All +AllowShortLambdasOnASingleLine: All +AllowShortIfStatementsOnASingleLine: WithoutElse +AllowShortLoopsOnASingleLine: true +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: true +AlwaysBreakTemplateDeclarations: Yes +AttributeMacros: + - __capability +BinPackArguments: true +BinPackParameters: true +BraceWrapping: + AfterCaseLabel: false + AfterClass: false + AfterControlStatement: Never + AfterEnum: false + AfterFunction: false + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + AfterExternBlock: false + BeforeCatch: false + BeforeElse: false + BeforeLambdaBody: false + BeforeWhile: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakBeforeBinaryOperators: None +BreakBeforeConceptDeclarations: true +BreakBeforeBraces: Attach +BreakBeforeInheritanceComma: false +BreakInheritanceList: BeforeColon +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +BreakConstructorInitializers: BeforeColon +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: true +ColumnLimit: 120 +CommentPragmas: '^ IWYU pragma:' +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DeriveLineEnding: true +DerivePointerAlignment: true +DisableFormat: false +EmptyLineAfterAccessModifier: Never +EmptyLineBeforeAccessModifier: LogicalBlock +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: true +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +IfMacros: + - KJ_IF_MAYBE +IncludeBlocks: Regroup +IncludeCategories: + - Regex: '^' + Priority: 2 + SortPriority: 0 + CaseSensitive: false + - Regex: '^<.*\.h>' + Priority: 1 + SortPriority: 0 + CaseSensitive: false + - Regex: '^<.*' + Priority: 2 + SortPriority: 0 + CaseSensitive: false + - Regex: '.*' + Priority: 3 + SortPriority: 0 + CaseSensitive: false +IncludeIsMainRegex: '([-_](test|unittest))?$' +IncludeIsMainSourceRegex: '' +IndentAccessModifiers: false +IndentCaseLabels: true +IndentCaseBlocks: false +IndentGotoLabels: true +IndentPPDirectives: None +IndentExternBlock: AfterExternBlock +IndentRequires: false +IndentWidth: 4 +IndentWrappedFunctionNames: false +InsertTrailingCommas: None +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: false +LambdaBodyIndentation: Signature +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCBinPackProtocolList: Never +ObjCBlockIndentWidth: 2 +ObjCBreakBeforeNestedBlockParam: true +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PenaltyBreakAssignment: 2 +PenaltyBreakBeforeFirstCallParameter: 1 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyBreakTemplateDeclaration: 10 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 200 +PenaltyIndentedWhitespace: 0 +PointerAlignment: Left +PPIndentWidth: -1 +RawStringFormats: + - Language: Cpp + Delimiters: + - cc + - CC + - cpp + - Cpp + - CPP + - 'c++' + - 'C++' + CanonicalDelimiter: '' + BasedOnStyle: google + - Language: TextProto + Delimiters: + - pb + - PB + - proto + - PROTO + EnclosingFunctions: + - EqualsProto + - EquivToProto + - PARSE_PARTIAL_TEXT_PROTO + - PARSE_TEST_PROTO + - PARSE_TEXT_PROTO + - ParseTextOrDie + - ParseTextProtoOrDie + - ParseTestProto + - ParsePartialTestProto + CanonicalDelimiter: pb + BasedOnStyle: google +ReferenceAlignment: Pointer +ReflowComments: true +ShortNamespaceLines: 1 +SortIncludes: CaseSensitive +SortJavaStaticImport: Before +SortUsingDeclarations: true +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceAroundPointerQualifiers: Default +SpaceBeforeRangeBasedForLoopColon: true +SpaceInEmptyBlock: false +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 2 +SpacesInAngles: Never +SpacesInConditionalStatement: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInLineCommentPrefix: + Minimum: 1 + Maximum: -1 +SpacesInParentheses: false +SpacesInSquareBrackets: false +SpaceBeforeSquareBrackets: false +BitFieldColonSpacing: Both +Standard: Auto +StatementAttributeLikeMacros: + - Q_EMIT +StatementMacros: + - Q_UNUSED + - QT_REQUIRE_VERSION +TabWidth: 8 +UseCRLF: false +UseTab: Never +WhitespaceSensitiveMacros: + - STRINGIZE + - PP_STRINGIZE + - BOOST_PP_STRINGIZE + - NS_SWIFT_NAME + - CF_SWIFT_NAME +... + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d163863 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build/ \ No newline at end of file diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..66fe773 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,24 @@ +{ + "configurations": [ + { + "name": "Win32", + "includePath": [ + "${default}", + "${workspaceFolder}/include", + "D:/Geant4/dist/include/Geant4" + ], + "defines": [ + "_DEBUG", + "UNICODE", + "_UNICODE" + ], + "windowsSdkVersion": "10.0.19041.0", + "compilerPath": "D:/Microsoft/VisualStudio/2022/Community/VC/Tools/MSVC/14.31.31103/bin/Hostx64/x64/cl.exe", + "cStandard": "c17", + "cppStandard": "c++17", + "intelliSenseMode": "windows-msvc-x64", + "configurationProvider": "ms-vscode.cmake-tools" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..90162d7 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "cmake.configureSettings": { + "CMAKE_TOOLCHAIN_FILE": "D:/Microsoft/vcpkg/scripts/buildsystems/vcpkg.cmake" + } +} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..9295d45 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,69 @@ +#---------------------------------------------------------------------------- +# Setup the project +cmake_minimum_required(VERSION 3.16...3.21) +project(B1) + +#---------------------------------------------------------------------------- +# Find Geant4 package, activating all available UI and Vis drivers by default +# You can set WITH_GEANT4_UIVIS to OFF via the command line or ccmake/cmake-gui +# to build a batch mode only executable +# +option(WITH_GEANT4_UIVIS "Build example with Geant4 UI and Vis drivers" ON) +if(WITH_GEANT4_UIVIS) + find_package(Geant4 REQUIRED ui_all vis_all) +else() + find_package(Geant4 REQUIRED) +endif() + +#---------------------------------------------------------------------------- +# Setup Geant4 include directories and compile definitions +# Setup include directory for this project +# +include(${Geant4_USE_FILE}) +include_directories(${PROJECT_SOURCE_DIR}/include) + +#---------------------------------------------------------------------------- +# Locate sources and headers for this project +# NB: headers are included so they will show up in IDEs +# +file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc) +file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh) + +#---------------------------------------------------------------------------- +# Add the executable, and link it to the Geant4 libraries +# +add_executable(exampleB1 exampleB1.cc ${sources} ${headers}) +target_link_libraries(exampleB1 ${Geant4_LIBRARIES}) + +#---------------------------------------------------------------------------- +# Copy all scripts to the build directory, i.e. the directory in which we +# build B1. This is so that we can run the executable directly because it +# relies on these scripts being in the current working directory. +# +set(EXAMPLEB1_SCRIPTS + exampleB1.in + exampleB1.out + init_vis.mac + run1.mac + run2.mac + vis.mac + ) + +foreach(_script ${EXAMPLEB1_SCRIPTS}) + configure_file( + ${PROJECT_SOURCE_DIR}/${_script} + ${PROJECT_BINARY_DIR}/${_script} + COPYONLY + ) +endforeach() + +#---------------------------------------------------------------------------- +# For internal Geant4 use - but has no effect if you build this +# example standalone +# +add_custom_target(B1 DEPENDS exampleB1) + +#---------------------------------------------------------------------------- +# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX +# +install(TARGETS exampleB1 DESTINATION bin) diff --git a/G4.code-workspace b/G4.code-workspace new file mode 100644 index 0000000..7493bdd --- /dev/null +++ b/G4.code-workspace @@ -0,0 +1,12 @@ +{ + "folders": [ + { + "path": "." + } + ], + "settings": { + "files.associations": { + "*.icc": "cpp" + } + } +} \ No newline at end of file diff --git a/GNUmakefile b/GNUmakefile new file mode 100644 index 0000000..763f9ef --- /dev/null +++ b/GNUmakefile @@ -0,0 +1,21 @@ +# -------------------------------------------------------------- +# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98. +# -------------------------------------------------------------- + +name := exampleB1 +G4TARGET := $(name) +G4EXLIB := true + +ifndef G4INSTALL + G4INSTALL = ../../.. +endif + +.PHONY: all +all: lib bin + +include $(G4INSTALL)/config/binmake.gmk + +visclean: + rm -f g4*.prim g4*.eps g4*.wrl + rm -f .DAWN_* + diff --git a/History b/History new file mode 100644 index 0000000..0c2c759 --- /dev/null +++ b/History @@ -0,0 +1,118 @@ +------------------------------------------------------------------- + + ========================================================= + Geant4 - an Object-Oriented Toolkit for Simulation in HEP + ========================================================= + + Example B1 History file + ----------------------- +This file should be used by the G4 example coordinator to briefly +summarize all major modifications introduced in the code and keep +track of all tags. + + ---------------------------------------------------------- + * Reverse chronological order (last date on top), please * + ---------------------------------------------------------- + +13-07-21 I. Hrivnacova (exampleB1-V10-07-03) +- Use B1 in multiple inclusion protection ifdefs +- Fixes in Doxygen documentation + +12-07-21 I. Hrivnacova (exampleB1-V10-07-02) +- Introduced namespace instead of a class names prefix +- Declare overriding functions 'override' (and removed 'virtual' keyword) + +31-05-21 I. Hrivnacova (exampleB1-V10-07-01) +- Use nullptr instead of 0 +- Clean trailing whitespaces from all files + +30-05-21 M.Maire (exampleB1-V10-07-00) +- exampleB1.cc: use G4SteppingVerboseWithUnits + +02/11/20 B.Morgan (exampleB1-V10-06-01) +- Support same CMake version range as core Geant4 + +30/06/20 G. Cosmo (exampleB1-V10-06-00) +- Migrated to use G4RunManagerFactory, therefore implicitly enabling + tasking by default in MT builds. + +21/11/19 G. Cosmo (exampleB1-V10-05-00) +- Use default MixMax random engine. + +26/09/16 I. Hrivnacova (exampleB1-V10-02-01) +- Updated for renaming G4Parameter in G4Accumulable + +20/09/16 J. Allison (exampleB1-V10-02-00) +- vis.mac: Added this to make "Envelope" transparent blue: + # "Envelope" is transparent blue to represent water + /vis/geometry/set/colour Envelope 0 0 0 1 .3 + +02/11/15 I. Hrivnacova (exampleB1-V10-01-03) +- B1Run class replaced with a code based on G4Parameter + +04/05/15 I. Hrivnacova (exampleB1-V10-01-02) +- Coding guidelines: removed empty lines + +23/04/15 mma (exampleB1-V10-01-01) +- RunAction : come back to previous formula + +21/04/15 mma (exampleB1-V10-01-00) +- RunAction : correct calculation of rmsEdep + +29/11/14 I. Hrivnacova +- Use G4endl instead of \n in G4cout; + this makes each new line in the output on threads preceded with + G4WTN > + +06/11/14 I. Hrivnacova +- Removed G4UI_USE/G4VIS_USE tests and init.mac macro (not needed) +- Moved G4UIExecutive at the beginning of main() in all examples +- Perform run initialization in macros instead of main() + +28/10/13 I. Hrivnacova (exampleB1-V09-06-06) +- Removed SetNumberOfThreads(4) from main (use Geant4 default) + +26/10/13 mma (exampleB1-V09-06-05) +- Use /run/printProgress. Cleanup in EventAction + +08/10/13 I. Hrivnacova (exampleB1-V09-06-04) +- Removed B1EventInformation for keeping maximum simplicity +- Improved documentation (added paragraph on Run::Merge()) +- Code clean-up + +09/06/13 I. Hrivnacova (exampleB1-V09-06-03) +- clarify local names in user actions + +05/06/13 mma (exampleB1-V09-06-02) +- add section about ACTION INITALIZATION to README and .README +- update section DETECTOR RESPONSE + +05/05/13 I. Hrivnacova (exampleB1-V09-06-01) +- Migration for MT (by Makoto): + Added B1ActionInitialization, B1EventInformation and B1Run classes + and updated actions classes accordingly. + README files still need to be updated. + +15/01/13 I. Hrivnacova (exampleB1-V09-06-00) +- Tag for a test only (g4svn update with svn 1.7.x) + +13/11/12 I. Hrivnacova (exampleB1-V09-05-03) +- Use QBBC physics list instead of QGSP_BIC_EMY, which becomes + obsolete + +02/11/12 J. Allison (exampleB1-V09-05-01 and 02) +- README: Improved. + +02/11/12 J. Allison (exampleB1-V09-05-00) +- vis.mac: Improved view and added text, scale, logo etc. to scene. + +14/11/11 I. Hrivnacova +- The first tagged version of the new B1 example + (tagged in basic) + +31/10/11 I. Hrivnacova +- change volume names +- scoring in 1 volume only, with new scheme + +05/09/11 M. Maire, P. Gueye +- Created. diff --git a/README b/README new file mode 100644 index 0000000..03d428d --- /dev/null +++ b/README @@ -0,0 +1,172 @@ +------------------------------------------------------------------- + + ========================================================= + Geant4 - an Object-Oriented Toolkit for Simulation in HEP + ========================================================= + + Example B1 + ----------- + + This example demonstrates a very simple application where an energy + deposit is accounted in user actions and their associated objects + and a dose in a selected volume is calculated. + + + 1- GEOMETRY DEFINITION + + The geometry is constructed in the B1::DetectorConstruction class. + The setup consists of a an envelope of box shape containing two + volumes: a spherical cone and a trapezoid. + + In this example we use some common materials materials for medical + applications. The envelope is made of water and the two inner volumes + are made from tissue and bone materials. + The materials are created with the help of the G4NistManager class, + which allows to build a material from the NIST database using their + names. All available materials can be found in the Geant4 User's Guide + for Application Developers, Appendix 10: Geant4 Materials Database. + + 2- PHYSICS LIST + + The particle's type and the physic processes which will be available + in this example are set in the QBBC physics list. This physics list + requires data files for electromagnetic and hadronic processes. + See more on installation of the datasets in Geant4 Installation Guide, + Chapter 3.3: Note On Geant4 Datasets: + http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides + /InstallationGuide/html/ch03s03.html + The following datasets: G4LEDATA, G4LEVELGAMMADATA, G4NEUTRONXSDATA, + G4SAIDXSDATA and G4ENSDFSTATEDATA are mandatory for this example. + + In addition the build-in interactive command: + /process/(in)activate processName + allows to activate/inactivate the processes one by one. + + 3- ACTION INITALIZATION + + A newly introduced class, B1::ActionInitialization, instantiates and registers + to Geant4 kernel all user action classes. + + While in sequential mode the action classes are instatiated just once, + via invoking the method: + B1::ActionInitialization::Build() + in multi-threading mode the same method is invoked for each thread worker + and so all user action classes are defined thread-local. + + A run action class is instantiated both thread-local + and global that's why its instance is created also in the method + B1::ActionInitialization::BuildForMaster() + which is invoked only in multi-threading mode. + + 4- PRIMARY GENERATOR + + The primary generator is defined in the B1::PrimaryGeneratorAction class. + The default kinematics is a 6 MeV gamma, randomly distributed in front + of the envelope across 80% of the transverse (X,Y) envelope size. + This default setting can be changed via the Geant4 built-in commands + of the G4ParticleGun class. + + 5- DETECTOR RESPONSE + + This example demonstrates a simple scoring implemented directly + in the user action classes. Alternative ways of scoring via Geant4 classes + can be found in the other examples. + + The energy deposited is collected step by step for a selected volume + in B1::SteppingAction and accumulated event by event in B1::EventAction. + + At end of event, the value acummulated in B1::EventAction is added in B1::RunAction + and summed over the whole run (see B1::EventAction::EndOfevent()). + + Total dose deposited is computed at B1::RunAction::EndOfRunAction(), + and printed together with informations about the primary particle. + In multi-threading mode the energy accumulated in G4Accumulable objects per + workers is merged to the master in B1::RunAction::EndOfRunAction() and the final + result is printed on the screen. + + G4Parameter type instead of G4double type is used for the B1::RunAction + data members in order to facilitate merging of the values accumulated on workers + to the master. Currently the accumulables have to be registered to G4AccumulablesManager + and G4AccumulablesManager::Merge() has to be called from the users code. This is planned + to be further simplified with a closer integration of G4Accumulable classes in + the Geant4 kernel next year. + + An example of creating and computing new units (e.g., dose) is also shown + in the class constructor. + + The following paragraphs are common to all basic examples + + A- VISUALISATION + + The visualization manager is set via the G4VisExecutive class + in the main() function in exampleB1.cc. + The initialisation of the drawing is done via a set of /vis/ commands + in the macro vis.mac. This macro is automatically read from + the main function when the example is used in interactive running mode. + + By default, vis.mac opens an OpenGL viewer (/vis/open OGL). + The user can change the initial viewer by commenting out this line + and instead uncommenting one of the other /vis/open statements, such as + HepRepFile or DAWNFILE (which produce files that can be viewed with the + HepRApp and DAWN viewers, respectively). Note that one can always + open new viewers at any time from the command line. For example, if + you already have a view in, say, an OpenGL window with a name + "viewer-0", then + /vis/open DAWNFILE + then to get the same view + /vis/viewer/copyView viewer-0 + or to get the same view *plus* scene-modifications + /vis/viewer/set/all viewer-0 + then to see the result + /vis/viewer/flush + + The DAWNFILE, HepRepFile drivers are always available + (since they require no external libraries), but the OGL driver requires + that the Geant4 libraries have been built with the OpenGL option. + + From Release 9.6 the vis.mac macro in example B1 has additional commands + that demonstrate additional functionality of the vis system, such as + displaying text, axes, scales, date, logo and shows how to change + viewpoint and style. Consider copying these to other examples or + your application. To see even more commands use help or + ls or browse the available UI commands in the Application + Developers Guide, Section 7.1. + + For more information on visualization, including information on how to + install and run DAWN, OpenGL and HepRApp, see the visualization tutorials, + for example, + http://geant4.slac.stanford.edu/Presentations/vis/G4[VIS]Tutorial/G4[VIS]Tutorial.html + (where [VIS] can be replaced by DAWN, OpenGL and HepRApp) + + The tracks are automatically drawn at the end of each event, accumulated + for all events and erased at the beginning of the next run. + + B- USER INTERFACES + + The user command interface is set via the G4UIExecutive class + in the main() function in exampleB1.cc + The selection of the user command interface is then done automatically + according to the Geant4 configuration or it can be done explicitly via + the third argument of the G4UIExecutive constructor (see exampleB4a.cc). + + C- HOW TO RUN + + - Execute exampleB1 in the 'interactive mode' with visualization: + % ./exampleB1 + and type in the commands from run1.mac line by line: + Idle> /control/verbose 2 + Idle> /tracking/verbose 1 + Idle> /run/beamOn 10 + Idle> ... + Idle> exit + or + Idle> /control/execute run1.mac + .... + Idle> exit + + - Execute exampleB1 in the 'batch' mode from macro files + (without visualization) + % ./exampleB1 run2.mac + % ./exampleB1 exampleB1.in > exampleB1.out + + diff --git a/exampleB1.cc b/exampleB1.cc new file mode 100644 index 0000000..7a765b7 --- /dev/null +++ b/exampleB1.cc @@ -0,0 +1,67 @@ +#include "ActionInitialization.hh" // 用户初始化 +#include "DetectorConstruction.hh" // 探测器构建文件 +#include "G4RunManagerFactory.hh" // 管理类 +#include "G4SteppingVerbose.hh" // step信息管理 verbose越大,输出越丰富 +#include "G4UIExecutive.hh" // UI操作 +#include "G4UImanager.hh" // UI管理 +#include "G4VisExecutive.hh" // 可视化 +#include "QBBC.hh" // 物理过程 +#include "Randomize.hh" // 随机数 + +using namespace B1; + +int main(int argc, char** argv) { + // argc 为 1 时,说明参数只有可执行文件本身,运行在GUI模式下 + // 如果 argc 不为 1,则运行在 batch mode,例如 example.exe run1.mac + G4UIExecutive* ui = nullptr; + if (argc == 1) { + ui = new G4UIExecutive(argc, argv); + } + + // 调整 step 的输出信息 + G4int precision = 4; + G4SteppingVerbose::UseBestUnit(precision); + + // 构建运行管理器 + auto* runManager = G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default); + + // 进行强制类的初始化 + // + // 探测器构建 + runManager->SetUserInitialization(new DetectorConstruction()); + + // 物理过程列表 + G4VModularPhysicsList* physicsList = new QBBC; + physicsList->SetVerboseLevel(1); + runManager->SetUserInitialization(physicsList); + + // 用户初始化 + runManager->SetUserInitialization(new ActionInitialization()); + + // 可视化初始化 + // G4VisExecutive 可以输入 verbose 参数,用于控制输出的详细程度 + // https://www.hep.ph.ic.ac.uk/~yoshiu/COMET/comet_g4HTMLdoc/_vis_.html + G4VisManager* visManager = new G4VisExecutive; + visManager->Initialize(); + + // 用户界面管理器的指针 + G4UImanager* UImanager = G4UImanager::GetUIpointer(); + + // 根据模式,选择开始进行模拟,或打开GUI + // + if (!ui) { + // batch mode + G4String command = "/control/execute "; + G4String fileName = argv[1]; + UImanager->ApplyCommand(command + fileName); + } else { + // interactive mode + UImanager->ApplyCommand("/control/execute init_vis.mac"); + ui->SessionStart(); + delete ui; + } + + // 释放指针 + delete visManager; + delete runManager; +} diff --git a/exampleB1.in b/exampleB1.in new file mode 100644 index 0000000..11f4c83 --- /dev/null +++ b/exampleB1.in @@ -0,0 +1,16 @@ +# Macro file for example B1 test + +/run/initialize + +# gamma 6 MeV +/gun/particle gamma +/gun/energy 6 MeV +# +/run/printProgress 100 +/run/beamOn 1000 +# +# proton 210 MeV +/gun/particle proton +/gun/energy 210 MeV +# +/run/beamOn 1000 diff --git a/exampleB1.out b/exampleB1.out new file mode 100644 index 0000000..86b9d60 --- /dev/null +++ b/exampleB1.out @@ -0,0 +1,917 @@ +Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Forcing G4RunManager type... + + ############################################ + !!! WARNING - FPE detection is activated !!! + ############################################ + + + ################################ + !!! G4Backtrace is activated !!! + ################################ + + +************************************************************** + Geant4 version Name: geant4-11-00-patch-01 (8-March-2022) + Copyright : Geant4 Collaboration + References : NIM A 506 (2003), 250-303 + : IEEE-TNS 53 (2006), 270-278 + : NIM A 835 (2016), 186-225 + WWW : http://geant4.org/ +************************************************************** + +<<< Reference Physics List QBBC +Visualization Manager instantiating with verbosity "warnings (3)"... +Visualization Manager initialising... +Registering graphics systems... + +You have successfully registered the following graphics systems. +Registered graphics systems are: + ASCIITree (ATree) + DAWNFILE (DAWNFILE) + G4HepRepFile (HepRepFile) + RayTracer (RayTracer) + VRML2FILE (VRML2FILE) + gMocrenFile (gMocrenFile) + OpenGLImmediateQt (OGLIQt, OGLI) + OpenGLStoredQt (OGLSQt, OGL, OGLS) + OpenGLImmediateXm (OGLIXm, OGLIQt_FALLBACK) + OpenGLStoredXm (OGLSXm, OGLSQt_FALLBACK) + OpenGLImmediateX (OGLIX, OGLIQt_FALLBACK, OGLIXm_FALLBACK) + OpenGLStoredX (OGLSX, OGLSQt_FALLBACK, OGLSXm_FALLBACK) + RayTracerX (RayTracerX) + +Registering model factories... + +You have successfully registered the following model factories. +Registered model factories: + generic + drawByAttribute + drawByCharge + drawByOriginVolume + drawByParticleID + drawByEncounteredVolume + +Registered models: + None + +Registered filter factories: + attributeFilter + chargeFilter + originVolumeFilter + particleFilter + encounteredVolumeFilter + +Registered filters: + None + +You have successfully registered the following user vis actions. +Run Duration User Vis Actions: none +End of Event User Vis Actions: none +End of Run User Vis Actions: none + +Some /vis commands (optionally) take a string to specify colour. +"/vis/list" to see available colours. +Checking overlaps for volume Envelope:0 (G4Box) ... OK! +Checking overlaps for volume Shape1:0 (G4Cons) ... OK! +Checking overlaps for volume Shape2:0 (G4Trd) ... OK! +### HadronInelasticQBBC Construct Process: + Emin(FTFP)= 3 GeV Emax(FTFP)= 100000 GeV + Emin(BERT)= 1 GeV Emax(BERT)= 6 GeV Emax(BERTpions)= 12 GeV + Emin(BIC) = 0 GeV Emax(BIC)= 1.5 GeV. +### Adding tracking cuts for neutron TimeCut(ns)= 10000 KinEnergyCut(MeV)= 0 +======================================================================= +====== Electromagnetic Physics Parameters ======== +======================================================================= +LPM effect enabled 1 +Enable creation and use of sampling tables 0 +Apply cuts on all EM processes 0 +Use general process 0 +Enable linear polarisation for gamma 0 +Enable sampling of quantum entanglement 0 +X-section factor for integral approach 0.8 +Min kinetic energy for tables 100 eV +Max kinetic energy for tables 100 TeV +Number of bins per decade of a table 7 +Verbose level 1 +Verbose level for worker thread 0 +Bremsstrahlung energy threshold above which + primary e+- is added to the list of secondary 100 TeV +Bremsstrahlung energy threshold above which primary + muon/hadron is added to the list of secondary 100 TeV +Lowest triplet kinetic energy 1 MeV +Enable sampling of gamma linear polarisation 0 +5D gamma conversion model type 0 +5D gamma conversion model on isolated ion 0 +Livermore data directory livermore +======================================================================= +====== Ionisation Parameters ======== +======================================================================= +Step function for e+- (0.2, 1 mm) +Step function for muons/hadrons (0.2, 0.1 mm) +Step function for light ions (0.2, 0.1 mm) +Step function for general ions (0.2, 0.1 mm) +Lowest e+e- kinetic energy 1 keV +Lowest muon/hadron kinetic energy 1 keV +Fluctuations of dE/dx are enabled 1 +Use ICRU90 data 0 +Use built-in Birks satuaration 0 +Build CSDA range enabled 0 +Use cut as a final range enabled 0 +Enable angular generator interface 0 +Max kinetic energy for CSDA tables 1 GeV +Max kinetic energy for NIEL computation 0 eV +Linear loss limit 0.01 +Read data from file for e+e- pair production by mu 0 +======================================================================= +====== Multiple Scattering Parameters ======== +======================================================================= +Type of msc step limit algorithm for e+- 1 +Type of msc step limit algorithm for muons/hadrons 0 +Msc lateral displacement for e+- enabled 1 +Msc lateral displacement for muons and hadrons 0 +Urban msc model lateral displacement alg96 1 +Range factor for msc step limit for e+- 0.04 +Range factor for msc step limit for muons/hadrons 0.2 +Geometry factor for msc step limitation of e+- 2.5 +Safety factor for msc step limit for e+- 0.6 +Skin parameter for msc step limitation of e+- 1 +Lambda limit for msc step limit for e+- 1 mm +Use Mott correction for e- scattering 0 +Factor used for dynamic computation of angular + limit between single and multiple scattering 1 +Fixed angular limit between single + and multiple scattering 3.1416 rad +Upper energy limit for e+- multiple scattering 100 MeV +Type of electron single scattering model 0 +Type of nuclear form-factor 1 +Screening factor 1 +======================================================================= + +phot: for gamma SubType=12 BuildTable=0 + LambdaPrime table from 200 keV to 100 TeV in 61 bins + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + LivermorePhElectric : Emin= 0 eV Emax= 100 TeV SauterGavrila Fluo + +compt: for gamma SubType=13 BuildTable=1 + Lambda table from 100 eV to 1 MeV, 7 bins/decade, spline: 1 + LambdaPrime table from 1 MeV to 100 TeV in 56 bins + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + Klein-Nishina : Emin= 0 eV Emax= 100 TeV + +conv: for gamma SubType=14 BuildTable=1 + Lambda table from 1.022 MeV to 100 TeV, 18 bins/decade, spline: 1 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + BetheHeitlerLPM : Emin= 0 eV Emax= 100 TeV ModifiedTsai + +Rayl: for gamma SubType=11 BuildTable=1 + Lambda table from 100 eV to 100 keV, 7 bins/decade, spline: 0 + LambdaPrime table from 100 keV to 100 TeV in 63 bins + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + LivermoreRayleigh : Emin= 0 eV Emax= 100 TeV CullenGenerator + +msc: for e- SubType= 10 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + UrbanMsc : Emin= 0 eV Emax= 100 MeV Nbins=42 100 eV - 100 MeV + StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llim=1 mm + WentzelVIUni : Emin= 100 MeV Emax= 100 TeV Nbins=42 100 MeV - 100 TeV + StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llim=1 mm + +eIoni: for e- XStype:1 SubType=2 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + StepFunction=(0.2, 1 mm), integ: 1, fluct: 1, linLossLim= 0.01 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + MollerBhabha : Emin= 0 eV Emax= 100 TeV + +eBrem: for e- XStype:4 SubType=3 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + LPM flag: 1 for E > 1 GeV, VertexHighEnergyTh(GeV)= 100000 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + eBremSB : Emin= 0 eV Emax= 1 GeV ModifiedTsai + eBremLPM : Emin= 1 GeV Emax= 100 TeV ModifiedTsai + +CoulombScat: for e- XStype:1 SubType=1 BuildTable=1 + Lambda table from 100 MeV to 100 TeV, 7 bins/decade, spline: 0 + ThetaMin(p) < Theta(degree) < 180 pLimit(GeV^1)= 0.139531 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + eCoulombScattering : Emin= 100 MeV Emax= 100 TeV + +msc: for e+ SubType= 10 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + UrbanMsc : Emin= 0 eV Emax= 100 MeV Nbins=42 100 eV - 100 MeV + StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llim=1 mm + WentzelVIUni : Emin= 100 MeV Emax= 100 TeV Nbins=42 100 MeV - 100 TeV + StepLim=UseSafety Rfact=0.04 Gfact=2.5 Sfact=0.6 DispFlag:1 Skin=1 Llim=1 mm + +eIoni: for e+ XStype:1 SubType=2 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + StepFunction=(0.2, 1 mm), integ: 1, fluct: 1, linLossLim= 0.01 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + MollerBhabha : Emin= 0 eV Emax= 100 TeV + +eBrem: for e+ XStype:4 SubType=3 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + LPM flag: 1 for E > 1 GeV, VertexHighEnergyTh(GeV)= 100000 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + eBremSB : Emin= 0 eV Emax= 1 GeV ModifiedTsai + eBremLPM : Emin= 1 GeV Emax= 100 TeV ModifiedTsai + +annihil: for e+ XStype:2 SubType=5 BuildTable=0 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + eplus2gg : Emin= 0 eV Emax= 100 TeV + +CoulombScat: for e+ XStype:1 SubType=1 BuildTable=1 + Lambda table from 100 MeV to 100 TeV, 7 bins/decade, spline: 0 + ThetaMin(p) < Theta(degree) < 180 pLimit(GeV^1)= 0.139531 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + eCoulombScattering : Emin= 100 MeV Emax= 100 TeV + +msc: for proton SubType= 10 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV + StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llim=1 mm + +hIoni: for proton XStype:1 SubType=2 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + StepFunction=(0.2, 0.1 mm), integ: 1, fluct: 1, linLossLim= 0.01 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + Bragg : Emin= 0 eV Emax= 2 MeV + BetheBloch : Emin= 2 MeV Emax= 100 TeV + +hBrems: for proton XStype:1 SubType=3 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 0 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + hBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi + +hPairProd: for proton XStype:1 SubType=4 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 0 + Sampling table 17x1001 from 7.50618 GeV to 100 TeV + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi + +CoulombScat: for proton XStype:1 SubType=1 BuildTable=1 + Lambda table from threshold to 100 TeV, 7 bins/decade, spline: 0 + ThetaMin(p) < Theta(degree) < 180 pLimit(GeV^1)= 0.139531 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + eCoulombScattering : Emin= 0 eV Emax= 100 TeV + +msc: for GenericIon SubType= 10 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + UrbanMsc : Emin= 0 eV Emax= 100 TeV + StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llim=1 mm + +ionIoni: for GenericIon XStype:1 SubType=2 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + StepFunction=(0.2, 0.1 mm), integ: 1, fluct: 1, linLossLim= 0.02 + Stopping Power data for 17 ion/material pairs + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + BraggIon : Emin= 0 eV Emax= 2 MeV + BetheBloch : Emin= 2 MeV Emax= 100 TeV + +msc: for alpha SubType= 10 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + UrbanMsc : Emin= 0 eV Emax= 100 TeV + StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llim=1 mm + +ionIoni: for alpha XStype:1 SubType=2 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + StepFunction=(0.2, 0.1 mm), integ: 1, fluct: 1, linLossLim= 0.02 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + BraggIon : Emin= 0 eV Emax=7.9452 MeV + BetheBloch : Emin=7.9452 MeV Emax= 100 TeV + +msc: for anti_proton SubType= 10 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV + StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llim=1 mm + +hIoni: for anti_proton XStype:1 SubType=2 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + StepFunction=(0.2, 0.1 mm), integ: 1, fluct: 1, linLossLim= 0.01 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + ICRU73QO : Emin= 0 eV Emax= 2 MeV + BetheBloch : Emin= 2 MeV Emax= 100 TeV + +hBrems: for anti_proton XStype:1 SubType=3 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 0 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + hBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi + +hPairProd: for anti_proton XStype:1 SubType=4 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 0 + Sampling table 17x1001 from 7.50618 GeV to 100 TeV + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi + +CoulombScat: for anti_proton XStype:1 SubType=1 BuildTable=1 + Lambda table from threshold to 100 TeV, 7 bins/decade, spline: 0 + ThetaMin(p) < Theta(degree) < 180 pLimit(GeV^1)= 0.139531 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + eCoulombScattering : Emin= 0 eV Emax= 100 TeV + +msc: for kaon+ SubType= 10 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV + StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llim=1 mm + +hIoni: for kaon+ XStype:1 SubType=2 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + StepFunction=(0.2, 0.1 mm), integ: 1, fluct: 1, linLossLim= 0.01 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + Bragg : Emin= 0 eV Emax=1.05231 MeV + BetheBloch : Emin=1.05231 MeV Emax= 100 TeV + +hBrems: for kaon+ XStype:1 SubType=3 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 0 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + hBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi + +hPairProd: for kaon+ XStype:1 SubType=4 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 0 + Sampling table 18x1001 from 3.94942 GeV to 100 TeV + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi + +CoulombScat: for kaon+ XStype:1 SubType=1 BuildTable=1 + Lambda table from threshold to 100 TeV, 7 bins/decade, spline: 0 + ThetaMin(p) < Theta(degree) < 180 pLimit(GeV^1)= 0.139531 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + eCoulombScattering : Emin= 0 eV Emax= 100 TeV + +msc: for kaon- SubType= 10 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV + StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llim=1 mm + +hIoni: for kaon- XStype:1 SubType=2 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + StepFunction=(0.2, 0.1 mm), integ: 1, fluct: 1, linLossLim= 0.01 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + ICRU73QO : Emin= 0 eV Emax=1.05231 MeV + BetheBloch : Emin=1.05231 MeV Emax= 100 TeV + +hBrems: for kaon- XStype:1 SubType=3 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 0 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + hBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi + +hPairProd: for kaon- XStype:1 SubType=4 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 0 + Sampling table 18x1001 from 3.94942 GeV to 100 TeV + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi + +CoulombScat: for kaon- XStype:1 SubType=1 BuildTable=1 + Used Lambda table of kaon+ + ThetaMin(p) < Theta(degree) < 180 pLimit(GeV^1)= 0.139531 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + eCoulombScattering : Emin= 0 eV Emax= 100 TeV + +msc: for mu+ SubType= 10 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV + StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llim=1 mm + +muIoni: for mu+ XStype:1 SubType=2 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + StepFunction=(0.2, 0.1 mm), integ: 1, fluct: 1, linLossLim= 0.01 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + Bragg : Emin= 0 eV Emax= 200 keV + BetheBloch : Emin= 200 keV Emax= 1 GeV + MuBetheBloch : Emin= 1 GeV Emax= 100 TeV + +muBrems: for mu+ XStype:1 SubType=3 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 0 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + MuBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi + +muPairProd: for mu+ XStype:1 SubType=4 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 0 + Sampling table 21x1001 from 1 GeV to 100 TeV + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + muPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi + +CoulombScat: for mu+ XStype:1 SubType=1 BuildTable=1 + Lambda table from threshold to 100 TeV, 7 bins/decade, spline: 0 + ThetaMin(p) < Theta(degree) < 180 pLimit(GeV^1)= 0.139531 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + eCoulombScattering : Emin= 0 eV Emax= 100 TeV + +msc: for mu- SubType= 10 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV + StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llim=1 mm + +muIoni: for mu- XStype:1 SubType=2 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + StepFunction=(0.2, 0.1 mm), integ: 1, fluct: 1, linLossLim= 0.01 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + ICRU73QO : Emin= 0 eV Emax= 200 keV + BetheBloch : Emin= 200 keV Emax= 1 GeV + MuBetheBloch : Emin= 1 GeV Emax= 100 TeV + +muBrems: for mu- XStype:1 SubType=3 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 0 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + MuBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi + +muPairProd: for mu- XStype:1 SubType=4 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 0 + Sampling table 21x1001 from 1 GeV to 100 TeV + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + muPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi + +CoulombScat: for mu- XStype:1 SubType=1 BuildTable=1 + Used Lambda table of mu+ + ThetaMin(p) < Theta(degree) < 180 pLimit(GeV^1)= 0.139531 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + eCoulombScattering : Emin= 0 eV Emax= 100 TeV + +msc: for pi+ SubType= 10 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV + StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llim=1 mm + +hIoni: for pi+ XStype:1 SubType=2 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + StepFunction=(0.2, 0.1 mm), integ: 1, fluct: 1, linLossLim= 0.01 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + Bragg : Emin= 0 eV Emax=297.505 keV + BetheBloch : Emin=297.505 keV Emax= 100 TeV + +hBrems: for pi+ XStype:1 SubType=3 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 0 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + hBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi + +hPairProd: for pi+ XStype:1 SubType=4 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 0 + Sampling table 20x1001 from 1.11656 GeV to 100 TeV + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi + +CoulombScat: for pi+ XStype:1 SubType=1 BuildTable=1 + Lambda table from threshold to 100 TeV, 7 bins/decade, spline: 0 + ThetaMin(p) < Theta(degree) < 180 pLimit(GeV^1)= 0.139531 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + eCoulombScattering : Emin= 0 eV Emax= 100 TeV + +msc: for pi- SubType= 10 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV + StepLim=Minimal Rfact=0.2 Gfact=2.5 Sfact=0.6 DispFlag:0 Skin=1 Llim=1 mm + +hIoni: for pi- XStype:1 SubType=2 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + StepFunction=(0.2, 0.1 mm), integ: 1, fluct: 1, linLossLim= 0.01 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + ICRU73QO : Emin= 0 eV Emax=297.505 keV + BetheBloch : Emin=297.505 keV Emax= 100 TeV + +hBrems: for pi- XStype:1 SubType=3 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 0 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + hBrem : Emin= 0 eV Emax= 100 TeV ModifiedMephi + +hPairProd: for pi- XStype:1 SubType=4 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 0 + Sampling table 20x1001 from 1.11656 GeV to 100 TeV + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + hPairProd : Emin= 0 eV Emax= 100 TeV ModifiedMephi + +CoulombScat: for pi- XStype:1 SubType=1 BuildTable=1 + Used Lambda table of pi+ + ThetaMin(p) < Theta(degree) < 180 pLimit(GeV^1)= 0.139531 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + eCoulombScattering : Emin= 0 eV Emax= 100 TeV + +==================================================================== + HADRONIC PROCESSES SUMMARY (verbose level 1) + +--------------------------------------------------- + Hadronic Processes for neutron + + Process: hadElastic + Model: hElasticCHIPS: 0 eV ---> 100 TeV + Cr_sctns: G4NeutronElasticXS: 0 eV ---> 100 TeV + + Process: neutronInelastic + Model: FTFP: 3 GeV ---> 100 TeV + Model: BertiniCascade: 1 GeV ---> 6 GeV + Model: Binary Cascade: 0 eV ---> 1.5 GeV + Cr_sctns: G4NeutronInelasticXS: 0 eV ---> 100 TeV + + Process: nCapture + Model: nRadCapture: 0 eV ---> 100 TeV + Cr_sctns: G4NeutronCaptureXS: 0 eV ---> 100 TeV + + Process: nKiller + +--------------------------------------------------- + Hadronic Processes for B- + + Process: hadElastic + Model: hElasticLHEP: 0 eV ---> 100 TeV + Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV + + Process: B-Inelastic + Model: FTFP: 0 eV ---> 100 TeV + Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV + +--------------------------------------------------- + Hadronic Processes for D- + + Process: hadElastic + Model: hElasticLHEP: 0 eV ---> 100 TeV + Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV + + Process: D-Inelastic + Model: FTFP: 0 eV ---> 100 TeV + Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV + +--------------------------------------------------- + Hadronic Processes for GenericIon + + Process: ionInelastic + Model: Binary Light Ion Cascade: 0 eV /n ---> 6 GeV/n + Model: FTFP: 3 GeV/n ---> 100 TeV/n + Cr_sctns: Glauber-Gribov Nucl-nucl: 0 eV ---> 25.6 PeV + + Process: ionElastic + Model: NNDiffuseElastic: 0 eV /n ---> 100 TeV/n + Cr_sctns: Glauber-Gribov Nucl-nucl: 0 eV ---> 25.6 PeV + +--------------------------------------------------- + Hadronic Processes for He3 + + Process: hadElastic + Model: hElasticLHEP: 0 eV /n ---> 100 TeV/n + Cr_sctns: Glauber-Gribov Nucl-nucl: 0 eV ---> 25.6 PeV + + Process: He3Inelastic + Model: Binary Light Ion Cascade: 0 eV /n ---> 6 GeV/n + Model: FTFP: 3 GeV/n ---> 100 TeV/n + Cr_sctns: G4ParticleInelasticXS: 0 eV ---> 25.6 PeV + +--------------------------------------------------- + Hadronic Processes for alpha + + Process: hadElastic + Model: hElasticLHEP: 0 eV /n ---> 100 TeV/n + Cr_sctns: Glauber-Gribov Nucl-nucl: 0 eV ---> 25.6 PeV + + Process: alphaInelastic + Model: Binary Light Ion Cascade: 0 eV /n ---> 6 GeV/n + Model: FTFP: 3 GeV/n ---> 100 TeV/n + Cr_sctns: G4ParticleInelasticXS: 0 eV ---> 25.6 PeV + +--------------------------------------------------- + Hadronic Processes for anti_He3 + + Process: hadElastic + Model: hElasticLHEP: 0 eV /n ---> 100.1 MeV/n + Model: AntiAElastic: 100 MeV/n ---> 100 TeV/n + Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV + + Process: anti_He3Inelastic + Model: FTFP: 0 eV /n ---> 100 TeV/n + Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV + + Process: hFritiofCaptureAtRest + +--------------------------------------------------- + Hadronic Processes for anti_alpha + + Process: hadElastic + Model: hElasticLHEP: 0 eV /n ---> 100.1 MeV/n + Model: AntiAElastic: 100 MeV/n ---> 100 TeV/n + Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV + + Process: anti_alphaInelastic + Model: FTFP: 0 eV /n ---> 100 TeV/n + Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV + + Process: hFritiofCaptureAtRest + +--------------------------------------------------- + Hadronic Processes for anti_deuteron + + Process: hadElastic + Model: hElasticLHEP: 0 eV /n ---> 100.1 MeV/n + Model: AntiAElastic: 100 MeV/n ---> 100 TeV/n + Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV + + Process: anti_deuteronInelastic + Model: FTFP: 0 eV /n ---> 100 TeV/n + Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV + + Process: hFritiofCaptureAtRest + +--------------------------------------------------- + Hadronic Processes for anti_lambda + + Process: hadElastic + Model: hElasticLHEP: 0 eV ---> 100 TeV + Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV + + Process: anti_lambdaInelastic + Model: FTFP: 0 eV ---> 100 TeV + Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV + + Process: hFritiofCaptureAtRest + +--------------------------------------------------- + Hadronic Processes for anti_neutron + + Process: hadElastic + Model: hElasticLHEP: 0 eV ---> 100.1 MeV + Model: AntiAElastic: 100 MeV ---> 100 TeV + Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV + + Process: anti_neutronInelastic + Model: FTFP: 0 eV ---> 100 TeV + Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV + + Process: hFritiofCaptureAtRest + +--------------------------------------------------- + Hadronic Processes for anti_proton + + Process: hadElastic + Model: hElasticLHEP: 0 eV ---> 100.1 MeV + Model: AntiAElastic: 100 MeV ---> 100 TeV + Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV + + Process: anti_protonInelastic + Model: FTFP: 0 eV ---> 100 TeV + Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV + + Process: hFritiofCaptureAtRest + +--------------------------------------------------- + Hadronic Processes for anti_triton + + Process: hadElastic + Model: hElasticLHEP: 0 eV /n ---> 100.1 MeV/n + Model: AntiAElastic: 100 MeV/n ---> 100 TeV/n + Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV + + Process: anti_tritonInelastic + Model: FTFP: 0 eV /n ---> 100 TeV/n + Cr_sctns: AntiAGlauber: 0 eV ---> 25.6 PeV + + Process: hFritiofCaptureAtRest + +--------------------------------------------------- + Hadronic Processes for deuteron + + Process: hadElastic + Model: hElasticLHEP: 0 eV /n ---> 100 TeV/n + Cr_sctns: Glauber-Gribov Nucl-nucl: 0 eV ---> 25.6 PeV + + Process: dInelastic + Model: Binary Light Ion Cascade: 0 eV /n ---> 6 GeV/n + Model: FTFP: 3 GeV/n ---> 100 TeV/n + Cr_sctns: G4ParticleInelasticXS: 0 eV ---> 25.6 PeV + +--------------------------------------------------- + Hadronic Processes for e+ + + Process: positronNuclear + Model: G4ElectroVDNuclearModel: 0 eV ---> 1 PeV + Cr_sctns: ElectroNuclearXS: 0 eV ---> 100 TeV + +--------------------------------------------------- + Hadronic Processes for e- + + Process: electronNuclear + Model: G4ElectroVDNuclearModel: 0 eV ---> 1 PeV + Cr_sctns: ElectroNuclearXS: 0 eV ---> 100 TeV + +--------------------------------------------------- + Hadronic Processes for gamma + + Process: photonNuclear + Model: GammaNPreco: 0 eV ---> 200 MeV + Model: BertiniCascade: 199 MeV ---> 6 GeV + Model: TheoFSGenerator: 3 GeV ---> 100 TeV + Cr_sctns: GammaNuclearXS: 0 eV ---> 100 TeV + +--------------------------------------------------- + Hadronic Processes for kaon+ + + Process: hadElastic + Model: hElasticLHEP: 0 eV ---> 100 TeV + Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV + + Process: kaon+Inelastic + Model: FTFP: 3 GeV ---> 100 TeV + Model: BertiniCascade: 0 eV ---> 6 GeV + Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV + +--------------------------------------------------- + Hadronic Processes for kaon- + + Process: hadElastic + Model: hElasticLHEP: 0 eV ---> 100 TeV + Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV + + Process: kaon-Inelastic + Model: FTFP: 3 GeV ---> 100 TeV + Model: BertiniCascade: 0 eV ---> 6 GeV + Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV + + Process: hBertiniCaptureAtRest + +--------------------------------------------------- + Hadronic Processes for lambda + + Process: hadElastic + Model: hElasticLHEP: 0 eV ---> 100 TeV + Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV + + Process: lambdaInelastic + Model: FTFP: 3 GeV ---> 100 TeV + Model: BertiniCascade: 0 eV ---> 6 GeV + Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV + +--------------------------------------------------- + Hadronic Processes for mu+ + + Process: muonNuclear + Model: G4MuonVDNuclearModel: 0 eV ---> 1 PeV + Cr_sctns: KokoulinMuonNuclearXS: 0 eV ---> 100 TeV + +--------------------------------------------------- + Hadronic Processes for mu- + + Process: muonNuclear + Model: G4MuonVDNuclearModel: 0 eV ---> 1 PeV + Cr_sctns: KokoulinMuonNuclearXS: 0 eV ---> 100 TeV + + Process: muMinusCaptureAtRest + +--------------------------------------------------- + Hadronic Processes for pi+ + + Process: hadElastic + Model: hElasticGlauber: 0 eV ---> 100 TeV + Cr_sctns: BarashenkovGlauberGribov: 0 eV ---> 100 TeV + + Process: pi+Inelastic + Model: FTFP: 3 GeV ---> 100 TeV + Model: BertiniCascade: 1 GeV ---> 12 GeV + Model: Binary Cascade: 0 eV ---> 1.5 GeV + Cr_sctns: BarashenkovGlauberGribov: 0 eV ---> 100 TeV + +--------------------------------------------------- + Hadronic Processes for pi- + + Process: hadElastic + Model: hElasticGlauber: 0 eV ---> 100 TeV + Cr_sctns: BarashenkovGlauberGribov: 0 eV ---> 100 TeV + + Process: pi-Inelastic + Model: FTFP: 3 GeV ---> 100 TeV + Model: BertiniCascade: 1 GeV ---> 12 GeV + Model: Binary Cascade: 0 eV ---> 1.5 GeV + Cr_sctns: BarashenkovGlauberGribov: 0 eV ---> 100 TeV + + Process: hBertiniCaptureAtRest + +--------------------------------------------------- + Hadronic Processes for proton + + Process: hadElastic + Model: hElasticCHIPS: 0 eV ---> 100 TeV + Cr_sctns: BarashenkovGlauberGribov: 0 eV ---> 100 TeV + + Process: protonInelastic + Model: FTFP: 3 GeV ---> 100 TeV + Model: BertiniCascade: 1 GeV ---> 6 GeV + Model: Binary Cascade: 0 eV ---> 1.5 GeV + Cr_sctns: G4ParticleInelasticXS: 0 eV ---> 100 TeV + +--------------------------------------------------- + Hadronic Processes for sigma- + + Process: hadElastic + Model: hElasticLHEP: 0 eV ---> 100 TeV + Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV + + Process: sigma-Inelastic + Model: FTFP: 3 GeV ---> 100 TeV + Model: BertiniCascade: 0 eV ---> 6 GeV + Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV + + Process: hBertiniCaptureAtRest + +--------------------------------------------------- + Hadronic Processes for triton + + Process: hadElastic + Model: hElasticLHEP: 0 eV /n ---> 100 TeV/n + Cr_sctns: Glauber-Gribov Nucl-nucl: 0 eV ---> 25.6 PeV + + Process: tInelastic + Model: Binary Light Ion Cascade: 0 eV /n ---> 6 GeV/n + Model: FTFP: 3 GeV/n ---> 100 TeV/n + Cr_sctns: G4ParticleInelasticXS: 0 eV ---> 25.6 PeV + +================================================================ +======================================================================= +====== Pre-compound/De-excitation Physics Parameters ======== +======================================================================= +Type of pre-compound inverse x-section 3 +Pre-compound model active 1 +Pre-compound excitation low energy (MeV) 0.1 +Pre-compound excitation high energy (MeV) 30 +Type of de-excitation inverse x-section 3 +Type of de-excitation factory Evaporation+GEM +Number of de-excitation channels 68 +Min excitation energy (keV) 0.01 +Min energy per nucleon for multifragmentation (MeV) 2e+05 +Limit excitation energy for Fermi BreakUp (MeV) 20 +Level density (1/MeV) 0.075 +Use simple level density model 1 +Use discrete excitation energy of the residual 0 +Time limit for long lived isomeres (ns) 1 +Isomer production flag 1 +Internal e- conversion flag 1 +Store e- internal conversion data 0 +Correlated gamma emission flag 0 +Max 2J for sampling of angular correlations 10 +======================================================================= +G4VisManager: Using G4TrajectoryDrawByCharge as fallback trajectory model. +See commands in /vis/modeling/trajectories/ for other options. +### Run 0 starts. +--> Event 0 starts. +--> Event 100 starts. +--> Event 200 starts. +--> Event 300 starts. +--> Event 400 starts. +--> Event 500 starts. +--> Event 600 starts. +--> Event 700 starts. +--> Event 800 starts. +--> Event 900 starts. + +--------------------End of Global Run----------------------- + The run consists of 1000 gamma of 6 MeV + Cumulated dose per run, in scoring volume : 38.9599 picoGy rms = 3.71693 picoGy +------------------------------------------------------------ + +0 events have been kept for refreshing and/or reviewing. + "/vis/reviewKeptEvents" to review them one by one. + "/vis/enable", then "/vis/viewer/flush" or "/vis/viewer/rebuild" to see them accumulated. +### Run 1 starts. +--> Event 0 starts. +--> Event 100 starts. +--> Event 200 starts. +--> Event 300 starts. +--> Event 400 starts. +--> Event 500 starts. +--> Event 600 starts. +--> Event 700 starts. +--> Event 800 starts. +--> Event 900 starts. + +--------------------End of Global Run----------------------- + The run consists of 1000 proton of 210 MeV + Cumulated dose per run, in scoring volume : 4.98572 nanoGy rms = 147.355 picoGy +------------------------------------------------------------ + +0 events have been kept for refreshing and/or reviewing. + "/vis/reviewKeptEvents" to review them one by one. + "/vis/enable", then "/vis/viewer/flush" or "/vis/viewer/rebuild" to see them accumulated. +Graphics systems deleted. +Visualization Manager deleting... diff --git a/include/ActionInitialization.hh b/include/ActionInitialization.hh new file mode 100644 index 0000000..1805db8 --- /dev/null +++ b/include/ActionInitialization.hh @@ -0,0 +1,21 @@ +#ifndef B1ActionInitialization_h +#define B1ActionInitialization_h 1 + +#include "G4VUserActionInitialization.hh" + +/// Action initialization class. + +namespace B1 { + +class ActionInitialization : public G4VUserActionInitialization { +public: + ActionInitialization(); + ~ActionInitialization() override; + + void BuildForMaster() const override; // 多线程的用户行为初始化 + void Build() const override; // 单线程的用户行为初始化 +}; + +} // namespace B1 + +#endif diff --git a/include/DetectorConstruction.hh b/include/DetectorConstruction.hh new file mode 100644 index 0000000..4c896cb --- /dev/null +++ b/include/DetectorConstruction.hh @@ -0,0 +1,29 @@ +#ifndef B1DetectorConstruction_h +#define B1DetectorConstruction_h 1 + +#include "G4VUserDetectorConstruction.hh" // 基类 +#include "globals.hh" + +class G4VPhysicalVolume; +class G4LogicalVolume; + +/// Detector construction class to define materials and geometry. + +namespace B1 { + +class DetectorConstruction : public G4VUserDetectorConstruction { +public: + DetectorConstruction(); // 构造 + ~DetectorConstruction() override; // 构析 + + G4VPhysicalVolume* Construct() override; // 函数,描述探测器,返回物理体 + + G4LogicalVolume* GetScoringVolume() const { return fScoringVolume; } // 自定义计数函数 返回指针fScoringVolume + +protected: + G4LogicalVolume* fScoringVolume = nullptr; // 用于计数 +}; + +} // namespace B1 + +#endif diff --git a/include/EventAction.hh b/include/EventAction.hh new file mode 100644 index 0000000..0a6e90d --- /dev/null +++ b/include/EventAction.hh @@ -0,0 +1,31 @@ +#ifndef B1EventAction_h +#define B1EventAction_h 1 + +#include "G4UserEventAction.hh" +#include "globals.hh" + +/// Event action class + +namespace B1 { + +class RunAction; + +class EventAction : public G4UserEventAction { +public: + EventAction(RunAction* runAction); + ~EventAction() override; + + void BeginOfEventAction(const G4Event* event) override; + void EndOfEventAction(const G4Event* event) override; + + // 对每个 step 累加,最后一个 step 输出一个 event 的能量沉积 + void AddEdep(G4double edep) { fEdep += edep; } + +private: + RunAction* fRunAction = nullptr; + G4double fEdep = 0.; +}; + +} // namespace B1 + +#endif diff --git a/include/PrimaryGeneratorAction.hh b/include/PrimaryGeneratorAction.hh new file mode 100644 index 0000000..1acbfdf --- /dev/null +++ b/include/PrimaryGeneratorAction.hh @@ -0,0 +1,38 @@ +#ifndef B1PrimaryGeneratorAction_h +#define B1PrimaryGeneratorAction_h 1 + +#include "G4ParticleGun.hh" +#include "G4VUserPrimaryGeneratorAction.hh" +#include "globals.hh" + +class G4ParticleGun; +class G4Event; +class G4Box; + +/// The primary generator action class with particle gun. +/// +/// The default kinematic is a 6 MeV gamma, randomly distribued +/// in front of the phantom across 80% of the (X,Y) phantom size. + +namespace B1 { + +// G4ParticleGun 粒子枪,即辐射源 +class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction { +public: + PrimaryGeneratorAction(); + ~PrimaryGeneratorAction() override; + + // method from the base class + void GeneratePrimaries(G4Event*) override; + + // method to access particle gun + const G4ParticleGun* GetParticleGun() const { return fParticleGun; } + +private: + G4ParticleGun* fParticleGun = nullptr; // pointer a to G4 gun class + G4Box* fEnvelopeBox = nullptr; +}; + +} // namespace B1 + +#endif diff --git a/include/RunAction.hh b/include/RunAction.hh new file mode 100644 index 0000000..f54fc3b --- /dev/null +++ b/include/RunAction.hh @@ -0,0 +1,35 @@ +#ifndef B1RunAction_h +#define B1RunAction_h 1 + +#include "G4Accumulable.hh" +#include "G4UserRunAction.hh" +#include "globals.hh" + +class G4Run; + +/// Run action class +/// +/// In EndOfRunAction(), it calculates the dose in the selected volume +/// from the energy deposit accumulated via stepping and event actions. +/// The computed dose is then printed on the screen. + +namespace B1 { + +class RunAction : public G4UserRunAction { +public: + RunAction(); + ~RunAction() override; + + void BeginOfRunAction(const G4Run*) override; // Run 开始时执行 + void EndOfRunAction(const G4Run*) override; // Run 结束时执行 + + void AddEdep(G4double edep); // 计算累计沉积的能量 + +private: + G4Accumulable fEdep = 0.; + G4Accumulable fEdep2 = 0.; +}; + +} // namespace B1 + +#endif diff --git a/include/SteppingAction.hh b/include/SteppingAction.hh new file mode 100644 index 0000000..9bc54b4 --- /dev/null +++ b/include/SteppingAction.hh @@ -0,0 +1,31 @@ +#ifndef B1SteppingAction_h +#define B1SteppingAction_h 1 + +#include "G4UserSteppingAction.hh" +#include "globals.hh" + +class G4LogicalVolume; + +/// Stepping action class + +namespace B1 { + +class EventAction; + +class SteppingAction : public G4UserSteppingAction { +public: + SteppingAction(EventAction* eventAction); + ~SteppingAction() override; + + // method from the base class + // 循环每个 step + void UserSteppingAction(const G4Step*) override; + +private: + EventAction* fEventAction = nullptr; + G4LogicalVolume* fScoringVolume = nullptr; +}; + +} // namespace B1 + +#endif diff --git a/init_vis.mac b/init_vis.mac new file mode 100644 index 0000000..8e46032 --- /dev/null +++ b/init_vis.mac @@ -0,0 +1,16 @@ +# Macro file for the initialization of example B1 +# in interactive session +# +# Set some default verbose +/control/verbose 2 +/control/saveHistory +/run/verbose 2 +# +# Change the default number of threads (in multi-threaded mode) +#/run/numberOfThreads 4 +# +# Initialize kernel +/run/initialize +# +# Visualization setting +/control/execute vis.mac diff --git a/run1.mac b/run1.mac new file mode 100644 index 0000000..8eb85c1 --- /dev/null +++ b/run1.mac @@ -0,0 +1,30 @@ +# Macro file for example B1 +# +# Can be run in batch, without graphic +# or interactively: Idle> /control/execute run1.mac +# +# Change the default number of workers (in multi-threading mode) +#/run/numberOfThreads 4 +# +# Initialize kernel +/run/initialize +# +/control/verbose 2 +/run/verbose 2 +/event/verbose 0 +/tracking/verbose 1 +# +# gamma 6 MeV to the direction (0.,0.,1.) +# +/gun/particle gamma +/gun/energy 6 MeV +# +/run/beamOn 5 +# +# proton 210 MeV to the direction (0.,0.,1.) +# +/gun/particle proton +/gun/energy 210 MeV +/tracking/verbose 2 +# +/run/beamOn 1 diff --git a/run2.mac b/run2.mac new file mode 100644 index 0000000..76b9b20 --- /dev/null +++ b/run2.mac @@ -0,0 +1,27 @@ +# Macro file for example B1 +# +# To be run preferably in batch, without graphics: +# % exampleB1 run2.mac +# +#/run/numberOfThreads 4 +/run/initialize +# +/control/verbose 2 +/run/verbose 2 +# +# gamma 6 MeV to the direction (0.,0.,1.) +# 10000 events +# +/gun/particle gamma +/gun/energy 6 MeV +# +/run/printProgress 100 +/run/beamOn 1000 +# +# proton 210 MeV to the direction (0.,0.,1.) +# 1000 events +# +/gun/particle proton +/gun/energy 210 MeV +# +/run/beamOn 1000 diff --git a/src/ActionInitialization.cc b/src/ActionInitialization.cc new file mode 100644 index 0000000..acf8920 --- /dev/null +++ b/src/ActionInitialization.cc @@ -0,0 +1,32 @@ +#include "ActionInitialization.hh" + +#include "EventAction.hh" +#include "PrimaryGeneratorAction.hh" +#include "RunAction.hh" +#include "SteppingAction.hh" + +namespace B1 { + +ActionInitialization::ActionInitialization() {} + +ActionInitialization::~ActionInitialization() {} + +void ActionInitialization::BuildForMaster() const { + RunAction* runAction = new RunAction; + SetUserAction(runAction); +} + +// 通过 SetUserAction() 函数对粒子发射器、run、event、step 设置用户行为 +void ActionInitialization::Build() const { + SetUserAction(new PrimaryGeneratorAction); + + RunAction* runAction = new RunAction; + SetUserAction(runAction); + + EventAction* eventAction = new EventAction(runAction); + SetUserAction(eventAction); + + SetUserAction(new SteppingAction(eventAction)); +} + +} // namespace B1 diff --git a/src/DetectorConstruction.cc b/src/DetectorConstruction.cc new file mode 100644 index 0000000..102e834 --- /dev/null +++ b/src/DetectorConstruction.cc @@ -0,0 +1,135 @@ +#include "DetectorConstruction.hh" + +#include "G4Box.hh" +#include "G4Cons.hh" +#include "G4LogicalVolume.hh" +#include "G4NistManager.hh" +#include "G4Orb.hh" +#include "G4PVPlacement.hh" +#include "G4RunManager.hh" +#include "G4Sphere.hh" +#include "G4SystemOfUnits.hh" +#include "G4Trd.hh" + +namespace B1 { + +// 构造函数 +DetectorConstruction::DetectorConstruction() {} + +// 构析函数 +DetectorConstruction::~DetectorConstruction() {} + +// 描述函数 +G4VPhysicalVolume* DetectorConstruction::Construct() { + // NIST 材料查找表 + G4NistManager* nist = G4NistManager::Instance(); + + // Envelope 的参数 + // 外层的水箱 + G4double env_sizeXY = 20 * cm, env_sizeZ = 30 * cm; + G4Material* env_mat = nist->FindOrBuildMaterial("G4_WATER"); + + // 检查几何体之间是否重叠 + G4bool checkOverlaps = true; + + // World + // 整个大环境,超出环境则认为逃逸 + G4double world_sizeXY = 1.2 * env_sizeXY; + G4double world_sizeZ = 1.2 * env_sizeZ; + G4Material* world_mat = nist->FindOrBuildMaterial("G4_AIR"); + + // 描述几何体 + // solid 几何框架 -> logic 材料 -> physical 放置等操作 + // 定义 World 的框架大小,注意尺寸是半尺寸 + G4Box* solidWorld = new G4Box("World", // 名称 + 0.5 * world_sizeXY, 0.5 * world_sizeXY, 0.5 * world_sizeZ); // 尺寸 + + G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld, // 几何框架 + world_mat, // 材料 + "World"); // 名称 + + G4VPhysicalVolume* physWorld = new G4PVPlacement(0, // 旋转 + G4ThreeVector(), // 中心位置,必须在 (0,0,0) + logicWorld, // 材料 + "World", // 名称 + 0, // 母体环境(Mother Volume) + false, // no boolean operation + 0, // copy number + checkOverlaps); // overlaps checking + + // Envelope + // World 中的小环境 + G4Box* solidEnv = new G4Box("Envelope", // 名称 + 0.5 * env_sizeXY, 0.5 * env_sizeXY, 0.5 * env_sizeZ); // 尺寸 + + G4LogicalVolume* logicEnv = new G4LogicalVolume(solidEnv, // 几何框架 + env_mat, // 材料 + "Envelope"); // 名称 + + new G4PVPlacement(0, // no rotation + G4ThreeVector(), // at (0,0,0) + logicEnv, // its logical volume + "Envelope", // its name + logicWorld, // 放置在 World 中 + false, // no boolean operation + 0, // copy number + checkOverlaps); // overlaps checking + + // Shape 1 + G4Material* shape1_mat = nist->FindOrBuildMaterial("G4_A-150_TISSUE"); + G4ThreeVector pos1 = G4ThreeVector(0, 2 * cm, -7 * cm); + + // 圆锥状 Conical section + G4double shape1_rmina = 0. * cm, shape1_rmaxa = 2. * cm; + G4double shape1_rminb = 0. * cm, shape1_rmaxb = 4. * cm; + G4double shape1_hz = 3. * cm; + G4double shape1_phimin = 0. * deg, shape1_phimax = 360. * deg; + G4Cons* solidShape1 = new G4Cons("Shape1", shape1_rmina, shape1_rmaxa, shape1_rminb, shape1_rmaxb, shape1_hz, + shape1_phimin, shape1_phimax); + + G4LogicalVolume* logicShape1 = new G4LogicalVolume(solidShape1, // its solid + shape1_mat, // its material + "Shape1"); // its name + + new G4PVPlacement(0, // no rotation + pos1, // at position + logicShape1, // its logical volume + "Shape1", // its name + logicEnv, // its mother volume + false, // no boolean operation + 0, // copy number + checkOverlaps); // overlaps checking + + // Shape 2 + G4Material* shape2_mat = nist->FindOrBuildMaterial("G4_BONE_COMPACT_ICRU"); + G4ThreeVector pos2 = G4ThreeVector(0, -1 * cm, 7 * cm); + + // 梯形 Trapezoid + G4double shape2_dxa = 12 * cm, shape2_dxb = 12 * cm; + G4double shape2_dya = 10 * cm, shape2_dyb = 16 * cm; + G4double shape2_dz = 6 * cm; + G4Trd* solidShape2 = new G4Trd("Shape2", // its name + 0.5 * shape2_dxa, 0.5 * shape2_dxb, 0.5 * shape2_dya, 0.5 * shape2_dyb, + 0.5 * shape2_dz); // its size + + G4LogicalVolume* logicShape2 = new G4LogicalVolume(solidShape2, // its solid + shape2_mat, // its material + "Shape2"); // its name + + new G4PVPlacement(0, // no rotation + pos2, // at position + logicShape2, // its logical volume + "Shape2", // its name + logicEnv, // its mother volume + false, // no boolean operation + 0, // copy number + checkOverlaps); // overlaps checking + + // 设置 Shape2 用于计算剂量 + fScoringVolume = logicShape2; + + // 总是返回大环境的物理体 + return physWorld; +} + +} // namespace B1 diff --git a/src/EventAction.cc b/src/EventAction.cc new file mode 100644 index 0000000..9f6bf42 --- /dev/null +++ b/src/EventAction.cc @@ -0,0 +1,20 @@ +#include "EventAction.hh" + +#include "G4Event.hh" +#include "G4RunManager.hh" +#include "RunAction.hh" + +namespace B1 { + +EventAction::EventAction(RunAction* runAction) : fRunAction(runAction) {} + +EventAction::~EventAction() {} + +void EventAction::BeginOfEventAction(const G4Event*) { fEdep = 0.; } + +void EventAction::EndOfEventAction(const G4Event*) { + // 将 event 中的沉积能量返回给 run + fRunAction->AddEdep(fEdep); +} + +} // namespace B1 diff --git a/src/PrimaryGeneratorAction.cc b/src/PrimaryGeneratorAction.cc new file mode 100644 index 0000000..3bb3f0d --- /dev/null +++ b/src/PrimaryGeneratorAction.cc @@ -0,0 +1,67 @@ +#include "PrimaryGeneratorAction.hh" + +#include "G4Box.hh" +#include "G4LogicalVolume.hh" +#include "G4LogicalVolumeStore.hh" +#include "G4ParticleDefinition.hh" +#include "G4ParticleGun.hh" +#include "G4ParticleTable.hh" +#include "G4RunManager.hh" +#include "G4SystemOfUnits.hh" +#include "Randomize.hh" + +namespace B1 { + +PrimaryGeneratorAction::PrimaryGeneratorAction() { + // 初始化粒子枪,每个 event 有 n_particle 个粒子 + G4int n_particle = 1; + fParticleGun = new G4ParticleGun(n_particle); + + // default particle kinematic + // 粒子列表的查找器 + G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable(); + // 设置为 6 MeV 沿 z 轴正方向的 gamma 源 + G4ParticleDefinition* particle = particleTable->FindParticle("gamma"); + fParticleGun->SetParticleDefinition(particle); + fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0., 0., 1.)); + fParticleGun->SetParticleEnergy(6. * MeV); +} + +PrimaryGeneratorAction::~PrimaryGeneratorAction() { delete fParticleGun; } + +// 每次 event 调用一次 this function is called at the begining of ecah event +// 可以设置粒子能谱分布、角度分布、源的位置分布 +void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent) { + G4double envSizeXY = 0; + G4double envSizeZ = 0; + + // 避免引入 DetectorConstruction 类 + // 从 G4LogicalVolumeStore 获取 Envelope volume + if (!fEnvelopeBox) { + G4LogicalVolume* envLV = G4LogicalVolumeStore::GetInstance()->GetVolume("Envelope"); + if (envLV) fEnvelopeBox = dynamic_cast(envLV->GetSolid()); + } + + // 获取几何参数 + if (fEnvelopeBox) { + envSizeXY = fEnvelopeBox->GetXHalfLength() * 2.; + envSizeZ = fEnvelopeBox->GetZHalfLength() * 2.; + } else { + G4ExceptionDescription msg; + msg << "Envelope volume of box shape not found.\n"; + msg << "Perhaps you have changed geometry.\n"; + msg << "The gun will be place at the center."; + G4Exception("PrimaryGeneratorAction::GeneratePrimaries()", "MyCode0002", JustWarning, msg); + } + + // 几何参数用于调整源的空间分布 + G4double size = 0.8; + G4double x0 = size * envSizeXY * (G4UniformRand() - 0.5); + G4double y0 = size * envSizeXY * (G4UniformRand() - 0.5); + G4double z0 = -0.5 * envSizeZ; + + fParticleGun->SetParticlePosition(G4ThreeVector(x0, y0, z0)); // 设置此次发射的位置 + fParticleGun->GeneratePrimaryVertex(anEvent); // 发射粒子 +} + +} // namespace B1 diff --git a/src/RunAction.cc b/src/RunAction.cc new file mode 100644 index 0000000..9b9c0a2 --- /dev/null +++ b/src/RunAction.cc @@ -0,0 +1,107 @@ +#include "RunAction.hh" + +#include "DetectorConstruction.hh" +#include "PrimaryGeneratorAction.hh" +// #include "Run.hh" + +#include "G4AccumulableManager.hh" +#include "G4LogicalVolume.hh" +#include "G4LogicalVolumeStore.hh" +#include "G4Run.hh" +#include "G4RunManager.hh" +#include "G4SystemOfUnits.hh" +#include "G4UnitsTable.hh" + +namespace B1 { + +RunAction::RunAction() { + // 定义剂量的单位,以 Gy 为准 + // + const G4double milligray = 1.e-3 * gray; + const G4double microgray = 1.e-6 * gray; + const G4double nanogray = 1.e-9 * gray; + const G4double picogray = 1.e-12 * gray; + + new G4UnitDefinition("milligray", "mGy", "Dose", milligray); + new G4UnitDefinition("microgray", "uGy", "Dose", microgray); + new G4UnitDefinition("nanogray", "nGy", "Dose", nanogray); + new G4UnitDefinition("picogray", "pGy", "Dose", picogray); + + // 将累加的数据注册到累加管理器 + G4AccumulableManager* accumulableManager = G4AccumulableManager::Instance(); + accumulableManager->RegisterAccumulable(fEdep); + accumulableManager->RegisterAccumulable(fEdep2); +} + +RunAction::~RunAction() {} + +// 每次 run 调用一次 +void RunAction::BeginOfRunAction(const G4Run*) { + // 保存随机数种子 + G4RunManager::GetRunManager()->SetRandomNumberStore(false); + + // 初始化累加的值 + G4AccumulableManager* accumulableManager = G4AccumulableManager::Instance(); + accumulableManager->Reset(); +} + +void RunAction::EndOfRunAction(const G4Run* run) { + // event 的数目 + G4int nofEvents = run->GetNumberOfEvent(); + if (nofEvents == 0) return; + + // 合并累加的值 + G4AccumulableManager* accumulableManager = G4AccumulableManager::Instance(); + accumulableManager->Merge(); + + // 计算剂量与方差 + // 一次 run 中的总沉积能量 + G4double edep = fEdep.GetValue(); + G4double edep2 = fEdep2.GetValue(); + + G4double rms = edep2 - edep * edep / nofEvents; + if (rms > 0.) + rms = std::sqrt(rms); + else + rms = 0.; + + // 剂量 = 总沉积能量 / 质量 + const DetectorConstruction* detConstruction = + static_cast(G4RunManager::GetRunManager()->GetUserDetectorConstruction()); + G4double mass = detConstruction->GetScoringVolume()->GetMass(); + G4double dose = edep / mass; + G4double rmsDose = rms / mass; + + // Run conditions + // note: There is no primary generator action object for "master" run manager for multi-threaded mode. + G4String runCondition; + const PrimaryGeneratorAction* generatorAction = + static_cast(G4RunManager::GetRunManager()->GetUserPrimaryGeneratorAction()); + if (generatorAction) { + const G4ParticleGun* particleGun = generatorAction->GetParticleGun(); + runCondition += particleGun->GetParticleDefinition()->GetParticleName(); + runCondition += " of "; + G4double particleEnergy = particleGun->GetParticleEnergy(); + runCondition += G4BestUnit(particleEnergy, "Energy"); + } + + // Print + if (IsMaster()) { + G4cout << G4endl << "--------------------End of Global Run-----------------------"; + } else { + G4cout << G4endl << "--------------------End of Local Run------------------------"; + } + + G4cout << G4endl << " The run consists of " << nofEvents << " " << runCondition << G4endl + << " Cumulated dose per run, in scoring volume : " << G4BestUnit(dose, "Dose") + << " rms = " << G4BestUnit(rmsDose, "Dose") << G4endl + << "------------------------------------------------------------" << G4endl << G4endl; +} + +void RunAction::AddEdep(G4double edep) { + // 累加沉积能量 + fEdep += edep; + fEdep2 += edep * edep; +} + +} // namespace B1 diff --git a/src/SteppingAction.cc b/src/SteppingAction.cc new file mode 100644 index 0000000..3f0f48c --- /dev/null +++ b/src/SteppingAction.cc @@ -0,0 +1,35 @@ +#include "SteppingAction.hh" + +#include "DetectorConstruction.hh" +#include "EventAction.hh" +#include "G4Event.hh" +#include "G4LogicalVolume.hh" +#include "G4RunManager.hh" +#include "G4Step.hh" + +namespace B1 { + +SteppingAction::SteppingAction(EventAction* eventAction) : fEventAction(eventAction) {} // 初始化 eventAction 类 + +SteppingAction::~SteppingAction() {} + +// 每个 step 调用一次 +void SteppingAction::UserSteppingAction(const G4Step* step) { + if (!fScoringVolume) { + const DetectorConstruction* detConstruction = + static_cast(G4RunManager::GetRunManager()->GetUserDetectorConstruction()); + fScoringVolume = detConstruction->GetScoringVolume(); + } + + // 获取当前的 Volume + G4LogicalVolume* volume = step->GetPreStepPoint()->GetTouchableHandle()->GetVolume()->GetLogicalVolume(); + + // 检查是否在计算的 Volume (Shape 2) + if (volume != fScoringVolume) return; + + // 获取当前 step 的沉积能量 + G4double edepStep = step->GetTotalEnergyDeposit(); + fEventAction->AddEdep(edepStep); +} + +} // namespace B1 diff --git a/vis.mac b/vis.mac new file mode 100644 index 0000000..5cc80c6 --- /dev/null +++ b/vis.mac @@ -0,0 +1,116 @@ +# Macro file for the visualization setting in the initialization phase +# of the B1 example when running in interactive mode +# + +# Use these open statements to open selected visualization +# +# Use this open statement to create an OpenGL view: +/vis/open OGL 600x600-0+0 +# +# Use this open statement to create an OpenInventor view: +#/vis/open OI +# +# Use this open statement to create a .prim file suitable for +# viewing in DAWN: +#/vis/open DAWNFILE +# +# Use this open statement to create a .heprep file suitable for +# viewing in HepRApp: +#/vis/open HepRepFile +# +# Use this open statement to create a .wrl file suitable for +# viewing in a VRML viewer: +#/vis/open VRML2FILE +# +# Disable auto refresh and quieten vis messages whilst scene and +# trajectories are established: +/vis/viewer/set/autoRefresh false +/vis/verbose errors +# +# Draw geometry: +/vis/drawVolume +# +# Specify view angle: +/vis/viewer/set/viewpointVector -1 0 0 +/vis/viewer/set/lightsVector -1 0 0 +# +# Specify style (surface, wireframe, auxiliary edges,...) +/vis/viewer/set/style wireframe +/vis/viewer/set/auxiliaryEdge true +/vis/viewer/set/lineSegmentsPerCircle 100 +# +# Draw smooth trajectories at end of event, showing trajectory points +# as markers 2 pixels wide: +/vis/scene/add/trajectories smooth +/vis/modeling/trajectories/create/drawByCharge +/vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true +/vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2 +# (if too many tracks cause core dump => /tracking/storeTrajectory 0) +# +# Draw hits at end of event: +#/vis/scene/add/hits +# +# To draw only gammas: +#/vis/filtering/trajectories/create/particleFilter +#/vis/filtering/trajectories/particleFilter-0/add gamma +# +# To invert the above, drawing all particles except gammas, +# keep the above two lines but also add: +#/vis/filtering/trajectories/particleFilter-0/invert true +# +# Many other options are available with /vis/modeling and /vis/filtering. +# For example, to select colour by particle ID: +#/vis/modeling/trajectories/create/drawByParticleID +#/vis/modeling/trajectories/drawByParticleID-0/default/setDrawStepPts true +# To select or override default colours (note: e+ is blue by default): +#/vis/modeling/trajectories/list +#/vis/modeling/trajectories/drawByParticleID-0/set e+ yellow +# +# To superimpose all of the events from a given run: +/vis/scene/endOfEventAction accumulate +# +# Decorations +# Name +/vis/set/textColour green +/vis/set/textLayout right +/vis/scene/add/text2D 0.9 -.9 24 ! ! exampleB1 +# or, if your system does not support right-adjustment +#/vis/scene/add/text2D 0 -.9 24 ! ! exampleB1 +/vis/set/textLayout # Revert to normal (left adjusted) layout +/vis/set/textColour # Revert to default text colour (blue) +# +# Axes, scale, etc. +/vis/scene/add/scale # Simple scale line +/vis/scene/add/axes # Simple axes: x=red, y=green, z=blue. +/vis/scene/add/eventID # Drawn at end of event +/vis/scene/add/date # Date stamp +/vis/scene/add/logo2D # Simple logo +/vis/scene/add/logo # 3D logo +# +# Frame +/vis/set/colour red +/vis/set/lineWidth 2 +/vis/scene/add/frame # Simple frame around the view +/vis/set/colour # Revert to default colour (white) +/vis/set/lineWidth # Revert to default line width (1.) +# +# Attach text to one edge of Shape1, with a small, fixed offset +/vis/scene/add/text 0 6 -4 cm 18 4 4 Shape1 +# Attach text to one corner of Shape2, with a small, fixed offset +/vis/scene/add/text 6 7 10 cm 18 4 4 Shape2 +# +# To get nice view +# Make the "World" box invisible +/vis/geometry/set/visibility World 0 false +# "Envelope" is transparent blue to represent water +/vis/geometry/set/colour Envelope 0 0 0 1 .3 +/vis/viewer/set/style surface +/vis/viewer/set/hiddenMarker true +/vis/viewer/set/viewpointThetaPhi 120 150 +# +# Re-establish auto refreshing and verbosity: +/vis/viewer/set/autoRefresh true +/vis/verbose warnings +# +# For file-based drivers, use this to create an empty detector view: +#/vis/viewer/flush