![]() |
|
|||
File indexing completed on 2025-09-16 08:56:28
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 // G4MSSteppingAction 0027 // 0028 // Class description: 0029 // 0030 // Stepping action for material scanner. 0031 0032 // Author: M.Asai, 5 May 2006 0033 // -------------------------------------------------------------------- 0034 #ifndef G4MSSteppingAction_hh 0035 #define G4MSSteppingAction_hh 1 0036 0037 #include "G4UserSteppingAction.hh" 0038 #include "globals.hh" 0039 #include "G4ThreeVector.hh" 0040 0041 #include <vector> 0042 0043 class G4Region; 0044 0045 0046 class G4MSSteppingAction : public G4UserSteppingAction 0047 { 0048 public: 0049 G4MSSteppingAction() = default; 0050 ~G4MSSteppingAction() override = default; 0051 0052 void Initialize(G4bool rSens, G4Region* reg); 0053 void UserSteppingAction(const G4Step*) override; 0054 0055 inline G4double GetTotalStepLength() const { return length; } 0056 inline G4double GetX0() const { return x0; } 0057 inline G4double GetLambda0() const { return lambda; } 0058 0059 /// Print material properties verbosely for each step of geantino 0060 /// This function is useful for single shot scans. 0061 void PrintEachMaterialVerbose(std::ostream & oss); 0062 0063 /// Print list of {material name, thickness, x0, lambda}, integrated by material name 0064 /// This function is useful for global scans. 0065 void PrintIntegratedMaterialVerbose(std::ostream & oss); 0066 0067 private: 0068 G4bool regionSensitive = false; 0069 G4Region* theRegion = nullptr; 0070 G4double length = 0.0; 0071 G4double x0 = 0.0; 0072 G4double lambda = 0.0; 0073 struct shape_mat_info_t 0074 { 0075 /// Calculated average atomic number 0076 G4double aveZ = 0.0; 0077 /// Calculated average mass number 0078 G4double aveA = 0.0; 0079 /// Density of material given by user 0080 G4double density = 0.0; 0081 /// Material radiation length 0082 G4double radiation_length = 0.0; 0083 /// Material interaction length 0084 G4double interaction_length = 0.0; 0085 /// Step of the geantino 0086 G4double thickness = 0.0; 0087 /// Integrated path of the geantino 0088 G4double integrated_thickness = 0.0; 0089 /// Calculated x0 = thickness/radiation_length 0090 G4double x0 = 0.0; 0091 /// Calculated lambda = thickness/interaction_length 0092 G4double lambda = 0.0; 0093 /// Integrated x0 0094 G4double integrated_x0 = 0.0; 0095 /// Integrated lambda 0096 G4double integrated_lambda = 0.0; 0097 /// Entry point of the geantino into the solid 0098 G4ThreeVector entry_point = { }; 0099 /// Exit point of the geantino out of the solid 0100 G4ThreeVector exit_point = { }; 0101 /// Material name. Composition is not checked. 0102 /// That is, if there are two identical materials 0103 /// except for the name, they are treated as different 0104 G4String material_name = { }; 0105 /// Getter that returns the full material name 0106 const G4String& GetName() { return material_name; } 0107 /// Getter that returns the material name, splitted in blocks of length 'column_width' 0108 G4String GetName(G4int column_width) 0109 { 0110 auto input_name_length = (G4int)material_name.length(); 0111 if( input_name_length < column_width) { return material_name; } 0112 0113 G4String formatted_name; 0114 for (std::size_t i = 0; i < material_name.length(); i += column_width) 0115 { 0116 // for each block of characters of length 'column_width', append '\n' 0117 formatted_name += material_name.substr(i, column_width); 0118 if (i + column_width < material_name.length()) 0119 { 0120 formatted_name += '\n'; 0121 } 0122 // append spaces for last block of characters so its length corresponds to column_width 0123 else 0124 { 0125 formatted_name+=G4String( column_width-(input_name_length%column_width),' '); 0126 } 0127 } 0128 return formatted_name; 0129 } 0130 }; 0131 std::vector<shape_mat_info_t> shape_mat_info_v; 0132 0133 }; 0134 0135 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |