ATLAS Offline Software
SignEnums.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #ifndef EVENT_SELECTOR_SIGN_ENUMS_H
8 #define EVENT_SELECTOR_SIGN_ENUMS_H
9 
10 
12 
13 namespace SignEnum {
14 
17  LT,
18  GT,
19  EQ,
20  GE,
21  LE
22  };
23 
25  static const std::map<std::string, ComparisonOperator> stringToOperator = {
26  {"LT", ComparisonOperator::LT}, // <
27  {"GT", ComparisonOperator::GT}, // >
28  {"EQ", ComparisonOperator::EQ}, // ==
29  {"GE", ComparisonOperator::GE}, // >=
30  {"LE", ComparisonOperator::LE} // <=
31  };
32 
34  template <typename T>
36  switch (sign) {
38  return test < reference;
40  return test > reference;
42  return test == reference;
44  return test >= reference;
46  return test <= reference;
47  }
48  throw std::runtime_error("SignEnum::checkValue did not recognise the sign argument! Make sure it is listed within SignEnum::ComparisonOperator.");
49  }
50 
51 } // namespace SignEnum
52 
53 #endif // EVENT_SELECTOR_SIGN_ENUMS_H
SignEnum::EQ
@ EQ
Definition: SignEnums.h:19
SignEnum
the conversion key for comparison operators for Event Selection Algorithms
Definition: SignEnums.h:13
reference
Definition: hcg.cxx:437
TrigInDetValidation_Base.test
test
Definition: TrigInDetValidation_Base.py:147
SignEnum::GE
@ GE
Definition: SignEnums.h:20
SignEnum::ComparisonOperator
ComparisonOperator
all possible comparison user inputs
Definition: SignEnums.h:16
SignEnum::LE
@ LE
Definition: SignEnums.h:21
sign
int sign(int a)
Definition: TRT_StrawNeighbourSvc.h:107
SignEnum::GT
@ GT
Definition: SignEnums.h:18
SignEnum::checkValue
bool checkValue(T reference, ComparisonOperator sign, T test)
the comparison test given the specified sign and two test values
Definition: SignEnums.h:35
SignEnum::LT
@ LT
Definition: SignEnums.h:17
dq_make_web_display.reference
reference
Definition: dq_make_web_display.py:44