10 const std::string& name,
11 const IInterface* parent)
20 return StatusCode::FAILURE;
23 return StatusCode::SUCCESS;
31 return StatusCode::SUCCESS;
38 return StatusCode::RECOVERABLE;
44 catch (
const std::exception& ex) {
46 return StatusCode::RECOVERABLE;
53 for (
auto& fakeRoI : fragment) {
54 const char*
const delim =
", ";
55 std::ostringstream debugPassedTresholdIDs;
56 std::copy(fakeRoI.passedThresholdIDs.begin(),
57 fakeRoI.passedThresholdIDs.end(),
58 std::ostream_iterator<std::string>(debugPassedTresholdIDs, delim));
61 ", Phi: " + std::to_string(fakeRoI.phi) +
62 ", Word: " + std::to_string(fakeRoI.roIWord) +
63 ", PassedThresholdIDs: " + debugPassedTresholdIDs.str());
67 return StatusCode::SUCCESS;
72 const char* whiteSpaceChars =
" \t\n\r\f\v";
73 auto rtrim = [whiteSpaceChars](std::string& s) { s.erase(s.find_last_not_of(whiteSpaceChars) + 1); };
74 auto ltrim = [whiteSpaceChars](std::string& s) { s.erase(0, s.find_first_not_of(whiteSpaceChars)); };
75 auto trim = [&rtrim, <rim](std::string& s) { ltrim(s); rtrim(s); };
77 std::vector<std::vector<RoIsUnpackingEmulationTool::FakeRoI>>
result;
78 unsigned lineNumber = 0;
82 if (!inputFile.good()) {
83 throw std::invalid_argument(
"File " +
m_inputFilename +
"does not exists or is corrupted");
86 while (getline(inputFile, line)) {
88 if (line.empty()) {
continue;}
93 throw std::invalid_argument(
"File " +
m_inputFilename +
" does not contain any RoI");
100std::vector<RoIsUnpackingEmulationTool::FakeRoI>
102 std::vector<RoIsUnpackingEmulationTool::FakeRoI>
result;
103 unsigned roiNumber = 0;
104 std::stringstream inputLine(line);
107 while (getline(inputLine, roi,
';')) {
112 if (roi.find (
',') != std::string::npos) {
123 std::stringstream inputRoi(roi);
124 std::string roiElement;
125 unsigned roiElementNumber = 0;
127 std::vector<std::function<void(
const std::string&)>> fillResultFunctors;
128 fillResultFunctors.emplace_back([&](
const std::string&
eta) {
result.eta = stod(
eta); });
129 fillResultFunctors.emplace_back([&](
const std::string&
phi) {
result.phi = stod(
phi); });
130 fillResultFunctors.emplace_back([&](
const std::string& word) {
result.roIWord = stoul(word); });
131 fillResultFunctors.emplace_back([&](
const std::string& passedThresholdID) {
132 result.passedThresholdIDs.push_back(passedThresholdID); });
134 while (getline(inputRoi, roiElement,
',')) {
135 if (roiElementNumber > 2) { roiElementNumber = 3; }
139 fillResultFunctors[roiElementNumber++](roiElement);
141 catch (
const std::exception& ex) {
142 throw std::invalid_argument(
"Exception encountered while parsing line " + std::to_string(lineNumber) +
143 ", roi " + std::to_string(roiNumber) +
". Exception: " + ex.what());
162 ATH_MSG_ERROR(
"No input dataset found. Cannot decode RoI emulation");
163 return StatusCode::FAILURE;
165 const size_t line = ctx.evt() %
m_inputData.size();
169 for (
auto& roi : FakeRoIs) {
170 uint32_t roIWord = roi.roIWord;
171 trigRoIs->push_back( std::make_unique<TrigRoiDescriptor>(
176 ATH_MSG_DEBUG(
"RoI word: 0x" << MSG::hex << std::setw(8) << roIWord << MSG::dec );
180 std::vector<TrigCompositeUtils::DecisionID> passedThresholdIDs;
182 for (
const auto& th: roi.passedThresholdIDs ) {
183 ATH_MSG_DEBUG(
"Passed Threshold " << th <<
" enabling respective chains " );
190 decision->setDetail(
"thresholds", passedThresholdIDs );
193 for (
auto roi: *trigRoIs ) {
194 ATH_MSG_DEBUG(
"RoI Eta: " << roi->eta() <<
" Phi: " << roi->phi() <<
" RoIWord: " << roi->roiWord());
197 return StatusCode::SUCCESS;
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
SG::WriteHandle< DecisionContainer > createAndStore(const SG::WriteHandleKey< DecisionContainer > &key, const EventContext &ctx)
Creates and right away records the DecisionContainer with the key.
ElementLink implementation for ROOT usage.
Class holding the LVL1 RoIB result build by the RoIBuilder.
pointer_type ptr()
Dereference the pointer.
std::set< HLT::Identifier > IDSet
SG::WriteHandle< CONT > createAndStoreNoAux(const SG::WriteHandleKey< CONT > &key, const EventContext &ctx)
Creates and right away records the Container CONT with the key.
Decision * newDecisionIn(DecisionContainer *dc, const std::string &name)
Helper method to create a Decision object, place it in the container and return a pointer to it.
const std::string & initialRoIString()
const std::string & hltSeedingNodeName()