![]() |
|
|||
File indexing completed on 2025-02-23 09:20:46
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 /// \file biasing/ReverseMC01/include/RMC01AnalysisManager.hh 0027 /// \brief Definition of the RMC01AnalysisManager class 0028 // 0029 // 0030 ////////////////////////////////////////////////////////////// 0031 // Class Name: RMC01AnalysisManager 0032 // Author: L. Desorgher 0033 // Organisation: SpaceIT GmbH 0034 // Contract: ESA contract 21435/08/NL/AT 0035 // Customer: ESA/ESTEC 0036 ////////////////////////////////////////////////////////////// 0037 // CHANGE HISTORY 0038 //-------------- 0039 // ChangeHistory: 0040 // 17-11-2009 creation by L. Desorgher 0041 // 24-11-2009 L.Desorgher, 0042 // -registering in Conv* ASCII files every 5000 events the computed 0043 // edep with precision. 0044 // -Correction of the adjoint computed current and answer matrices 0045 // by a factor n_asked/n_processed for the case where a run is aborted 0046 // because the user expected precision on e_dep has been reached. 0047 // 7-11-2013 L. Desorgher, migrate to the use of G4Histo 0048 // 0049 //------------------------------------------------------------- 0050 0051 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0052 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0053 0054 #ifndef RMC01AnalysisManager_HH 0055 #define RMC01AnalysisManager_HH 0056 0057 #include "G4AnalysisManager.hh" 0058 #include "G4Event.hh" 0059 #include "G4Run.hh" 0060 #include "G4ThreeVector.hh" 0061 #include "G4ios.hh" 0062 #include "g4hntools_defs.hh" 0063 #include "globals.hh" 0064 0065 #include <fstream> 0066 #include <vector> 0067 0068 class G4Timer; 0069 class RMC01AnalysisManagerMessenger; 0070 0071 enum PRIM_SPECTRUM_TYPE 0072 { 0073 EXPO, 0074 POWER 0075 }; 0076 0077 class G4Step; 0078 0079 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0080 0081 class RMC01AnalysisManager 0082 { 0083 public: 0084 ~RMC01AnalysisManager(); 0085 static RMC01AnalysisManager* GetInstance(); 0086 0087 void BeginOfRun(const G4Run*); 0088 void EndOfRun(const G4Run*); 0089 void BeginOfEvent(const G4Event*); 0090 void EndOfEvent(const G4Event*); 0091 0092 void SetPrimaryExpSpectrumForAdjointSim(const G4String& particle_name, G4double fluence, 0093 G4double E0, G4double Emin, G4double Emax); 0094 void SetPrimaryPowerLawSpectrumForAdjointSim(const G4String& particle_name, G4double fluence, 0095 G4double alpha, G4double Emin, G4double Emax); 0096 // precision of the simulation results is given in % by the user 0097 inline void SetPrecision(G4double precision) { fPrecision_to_reach = precision / 100.; }; 0098 0099 // Booking and saving of histograms 0100 void Book(); 0101 void Save(G4double scaling_factor); 0102 0103 private: 0104 static RMC01AnalysisManager* fInstance; 0105 0106 RMC01AnalysisManager(); 0107 0108 void EndOfEventForForwardSimulation(const G4Event* anEvent); 0109 void EndOfEventForAdjointSimulation(const G4Event* anEvent); 0110 G4double PrimDiffAndDirFluxForAdjointSim(G4double prim_energy); 0111 /* 0112 void WriteHisto(G4H1* anHisto, G4double scaling_factor, 0113 G4String fileName, G4String header_lines); 0114 void WriteHisto(G4H2* anHisto, G4double scaling_factor, 0115 G4String fileName, G4String header_lines); 0116 */ 0117 void ComputeMeanEdepAndError(const G4Event* anEvent, G4double& mean, G4double& error); 0118 0119 RMC01AnalysisManagerMessenger* fMsg; 0120 0121 // Histos for fwd simulation 0122 //-------------- 0123 G4H1* fEdep_vs_prim_ekin; 0124 G4H1* fElectron_current; 0125 G4H1* fProton_current; 0126 G4H1* fGamma_current; 0127 0128 // Fluence 0129 //------------ 0130 // G4double fOmni_fluence_for_fwd_sim; 0131 0132 // Variable to check the convergence of the energy deposited 0133 // for forward and adjoint simulations 0134 //--------------------------------------------------------- 0135 G4double fAccumulated_edep; 0136 G4double fAccumulated_edep2; 0137 G4double fNentry; 0138 G4double fMean_edep; 0139 G4double fError_mean_edep; 0140 G4double fRelative_error; 0141 G4double fElapsed_time; 0142 G4double fPrecision_to_reach; 0143 G4bool fStop_run_if_precision_reached; 0144 G4int fNb_evt_modulo_for_convergence_test; 0145 0146 // Histos for forward and adjoint simulation 0147 //----------------------------- 0148 G4H1* fEdep_rmatrix_vs_electron_prim_energy; 0149 G4H2* fElectron_current_rmatrix_vs_electron_prim_energy; 0150 G4H2* fGamma_current_rmatrix_vs_electron_prim_energy; 0151 0152 G4H1* fEdep_rmatrix_vs_gamma_prim_energy; 0153 G4H2* fElectron_current_rmatrix_vs_gamma_prim_energy; 0154 G4H2* fGamma_current_rmatrix_vs_gamma_prim_energy; 0155 0156 G4H1* fEdep_rmatrix_vs_proton_prim_energy; 0157 G4H2* fElectron_current_rmatrix_vs_proton_prim_energy; 0158 G4H2* fProton_current_rmatrix_vs_proton_prim_energy; 0159 G4H2* fGamma_current_rmatrix_vs_proton_prim_energy; 0160 0161 G4String fFileName[2]; 0162 G4bool fFactoryOn; 0163 0164 // Prim spectrum to which the adjoint simulation will be normalised 0165 // Answer matrices will be also registered for post processing 0166 // normalisation 0167 //-------------------------------------------------------- 0168 PRIM_SPECTRUM_TYPE fPrimSpectrumType; 0169 G4int fPrimPDG_ID; 0170 G4double fAlpha_or_E0; 0171 G4double fAmplitude_prim_spectrum; 0172 G4double fEmin_prim_spectrum; 0173 G4double fEmax_prim_spectrum; 0174 G4bool fAdjoint_sim_mode; 0175 G4int fNb_evt_per_adj_evt; 0176 0177 // Timer 0178 //------ 0179 G4Timer* fTimer; 0180 std::fstream fConvergenceFileOutput; 0181 }; 0182 0183 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0184 0185 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |