Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:54:35

0001 // -*- C++ -*-
0002 // $Id: Parameter.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $
0003 //-----------------------Class Parameter------------------------------------//
0004 //                                                                          //
0005 //  Joe Boudreau                                                            //
0006 //  Petar Maksimovic                                                        //
0007 //  November 1999                                                           //
0008 //                                                                          //
0009 //  This class is a simple low-level double precision number, together with //
0010 //  some limiting values. It is designed essentially as an ingredient for   //
0011 //  building function objects.                                              //
0012 //                                                                          //
0013 //  Parameters can be connnected to one another. If a parameter is          //
0014 //  connected, it takes is value (and limits) from the parameter to which   //
0015 //  it is connected.                                                        //
0016 //  When disconnected, it captures the values of the connected field before //
0017 //  dropping the connection.  An attempt to alter the values of the field   //
0018 //  while the Parameter is connected to another parameter will result in    //
0019 //  an obnoxious warning mesage.                                            //
0020 //                                                                          //
0021 //--------------------------------------------------------------------------//
0022 #ifndef Parameter_h
0023 #define Parameter_h 1
0024 
0025 #include <string>
0026 #include <iostream>
0027 #include "CLHEP/GenericFunctions/AbsParameter.hh"
0028 
0029 namespace Genfun {
0030 
0031   /**
0032    * @author
0033    * @ingroup genfun
0034    */
0035   class Parameter:public AbsParameter {
0036 
0037     PARAMETER_OBJECT_DEF(Parameter)
0038   
0039       public:
0040   
0041     // Constructor.
0042     Parameter(std::string name,
0043           double value, 
0044           double lowerLimit=-1e100,
0045           double upperLimit= 1e100);
0046   
0047     // Copy constructor
0048     Parameter(const Parameter & right);
0049   
0050     // Destructor
0051     virtual ~Parameter();
0052 
0053     // Assignment
0054     const Parameter & operator=(const Parameter &right);
0055   
0056     // Accessor for the Parameter name
0057     const std::string & getName() const;
0058 
0059     // Accessor for value
0060     virtual double getValue() const;
0061   
0062     // Accessor for Lower Limit
0063     double getLowerLimit() const;
0064   
0065     // Accessor for Upper Limit
0066     double getUpperLimit() const;
0067   
0068     // Set Value
0069     void setValue(double value);
0070   
0071     // Set Lower Limit
0072     void setLowerLimit(double lowerLimit);
0073   
0074     // Set Upper Limit
0075     void setUpperLimit(double upperLimit);
0076   
0077     // Take values + limits from some other parameter.
0078     void connectFrom(const AbsParameter *  source);
0079   
0080     // Extra lingual type information:
0081     virtual Parameter *parameter() {return this;}
0082     virtual const Parameter *parameter() const {return this;}
0083   
0084   private:
0085 
0086     std::string        _name ;                // name
0087     double                _value;                // value
0088     double                _lowerLimit;           // lower limit
0089     double                _upperLimit;           // upper limit
0090     const AbsParameter   *_sourceParameter;      // connection
0091   
0092   };
0093 std::ostream & operator << ( std::ostream & o, const Parameter &p);
0094 } // namespace Genfun
0095 
0096 #endif