ATLAS Offline Software
Loading...
Searching...
No Matches
Enums.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
6#include <string>
7#include <sstream>
8#include <iostream>
9
10using namespace HLT;
11const std::string ActionNames [4] = {"CONTINUE", "ABORT_CHAIN", "ABORT_EVENT", "ABORT_JOB"};
12
13const std::string& strAction(const Action::Code code) {
14 return ActionNames[code & 0x3];
15}
16
18 if (str == "CONTINUE") return Action::CONTINUE;
19 else if (str == "ABORT_CHAIN") return Action::ABORT_CHAIN;
20 else if (str == "ABORT_EVENT") return Action::ABORT_EVENT;
21 else if (str == "ABORT_JOB") return Action::ABORT_JOB;
23}
24
25
26namespace HLTEnums {
27 const std::string ReasonNames [16] = {"UNKNOWN", "MISSING_FEATURE",
28 "GAUDI_EXCEPTION", "EFORMAT_EXCEPTION",
29 "STD_EXCEPTION", "UNKNOWN_EXCEPTION",
30 "NAV_ERROR",
31 "MISSING_ROD", "CORRUPTED_ROD", "TIMEOUT",
32 "BAD_JOB_SETUP",
33 "USERDEF_1", "USERDEF_2", "USERDEF_3", "USERDEF_4",
34 "LAST_" };
35}
36
37const std::string strReason(const Reason::Code code) {
38 return HLTEnums::ReasonNames[code & 0xf];
39}
40
42 bool found = false;
43 int i=0;
44 for ( i = 0; i < HLT::Reason::LAST_; ++i ) {
45 if (str == HLTEnums::ReasonNames[i]) {
46 found = true;
47 break;
48 }
49 }
50 if ( ! found )
52 return Reason::Code(i);
53}
54
55
56namespace HLTEnums {
57 const std::string SteeringInternalReasonNames [] = { "UNKNOWN",
58 "NO_LVL1_ITEMS",
59 "NO_LVL2_CHAINS",
60 "NO_LVL1_RESULT",
61 "WRONG_HLT_RESULT",
62 "NO_HLT_RESULT",
63 "ALGO_ERROR",
64 "TIMEOUT",
65 "BUSY",
66 "BAD_JOB_SETUP",
67 "MISSING_CALO_ROI",
68 "MISSING_MUON_ROI",
69 "MISSING_OTHER_ROI",
70 "LAST_"};
71}
72
73
75 bool found = false;
76 unsigned int i=0;
77
78 for ( i = 0; i < HLT::SteeringInternalReason::LAST_; ++i ) {
80 found = true;
81 break;
82 }
83 }
84 if ( ! found )
87}
88
89
90
91
93 if ( unsigned(code) < HLT::SteeringInternalReason::LAST_ )
95 return "UNSPECIFIED_";
96}
97
98
99std::string HLT::strErrorCode(const ErrorCode code) {
100 return ""+strAction(code.action())
101 + " " + strSteeringInternalReason(code.steeringInternalReason())
102 + " " + strReason(code.reason()) ;
103}
104
105int HLT::getErrorCodePosFromStr(const std::string& ec) {
106 std::istringstream ss(ec);
107
108 std::string actionStr;
109 std::string reasonStr;
110 std::string steeringStr;
111
112 // parse input
113 ss >> actionStr >> steeringStr >> reasonStr;
114
115
116 Action::Code actionCode = getActionFromString(actionStr);
117
118 if ( actionCode == Action::UNSPECIFIED_ )
119 return -1;
120
121 Reason::Code reasonCode = getReasonFromString(reasonStr);
122 if ( reasonCode == Reason::UNSPECIFIED_ )
123 return -1;
124
125
127 if ( steeringCode == SteeringInternalReason::UNSPECIFIED_ )
128 return -1;
129
130 return ErrorCode(actionCode, reasonCode, steeringCode );
131}
132
133
134std::string HLT::ErrorCode::str() {
135 return strErrorCode(*this);
136}
Reason::Code getReasonFromString(const std::string &str)
Definition Enums.cxx:41
Action::Code getActionFromString(const std::string &str)
Definition Enums.cxx:17
const std::string ActionNames[4]
Definition Enums.cxx:11
const std::string strReason(const Reason::Code code)
Definition Enums.cxx:37
const std::string strSteeringInternalReason(const SteeringInternalReason::Code code)
Definition Enums.cxx:92
SteeringInternalReason::Code getSteeringInternalReasonFromString(const std::string &str)
Definition Enums.cxx:74
const std::string & strAction(const Action::Code code)
Definition Enums.cxx:13
std::string str()
Definition Enums.cxx:134
const std::string SteeringInternalReasonNames[]
Definition Enums.cxx:57
const std::string ReasonNames[16]
Definition Enums.cxx:27
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
std::string strErrorCode(const ErrorCode code)
Definition Enums.cxx:99
int getErrorCodePosFromStr(const std::string &ec)
Definition Enums.cxx:105
@ CONTINUE
if all is OK the processing should be continued
@ ABORT_CHAIN
if things went wrong but it is not severe, other unrelated chains will continue
@ ABORT_EVENT
if things went wrong severely, event corruption suspected
@ LAST_
and can't be higher because of serialization in the chain
@ LAST_
there is basically no restriction on size since these errors are not saved per chain so do not need t...