CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ConeAreaFunction.cc
Go to the documentation of this file.
2 
3 // -*- C++ -*-
4 //
5 // Package: ConeAreaFunction
6 // Class: ConeAreaFunction
7 //
16 //
17 // Original Author: Christian Veelken, UC Davis
18 // Created: Thu Nov 2 13:47:40 CST 2006
19 // $Id: ConeAreaFunction.cc,v 1.3 2009/01/14 10:53:15 hegner Exp $
20 //
21 //
22 
23 // C++ standard library include files
24 #include <iostream>
25 #include <iomanip>
26 #include <vector>
27 
28 // ROOT include files
29 #include <TMath.h>
30 
31 // CMSSW include files
33 
36 
37 //
38 // constructors and destructor
39 //
40 
42  : ROOT::Math::ParamFunction<ROOT::Math::IParametricGradFunctionOneDim>(2)
43 {
44  theta0_ = 0.;
45  phi0_ = 0.;
46 
47  etaMax_ = -1;
48 
50  integrator_ = new ROOT::Math::Integrator(*fTheta_);
51 }
52 
54 {
55  theta0_ = bluePrint.theta0_;
56  phi0_ = bluePrint.phi0_;
57 
58  etaMax_ = bluePrint.etaMax_;
59 
60  fTheta_ = new IntegrandThetaFunction(*bluePrint.fTheta_);
61  integrator_ = new ROOT::Math::Integrator(*fTheta_);
62 }
63 
65 {
66  delete fTheta_; // function gets deleted automatically by Integrator ?
67  delete integrator_;
68 }
69 
70 //
71 // assignment operator
72 //
73 
75 {
76  theta0_ = bluePrint.theta0_;
77  phi0_ = bluePrint.phi0_;
78 
79  etaMax_ = bluePrint.etaMax_;
80 
81  (*fTheta_) = (*bluePrint.fTheta_);
82  integrator_->SetFunction(*fTheta_);
83 
84  return (*this);
85 }
86 
87 //
88 // member functions
89 //
90 
92 {
93  theta0_ = theta0;
94 }
95 
97 {
98  phi0_ = normalizedPhi(phi0); // map azimuth angle into interval [-pi,+pi]
99 }
100 
102 {
103  if ( debugLevel_ > 0 ) {
104  edm::LogVerbatim("") << "<ConeAreaFunction::SetParameters>:" << std::endl
105  << " theta0 = " << param[0] << std::endl
106  << " phi0 = " << param[1] << std::endl;
107  }
108 
109  theta0_ = param[0];
110  phi0_ = param[1];
111 }
112 
114 {
115 //--- check that pseudo-rapidity given as function argument is positive
116 // (assume equal acceptance for positive and negative pseudo-rapidities)
117 
118  if ( etaMax > 0 ) {
119  etaMax_ = etaMax;
120  } else {
121  edm::LogError("") << "etaMax cannot be negative !" << std::endl;
122  }
123 }
124 
125 double ConeAreaFunction::DoEvalPar(double x, const double* param) const
126 {
127 //--- calculate area covered by cone of opening angle alpha
128 // (measured from cone axis);
129 // evaluate integral over angle theta
130 // (polar angle of point within cone)
131 // FIXME: the const above is actually not true as it is implemented now.
132 
133  theta0_ = param[0];
134  phi0_ = param[1];
135 
136  return DoEval(x);
137 }
138 
139 
140 double ConeAreaFunction::DoEval(double x) const
141 {
142 //--- calculate area covered by cone of opening angle alpha
143 // (measured from cone axis);
144 // evaluate integral over angle theta
145 // (polar angle of point within cone)
146 
150 
151  integrator_->SetFunction(*fTheta_); // set updated parameter values in Integrator
152 
153  double thetaMin = (etaMax_ > 0) ? 2*TMath::ATan(TMath::Exp(-etaMax_)) : 0.;
154  double thetaMax = TMath::Pi() - thetaMin;
155 
156  double integralOverTheta = integrator_->Integral(thetaMin, thetaMax);
157 
158  return integralOverTheta;
159 }
160 
161 double ConeAreaFunction::DoDerivative(double x) const
162 {
163 //--- virtual function inherited from ROOT::Math::ParamFunction base class;
164 // not implemented, because not neccessary, but needs to be defined to make code compile...
165  edm::LogWarning("") << "Function not implemented yet !" << std::endl;
166 
167  return 0.;
168 }
169 
170 double ConeAreaFunction::DoParameterDerivative(double, const double*, unsigned int) const
171 {
172 //--- virtual function inherited from ROOT::Math::ParamFunction base class;
173 // not implemented, because not neccessary, but needs to be defined to make code compile...
174  edm::LogWarning("") << "Function not implemented yet !" << std::endl;
175 
176  return 0.;
177 }
178 
179 
180 
181 void ConeAreaFunction::DoParameterGradient(double x, double* paramGradient) const
182 {
183 //--- virtual function inherited from ROOT::Math::ParamFunction base class;
184 // not implemented, because not neccessary, but needs to be defined to make code compile...
185  edm::LogWarning("") << "Function not implemented yet !" << std::endl;
186 }
187 
static const unsigned int debugLevel_
const double Pi
double DoDerivative(double x) const
void SetAcceptanceLimit(double etaMax)
void DoParameterGradient(double x, double *paramGradient) const
ROOT::Math::Integrator * integrator_
virtual double DoParameterDerivative(double, const double *, unsigned int) const
double DoEval(double x) const
void SetParameterPhi0(double phi0)
void SetParameterPhi0(double phi0)
void SetParameterAlpha(double alpha)
void SetParameterTheta0(double theta0)
IntegrandThetaFunction * fTheta_
void SetParameterTheta0(double theta0)
void SetParameters(double *param)
Definition: DDAxes.h:10
double normalizedPhi(double phi)
Definition: normalizedPhi.cc:5
ConeAreaFunction & operator=(const ConeAreaFunction &bluePrint)
virtual double DoEvalPar(double, const double *) const