CMS 3D CMS Logo

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 //
20 //
21 
22 // C++ standard library include files
23 #include <iostream>
24 #include <iomanip>
25 #include <vector>
26 
27 // ROOT include files
28 #include <TMath.h>
29 
30 // CMSSW include files
32 
35 
36 //
37 // constructors and destructor
38 //
39 
41  : ROOT::Math::ParamFunction<ROOT::Math::IParametricGradFunctionOneDim>(2)
42 {
43  theta0_ = 0.;
44  phi0_ = 0.;
45 
46  etaMax_ = -1;
47 
49  integrator_ = new ROOT::Math::Integrator(*fTheta_);
50 }
51 
53 {
54  theta0_ = bluePrint.theta0_;
55  phi0_ = bluePrint.phi0_;
56 
57  etaMax_ = bluePrint.etaMax_;
58 
59  fTheta_ = new IntegrandThetaFunction(*bluePrint.fTheta_);
60  integrator_ = new ROOT::Math::Integrator(*fTheta_);
61 }
62 
64 {
65  delete fTheta_; // function gets deleted automatically by Integrator ?
66  delete integrator_;
67 }
68 
69 //
70 // assignment operator
71 //
72 
74 {
75  theta0_ = bluePrint.theta0_;
76  phi0_ = bluePrint.phi0_;
77 
78  etaMax_ = bluePrint.etaMax_;
79 
80  (*fTheta_) = (*bluePrint.fTheta_);
81  integrator_->SetFunction(*fTheta_);
82 
83  return (*this);
84 }
85 
86 //
87 // member functions
88 //
89 
91 {
92  theta0_ = theta0;
93 }
94 
96 {
97  phi0_ = normalizedPhi(phi0); // map azimuth angle into interval [-pi,+pi]
98 }
99 
100 void ConeAreaFunction::SetParameters(const double* param)
101 {
102  if ( debugLevel_ > 0 ) {
103  edm::LogVerbatim("") << "<ConeAreaFunction::SetParameters>:" << std::endl
104  << " theta0 = " << param[0] << std::endl
105  << " phi0 = " << param[1] << std::endl;
106  }
107 
108  theta0_ = param[0];
109  phi0_ = param[1];
110 }
111 
113 {
114 //--- check that pseudo-rapidity given as function argument is positive
115 // (assume equal acceptance for positive and negative pseudo-rapidities)
116 
117  if ( etaMax > 0 ) {
118  etaMax_ = etaMax;
119  } else {
120  edm::LogError("") << "etaMax cannot be negative !" << std::endl;
121  }
122 }
123 
124 double ConeAreaFunction::DoEvalPar(double x, const double* param) const
125 {
126 //--- calculate area covered by cone of opening angle alpha
127 // (measured from cone axis);
128 // evaluate integral over angle theta
129 // (polar angle of point within cone)
130 // FIXME: the const above is actually not true as it is implemented now.
131 
132  theta0_ = param[0];
133  phi0_ = param[1];
134 
135  return DoEval(x);
136 }
137 
138 
139 double ConeAreaFunction::DoEval(double x) const
140 {
141 //--- calculate area covered by cone of opening angle alpha
142 // (measured from cone axis);
143 // evaluate integral over angle theta
144 // (polar angle of point within cone)
145 
149 
150  integrator_->SetFunction(*fTheta_); // set updated parameter values in Integrator
151 
152  double thetaMin = (etaMax_ > 0) ? 2*TMath::ATan(TMath::Exp(-etaMax_)) : 0.;
153  double thetaMax = TMath::Pi() - thetaMin;
154 
155  double integralOverTheta = integrator_->Integral(thetaMin, thetaMax);
156 
157  return integralOverTheta;
158 }
159 
160 double ConeAreaFunction::DoDerivative(double x) const
161 {
162 //--- virtual function inherited from ROOT::Math::ParamFunction base class;
163 // not implemented, because not neccessary, but needs to be defined to make code compile...
164  edm::LogWarning("") << "Function not implemented yet !" << std::endl;
165 
166  return 0.;
167 }
168 
169 double ConeAreaFunction::DoParameterDerivative(double, const double*, unsigned int) const
170 {
171 //--- virtual function inherited from ROOT::Math::ParamFunction base class;
172 // not implemented, because not neccessary, but needs to be defined to make code compile...
173  edm::LogWarning("") << "Function not implemented yet !" << std::endl;
174 
175  return 0.;
176 }
177 
178 
179 
180 void ConeAreaFunction::DoParameterGradient(double x, double* paramGradient) const
181 {
182 //--- virtual function inherited from ROOT::Math::ParamFunction base class;
183 // not implemented, because not neccessary, but needs to be defined to make code compile...
184  edm::LogWarning("") << "Function not implemented yet !" << std::endl;
185 }
186 
static const unsigned int debugLevel_
const double Pi
double DoDerivative(double x) const
T normalizedPhi(T phi)
Definition: normalizedPhi.h:9
void SetAcceptanceLimit(double etaMax)
void DoParameterGradient(double x, double *paramGradient) const
void SetParameters(double const *param) override
ROOT::Math::Integrator * integrator_
void SetParameterPhi0(double phi0)
void SetParameterPhi0(double phi0)
void SetParameterAlpha(double alpha)
void SetParameterTheta0(double theta0)
IntegrandThetaFunction * fTheta_
void SetParameterTheta0(double theta0)
virtual double DoParameterDerivative(double, const double *, unsigned int) const override
double DoEval(double x) const override
ConeAreaFunction & operator=(const ConeAreaFunction &bluePrint)
virtual double DoEvalPar(double, const double *) const override