ATLAS Offline Software
Loading...
Searching...
No Matches
DipzLikelihood Class Reference

#include <DipzLikelihoodCmp.h>

Collaboration diagram for DipzLikelihood:

Public Member Functions

 DipzLikelihood (const std::string &decName_z, const std::string &decName_negLogSigma2)
 ~DipzLikelihood ()=default
double operator() (const HypoJetVector &) const

Private Member Functions

double getDipzMLPLDecValue (const pHypoJet &ip, const std::string &decName) const
double calcNum (double acmlt, const pHypoJet &ip) const
double calcDenom (double acmlt, const pHypoJet &ip) const
double calcLogTerm (double acmlt, const pHypoJet &ip, double zhat) const
double checkedRatio (double num, double den) const

Private Attributes

const std::string m_decName_z
const std::string m_decName_negLogSigma2

Detailed Description

Definition at line 40 of file DipzLikelihoodCmp.h.

Constructor & Destructor Documentation

◆ DipzLikelihood()

DipzLikelihood::DipzLikelihood ( const std::string & decName_z,
const std::string & decName_negLogSigma2 )

Definition at line 11 of file DipzLikelihoodCmp.cxx.

12 :
13 m_decName_z(decName_z),
14 m_decName_negLogSigma2(decName_negLogSigma2){
15}
const std::string m_decName_z
const std::string m_decName_negLogSigma2

◆ ~DipzLikelihood()

DipzLikelihood::~DipzLikelihood ( )
default

Member Function Documentation

◆ calcDenom()

double DipzLikelihood::calcDenom ( double acmlt,
const pHypoJet & ip ) const
private

Definition at line 54 of file DipzLikelihoodCmp.cxx.

54 {
55 double sigma_squared =
57
58 double oneoversigmasq = checkedRatio(1, sigma_squared);
59
60 return acml + oneoversigmasq;
61}
double checkedRatio(double num, double den) const
double getDipzMLPLDecValue(const pHypoJet &ip, const std::string &decName) const

◆ calcLogTerm()

double DipzLikelihood::calcLogTerm ( double acmlt,
const pHypoJet & ip,
double zhat ) const
private

Definition at line 63 of file DipzLikelihoodCmp.cxx.

65 {
66
67 double dipz_mu = getDipzMLPLDecValue(ip, m_decName_z);
68
69 double dipz_negLogSigmaSq =
71
72 double sigma_squared = std::exp(-1 * dipz_negLogSigmaSq);
73
74 double logterm =
75 -0.5 * std::log(2.0 * M_PI)
76 + 0.5 * dipz_negLogSigmaSq
77 - checkedRatio(std::pow(zhat - dipz_mu, 2), (2.0 * sigma_squared) );
78
79 return acml + logterm;
80
81}
#define M_PI

◆ calcNum()

double DipzLikelihood::calcNum ( double acmlt,
const pHypoJet & ip ) const
private

Definition at line 42 of file DipzLikelihoodCmp.cxx.

42 {
43
44 double sigma_squared =
46
47 double muoversigmasq =
48 checkedRatio( getDipzMLPLDecValue(ip, m_decName_z), sigma_squared);
49
50 return acml + muoversigmasq;
51}

◆ checkedRatio()

double DipzLikelihood::checkedRatio ( double num,
double den ) const
private

Definition at line 17 of file DipzLikelihoodCmp.cxx.

17 {
18 if (den == 0.) {
19 // dividing x/0 is picked up by FPEAditor. C++ simply returns
20 // +inf or -inf if x != 0, or a nan otherwise.
21 throw std::runtime_error("DipzLikelihood::checkedRatio dividing by 0");
22 }
23
24 return num/den;
25}

◆ getDipzMLPLDecValue()

double DipzLikelihood::getDipzMLPLDecValue ( const pHypoJet & ip,
const std::string & decName ) const
private

Definition at line 27 of file DipzLikelihoodCmp.cxx.

29{
30
31 float momentValue;
32 if (!(ip->getAttribute(decName, momentValue))) {
33 throw std::runtime_error("Impossible to retrieve decorator \'" +
34 decName + "\' for jet hypo");
35 }
36
37 // momentValue is retrieved as a float, but will be heavily used in
38 // further calculations. Convert to a double here
39 return momentValue;
40}

◆ operator()()

double DipzLikelihood::operator() ( const HypoJetVector & ips) const

Definition at line 84 of file DipzLikelihoodCmp.cxx.

84 {
85
86 auto zhat_num = std::accumulate(ips.begin(),
87 ips.end(),
88 0.0,
89 [this](double sum, const pHypoJet& jp) {
90 return this->calcNum(sum, jp);});
91
92 auto zhat_den = std::accumulate(ips.begin(),
93 ips.end(),
94 0.0,
95 [this](double sum, const pHypoJet& jp) {
96 return this->calcDenom(sum, jp);});
97
98 auto zhat = checkedRatio(zhat_num, zhat_den);
99
100 auto logproduct =
101 std::accumulate(ips.begin(),
102 ips.end(),
103 0.0,
104 [&zhat,this](double sum, const pHypoJet& jp) {
105 return this->calcLogTerm(sum, jp, zhat);});
106
107 return logproduct;
108}
std::shared_ptr< const HypoJet::IJet > pHypoJet
Definition HypoJetDefs.h:25

Member Data Documentation

◆ m_decName_negLogSigma2

const std::string DipzLikelihood::m_decName_negLogSigma2
private

Definition at line 51 of file DipzLikelihoodCmp.h.

◆ m_decName_z

const std::string DipzLikelihood::m_decName_z
private

Definition at line 50 of file DipzLikelihoodCmp.h.


The documentation for this class was generated from the following files: