BLPhysics.hh

Go to the documentation of this file.
00001 //      BLPhysics.hh
00002 /*
00003 This source file is part of G4beamline, http://g4beamline.muonsinc.com
00004 Copyright (C) 2003,2004,2005,2006 by Tom Roberts, all rights reserved.
00005 
00006 This program is free software; you can redistribute it and/or
00007 modify it under the terms of the GNU General Public License
00008 as published by the Free Software Foundation; either version 2
00009 of the License, or (at your option) any later version.
00010 
00011 This program is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.
00015 
00016 http://www.gnu.org/copyleft/gpl.html
00017 */
00018 
00019 #ifndef BLPHYSICS_HH
00020 #define BLPHYSICS_HH
00021 
00022 #include "globals.hh"
00023 #include "G4VUserPhysicsList.hh"
00024 
00025 enum BLSetValue { FORCE_ON, FORCE_OFF, NORMAL };
00026 
00027 /**     class BLPhysics is the interface class for selecting the physics
00028  *      processes to be used in the simulation.
00029  *
00030  *      Note: all functions are either inline or abstract, so no .cc file 
00031  *      is needed.
00032  **/
00033 class BLPhysics {
00034 protected:
00035         bool stochasticsEnabled;
00036         G4double minRangeCut;
00037 public:
00038         /// default constructor.
00039         BLPhysics() { }
00040 
00041         /// destructor.
00042         virtual ~BLPhysics() { }
00043 
00044         /// setNoStochastics() sets whether or not stochastic processes
00045         /// are to be enabled. Note that Decay is a stochastic process.
00046         /// The argument can be FORCE_ON, FORCE_OFF, and NORMAL (which
00047         /// means use the doStochastics parameter of the physics command).
00048         virtual void setDoStochastics(BLSetValue value, G4bool quiet=false) = 0;
00049 
00050         /// getPhysicsList() returns the G4PhysicsList.
00051         virtual G4VUserPhysicsList *getPhysicsList() = 0;
00052 
00053         /// getStochasticsEnabled() returns true if stochastics are enabled,
00054         /// false if not.
00055         bool getStochasticsEnabled() { return stochasticsEnabled; }
00056 
00057         /// getRangeCut() returns the range cut.
00058         G4double getRangeCut() { return minRangeCut; }
00059 
00060         /// isStochasticProcess() returns true if the process is stochastic.
00061         bool isStochasticProcess(G4VProcess *process) 
00062                 { return isStochasticProcess(process->GetProcessName()); }
00063 
00064         /// isStochasticProcess() returns true if the process is stochastic.
00065         bool isStochasticProcess(G4String name) {
00066                 if(name.find("Trans") < name.size()) return false;
00067                 if(name.find("Ioni") < name.size()) return false;
00068                 if(name.find("Limiter") < name.size()) return false;
00069                 if(name.find("BLCMD") < name.size()) return false;
00070                 return true;
00071         }
00072 };
00073 
00074 #endif // BLPHYSICS_HH
g4beamline