CMS 3D CMS Logo

IntegrandThetaFunction.cc

Go to the documentation of this file.
00001 #include "PhysicsTools/IsolationUtils/interface/IntegrandThetaFunction.h"
00002 
00003 // -*- C++ -*-
00004 //
00005 // Package:    IntegrandThetaFunction
00006 // Class:      IntegrandThetaFunction
00007 // 
00016 //
00017 // Original Author:  Christian Veelken, UC Davis
00018 //         Created:  Thu Nov  2 13:47:40 CST 2006
00019 // $Id: IntegrandThetaFunction.cc,v 1.2 2007/05/28 09:59:50 llista Exp $
00020 //
00021 //
00022 
00023 // system include files
00024 #include <iostream>
00025 #include <iomanip>
00026 #include <vector>
00027 
00028 // ROOT include files
00029 #include <TMath.h>
00030 
00031 // CMSSW include files
00032 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00033 
00034 #include "PhysicsTools/IsolationUtils/interface/IntegralOverPhiFunction.h"
00035 #include "DataFormats/Math/interface/normalizedPhi.h"
00036 
00037 //
00038 // constructors and destructor
00039 //
00040 
00041 IntegrandThetaFunction::IntegrandThetaFunction()
00042   : ROOT::Math::ParamFunction(3)
00043 {
00044   theta0_ = 0.; 
00045   phi0_ = 0.; 
00046   alpha_ = 0.; 
00047 
00048   fPhi_ = new IntegralOverPhiFunction();
00049 }
00050 
00051 IntegrandThetaFunction::IntegrandThetaFunction(const IntegrandThetaFunction& bluePrint)
00052 {
00053   theta0_ = bluePrint.theta0_;
00054   phi0_ = bluePrint.phi0_;
00055   alpha_ = bluePrint.alpha_;
00056 
00057   fPhi_ = new IntegralOverPhiFunction(*bluePrint.fPhi_);
00058 }
00059 
00060 IntegrandThetaFunction::~IntegrandThetaFunction()
00061 {
00062   delete fPhi_;
00063 }
00064 
00065 //
00066 // assignment operator
00067 //
00068 
00069 IntegrandThetaFunction& IntegrandThetaFunction::operator=(const IntegrandThetaFunction& bluePrint)
00070 {
00071   theta0_ = bluePrint.theta0_;
00072   phi0_ = bluePrint.phi0_;
00073   alpha_ = bluePrint.alpha_;
00074   
00075   (*fPhi_) = (*bluePrint.fPhi_);
00076 
00077   return (*this);
00078 }
00079 
00080 //
00081 // member functions
00082 //
00083 
00084 void IntegrandThetaFunction::SetParameterTheta0(double theta0)
00085 {
00086   theta0_ = theta0;
00087 }
00088 
00089 void IntegrandThetaFunction::SetParameterPhi0(double phi0)
00090 {
00091   phi0_ = normalizedPhi(phi0); // map azimuth angle into interval [-pi,+pi]
00092 }
00093 
00094 void IntegrandThetaFunction::SetParameterAlpha(double alpha)
00095 {
00096   alpha_ = alpha;
00097 }
00098 
00099 void IntegrandThetaFunction::SetParameters(double* param)
00100 {
00101   theta0_ = param[0];
00102   phi0_ = param[1];
00103   alpha_ = param[2];
00104 }
00105 
00106 double IntegrandThetaFunction::DoEval(double x) const
00107 {
00108 //--- return zero if theta either close  to zero or close to Pi
00109 //    (numerical expressions might become "NaN"s)
00110   const double epsilon = 1.e-3;
00111   if ( x < epsilon || x > (TMath::Pi() - epsilon) ) return 0.;
00112 
00113 //--- calculate trigonometric expressions
00114 //    (dependend on angle theta;
00115 //     polar angle of point within cone)
00116   double sinTheta = TMath::Sin(x);
00117   double cscTheta = 1./sinTheta;
00118 
00119   double detJacobi = -cscTheta; // partial derrivative dEta/dTheta (for constant particle density in tau id. isolation cone)
00120   //double detJacobi = 1.; // ordinary solid angle (FOR TESTING ONLY)
00121 
00122 //--- evaluate integral over angle phi
00123 //    (azimuth angle of point within cone)
00124   fPhi_->SetParameterTheta0(theta0_);
00125   fPhi_->SetParameterPhi0(phi0_);
00126   fPhi_->SetParameterAlpha(alpha_);
00127 
00128   double integralOverPhi = (*fPhi_)(x);
00129 
00130   if ( debugLevel_ > 0 ) {
00131     edm::LogVerbatim("") << "integralOverPhi = " << integralOverPhi << std::endl
00132                          << " theta0 = " << theta0_ << std::endl
00133                          << " phi0 = " << phi0_ << std::endl
00134                          << " alpha = " << alpha_ << std::endl
00135                          << " theta = " << x << std::endl
00136                          << std::endl;
00137   }
00138   
00139 //--- integrand for integration over theta
00140 //    equals 
00141 //      |dEta/dTheta| * integral over phi * sin(theta)
00142 //
00143 //    (o the factor dEta/dTheta represents the particle density as function of theta, 
00144 //       assuming that the particle density is flat in eta;
00145 //     o the factor sin(theta) originates from the solid angle surface element 
00146 //       expressed in spherical polar coordinates)
00147 //
00148   //return TMath::Abs(detJacobi)*integralOverPhi*sinTheta;
00149   return TMath::Abs(detJacobi)*integralOverPhi;
00150 }  
00151 
00152 double IntegrandThetaFunction::DoDerivative(double x) const
00153 {
00154 //--- virtual function inherited from ROOT::Math::ParamFunction base class;
00155 //    not implemented, because not neccessary, but needs to be defined to make code compile...
00156   edm::LogWarning("") << "Function not implemented yet !" << std::endl;
00157 
00158   return 0.;
00159 }
00160 
00161 void IntegrandThetaFunction::DoParameterGradient(double x, double* paramGradient) const
00162 {
00163 //--- virtual function inherited from ROOT::Math::ParamFunction base class;
00164 //    not implemented, because not neccessary, but needs to be defined to make code compile...
00165   edm::LogWarning("") << "Function not implemented yet !" << std::endl;
00166 }
00167 

Generated on Tue Jun 9 17:41:11 2009 for CMSSW by  doxygen 1.5.4