//////////////////////////////////////////////////////////////////////////////// /// \class RAT::Gen_MultiCombo /// /// \brief Class that generates any number of vertices in any number of volumes /// /// \author Daniel Asher Resnick /// \author Phil Jones -- contact person /// /// REVISION HISTORY:\n /// Jun 12, 2012 : Daniel Resnick - created /// 07-02-2017 : N Barros - Removed instances of low level generators (now inherited form GLG4Gen) /// - Added concrete implementations of BeginOfRun and EndOfRun /// /// \details With this class, one can specify any number of triples consisting of /// a vertex, a position, and a weight, and the generator will then /// create each vertex in its associated volume, such that the relative /// frequency at which each vertex is generated is given by the weight. /// //////////////////////////////////////////////////////////////////////////////// #ifndef __Gen_MultiCombo_h__ #define __Gen_MultiCombo_h__ #include #include #include class GLG4TimeGen; class GLG4VertexGen; class GLG4PosGen; namespace RAT { class Gen_MultiCombo : public GLG4Gen { public: Gen_MultiCombo(); virtual ~Gen_MultiCombo(); /// Set the type of each of the sub-generators /// Set the type of vertex generator (Gun, Gun2, etc.), /// position generator (Fill, Paint, Point, etc.), /// and time generator (Uniform, Poisson, etc.) virtual void SetState(G4String state); /// Get the type of each of the sub-generators virtual G4String GetState() const; /// Set the state of the time generator virtual void SetTimeState(G4String state); /// Set the state of the time generator virtual G4String GetTimeState() const; /// Add another vertex;pos;weight triple to the generator /// Format of state:\n /// "vtxState|posState|weight", where\n /// - vtxState is the weight to pass to VertexGen::SetState() /// - posState is the weight to pass to PosGen::SetState() /// - weight is the weight to assign this triple virtual void SetVertexState(G4String state); /// Check current list of triples in the generator virtual G4String GetVertexState() const; /// Add another vertex;pos;weight triple to the generator virtual void SetPosState(G4String state); /// Check current list of triples in the generator virtual G4String GetPosState() const; /// Create a new event virtual void GenerateEvent(G4Event *event); virtual void ResetTime(double offset=0.0); virtual bool IsRepeatable() const { return true; }; virtual void BeginOfRun(); virtual void EndOfRun(); private: // Simple struct to package a vertex generator, position generator, // and weight struct GenPair { GLG4VertexGen* fVtxGen; GLG4PosGen* fPosGen; double fWeight; GenPair(G4String vtxType, G4String vtxState, G4String posType, G4String posState, double weight); ~GenPair(); } ; std::vector fGenPairs; // List of all the GenPairs // String listing the types of sub-generators to use G4String fStateStr; // String listing the details of all the GenPairs G4String fPairStateStr; // The type of vertex and position generators to use G4String fVertexGenType; G4String fPosGenType; // Sum of all the weights, used to select a random GenPair by weight double fWeightSum; // Private implementation methods - see source for details virtual void AddGenPair(G4String newValues); virtual void DisplayFormat(); }; } //namespace RAT #endif //Gen_MultiCombo_h