ATLAS Offline Software
Loading...
Searching...
No Matches
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 {
31 m_min = convert(m_strmin);
32 } catch (...) {
33 ATH_MSG_ERROR ("Cannot convert " + m_strmin + " to double");
34 return StatusCode::FAILURE;
35 }
36
37 try {
38 m_max = convert(m_strmax);
39 } catch (...) {
40 ATH_MSG_ERROR ("Cannot convert " + m_strmax + " to double");
41 return StatusCode::FAILURE;
42 }
43
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}
#define M_PI
#define ATH_MSG_ERROR(x)
std::unique_ptr< ICondition > Condition
#define CHECK(...)
Evaluate an expression and check for errors.
virtual Condition getCondition() const override
virtual StatusCode initialize() override
TrigJetConditionConfig_phi(const std::string &type, const std::string &name, const IInterface *parent)
Gaudi::Property< std::string > m_strmax
Gaudi::Property< std::string > m_strmin