//////////////////////////////////////////////////////////////////// ///\class RAT::VertexGen_ES ///\author Nuno Barros -- contact person ///\date 18-Feb-2011 /// /// \brief Vertex generator for neutrino-electron elastic scattering. /// /// \details /// This class generates a vertex of a neutrino-electron elastic scattering. /// It is strongly based in an initial implementation by Joe Formaggio and an adaptation for a beam by Bill Seligman. /// The event generation for solar neutrinos is a bit more complicated and therefore the whole class was virtually re-written since then. /// The ES cross-section is now determined in a separate class. This class is responsible for performing the kinematic propagation. /// /// REVISION HISTORY: /// - 02/09/2005 J. Formaggio (UW): /// - Original implementation /// - 21-Jan-2006 Bill Seligman: /// - Converted to Geant4+GLG4Sim+RAT /// - 18-Feb-2011 Nuno Barros: /// - Updated to accommodate the new solar generator, which is now used by default. /// - Completely refactored to improve the cross-section calculation on a different class (imported from QSNO). /// - Prepare ground to return both the electron in the neutrino in the generated event (only electron for now). /// - 02-Jul-2012 N. Barros: /// - Removed the usage of Geant4 default streamers (G4cout) to use RAT Log mechanism instead. /// - 02-Aug-2012 N. Barros: /// - Reintroduced the compatibility with the combo generator, for simulation of simple cases. /// - The messenger options are available or not depending on who is the parent generator (disabled if it is solar). /// - Changed the "simple" data types from G4XXX to C++ core types. /// - 14-Aug-2012 N. Barros: /// - Solved some issues with the compatibility with the combo generator. /// - If the direction is set to 0,0,0 the generator now produces a random direction at each event. /// - 26-Nov-2014: Matt Strait: Doxygen fixes. /// //////////////////////////////////////////////////////////////////// #ifndef __RAT_VertexGen_ES__ #define __RAT_VertexGen_ES__ /// - RAT includes #include #include /// - Geant4 includes #include #include #include namespace RAT { class VertexGen_ES : public GLG4VertexGen { public: /** * Default constructor. * * As all GLG4VertexGen based objects, it takes an an argument to point to the default database entry. * This can later be changed. * * @param arg_dbname RATDB entry to load by default. * */ VertexGen_ES(const char* arg_dbname="solar"); /** Destructor. */ virtual ~VertexGen_ES(); /** * Implementation of GLG4VertexGen::GeneratePrimaryVertex. * \attention Requires the neutrino direction to be previously set. */ virtual void GeneratePrimaryVertex( G4Event* argEvent, G4ThreeVector& dx, G4double dt); /** * Private implementation of GLG4VertexGen::GeneratePrimaryVertex to be used by RAT::SolarGen * * Overload of RAT::VertexGen_ES::GeneratePrimaryVertex to allow for internal call from RAT::SolarGen. * This allows for backwards compatibility for simulation of a neutrino "beam" with fixed direction, while allowing also SolarGen to * update the direction of the incoming neutrino (necessary for solar neutrinos). * * @param[out] argEvent Output G4Event object with the generated primary. * @param[in] dx Position of the interaction. * @param[in] dt Time as defined by the time generator. * @param[in] nudir Incoming neutrino direction. * * \sa RAT::VertexGen_ES::GeneratePrimaryVertex, RAT::SolarGen */ virtual void GeneratePrimaryVertex( G4Event* argEvent, G4ThreeVector& dx, G4double dt, G4ThreeVector& nudir); /** * Set the direction state of the vertex generator. Used for command line override when using this generator with the \p combo generator. * * * \param[in] newValues Input string containing the direction in the format : " dir_x dir_y dir_z ". * \attention If the state string specifies a zero direction ("0 0 0"), the neutrinos are generated isotropically. */ virtual void SetState( G4String newValues ); /** Return the present state of the neutrino being generated in the same format as RAT::VertexGen_ES::SetState. */ virtual G4String GetState(); /** * Auxiliary method to set the flux to be generated. * * The flux can be any entry existing in the database defined in the constructor. * For the case of solar it should be one of the solar fluxes (pp,pep,hep,be7,b8,n13,o15,f17). * It looks up the corresponding spectrum in the SOLAR.ratdb file. * @param flux Key to the database entry. In case of solar it should be the corresponding flux. */ void SetFlux(const G4String flux); /** * Return the flux being generated. * @return Database key of the flux being used in this instance of the generator. */ G4String GetFlux() {return fFlux;}; /** * Auxiliary method to set the neutrino flavor being generated. * * @param flavor Flavor key passed to the RAT::ESCrossSec class. It can be one of (nue,numu,nuebar,numubar). */ void SetNuFlavor(const G4String flavor); /** Returns the neutrino flavor being generated. */ G4String GetNuFlavor() {return fNuFlavor;}; /** * @return the helper elastic scattering generator object. * */ ESgen *GetHelper() {return fESgen;}; /** * Setter as to whether the messenger can modify the generator behavior. * This is to allow the solar generator to lock the options to avoid * messing up the event production. */ void SetEnableMessenger( const bool state ); /** * Getter as to whether the messenger can modify the generator behavior. */ bool GetEnableMessenger() const {return fEnableMessenger;}; /** * Getter of the DB entry to input the spectrum from. * @return name of the DB name. */ const G4String GetDBName() const {return fDBName;} /** * Setter of the DB name. Defaults to \'SOLAR\' * @param[in] name of the database entry to look at. */ void SetDBName(const G4String name); private: /** Definitions of the involved particles. */ G4ParticleDefinition* fElectron, *fNue, *fNumu; /** Incoming neutrino direction. */ G4ThreeVector fNuDir; /** Database key for the spectrum being generated. */ G4String fFlux; /** Neutrino flavor being generated to initialize the cross section calculation. */ G4String fNuFlavor; /** * Class responsible for the kinematic calculations. * * \todo Merge both classes. */ ESgen *fESgen; // Electron mass double fElectronMass; /** Flag to keep track of the top level parent generator. * If this instance was built by the solar generator, disallow the * customizations from the messenger, otherwise we could easily get into too much trouble. * * By default it is turned on. The solar generator forces it to off. */ bool fEnableMessenger; /** Name of the database entry to read the input spectrum from. * Defaults to SOLAR. */ G4String fDBName; /** Failsafe flag in case of direction with zero amplitude.*/ bool fRandomDir; }; } // namespace RAT #endif