ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
ZDCTriggerEfficiency Class Reference

#include <ZDCTriggerEfficiency.h>

Collaboration diagram for ZDCTriggerEfficiency:

Public Member Functions

void UpdatelumiBlock (unsigned int lumiBlock)
 
 ZDCTriggerEfficiency ()
 
void SetEffParamsAndErrors (const std::array< std::vector< TSpline3 * >, 2 > &effParams, const std::array< std::vector< TSpline3 * >, 2 > &effParamErrors)
 
void SetEffParamCorrCoeffs (const std::array< std::vector< TSpline3 * >, 2 > &effParamsCorrCoeffs)
 
double GetEfficiency (int side, float ADCSum)
 
std::pair< double, double > GetEfficiencyAndError (MsgStream &msg, int side, float ADCSum)
 

Private Attributes

bool m_haveParams
 
bool m_haveCorrCoeffs
 
unsigned int m_minLB
 
unsigned int m_maxLB
 
unsigned int m_currentLB
 
std::array< std::vector< TSpline3 * >, 2 > m_effParams
 
std::array< std::vector< TSpline3 * >, 2 > m_effParamErrors
 
std::array< std::vector< TSpline3 * >, 2 > m_effParamCorrCoeffs
 
std::array< std::vector< double >, 2 > m_currentParams
 
std::array< std::vector< double >, 2 > m_currentParamErrors
 
std::array< std::vector< double >, 2 > m_currentCorrCoefff
 

Detailed Description

Definition at line 16 of file ZDCTriggerEfficiency.h.

Constructor & Destructor Documentation

◆ ZDCTriggerEfficiency()

ZDCTriggerEfficiency::ZDCTriggerEfficiency ( )
inline

Definition at line 59 of file ZDCTriggerEfficiency.h.

59  : // in order, alpha-beta, alpha-theta, beta-theta
60  m_haveParams(false), m_haveCorrCoeffs(false),
61  m_minLB(0), m_maxLB(0), m_currentLB(0) {
62 
63  }

Member Function Documentation

◆ GetEfficiency()

double ZDCTriggerEfficiency::GetEfficiency ( int  side,
float  ADCSum 
)

Definition at line 9 of file ZDCTriggerEfficiency.cxx.

9  {
10  double alpha = m_currentParams[side][0];
11  double beta = m_currentParams[side][1];
12  double theta = m_currentParams[side][2];
13  if(alpha<10e-5||beta<10e-5||theta<10e-5)
14  {
15  return -1;
16  }
17  double m = std::exp(-ADCSum/theta);
18  double p = std::exp(-(ADCSum - alpha) / beta);
19  double efficiency = (1 - m) / (1 + p);
20  return efficiency;
21 }

◆ GetEfficiencyAndError()

std::pair< double, double > ZDCTriggerEfficiency::GetEfficiencyAndError ( MsgStream &  msg,
int  side,
float  ADCSum 
)

Definition at line 23 of file ZDCTriggerEfficiency.cxx.

23  {
24  double alpha = m_currentParams[side][0];
25  double beta = m_currentParams[side][1];
26  double theta = m_currentParams[side][2];
27  if(alpha<10e-5||beta<10e-5||theta<10e-5)
28  {
29  return std::make_pair(-1,-1);
30  }
31 
32  double alphaErr = m_currentParamErrors[side][0];
33  double betaErr = m_currentParamErrors[side][1];
34  double thetaErr = m_currentParamErrors[side][2];
35 
36  double corrAlphaBeta = m_currentCorrCoefff[side][0];
37  double corrAlphaTheta = m_currentCorrCoefff[side][1];
38  double corrBetaTheta = m_currentCorrCoefff[side][2];
39 
40  double m = std::exp(-ADCSum/theta);
41  double p = std::exp(-(ADCSum - alpha) / beta);
42  double efficiency = (1 - m) / (1 + p);
43  double dda = (1 - m) * -p / beta / (1 + p) / (1 + p);
44  double ddb = (1 - m) * -p / std::pow(1 + p, 2.0) * ADCSum / beta / beta;
45  double ddt = -ADCSum * m / theta / theta / (1 + p);
46 
47  double efficiencyErr = std::sqrt(
48  std::pow(alphaErr * dda, 2) +
49  std::pow(betaErr * ddb, 2) +
50  std::pow(thetaErr * ddt, 2) +
51  2 * corrAlphaBeta*alphaErr*betaErr * dda * ddb +
52  2 * corrAlphaTheta*alphaErr*thetaErr * dda * ddt +
53  2 * corrBetaTheta*betaErr*thetaErr * ddb * ddt);
54 
55  if (efficiencyErr<0)
56  {
57  efficiencyErr = 0;
58  msg << MSG::INFO << "Efficiency Uncertainty calculation abnormal." << endmsg;
59  }
60 
61  return std::make_pair(efficiency, efficiencyErr);
62 }

◆ SetEffParamCorrCoeffs()

void ZDCTriggerEfficiency::SetEffParamCorrCoeffs ( const std::array< std::vector< TSpline3 * >, 2 > &  effParamsCorrCoeffs)
inline

Definition at line 77 of file ZDCTriggerEfficiency.h.

77  {
78  for (int side : {0, 1}) {
79  m_effParamCorrCoeffs[side] = effParamsCorrCoeffs[side];
80  }
81 
82  m_haveCorrCoeffs = true;
83  }

◆ SetEffParamsAndErrors()

void ZDCTriggerEfficiency::SetEffParamsAndErrors ( const std::array< std::vector< TSpline3 * >, 2 > &  effParams,
const std::array< std::vector< TSpline3 * >, 2 > &  effParamErrors 
)
inline

Definition at line 65 of file ZDCTriggerEfficiency.h.

66  {
67  for (int side : {0, 1}) {
68  m_effParams[side] = effParams[side];
69  m_effParamErrors[side] = effParamErrors[side];
70  }
71 
72  m_minLB = m_effParams[0][0]->GetXmin();
73  m_maxLB = m_effParams[0][0]->GetXmax();
74  m_haveParams = true;
75  }

◆ UpdatelumiBlock()

void ZDCTriggerEfficiency::UpdatelumiBlock ( unsigned int  lumiBlock)
inline

Definition at line 35 of file ZDCTriggerEfficiency.h.

36  {
37  if (!m_haveParams) throw std::runtime_error("No params for trigger efficiency.");
38 
39  if (lumiBlock != m_currentLB) {
40  int newLB = std::max(std::min(lumiBlock, m_maxLB), m_minLB);
41  for (int side : {0, 1}) {
42  m_currentParams[side].clear();
43  m_currentParamErrors[side].clear();
44  m_currentCorrCoefff[side].clear();
45 
46  for (size_t ipar = 0; ipar < m_effParams[side].size(); ipar++) {
47  m_currentParams[side].push_back(m_effParams[side][ipar]->Eval(newLB));
48  m_currentParamErrors[side].push_back(m_effParamErrors[side][ipar]->Eval(newLB));
49 
50  if (m_haveCorrCoeffs) {
51  m_currentCorrCoefff[side].push_back(m_effParamCorrCoeffs[side][ipar]->Eval(newLB));
52  }
53  }
55  }
56  }
57  }

Member Data Documentation

◆ m_currentCorrCoefff

std::array<std::vector<double>, 2> ZDCTriggerEfficiency::m_currentCorrCoefff
private

Definition at line 32 of file ZDCTriggerEfficiency.h.

◆ m_currentLB

unsigned int ZDCTriggerEfficiency::m_currentLB
private

Definition at line 24 of file ZDCTriggerEfficiency.h.

◆ m_currentParamErrors

std::array<std::vector<double>, 2> ZDCTriggerEfficiency::m_currentParamErrors
private

Definition at line 31 of file ZDCTriggerEfficiency.h.

◆ m_currentParams

std::array<std::vector<double>, 2> ZDCTriggerEfficiency::m_currentParams
private

Definition at line 30 of file ZDCTriggerEfficiency.h.

◆ m_effParamCorrCoeffs

std::array<std::vector<TSpline3*>, 2> ZDCTriggerEfficiency::m_effParamCorrCoeffs
private

Definition at line 28 of file ZDCTriggerEfficiency.h.

◆ m_effParamErrors

std::array<std::vector<TSpline3*>, 2> ZDCTriggerEfficiency::m_effParamErrors
private

Definition at line 27 of file ZDCTriggerEfficiency.h.

◆ m_effParams

std::array<std::vector<TSpline3*>, 2> ZDCTriggerEfficiency::m_effParams
private

Definition at line 26 of file ZDCTriggerEfficiency.h.

◆ m_haveCorrCoeffs

bool ZDCTriggerEfficiency::m_haveCorrCoeffs
private

Definition at line 19 of file ZDCTriggerEfficiency.h.

◆ m_haveParams

bool ZDCTriggerEfficiency::m_haveParams
private

Definition at line 18 of file ZDCTriggerEfficiency.h.

◆ m_maxLB

unsigned int ZDCTriggerEfficiency::m_maxLB
private

Definition at line 22 of file ZDCTriggerEfficiency.h.

◆ m_minLB

unsigned int ZDCTriggerEfficiency::m_minLB
private

Definition at line 21 of file ZDCTriggerEfficiency.h.


The documentation for this class was generated from the following files:
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
ZDCTriggerEfficiency::m_haveCorrCoeffs
bool m_haveCorrCoeffs
Definition: ZDCTriggerEfficiency.h:19
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
theta
Scalar theta() const
theta method
Definition: AmgMatrixBasePlugin.h:75
ZDCTriggerEfficiency::m_haveParams
bool m_haveParams
Definition: ZDCTriggerEfficiency.h:18
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
ZDCTriggerEfficiency::m_currentParamErrors
std::array< std::vector< double >, 2 > m_currentParamErrors
Definition: ZDCTriggerEfficiency.h:31
TRT::Hit::side
@ side
Definition: HitInfo.h:83
efficiency
void efficiency(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")
Definition: dependence.cxx:128
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ZDCTriggerEfficiency::m_currentLB
unsigned int m_currentLB
Definition: ZDCTriggerEfficiency.h:24
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
ZDCTriggerEfficiency::m_effParamCorrCoeffs
std::array< std::vector< TSpline3 * >, 2 > m_effParamCorrCoeffs
Definition: ZDCTriggerEfficiency.h:28
ZDCTriggerEfficiency::m_maxLB
unsigned int m_maxLB
Definition: ZDCTriggerEfficiency.h:22
ZDCTriggerEfficiency::m_currentCorrCoefff
std::array< std::vector< double >, 2 > m_currentCorrCoefff
Definition: ZDCTriggerEfficiency.h:32
dq_defect_bulk_create_defects.ddb
ddb
Definition: dq_defect_bulk_create_defects.py:43
ZDCTriggerEfficiency::m_effParams
std::array< std::vector< TSpline3 * >, 2 > m_effParams
Definition: ZDCTriggerEfficiency.h:26
ZDCTriggerEfficiency::m_currentParams
std::array< std::vector< double >, 2 > m_currentParams
Definition: ZDCTriggerEfficiency.h:30
ZDCTriggerEfficiency::m_minLB
unsigned int m_minLB
Definition: ZDCTriggerEfficiency.h:21
ZDCTriggerEfficiency::m_effParamErrors
std::array< std::vector< TSpline3 * >, 2 > m_effParamErrors
Definition: ZDCTriggerEfficiency.h:27
MuonParameters::beta
@ beta
Definition: MuonParamDefs.h:144
xAOD::lumiBlock
setTeId lumiBlock
Definition: L2StandAloneMuon_v1.cxx:327
pow
constexpr int pow(int base, int exp) noexcept
Definition: ap_fixedTest.cxx:15
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7