ATLAS Offline Software
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 
10  return StatusCode::SUCCESS;
11 }
12 
13 StatusCode 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 }
ChainNameParser.h
runLayerRecalibration.chain
chain
Definition: runLayerRecalibration.py:175
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
TrigConf::HLTMenu
HLT menu configuration.
Definition: HLTMenu.h:21
TrigChainNameParserChecker.h
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
TrigChainNameParserChecker::m_HLTMenuKey
SG::ReadHandleKey< TrigConf::HLTMenu > m_HLTMenuKey
Definition: TrigChainNameParserChecker.h:26
lumiFormat.i
int i
Definition: lumiFormat.py:85
TrigChainNameParserChecker::initialize
virtual StatusCode initialize() override
Definition: TrigChainNameParserChecker.cxx:8
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
ChainNameParser::multiplicities
std::vector< int > multiplicities(const std::string &chain)
Definition: ChainNameParser.cxx:226
error
Definition: IImpactPoint3dEstimator.h:70
TrigChainNameParserChecker::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: TrigChainNameParserChecker.cxx:13