//////////////////////////////////////////////////////////////////// /// \class RAT::PosGen_Paint /// /// \brief Generates events on the surface of set volume(s). /// /// \author Phil G Jones /// \author Matthew Mottram -- contact person /// /// REVISION HISTORY:\n /// 11 Jun 2012 : P.Jones - Refactor of GLG4PosGen. /// 17 July 2012 : D.Resnick - Use VolumeList to store volumes. /// /// \details Multiple volume paints can be added by calling the /// /generator/pos/set command multiple times e.g: /// /generator/pos/set 0 0 0 /// /generator/pos/set 1000 0 0 /// For events on the surface of the volumes located at the /// centre and 1m on x axis. /// The number of generated positions in each physical /// volume is proportional to the surface area (size). /// //////////////////////////////////////////////////////////////////// #ifndef __RAT_PosGen_Paint__ #define __RAT_PosGen_Paint__ #include #include #include #include #include class G4VPhysicalVolume; class G4VSolid; namespace RAT { class PosGen_Paint : public GLG4PosGen { public: /// Constructor sets the default db name PosGen_Paint(const std::string& dbname = std::string("paint")) : GLG4PosGen(dbname) { }; /// Destructor virtual ~PosGen_Paint() { }; /// Abstract interface for generating the position virtual void GeneratePosition(G4ThreeVector& argResult); /// Abstract interface for setting the state virtual void SetState(G4String newValues); /// Abstract interface for getting the state virtual G4String GetState() const; protected: VolumeList fVolumes; ///< List of volumes to generate events in std::vector fStates; ///< List of states to build fVolumes /// List of thicknesses, per state std::vector fStateThicknesses; std::vector fThicknesses; ///< List of thicknesses, per volume /// The total surface area of all the physical volumes to paint, in mm^2 double fTotalSurfaceArea; /// A flag marking whether the list of volumes needs to be regenerated bool fListValid; /// Memoized volume computation static double ComputeArea(const G4VPhysicalVolume* volume); /// A map of solid names to their cubic volumes, in mm^3 static std::map fSolidAreas; }; } // namespace RAT #endif