ATLAS Offline Software
Loading...
Searching...
No Matches
ZDCTriggerEfficiency.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
7#include <cmath>
8
9double 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
23std::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}
Scalar theta() const
theta method
#define endmsg
std::pair< double, double > GetEfficiencyAndError(MsgStream &msg, int side, float ADCSum)
std::array< std::vector< double >, 2 > m_currentCorrCoefff
std::array< std::vector< double >, 2 > m_currentParams
double GetEfficiency(int side, float ADCSum)
std::array< std::vector< double >, 2 > m_currentParamErrors
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="")
MsgStream & msg
Definition testRead.cxx:32