ATLAS Offline Software
Loading...
Searching...
No Matches
TrigChainNameParserChecker.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
7
9 ATH_CHECK( m_HLTMenuKey.initialize() );
10 return StatusCode::SUCCESS;
11}
12
13StatusCode TrigChainNameParserChecker::execute(const EventContext& ctx) const {
14
15 // Validate the ChainNameParser against the JSON menu.
16 // Expecting to run in a trigger production job hence the menu comes from the detector store.
17
18 // Only needs to run once per job, on the first event.
19 static const bool error = [&](){
20
22 const TrigConf::HLTMenu& hltMenu = *hltMenuHandle;
23 bool isErr = false;
24 for (const auto& chain : hltMenu) {
25 const std::vector<size_t> legMultiplicitesA = chain.legMultiplicities();
26 const std::vector<int> legMultiplicitesB = ChainNameParser::multiplicities(chain.name());
27 if (!legMultiplicitesB.size()) {
28 ATH_MSG_ERROR("Zero parsed legs for chain:" << chain.name());
29 isErr = true;
30 } else if (legMultiplicitesA.size() != legMultiplicitesB.size()) {
31 ATH_MSG_ERROR("Inconsistent N Legs, Menu:" << legMultiplicitesA.size() << " Parser:" << legMultiplicitesB.size() << " chain:" << chain.name());
32 isErr = true;
33 } else {
34 for (size_t i = 0; i < legMultiplicitesA.size(); ++i) {
35 if (legMultiplicitesA.at(i) != (size_t)legMultiplicitesB.at(i)) {
36 ATH_MSG_ERROR("Inconsistency in Leg " << i << ", Menu multi:" << legMultiplicitesA.at(i) << " Parser multi:" << legMultiplicitesB.at(i) << " chain:" << chain.name());
37 isErr = true;
38 }
39 }
40 }
41 }
42
43 if (isErr) {
44 ATH_MSG_ERROR("One or more chains (above) in the menu were parsed incorrectly by the ChainNameParser with respect to the menu.");
45 ATH_MSG_ERROR("Please update the parser in TrigCompositeUtils to bring it into agreement with the menu.");
46 ATH_MSG_ERROR("You may need to update the lists of identifiers in allSignatures() or allSignaturePostfixQualifiers().");
47 } else {
48 ATH_MSG_INFO("TrigChainNameParserChecker did not find any issues over " << hltMenu.size() << " chains.");
49 }
50 return isErr;
51
52 }();
53
54 return (error ? StatusCode::FAILURE : StatusCode::SUCCESS);
55
56}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
SG::ReadHandleKey< TrigConf::HLTMenu > m_HLTMenuKey
virtual StatusCode execute(const EventContext &ctx) const override
virtual StatusCode initialize() override
HLT menu configuration.
Definition HLTMenu.h:21
std::size_t size() const
Accessor to the number of HLT chains.
Definition HLTMenu.cxx:35
std::vector< int > multiplicities(const std::string &chain)