Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 // $Id: AnalyticConvolution.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $
0003 // ---------------------------------------------------------------------------//
0004 // This function-object makes analytic convolutions of a gaussian plus either //
0005 // an exponential, or else the function exp * (1+/-cos)                       //
0006 // The choice depends on which constructor is used to build the analytic      //
0007 // convolution and which arguments are used.                                  //
0008 //                                                                            //
0009 // Joe Boudreau, Petar Maksimovic, Hongquan Niu, Craig Blocker                //
0010 //                                                                            //
0011 // ---------------------------------------------------------------------------//
0012 #ifndef _AnalyticConvolution_h_
0013 #define _AnalyticConvolution_h_ 
0014 #include "CLHEP/GenericFunctions/AbsFunction.hh"
0015 #include "CLHEP/GenericFunctions/Parameter.hh"
0016 #include <complex>
0017 namespace Genfun {
0018 
0019   class Gaussian;
0020   class Exponential;
0021   class Cosine;
0022 
0023   /**
0024    * @author
0025    * @ingroup genfun
0026    */
0027   class AnalyticConvolution: public AbsFunction {
0028 
0029     FUNCTION_OBJECT_DEF(AnalyticConvolution)
0030 
0031       public:
0032 
0033     // Flag for mixed or unmixed:
0034     enum Type       {MIXED          =0,  // PDF for mixed events 
0035              UNMIXED        =1,  // PDF for unmixed events
0036              SMEARED_EXP    =2,  // Exponential (convolve) Gaussian
0037              SMEARED_COS_EXP=3,  // Exponential * Cosine (convolve) Gaussian
0038                      SMEARED_SIN_EXP=4,  // Exponential * Sine   (convolve) Gaussian
0039                      SMEARED_NEG_EXP=5}; // Negative exponential (convolve) Gaussian
0040     // Constructor
0041     AnalyticConvolution(Type=SMEARED_EXP);
0042 
0043     // Copy constructor
0044     AnalyticConvolution(const AnalyticConvolution &right);
0045   
0046     // Destructor:
0047     virtual ~AnalyticConvolution();
0048 
0049     // Retreive function value
0050     virtual double operator ()(double argument) const override;
0051     virtual double operator ()(const Argument & a) const override {return operator() (a[0]);}
0052   
0053     // Frequency of oscillation
0054     Parameter & frequency();
0055     const Parameter & frequency() const;
0056 
0057     // Lifetime of exponential:
0058     Parameter & lifetime();
0059     const Parameter & lifetime() const;
0060 
0061     // Width of the gaussian:
0062     Parameter & sigma();
0063     const Parameter & sigma() const;
0064 
0065     // The mean of the gaussian:
0066     Parameter & offset();
0067     const Parameter & offset() const;
0068 
0069   private:
0070   
0071     // These are for calculating mixing terms.
0072     double pow(double x, int n) const ;
0073     double erfc(double x) const ;
0074     std::complex<double> nwwerf(std::complex<double> z) const;
0075 
0076     // It is illegal to assign an adjustable constant
0077     const AnalyticConvolution & operator=(const AnalyticConvolution &right);
0078 
0079     Parameter          _lifetime;
0080     Parameter          _frequency;
0081     Parameter          _sigma;
0082     Parameter          _offset;
0083     Type               _type;
0084 
0085   };
0086 } // namespace Genfun
0087 #endif