Warning, file /geant4/examples/extended/biasing/ReverseMC01/include/RMC01AnalysisManager.hh was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052 #ifndef RMC01AnalysisManager_HH
0053 #define RMC01AnalysisManager_HH
0054
0055 #include "G4ios.hh"
0056
0057 #include <vector>
0058 #include "globals.hh"
0059 #include <fstream>
0060 #include "G4ThreeVector.hh"
0061 #include "G4Accumulable.hh"
0062 #include "G4ThreadLocalSingleton.hh"
0063 #include "G4Event.hh"
0064 #include "G4Run.hh"
0065 #include"G4AnalysisManager.hh"
0066 #include "RMC01Analysis.hh"
0067
0068
0069 class G4Timer;
0070 class RMC01AnalysisManagerMessenger;
0071
0072 enum PRIM_SPECTRUM_TYPE{EXPO,POWER,USER};
0073
0074 class G4Step;
0075
0076
0077 using G4AnaH1 = tools::histo::h1d;
0078 using G4AnaH2 = tools::histo::h2d;
0079
0080
0081 class RMC01AnalysisManager
0082 {
0083 friend class G4ThreadLocalSingleton <RMC01AnalysisManager>;
0084
0085 public:
0086
0087 ~RMC01AnalysisManager();
0088 static RMC01AnalysisManager* GetInstance();
0089
0090 void BeginOfRun(const G4Run*);
0091 void EndOfRun(const G4Run*);
0092 void BeginOfEvent(const G4Event*);
0093 void EndOfEvent(const G4Event*);
0094
0095 void SetPrimaryExpSpectrumForAdjointSim(const G4String& particle_name,
0096 G4double fluence, G4double E0,
0097 G4double Emin, G4double Emax);
0098 void SetPrimaryPowerLawSpectrumForAdjointSim(
0099 const G4String& particle_name,
0100 G4double fluence, G4double alpha,
0101 G4double Emin, G4double Emax);
0102
0103
0104
0105 void SetUserDefinedSpectrumPointForAdjointSim(
0106 const G4String& particle_name,
0107 G4double fluence,
0108 G4bool is_arbitrary_point_wise=true);
0109
0110
0111
0112 inline void SetPrecision(G4double precision)
0113 {
0114 fPrecision_to_reach =precision/100.;
0115 }
0116
0117 inline void SetEventWeightFactor(G4double factor)
0118 {
0119 fevent_weight_factor=factor;
0120 }
0121
0122
0123
0124 void Book();
0125 void Save(G4double scaling_factor);
0126
0127 private:
0128
0129 RMC01AnalysisManager();
0130
0131 void EndOfEventForForwardSimulation(const G4Event* anEvent);
0132 void EndOfEventForAdjointSimulation(const G4Event* anEvent);
0133 G4double PrimDiffAndDirFluxForAdjointSim(G4double prim_energy);
0134
0135 void ComputeMeanEdepAndError(G4double& mean, G4double& error,
0136 G4int nb_of_global_evt);
0137
0138 RMC01AnalysisManagerMessenger* fMsg;
0139
0140
0141
0142 G4AnaH1* fEdep_vs_prim_ekin;
0143 G4AnaH1* fElectron_current;
0144 G4AnaH1* fProton_current;
0145 G4AnaH1* fGamma_current;
0146
0147
0148
0149
0150
0151
0152
0153
0154 G4Accumulable<G4double> fAccumulated_edep;
0155 G4Accumulable<G4double> fAccumulated_edep2;
0156 G4double fMean_edep;
0157 G4double fError_mean_edep;
0158 G4double fRelative_error;
0159 G4double fElapsed_time;
0160 G4double fPrecision_to_reach;
0161 G4bool fStop_run_if_precision_reached;
0162 G4int fNb_evt_modulo_for_convergence_test;
0163
0164
0165
0166 G4AnaH1* fEdep_rmatrix_vs_electron_prim_energy;
0167 G4AnaH2* fElectron_current_rmatrix_vs_electron_prim_energy;
0168 G4AnaH2* fGamma_current_rmatrix_vs_electron_prim_energy;
0169
0170 G4AnaH1* fEdep_rmatrix_vs_gamma_prim_energy;
0171 G4AnaH2* fElectron_current_rmatrix_vs_gamma_prim_energy;
0172 G4AnaH2* fGamma_current_rmatrix_vs_gamma_prim_energy;
0173
0174 G4AnaH1* fEdep_rmatrix_vs_proton_prim_energy;
0175 G4AnaH2* fElectron_current_rmatrix_vs_proton_prim_energy;
0176 G4AnaH2* fProton_current_rmatrix_vs_proton_prim_energy;
0177 G4AnaH2* fGamma_current_rmatrix_vs_proton_prim_energy;
0178
0179 G4String fFileName[2];
0180 G4bool fFactoryOn;
0181
0182
0183
0184
0185
0186 PRIM_SPECTRUM_TYPE fPrimSpectrumType;
0187 G4int fPrimPDG_ID;
0188 G4double fAlpha_or_E0;
0189 G4double fAmplitude_prim_spectrum;
0190 G4double fEmin_prim_spectrum;
0191 G4double fEmax_prim_spectrum;
0192 G4bool fAdjoint_sim_mode;
0193 G4int fNb_evt_per_adj_evt;
0194 std::vector<G4double> f_energy_vec;
0195 std::vector<G4double> f_flux_vec;
0196 G4double fevent_weight_factor;
0197
0198
0199
0200 G4bool fIsEndOfRun;
0201 };
0202
0203
0204
0205 #endif