CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 //
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 
40 ConeAreaFunction::ConeAreaFunction() : ROOT::Math::ParamFunction<ROOT::Math::IParametricGradFunctionOneDim>(2) {
41  theta0_ = 0.;
42  phi0_ = 0.;
43 
44  etaMax_ = -1;
45 
47  integrator_ = new ROOT::Math::Integrator(*fTheta_);
48 }
49 
51  : ROOT::Math::ParamFunction<ROOT::Math::IParametricGradFunctionOneDim>(bluePrint) {
52  theta0_ = bluePrint.theta0_;
53  phi0_ = bluePrint.phi0_;
54 
55  etaMax_ = bluePrint.etaMax_;
56 
57  fTheta_ = new IntegrandThetaFunction(*bluePrint.fTheta_);
58  integrator_ = new ROOT::Math::Integrator(*fTheta_);
59 }
60 
62  delete fTheta_; // function gets deleted automatically by Integrator ?
63  delete integrator_;
64 }
65 
66 //
67 // assignment operator
68 //
69 
71  theta0_ = bluePrint.theta0_;
72  phi0_ = bluePrint.phi0_;
73 
74  etaMax_ = bluePrint.etaMax_;
75 
76  (*fTheta_) = (*bluePrint.fTheta_);
77  integrator_->SetFunction(*fTheta_);
78 
79  return (*this);
80 }
81 
82 //
83 // member functions
84 //
85 
86 void ConeAreaFunction::SetParameterTheta0(double theta0) { theta0_ = theta0; }
87 
89  phi0_ = normalizedPhi(phi0); // map azimuth angle into interval [-pi,+pi]
90 }
91 
92 void ConeAreaFunction::SetParameters(const double* param) {
93  if (debugLevel_ > 0) {
94  edm::LogVerbatim("") << "<ConeAreaFunction::SetParameters>:" << std::endl
95  << " theta0 = " << param[0] << std::endl
96  << " phi0 = " << param[1] << std::endl;
97  }
98 
99  theta0_ = param[0];
100  phi0_ = param[1];
101 }
102 
104  //--- check that pseudo-rapidity given as function argument is positive
105  // (assume equal acceptance for positive and negative pseudo-rapidities)
106 
107  if (etaMax > 0) {
108  etaMax_ = etaMax;
109  } else {
110  edm::LogError("") << "etaMax cannot be negative !" << std::endl;
111  }
112 }
113 
114 double ConeAreaFunction::DoEvalPar(double x, const double* param) const {
115  //--- calculate area covered by cone of opening angle alpha
116  // (measured from cone axis);
117  // evaluate integral over angle theta
118  // (polar angle of point within cone)
119  // FIXME: the const above is actually not true as it is implemented now.
120 
121  theta0_ = param[0];
122  phi0_ = param[1];
123 
124  return DoEval(x);
125 }
126 
127 double ConeAreaFunction::DoEval(double x) const {
128  //--- calculate area covered by cone of opening angle alpha
129  // (measured from cone axis);
130  // evaluate integral over angle theta
131  // (polar angle of point within cone)
132 
136 
137  integrator_->SetFunction(*fTheta_); // set updated parameter values in Integrator
138 
139  double thetaMin = (etaMax_ > 0) ? 2 * TMath::ATan(TMath::Exp(-etaMax_)) : 0.;
140  double thetaMax = TMath::Pi() - thetaMin;
141 
142  double integralOverTheta = integrator_->Integral(thetaMin, thetaMax);
143 
144  return integralOverTheta;
145 }
146 
147 double ConeAreaFunction::DoDerivative(double x) const {
148  //--- virtual function inherited from ROOT::Math::ParamFunction base class;
149  // not implemented, because not neccessary, but needs to be defined to make code compile...
150  edm::LogWarning("") << "Function not implemented yet !" << std::endl;
151 
152  return 0.;
153 }
154 
155 double ConeAreaFunction::DoParameterDerivative(double, const double*, unsigned int) const {
156  //--- virtual function inherited from ROOT::Math::ParamFunction base class;
157  // not implemented, because not neccessary, but needs to be defined to make code compile...
158  edm::LogWarning("") << "Function not implemented yet !" << std::endl;
159 
160  return 0.;
161 }
162 
163 void ConeAreaFunction::DoParameterGradient(double x, double* paramGradient) const {
164  //--- virtual function inherited from ROOT::Math::ParamFunction base class;
165  // not implemented, because not neccessary, but needs to be defined to make code compile...
166  edm::LogWarning("") << "Function not implemented yet !" << std::endl;
167 }
static const unsigned int debugLevel_
const double Pi
Log< level::Info, true > LogVerbatim
double DoEval(double x) const override
double DoDerivative(double x) const
constexpr T normalizedPhi(T phi)
Definition: normalizedPhi.h:8
void SetAcceptanceLimit(double etaMax)
Log< level::Error, false > LogError
void DoParameterGradient(double x, double *paramGradient) const
void SetParameters(double const *param) override
ROOT::Math::Integrator * integrator_
double DoEvalPar(double, const double *) const override
double DoParameterDerivative(double, const double *, unsigned int) const override
void SetParameterPhi0(double phi0)
uint16_t const *__restrict__ x
Definition: gpuClustering.h:39
void SetParameterPhi0(double phi0)
void SetParameterAlpha(double alpha)
void SetParameterTheta0(double theta0)
IntegrandThetaFunction * fTheta_
void SetParameterTheta0(double theta0)
~ConeAreaFunction() override
Log< level::Warning, false > LogWarning
tuple etaMax
Definition: Puppi_cff.py:46
ConeAreaFunction & operator=(const ConeAreaFunction &bluePrint)