CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes

BSpdfsFcn Class Reference

#include <BSpdfsFcn.h>

List of all members.

Public Member Functions

virtual double operator() (const std::vector< double > &) const
void SetData (std::vector< BSTrkParameters > a_BSvector)
void SetPDFs (std::string usepdfs)
virtual double Up () const

Private Member Functions

double PDFGauss_d (double z, double d, double sigmad, double phi, const std::vector< double > &parms) const
double PDFGauss_d_resolution (double z, double d, double phi, double pt, const std::vector< double > &parms) const
double PDFGauss_z (double z, double sigmaz, const std::vector< double > &parms) const

Private Attributes

std::vector< BSTrkParametersfBSvector
std::string fusepdfs

Static Private Attributes

static const int fPar_c0 = 7
static const int fPar_c1 = 8
static const int fPar_dxdz = 4
static const int fPar_dydz = 5
static const int fPar_SigmaBeam = 6
static const int fPar_SigmaZ = 3
static const int fPar_X0 = 0
static const int fPar_Y0 = 1
static const int fPar_Z0 = 2

Detailed Description

_________________________________________________________________ class: BSpdfsFcn.h package: RecoVertex/BeamSpotProducer

author: Francisco Yumiceva, Fermilab (yumiceva@fnal.gov)

version

Id:
BSpdfsFcn.h,v 1.2 2010/07/21 04:23:26 wmtan Exp

________________________________________________________________

Definition at line 23 of file BSpdfsFcn.h.


Member Function Documentation

double BSpdfsFcn::operator() ( const std::vector< double > &  params) const [virtual]

Definition at line 88 of file BSpdfsFcn.cc.

References f, fBSvector, fusepdfs, funct::log(), PDFGauss_d(), PDFGauss_d_resolution(), and PDFGauss_z().

                                                                   {
                
        double f = 0.0;

        //std::cout << "fusepdfs=" << fusepdfs << " params.size="<<params.size() << std::endl;
        
        std::vector<BSTrkParameters>::const_iterator iparam = fBSvector.begin();

        double pdf = 0;
        
        for( iparam = fBSvector.begin(); iparam != fBSvector.end(); ++iparam) {

                
                if (fusepdfs == "PDFGauss_z") {
                        pdf = PDFGauss_z( iparam->z0(), iparam->sigz0(),params);
                }
                else if (fusepdfs == "PDFGauss_d") {
                        pdf = PDFGauss_d( iparam->z0(), iparam->d0(),
                                                          iparam->sigd0(), iparam->phi0(),params);
                }
                else if (fusepdfs == "PDFGauss_d_resolution") {
                        pdf = PDFGauss_d_resolution( iparam->z0(), iparam->d0(),
                                                          iparam->phi0(), iparam->pt(),params);
                }
                else if (fusepdfs == "PDFGauss_d*PDFGauss_z") {
                        //std::cout << "pdf= " << pdf << std::endl;
                        pdf = PDFGauss_d( iparam->z0(), iparam->d0(),
                                                          iparam->sigd0(), iparam->phi0(),params)*
                                PDFGauss_z( iparam->z0(), iparam->sigz0(),params);
                }
                else if (fusepdfs == "PDFGauss_d_resolution*PDFGauss_z") {
                        pdf = PDFGauss_d_resolution( iparam->z0(), iparam->d0(),
                                                                                 iparam->phi0(), iparam->pt(),params)*
                                PDFGauss_z( iparam->z0(), iparam->sigz0(),params);
                }
                
                f = log(pdf) + f;
    }

        f= -2.0*f;
        return f;

}
double BSpdfsFcn::PDFGauss_d ( double  z,
double  d,
double  sigmad,
double  phi,
const std::vector< double > &  parms 
) const [private]

_________________________________________________________________ class: BSpdfsFcn.cc package: RecoVertex/BeamSpotProducer

author: Francisco Yumiceva, Fermilab (yumiceva@fnal.gov)

version

Id:
BSpdfsFcn.cc,v 1.1 2006/12/15 20:00:37 yumiceva Exp

________________________________________________________________

Definition at line 21 of file BSpdfsFcn.cc.

References funct::cos(), funct::exp(), fPar_dxdz, fPar_dydz, fPar_SigmaBeam, fPar_X0, fPar_Y0, Pi, query::result, funct::sin(), and mathSSE::sqrt().

Referenced by operator()().

                                                                                                           {

  //---------------------------------------------------------------------------
  //  PDF for d0 distribution. This PDF is a simple gaussian in the
  //  beam reference frame.
  //---------------------------------------------------------------------------
        double fsqrt2pi = sqrt(2.* TMath::Pi());
        
        double sig = sqrt(parms[fPar_SigmaBeam]*parms[fPar_SigmaBeam] +
                                          sigmad*sigmad);

        double dprime = d - ( ( parms[fPar_X0] + z*parms[fPar_dxdz] )*sin(phi)
                - ( parms[fPar_Y0] + z*parms[fPar_dydz] )*cos(phi) );
        
        double result = (exp(-(dprime*dprime)/(2.0*sig*sig)))/(sig*fsqrt2pi);
                
        return result;

}
double BSpdfsFcn::PDFGauss_d_resolution ( double  z,
double  d,
double  phi,
double  pt,
const std::vector< double > &  parms 
) const [private]

Definition at line 43 of file BSpdfsFcn.cc.

References funct::cos(), funct::exp(), fPar_c0, fPar_c1, fPar_dxdz, fPar_dydz, fPar_SigmaBeam, fPar_X0, fPar_Y0, Pi, query::result, funct::sin(), and mathSSE::sqrt().

Referenced by operator()().

                                                                                                                       {

  //---------------------------------------------------------------------------
  //  PDF for d0 distribution. This PDF is a simple gaussian in the
  //  beam reference frame. The IP resolution is parametrize by a linear
  //  function as a function of 1/pt.   
  //---------------------------------------------------------------------------
        double fsqrt2pi = sqrt(2.* TMath::Pi());

        double sigmad = parms[fPar_c0] + parms[fPar_c1]/pt;
        
        double sig = sqrt(parms[fPar_SigmaBeam]*parms[fPar_SigmaBeam] +
                                          sigmad*sigmad);

        double dprime = d - ( ( parms[fPar_X0] + z*parms[fPar_dxdz] )*sin(phi)
                - ( parms[fPar_Y0] + z*parms[fPar_dydz] )*cos(phi) );
        
        double result = (exp(-(dprime*dprime)/(2.0*sig*sig)))/(sig*fsqrt2pi);
                
        return result;

}
double BSpdfsFcn::PDFGauss_z ( double  z,
double  sigmaz,
const std::vector< double > &  parms 
) const [private]

Definition at line 67 of file BSpdfsFcn.cc.

References funct::exp(), fPar_SigmaZ, fPar_Z0, Pi, query::result, and mathSSE::sqrt().

Referenced by operator()().

                                                                                          {

  //---------------------------------------------------------------------------
  //  PDF for z-vertex distribution. This distribution
  // is parametrized by a simple normalized gaussian distribution.
  //---------------------------------------------------------------------------
        double fsqrt2pi = sqrt(2.* TMath::Pi());

        double sig = sqrt(sigmaz*sigmaz+parms[fPar_SigmaZ]*parms[fPar_SigmaZ]);
        //double sig = sqrt(sigmaz*sigmaz+parms[1]*parms[1]);
        double result = (exp(-((z-parms[fPar_Z0])*(z-parms[fPar_Z0]))/(2.0*sig*sig)))/(sig*fsqrt2pi);
        //double result = (exp(-((z-parms[0])*(z-parms[0]))/(2.0*sig*sig)))/(sig*fsqrt2pi);
        
        return result;

}
void BSpdfsFcn::SetData ( std::vector< BSTrkParameters a_BSvector) [inline]

Definition at line 27 of file BSpdfsFcn.h.

References fBSvector.

                                                              {
                
                fBSvector = a_BSvector;
                
        };
void BSpdfsFcn::SetPDFs ( std::string  usepdfs) [inline]

Definition at line 33 of file BSpdfsFcn.h.

References fusepdfs.

                                        {
                fusepdfs = usepdfs;
        }
virtual double BSpdfsFcn::Up ( ) const [inline, virtual]

Definition at line 38 of file BSpdfsFcn.h.

{return 1.;}

Member Data Documentation

std::vector< BSTrkParameters > BSpdfsFcn::fBSvector [private]

Definition at line 50 of file BSpdfsFcn.h.

Referenced by operator()(), and SetData().

const int BSpdfsFcn::fPar_c0 = 7 [static, private]

Definition at line 59 of file BSpdfsFcn.h.

Referenced by PDFGauss_d_resolution().

const int BSpdfsFcn::fPar_c1 = 8 [static, private]

Definition at line 60 of file BSpdfsFcn.h.

Referenced by PDFGauss_d_resolution().

const int BSpdfsFcn::fPar_dxdz = 4 [static, private]

Definition at line 56 of file BSpdfsFcn.h.

Referenced by PDFGauss_d(), and PDFGauss_d_resolution().

const int BSpdfsFcn::fPar_dydz = 5 [static, private]

Definition at line 57 of file BSpdfsFcn.h.

Referenced by PDFGauss_d(), and PDFGauss_d_resolution().

const int BSpdfsFcn::fPar_SigmaBeam = 6 [static, private]

Definition at line 58 of file BSpdfsFcn.h.

Referenced by PDFGauss_d(), and PDFGauss_d_resolution().

const int BSpdfsFcn::fPar_SigmaZ = 3 [static, private]

Definition at line 55 of file BSpdfsFcn.h.

Referenced by PDFGauss_z().

const int BSpdfsFcn::fPar_X0 = 0 [static, private]

Definition at line 52 of file BSpdfsFcn.h.

Referenced by PDFGauss_d(), and PDFGauss_d_resolution().

const int BSpdfsFcn::fPar_Y0 = 1 [static, private]

Definition at line 53 of file BSpdfsFcn.h.

Referenced by PDFGauss_d(), and PDFGauss_d_resolution().

const int BSpdfsFcn::fPar_Z0 = 2 [static, private]

Definition at line 54 of file BSpdfsFcn.h.

Referenced by PDFGauss_z().

std::string BSpdfsFcn::fusepdfs [private]

Definition at line 49 of file BSpdfsFcn.h.

Referenced by operator()(), and SetPDFs().