CMS 3D CMS Logo

IntegralOverPhiFunction Class Reference

Description: auxialiary class for fixed area isolation cone computation (this class performs the integration over the azimuthal angle). More...

#include <PhysicsTools/IsolationUtils/src/IntegralOverPhiFunction.cc>

List of all members.

Public Member Functions

ROOT::Math::IGenFunction * Clone () const
 IntegralOverPhiFunction ()
void SetParameterAlpha (double alpha)
void SetParameterPhi0 (double phi0)
void SetParameterTheta0 (double theta0)
 ~IntegralOverPhiFunction ()

Private Member Functions

double DoDerivative (double x) const
double DoEval (double x) const
void DoParameterGradient (double x, double *paramGradient) const
void SetParameters (double *param)

Private Attributes

double alpha_
unsigned int numSolutionMax1_
unsigned int numSolutionMax2_
unsigned int numSolutionMax3_
unsigned int numSolutionMax4_
unsigned int numSolutionMin1_
unsigned int numSolutionMin2_
unsigned int numSolutionMin3_
unsigned int numSolutionMin4_
double phi0_
double theta0_

Static Private Attributes

static const unsigned int debugLevel_ = 0


Detailed Description

Description: auxialiary class for fixed area isolation cone computation (this class performs the integration over the azimuthal angle).

Implementation: imported into CMSSW on 05/18/2007

Definition at line 31 of file IntegralOverPhiFunction.h.


Constructor & Destructor Documentation

IntegralOverPhiFunction::IntegralOverPhiFunction (  ) 

Definition at line 46 of file IntegralOverPhiFunction.cc.

References alpha_, numSolutionMax1_, numSolutionMax2_, numSolutionMax3_, numSolutionMax4_, numSolutionMin1_, numSolutionMin2_, numSolutionMin3_, numSolutionMin4_, phi0_, and theta0_.

Referenced by Clone().

00047   : ROOT::Math::ParamFunction(3)
00048 { 
00049   theta0_ = 0.; 
00050   phi0_ = 0.; 
00051   alpha_ = 0.; 
00052 
00053 // !!! ONLY FOR TESTING
00054   numSolutionMin1_ = 0;
00055   numSolutionMax1_ = 0;
00056   numSolutionMin2_ = 0;
00057   numSolutionMax2_ = 0;
00058   numSolutionMin3_ = 0;
00059   numSolutionMax3_ = 0;
00060   numSolutionMin4_ = 0;
00061   numSolutionMax4_ = 0;
00062 //     FOR TESTING ONLY !!!
00063 }

IntegralOverPhiFunction::~IntegralOverPhiFunction (  ) 

Definition at line 65 of file IntegralOverPhiFunction.cc.

References debugLevel_, lat::endl(), numSolutionMax1_, numSolutionMax2_, numSolutionMax3_, numSolutionMax4_, numSolutionMin1_, numSolutionMin2_, numSolutionMin3_, and numSolutionMin4_.

00066 {
00067 // !!! ONLY FOR TESTING
00068   if ( debugLevel_ > 0 ) {
00069     edm::LogVerbatim("") << "<IntegralOverPhiFunction::~IntegralOverPhiFunction>:" << std::endl
00070                          << " numSolutionMin1 = " << numSolutionMin1_ << std::endl
00071                          << " numSolutionMax1 = " << numSolutionMax1_ << std::endl
00072                          << " numSolutionMin2 = " << numSolutionMin2_ << std::endl
00073                          << " numSolutionMax2 = " << numSolutionMax2_ << std::endl
00074                          << " numSolutionMin3 = " << numSolutionMin3_ << std::endl
00075                          << " numSolutionMax3 = " << numSolutionMax3_ << std::endl
00076                          << " numSolutionMin4 = " << numSolutionMin4_ << std::endl
00077                          << " numSolutionMax4 = " << numSolutionMax4_ << std::endl;
00078   }
00079 //     FOR TESTING ONLY !!!
00080 }


Member Function Documentation

ROOT::Math::IGenFunction* IntegralOverPhiFunction::Clone (  )  const [inline]

Definition at line 41 of file IntegralOverPhiFunction.h.

References IntegralOverPhiFunction().

00041 { return new IntegralOverPhiFunction(*this); }

double IntegralOverPhiFunction::DoDerivative ( double  x  )  const [private]

Definition at line 212 of file IntegralOverPhiFunction.cc.

References lat::endl().

00213 {
00214 //--- virtual function inherited from ROOT::Math::ParamFunction base class;
00215 //    not implemented, because not neccessary, but needs to be defined to make code compile...
00216   edm::LogWarning("") << "Function not implemented yet !" << std::endl;
00217 
00218   return 0.;
00219 }

double IntegralOverPhiFunction::DoEval ( double  x  )  const [private]

Definition at line 108 of file IntegralOverPhiFunction.cc.

References alpha_, TestMuL1L2Filter_cff::cerr, checkSolutions(), debugLevel_, lat::endl(), geometryDiff::epsilon, i, j, normalizedPhi(), numSolutionMax1_, numSolutionMax2_, numSolutionMax3_, numSolutionMax4_, numSolutionMin1_, numSolutionMin2_, numSolutionMin3_, numSolutionMin4_, phi, phi0_, Pi, r, s, t, and theta0_.

00109 {
00110 //--- return zero if theta either close to zero or close to Pi
00111 //    (phi not well-defined in that case;
00112 //     numerical expressions might become "NaN"s)
00113   const double epsilon = 1.e-3;
00114   if ( x < epsilon || x > (TMath::Pi() - epsilon) ) return 0.;
00115 
00116 //--- calculate trigonometric expressions
00117 //    (dependend on angle theta0;
00118 //     polar angle of cone axis);
00119 //    avoid theta0 exactly zero or exactly Pi
00120 //    (numerical expressions become "NaN"s)
00121   double theta0 = theta0_;
00122   if ( theta0 <                epsilon ) theta0 = epsilon;
00123   if ( theta0 > (TMath::Pi() - epsilon)) theta0 = (TMath::Pi() - epsilon);
00124   double cosTheta0 = TMath::Cos(theta0);
00125   double cos2Theta0 = TMath::Cos(2*theta0);
00126   double sinTheta0 = TMath::Sin(theta0);
00127   double cotTheta0 = 1./TMath::Tan(theta0);
00128   double cscTheta0 = 1./TMath::Sin(theta0);
00129 //    (dependend on angle phi0;
00130 //     azimuth angle of cone axis)
00131   double cosPhi0 = TMath::Cos(phi0_);
00132   double tanPhi0 = TMath::Tan(phi0_);
00133 //    (dependend on angle theta;
00134 //     polar angle of point within cone)
00135   double cosTheta = TMath::Cos(x);
00136   double cos2Theta = TMath::Cos(2*x);
00137   double sinTheta = TMath::Sin(x);
00138   double cotTheta = 1./TMath::Tan(x);
00139   double cscTheta = 1./TMath::Sin(x);
00140 //    (dependent on angle alpha;
00141 //     opening angle of cone, measured from cone axis)
00142   double cosAlpha = TMath::Cos(alpha_);
00143 
00144   double s = -cosPhi0*cosPhi0*(2*cosAlpha*cosAlpha + cos2Theta - 4*cosAlpha*cosTheta*cosTheta0 + cos2Theta0)*sinTheta*sinTheta*sinTheta0*sinTheta0;
00145 
00146 //--- return either zero or 2 Pi
00147 //    in case argument of square-root is zero or negative
00148 //    (negative values solely arise from rounding errors);
00149 //    check whether to return zero or 2 Pi:
00150 //     o return zero 
00151 //       if |theta- theta0| > alpha, 
00152 //       (theta outside cone of opening angle alpha, so vanishing integral over phi)
00153 //     o return 2 Pi
00154 //       if |theta- theta0| < alpha
00155 //       (theta within cone of opening angle alpha;
00156 //        actually theta0 < alpha in forward/backward direction,
00157 //        so that integral includes all phi values, hence yielding 2 Pi)
00158   if ( s <= 0 ) {
00159     if ( TMath::Abs(x - theta0) >  alpha_ ) return 0;
00160     if ( TMath::Abs(x - theta0) <= alpha_ ) return 2*TMath::Pi();
00161     std::cerr << "Error in <IntegralOverPhiFunction::operator()>: failed to compute return value !" << std::endl;
00162   }
00163 
00164   double r = (1./TMath::Sqrt(2.))*(cscTheta*cscTheta*cscTheta0*cscTheta0*TMath::Sqrt(s)*tanPhi0);
00165   double t = cosPhi0*(-cotTheta*cotTheta0 + cosAlpha*cscTheta*cscTheta0);
00166   
00167   double phi[4];
00168   phi[0] = -TMath::ACos(t - r);
00169   phi[1] =  TMath::ACos(t - r);
00170   phi[2] = -TMath::ACos(t + r);
00171   phi[3] =  TMath::ACos(t + r);
00172 
00173   if ( debugLevel_ > 0 ) {
00174     edm::LogVerbatim("") << "phi0 = " << phi0_ << std::endl
00175                          << "phi[0] = " << phi[0] << " (phi[0] - phi0 = " << (phi[0] - phi0_)*180/TMath::Pi() << ")" << std::endl
00176                          << "phi[1] = " << phi[1] << " (phi[1] - phi0 = " << (phi[1] - phi0_)*180/TMath::Pi() << ")" << std::endl
00177                          << "phi[2] = " << phi[2] << " (phi[2] - phi0 = " << (phi[2] - phi0_)*180/TMath::Pi() << ")" << std::endl
00178                          << "phi[3] = " << phi[3] << " (phi[3] - phi0 = " << (phi[3] - phi0_)*180/TMath::Pi() << ")" << std::endl;
00179   }
00180 
00181   double phiMin = 0.;
00182   double phiMax = 0.;  
00183   for ( unsigned int i = 0; i < 4; ++i ) {
00184     for ( unsigned int j = (i + 1); j < 4; ++j ) {
00185 //--- search for the two solutions for phi
00186 //    that have an equal distance to phi0
00187 //    and are on either side
00188       double dPhi_i = phi[i] - phi0_;
00189       double dPhi_j = phi0_ - phi[j];
00190       if ( TMath::Abs(normalizedPhi(dPhi_i - dPhi_j)) < epsilon ) { // map difference in azimuth angle into interval [-pi,+pi] and require it to be negligible
00191       //if ( TMath::Abs((phi[i] - phi0_) - (phi0_ - phi[j])) < epsilon ) { // map difference in azimuth angle into interval [-pi,+pi] and require it to be negligible
00192         phiMin = TMath::Min(phi[i], phi[j]);
00193         phiMax = TMath::Max(phi[i], phi[j]);
00194 
00195 // !!! ONLY FOR TESTING
00196         if ( phi[i] == phiMin ) checkSolutions(i, numSolutionMin1_, numSolutionMin2_, numSolutionMin3_, numSolutionMin4_);
00197         if ( phi[i] == phiMax ) checkSolutions(i, numSolutionMax1_, numSolutionMax2_, numSolutionMax3_, numSolutionMax4_);
00198         if ( phi[j] == phiMin ) checkSolutions(j, numSolutionMin1_, numSolutionMin2_, numSolutionMin3_, numSolutionMin4_);
00199         if ( phi[j] == phiMax ) checkSolutions(j, numSolutionMax1_, numSolutionMax2_, numSolutionMax3_, numSolutionMax4_);
00200 //     FOR TESTING ONLY !!!
00201       }
00202     }
00203   }
00204 
00205   if ( phiMin == 0 && phiMax == 0 ) {
00206     edm::LogError("") << "failed to compute Return Value !" << std::endl;
00207   }
00208 
00209   return TMath::Abs(normalizedPhi(phi0_ - phiMin)) + TMath::Abs(normalizedPhi(phiMax - phi0_));
00210 }  

void IntegralOverPhiFunction::DoParameterGradient ( double  x,
double *  paramGradient 
) const [private]

Definition at line 221 of file IntegralOverPhiFunction.cc.

References lat::endl().

00222 {
00223 //--- virtual function inherited from ROOT::Math::ParamFunction base class;
00224 //    not implemented, because not neccessary, but needs to be defined to make code compile...
00225   edm::LogWarning("") << "Function not implemented yet !" << std::endl;
00226 }

void IntegralOverPhiFunction::SetParameterAlpha ( double  alpha  ) 

Definition at line 96 of file IntegralOverPhiFunction.cc.

References alpha_.

Referenced by IntegrandThetaFunction::DoEval().

00097 {
00098   alpha_ = alpha;
00099 }

void IntegralOverPhiFunction::SetParameterPhi0 ( double  phi0  ) 

Definition at line 91 of file IntegralOverPhiFunction.cc.

References normalizedPhi(), and phi0_.

Referenced by IntegrandThetaFunction::DoEval().

00092 {
00093   phi0_ = normalizedPhi(phi0); // map azimuth angle into interval [-pi,+pi]
00094 }

void IntegralOverPhiFunction::SetParameters ( double *  param  )  [private]

Definition at line 101 of file IntegralOverPhiFunction.cc.

References alpha_, phi0_, and theta0_.

00102 {
00103   theta0_ = param[0];
00104   phi0_ = param[1];
00105   alpha_ = param[2];
00106 }

void IntegralOverPhiFunction::SetParameterTheta0 ( double  theta0  ) 

Definition at line 86 of file IntegralOverPhiFunction.cc.

References theta0_.

Referenced by IntegrandThetaFunction::DoEval().

00087 {
00088   theta0_ = theta0;
00089 }


Member Data Documentation

double IntegralOverPhiFunction::alpha_ [private]

Definition at line 52 of file IntegralOverPhiFunction.h.

Referenced by DoEval(), IntegralOverPhiFunction(), SetParameterAlpha(), and SetParameters().

const unsigned int IntegralOverPhiFunction::debugLevel_ = 0 [static, private]

Definition at line 65 of file IntegralOverPhiFunction.h.

Referenced by DoEval(), and ~IntegralOverPhiFunction().

unsigned int IntegralOverPhiFunction::numSolutionMax1_ [mutable, private]

Definition at line 56 of file IntegralOverPhiFunction.h.

Referenced by DoEval(), IntegralOverPhiFunction(), and ~IntegralOverPhiFunction().

unsigned int IntegralOverPhiFunction::numSolutionMax2_ [mutable, private]

Definition at line 58 of file IntegralOverPhiFunction.h.

Referenced by DoEval(), IntegralOverPhiFunction(), and ~IntegralOverPhiFunction().

unsigned int IntegralOverPhiFunction::numSolutionMax3_ [mutable, private]

Definition at line 60 of file IntegralOverPhiFunction.h.

Referenced by DoEval(), IntegralOverPhiFunction(), and ~IntegralOverPhiFunction().

unsigned int IntegralOverPhiFunction::numSolutionMax4_ [mutable, private]

Definition at line 62 of file IntegralOverPhiFunction.h.

Referenced by DoEval(), IntegralOverPhiFunction(), and ~IntegralOverPhiFunction().

unsigned int IntegralOverPhiFunction::numSolutionMin1_ [mutable, private]

Definition at line 55 of file IntegralOverPhiFunction.h.

Referenced by DoEval(), IntegralOverPhiFunction(), and ~IntegralOverPhiFunction().

unsigned int IntegralOverPhiFunction::numSolutionMin2_ [mutable, private]

Definition at line 57 of file IntegralOverPhiFunction.h.

Referenced by DoEval(), IntegralOverPhiFunction(), and ~IntegralOverPhiFunction().

unsigned int IntegralOverPhiFunction::numSolutionMin3_ [mutable, private]

Definition at line 59 of file IntegralOverPhiFunction.h.

Referenced by DoEval(), IntegralOverPhiFunction(), and ~IntegralOverPhiFunction().

unsigned int IntegralOverPhiFunction::numSolutionMin4_ [mutable, private]

Definition at line 61 of file IntegralOverPhiFunction.h.

Referenced by DoEval(), IntegralOverPhiFunction(), and ~IntegralOverPhiFunction().

double IntegralOverPhiFunction::phi0_ [private]

Definition at line 51 of file IntegralOverPhiFunction.h.

Referenced by DoEval(), IntegralOverPhiFunction(), SetParameterPhi0(), and SetParameters().

double IntegralOverPhiFunction::theta0_ [private]

Definition at line 50 of file IntegralOverPhiFunction.h.

Referenced by DoEval(), IntegralOverPhiFunction(), SetParameters(), and SetParameterTheta0().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:25:53 2009 for CMSSW by  doxygen 1.5.4