////////////////////////////////////////////////////////////////////////
/// \class RAT::SNOMANConcentratorConstructor
///
/// \brief   Class that constructs the Concentrator Logical Volume using \n
///          the concentrator parameters
///
/// \author  Phil Jones <p.jones22@physics.ox.ac.uk>
/// \author Aksel Hallin <aksel.hallin@ualberta.ca> -- contact person
///
/// REVISION HISTORY:\n
///     07/09 : P.Jones - First Revision, new file. \n
///     05/10 : P.Jones - Added plastic back surface, and logical envelope \n
///     08/10 : P.Jones - Added model parameterization \n
///     01/11 : P.Jones - Added data input option \n
///     04/11 : P.Jones - Split into SNOMAN and RAT concentrator definitions \n
///
/// \details  Takes the concentrator parameters and constructs a \n
///          concentrator solid and places it into a logical volume. \n
///          This class build the SNOMAN defined concentrator
///
///
////////////////////////////////////////////////////////////////////////

#ifndef __RAT_SNOMANConcentratorConstructor__
#define __RAT_SNOMANConcentratorConstructor__

#include <RAT/ConcentratorConstructor.hh>

class G4VSolid;

namespace RAT
{

class SNOMANConcentratorConstructor : public ConcentratorConstructor
{
public:
  /// Constructor for the class, needs parameters and a name
  SNOMANConcentratorConstructor( const std::string& prefix,///< Prefix to name objects
                                 const ConcentratorConstructorParams& params ); ///< Parameters to build concentrator
  /// Produces a concentrator shaped solid volume
  virtual G4VSolid* ProduceSolid( const std::string& name,
                                  int numPoints,
                                  double* z,
                                  double* rInner,
                                  double* rOuter );
  /// Returns the Max height above the pmt equator of the concentrator
  virtual double GetMaxHeight();
  /// Returns the Max depth below the pmt equator of the concentrator (note returns a -ive number)
  virtual double GetMaxDepth();
  /// Returns the radius of the concentrator, for a hex shape this is the distance of the plane that has \n
  /// a normal that passes through the origin (See G4Polyhedra definition).
  virtual double GetHexRadius();
  /// Returns the maximum radius from the origin in xy plane.
  virtual double GetMaxRadius();

protected:
  /// Converts the ellipse fit into z, rho coords in conc params
  virtual double ProduceZRhoCoordsPetal( int& numPoints,
                                         double** z,
                                         double** petalInner,
                                         double** petalOuter,
                                         double** plasticInner,
                                         double** plasticOuter,
                                         double** zEnvelope,
                                         double** envelopeInner,
                                         double** envelopeOuter );
  /// Returns the Z co-ord given the radial value, note -ve z values only
  double ZFromR( double r );  ///< The radial co-ord
  /// Returns the radial co-ord given the z value
  double RFromZ( double z ); ///< The Z co-ord


};

} //::RAT

#endif