/search.css" rel="stylesheet" type="text/css"/> /search.js">
00001 /****************************************************************************** 00002 * GtRockGammaTool - Tool for roughly generating gammas from rock 00003 * 00004 * Tool to generate gammas from radioactivity in the rock around the 00005 * pool. It chooses a random point around the pool wall, top, or 00006 * bottom, and emits a gamma ray in a uniform random direction, in a 00007 * hemisphere defined away from the wall. 00008 * 00009 * GammaSpectrum: vector containing the bin content for the gamma 00010 * ray spectrum histogram. 00011 * 00012 * GammaBinEdges: vector containing the bin edges of the 00013 * histogram. Inputting this allows for dealing with uneven bin sizes. 00014 * The pdf does not need to be normalized. Obviously, GammaBinEdges 00015 * should have one more element than GammaSpectrum. 00016 * 00017 * Created by: dandwyer@caltech.edu 2011/05/16 00018 * Based on GtDiffuserBallTool by kboddy@caltech.edu 00019 *****************************************************************************/ 00020 00021 #ifndef GTROCKGAMMATOOL_H 00022 #define GTROCKGAMMATOOL_H 00023 00024 #include "GenTools/IHepMCEventMutator.h" 00025 #include "GaudiAlg/GaudiTool.h" 00026 #include "GaudiKernel/RndmGenerators.h" 00027 #include "CLHEP/Vector/ThreeVector.h" 00028 00029 // Rectangular surface 00030 class GtSourceRect { 00031 public: 00032 GtSourceRect(const CLHEP::Hep3Vector& origin, 00033 const CLHEP::Hep3Vector& edgeA, 00034 const CLHEP::Hep3Vector& edgeB); 00035 virtual ~GtSourceRect(); 00036 // Center of rectangle 00037 virtual double area(); 00038 // Center of rectangle 00039 virtual CLHEP::Hep3Vector origin(); 00040 // Normal of rectangular plane 00041 virtual CLHEP::Hep3Vector normal(); 00042 // Select random, uniform point on surface 00043 virtual CLHEP::Hep3Vector randomPoint(Rndm::Numbers& random); 00044 protected: 00045 double m_area; 00046 CLHEP::Hep3Vector m_origin; 00047 CLHEP::Hep3Vector m_edgeA; 00048 CLHEP::Hep3Vector m_edgeB; 00049 CLHEP::Hep3Vector m_normal; 00050 }; 00051 00052 // Octagonal surface: Based on rectangle, but with beveled corners 00053 class GtSourceOct : virtual public GtSourceRect { 00054 public: 00055 GtSourceOct(const CLHEP::Hep3Vector& origin, 00056 const CLHEP::Hep3Vector& edgeA, 00057 const CLHEP::Hep3Vector& edgeB, 00058 const double& bevelLength); 00059 virtual ~GtSourceOct(); 00060 virtual CLHEP::Hep3Vector randomPoint(Rndm::Numbers& random); 00061 protected: 00062 double m_bevelLength; 00063 }; 00064 00065 class GtRockGammaTool : public GaudiTool, 00066 virtual public IHepMCEventMutator 00067 { 00068 public: 00069 GtRockGammaTool(const std::string& type, 00070 const std::string& name, 00071 const IInterface* parent); 00072 virtual ~GtRockGammaTool(); 00073 00074 // GaudiTool interface 00075 virtual StatusCode initialize(); 00076 virtual StatusCode finalize(); 00077 00078 // HepMCEventMutator interface 00079 virtual StatusCode mutate(HepMC::GenEvent& event); 00080 00081 private: 00082 00083 Rndm::Numbers m_uni; 00084 double m_totalSurfaceArea; 00085 std::vector<GtSourceRect*> m_walls; 00086 00087 // User-defined PDF and associated bin edges for Gamma ray spectrum 00088 std::vector<double> m_pdfGammas; 00089 std::vector<double> m_edgesGammas; 00090 std::vector<double> m_cdfGammas; // Transient storage of Cum. Dist. Func. 00091 00092 StatusCode oneVertex(HepMC::GenEvent& event); 00093 double ConvertCdfRand(const double& rand, const std::vector<double>& cdf, 00094 const std::vector<double>& edges); 00095 unsigned int GetRandomWall(); 00096 00097 }; 00098 00099 00100 #endif //GTROCKGAMMATOOL_H