BLPhysics.hh
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef BLPHYSICS_HH
00020 #define BLPHYSICS_HH
00021
00022 #include "globals.hh"
00023 #include "G4VUserPhysicsList.hh"
00024 #include "G4ProcessTable.hh"
00025
00026 enum BLSetValue { FORCE_ON, FORCE_OFF, NORMAL };
00027
00028
00029
00030
00031
00032
00033
00034 class BLPhysics {
00035 protected:
00036 bool stochasticsEnabled;
00037 G4double minRangeCut;
00038 public:
00039
00040 BLPhysics() { stochasticsEnabled = true; minRangeCut = 1.0*mm; }
00041
00042
00043 virtual ~BLPhysics() { }
00044
00045
00046
00047
00048
00049
00050
00051 virtual void setDoStochastics(BLSetValue value, G4int warn=1) = 0;
00052
00053
00054 virtual G4VUserPhysicsList *getPhysicsList() = 0;
00055
00056
00057
00058 bool getStochasticsEnabled() { return stochasticsEnabled; }
00059
00060
00061 G4double getRangeCut() { return minRangeCut; }
00062
00063
00064 bool isStochasticProcess(G4VProcess *process)
00065 { return isStochasticProcess(process->GetProcessName()); }
00066
00067
00068
00069
00070
00071 bool isStochasticProcess(G4String name) {
00072 if(name.find("Trans") < name.size()) return false;
00073 if(name.find("Ioni") < name.size()) return false;
00074 if(name.find("Limiter") < name.size()) return false;
00075 if(name.find("BLCMD") < name.size()) return false;
00076 return true;
00077 }
00078
00079
00080
00081 void setProcessEnable(G4String pattern, bool onoff) {
00082 G4ProcessTable *pt = G4ProcessTable::GetProcessTable();
00083 std::vector<G4String> &pnv = *pt->GetNameList();
00084 for(unsigned i=0; i<pnv.size(); ++i) {
00085 G4String name = pnv[i];
00086 if(name.find(pattern) >= name.size()) continue;
00087 pt->SetProcessActivation(name,onoff);
00088 }
00089 }
00090 };
00091
00092 #endif // BLPHYSICS_HH