ATLAS Offline Software
ZDCTriggerEfficiency.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 #include <vector>
8 
9 double ZDCTriggerEfficiency::GetEfficiency(int side, float ADCSum){
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 }
22 
23 std::pair<double, double> ZDCTriggerEfficiency::GetEfficiencyAndError(MsgStream& msg, int side, float ADCSum){
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 }
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
theta
Scalar theta() const
theta method
Definition: AmgMatrixBasePlugin.h:75
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
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
ZDCTriggerEfficiency::GetEfficiency
double GetEfficiency(int side, float ADCSum)
Definition: ZDCTriggerEfficiency.cxx:9
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.h
ZDCTriggerEfficiency::m_currentParams
std::array< std::vector< double >, 2 > m_currentParams
Definition: ZDCTriggerEfficiency.h:30
MuonParameters::beta
@ beta
Definition: MuonParamDefs.h:144
pow
constexpr int pow(int base, int exp) noexcept
Definition: ap_fixedTest.cxx:15
ZDCTriggerEfficiency::GetEfficiencyAndError
std::pair< double, double > GetEfficiencyAndError(MsgStream &msg, int side, float ADCSum)
Definition: ZDCTriggerEfficiency.cxx:23
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
MessageCheckAsgTools.h