ATLAS Offline Software
TrigJetConditionConfig_phi.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include "GaudiKernel/StatusCode.h"
8 #include "./PhiCondition.h"
9 #include <cmath>
10 
12  const std::string& name,
13  const IInterface* parent) :
14  base_class(type, name, parent){
15 
16 }
17 
19 
20  auto convert = [](const std::string& s) {
21 
22  if (s == "PI"){
23  return M_PI;
24  } else if (s == "-PI") {
25  return -M_PI;
26  }
27  return std::stod(s);
28  };
29 
30  try {
32  } catch (...) {
33  ATH_MSG_ERROR ("Cannot convert " + m_strmin + " to double");
34  return StatusCode::FAILURE;
35  }
36 
37  try {
39  } catch (...) {
40  ATH_MSG_ERROR ("Cannot convert " + m_strmax + " to double");
41  return StatusCode::FAILURE;
42  }
43 
44  CHECK(checkVals());
45  return StatusCode::SUCCESS;
46 }
47 
48 
50  return std::make_unique<PhiCondition>(m_min, m_max);
51 }
52 
53 
55 
56  if (m_min > m_max){
57  ATH_MSG_ERROR(" min phi > max phi");
58  return StatusCode::FAILURE;
59  }
60 
61  if (m_min < -M_PI) {
62  ATH_MSG_ERROR(" min phi " << m_min << " out of range");
63  return StatusCode::FAILURE;
64  }
65 
66  if (m_max > M_PI) {
67  ATH_MSG_ERROR(" max phi " << m_max << " out of range");
68  return StatusCode::FAILURE;
69  }
70 
71  return StatusCode::SUCCESS;
72 }
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
TrigJetConditionConfig_phi::getCondition
virtual Condition getCondition() const override
Definition: TrigJetConditionConfig_phi.cxx:49
M_PI
#define M_PI
Definition: ActiveFraction.h:11
TrigJetConditionConfig_phi::m_strmin
Gaudi::Property< std::string > m_strmin
Definition: TrigJetConditionConfig_phi.h:32
TrigJetConditionConfig_phi::m_min
double m_min
Definition: TrigJetConditionConfig_phi.h:37
Condition
std::unique_ptr< ICondition > Condition
Definition: ConditionsDefs.h:19
TrigJetConditionConfig_phi::m_max
double m_max
Definition: TrigJetConditionConfig_phi.h:38
TrigJetConditionConfig_phi::initialize
virtual StatusCode initialize() override
Definition: TrigJetConditionConfig_phi.cxx:18
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
test_pyathena.parent
parent
Definition: test_pyathena.py:15
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
TrigJetConditionConfig_phi.h
TrigJetConditionConfig_phi::m_strmax
Gaudi::Property< std::string > m_strmax
Definition: TrigJetConditionConfig_phi.h:35
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TMVAToMVAUtils::convert
std::unique_ptr< MVAUtils::BDT > convert(TMVA::MethodBDT *bdt, bool isRegression=true, bool useYesNoLeaf=false)
Definition: TMVAToMVAUtils.h:114
TrigJetConditionConfig_phi::checkVals
StatusCode checkVals() const
Definition: TrigJetConditionConfig_phi.cxx:54
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
PhiCondition.h
TrigJetConditionConfig_phi::TrigJetConditionConfig_phi
TrigJetConditionConfig_phi(const std::string &type, const std::string &name, const IInterface *parent)
Definition: TrigJetConditionConfig_phi.cxx:11