ATLAS Offline Software
Loading...
Searching...
No Matches
NavigationDAODTesterAlgv2.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TRIG_NAVTOOLS_NAVIGATIONDAODTESTERALGV2_H
6#define TRIG_NAVTOOLS_NAVIGATIONDAODTESTERALGV2_H
7
16
18#include "GaudiKernel/ToolHandle.h"
19#include "Gaudi/Property.h"
25
27
28#include <vector>
29#include <map>
30#include <string>
31#include <mutex>
32
33
34namespace Trig {
35
37{
38public:
39 NavigationDAODTesterAlgv2(const std::string &name, ISvcLocator *pSvcLocator);
40 virtual ~NavigationDAODTesterAlgv2() override = default;
41
42 virtual StatusCode initialize() override;
43 virtual StatusCode execute(const EventContext &context) const override;
44 virtual StatusCode finalize() override;
45
46private:
47
48 // Tool handles
49 PublicToolHandle<Trig::TrigDecisionTool> m_tdt{
50 this, "TrigDecisionTool", "", "Read R3 navigation data from TDT"};
51
52 PublicToolHandle<Trig::R3MatchingTool> m_matchingTool{
53 this, "R3MatchingTool", "Trig::R3MatchingTool", "R3 matching tool for converted navigation"};
54
55 PublicToolHandle<Trig::MatchFromCompositeTool> m_matchFromCompositeTool{
56 this, "MatchFromCompositeTool", "Trig::MatchFromCompositeTool", "R2 matching from pre-stored TrigComposite containers"};
57
58 // Properties
59 Gaudi::Property<std::vector<std::string>> m_chains{
60 this, "Chains", {}, "The trigger chains to test"};
61
62 Gaudi::Property<std::vector<std::string>> m_chainsToExclude{
63 this, "ChainsToExclude", {},
64 "Chain name patterns to skip (substring match), e.g. 'noL1'. "
65 "DAOD-tester-local exception list for pathological chain families whose "
66 "TrigMatch layout does not support the generic R2/R3 comparison. "
67 "Note: nomucomb chains no longer need excluding - they are handled by "
68 "the dedicated linearised path (see ChainsWithLinearisedR2Matching)."};
69
70 Gaudi::Property<std::vector<std::string>> m_linearisedR2Chains{
71 this, "ChainsWithLinearisedR2Matching", {"nomucomb"},
72 "Chain name patterns (substring match) whose TrigMatch container uses "
73 "the linearised layout: N entries of vector size 1, one per "
74 "individually matched offline object, instead of one entry of size "
75 "= sum of leg multiplicities per matched combination. These chains "
76 "are compared PER OBJECT (pool of individually matched objects vs "
77 "single-object R3 matching) instead of per combination, since the "
78 "reference carries no combination structure."};
79
80
81 Gaudi::Property<bool> m_failOnDifference{
82 this, "FailOnDifference", false,
83 "Return FAILURE if the navigation does not compare equal"};
84
85 Gaudi::Property<bool> m_verifyCombinationsSize{
86 this, "VerifyCombinationsSize", true,
87 "Check if combinations have matching size (that is Run2 >= Run3)"};
88
89 Gaudi::Property<bool> m_verifyCombinations{
90 this, "VerifyCombinationsContent", true,
91 "Check if combinations are compatible (point to same objects)"};
92
93 Gaudi::Property<std::string> m_inputPrefix{
94 this, "InputPrefix", "TrigMatch_",
95 "Prefix used for pre-matched trigger combinations branches"};
96
97 Gaudi::Property<bool> m_printSubfeatures{
98 this, "PrintSubfeatures", false,
99 "When true, print subfeatures (lower-pT objects from Run2->Run3 conversion) for each passing chain"};
100
101 Gaudi::Property<bool> m_r3MatchingRerun{
102 this, "R3MatchingRerun", true,
103 "Pass rerun=true to the R3 matching, i.e. also accept chains whose "
104 "decision is only resurrected (prescaled or disabled chains evaluated "
105 "in rerun). This must match how the R2 reference was produced: the "
106 "DerivationFramework TriggerMatchingTool writes the TrigMatch_<chain> "
107 "containers with Rerun=true. With false, every rerun-only event of a "
108 "prescaled chain shows up as 'R2 passes, R3 fails' although the "
109 "converted navigation holds the matching objects."};
110
111 Gaudi::Property<bool> m_drFromRun2Lists{
112 this, "DRThresholdFromRun2Lists", true,
113 "Choose the R3 matching dR as the Run 2 TrigMatch production did, per "
114 "trigger list (DerivationFrameworkPhys/PhysCommonConfig.py): 0.2 only "
115 "for chains of the Tau list, i.e. chains with a tau leg and no e/mu/g "
116 "leg (tau, di-tau, tau+xe), 0.1 for every chain of the NoTau list, "
117 "which includes the e+tau and mu+tau chains. Exact for the TriggerAPI "
118 "lists and the run2ExtraMatching*.txt files; chains added through "
119 "flags.Trigger.derivationsExtraChains are routed by the substring 'tau' "
120 "in their name instead. With false: 0.2 for any chain with a tau leg, "
121 "0.1 otherwise (the previous rule, which lets the R3 matching accept "
122 "lepton+tau objects the Run 2 reference never considered)."};
123
124 Gaudi::Property<bool> m_dumpFeaturesWithoutR2{
125 this, "DumpFeaturesWithoutR2", false,
126 "Diagnostic: when the TrigMatch_<chain> container is absent (e.g. when "
127 "running directly on the conversion output at AOD level, where no R2 "
128 "matching reference exists), still print the per-leg R3 features of "
129 "passed chains. The cross-leg feature pooling converter defect shows "
130 "up directly in this dump (identical pooled lists on every leg)."};
131
132 // Mutable counters for statistics (thread-safe)
133 mutable std::map<std::string, int> m_failingChains ATLAS_THREAD_SAFE;
138 mutable std::map<std::string, int> m_emptyR2Chains ATLAS_THREAD_SAFE;
142 mutable std::map<std::string, int> m_rerunOnlyChains ATLAS_THREAD_SAFE;
143 mutable std::mutex m_failingChainsMutex;
144
145 // Helper methods
146
150 std::size_t numberOfLegs(const std::string& chain) const;
151
156 void dumpFeaturesPerLeg(const std::string& chain,
157 std::size_t nLegs,
158 MSG::Level level,
159 const std::string& linkName = "") const;
160
162 static bool matchesAnyPattern(const std::string& chain,
163 const std::vector<std::string>& patterns);
164
169 static const xAOD::IParticle* resolveOriginal(const xAOD::IParticle* p);
170
176 static bool matchLinearisedR2(std::vector<const xAOD::IParticle*> pool,
177 const std::vector<const xAOD::IParticle*>& particles);
178
179}; // end class NavigationDAODTesterAlgv2
180
181
182} // end namespace Trig
183
184#endif // TRIG_NAVTOOLS_NAVIGATIONDAODTESTERALGV2_H
Define macros for attributes used to control the static checker.
An algorithm that can be simultaneously executed in multiple threads.
Gaudi::Property< bool > m_dumpFeaturesWithoutR2
static bool matchesAnyPattern(const std::string &chain, const std::vector< std::string > &patterns)
True if the chain name contains any of the patterns (substring match).
std::map< std::string, int > m_failingChains ATLAS_THREAD_SAFE
void dumpFeaturesPerLeg(const std::string &chain, std::size_t nLegs, MSG::Level level, const std::string &linkName="") const
Dump the per-leg R3 features of a chain at the given message level.
virtual ~NavigationDAODTesterAlgv2() override=default
PublicToolHandle< Trig::TrigDecisionTool > m_tdt
Gaudi::Property< std::vector< std::string > > m_chains
virtual StatusCode initialize() override
virtual StatusCode execute(const EventContext &context) const override
PublicToolHandle< Trig::MatchFromCompositeTool > m_matchFromCompositeTool
std::size_t numberOfLegs(const std::string &chain) const
Number of legs of a chain, derived from ChainNameParser::multiplicities().
Gaudi::Property< std::vector< std::string > > m_linearisedR2Chains
static const xAOD::IParticle * resolveOriginal(const xAOD::IParticle *p)
Resolve a possible shallow copy to its original object via the "originalObjectLink" decoration (mirro...
NavigationDAODTesterAlgv2(const std::string &name, ISvcLocator *pSvcLocator)
static bool matchLinearisedR2(std::vector< const xAOD::IParticle * > pool, const std::vector< const xAOD::IParticle * > &particles)
R2 verdict for chains with linearised TrigMatch layout (e.g.
Gaudi::Property< bool > m_verifyCombinationsSize
PublicToolHandle< Trig::R3MatchingTool > m_matchingTool
Gaudi::Property< std::string > m_inputPrefix
Gaudi::Property< std::vector< std::string > > m_chainsToExclude
Class providing the definition of the 4-vector interface.
std::vector< std::string > patterns
Definition listroot.cxx:187
The common trigger namespace for trigger analysis tools.
Framework include files.