18 std::set<std::set<const xAOD::IParticle *>> vectorToSet(
19 const std::vector<std::vector<const xAOD::IParticle *>>&
vec)
21 std::set<std::set<const xAOD::IParticle *>> ret;
22 for (
const std::vector<const xAOD::IParticle *> &combination :
vec)
23 ret.emplace(combination.begin(), combination.end());
33 <<
"type = " << p->type() <<
", "
34 <<
"pt = " << p->pt() <<
", "
35 <<
"eta = " << p->eta() <<
", "
36 <<
"phi = " << p->phi() <<
", "
37 <<
"ptr = " <<
reinterpret_cast<const void*
>(p)
46 std::ostream &
operator<<(std::ostream &os,
const std::set<T> &s)
49 for (
auto itr = s.begin(); itr != s.end(); ++itr)
75 return StatusCode::SUCCESS;
80 for (
const std::string &chain :
m_chains)
83 ATH_MSG_DEBUG(
"Begin testing chain " << chain << (chainPassed ?
" and will dive into details as the chain passed " :
" but will not do anything as the chain did not pass"));
84 if (!chainPassed)
continue;
87 bool isExcluded =
false;
89 if (chain == excludedChain) {
108 auto combsRun2 = vectorToSet(vecCombinationsRun2);
111 if (combsRun2.size() == 0)
113 ATH_MSG_DEBUG(
"Chain " << chain <<
" testing discarded due to detected Run 2 size == 0");
116 for (
auto& c : combsRun2 ) {
121 auto combsRun3 = vectorToSet(vecCombinationsRun3);
125 ATH_MSG_DEBUG(
"Both, Run2 and Run3 combinations are effectively empty");
130 for (
auto& c : combsRun3 ) {
146 return StatusCode::SUCCESS;
151 std::set<const xAOD::IParticle*> particlesRun3;
152 for (
auto l: run3) {
153 if ( l.link.isValid() )
154 particlesRun3.insert(*(l.link));
159 std::set<const xAOD::IParticle*> particlesRun2;
160 for (
auto& comb: vecCombinationsRun2) {
161 for (
auto el: comb) {
162 particlesRun2.insert(el);
166 for (
auto f2: particlesRun2 ) {
168 for (
auto f3: particlesRun3 ) {
174 ATH_MSG_ERROR(
"Missing feature in Run 3 that is present in Run 2 " << f2 <<
" chain " << chain <<
" enable DEBUG to see more details" );
176 return StatusCode::FAILURE;
180 return StatusCode::SUCCESS;
187 if (run2.size() > run3.size()) {
189 <<
": Run2=" << run2.size() <<
" Run3=" << run3.size()
190 <<
" (possible false positive from chain config decoding)");
192 return StatusCode::FAILURE;
195 return StatusCode::SUCCESS;
203 auto isSubsetPresent = [](
const std::set<xAODParticle*>& subset,
const CombinationsSet& r2) {
204 for (
const auto& setInRun2 : r2) {
206 bool allFound =
true;
207 for (
auto particle : subset) {
208 if (setInRun2.find(particle) == setInRun2.end()) {
213 if (allFound)
return true;
220 for (
const auto& subset : r3) {
221 if (isSubsetPresent(subset, r2)) {
228 bool result {
false };
235 result = isAnySubsetPresent(run3, run2);
238 result = isAnySubsetPresent(run2, run3);
243 ATH_MSG_WARNING(
"Run2 objects not within subset of Run3 for chain " << chain
248 return StatusCode::FAILURE;
250 }
else if (run2 != run3) {
252 ATH_MSG_WARNING(
"Run2/Run3 combinations differ (but subset OK) for chain " << chain
258 return StatusCode::SUCCESS;
263 for (
const std::vector<const xAOD::IParticle*>& outerc: combs )
264 counter += outerc.size();
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
std::vector< size_t > vec
An algorithm that can be simultaneously executed in multiple threads.
StatusCode verifyFlatContent(const std::string &chain) const
PublicToolHandle< Trig::TrigDecisionTool > m_tdtRun3
StatusCode verifyCombinationsSize(const CombinationsVector &run2, const CombinationsVector &run3, const std::string &chain) const
PublicToolHandle< Trig::TrigDecisionTool > m_tdtRun2
PublicToolHandle< Trig::TrigDecisionTool > m_tdt
std::vector< std::vector< const xAOD::IParticle * > > CombinationsVector
ToolHandle< Trig::IIParticleRetrievalTool > m_toolRun3
std::set< std::set< const xAOD::IParticle * > > CombinationsSet
StatusCode execute(const EventContext &context) const override
StatusCode initialize() override
StatusCode verifyCombinationsContent(const CombinationsSet &run2, const CombinationsSet &run3, const std::string &chain) const
Gaudi::Property< bool > m_verifyCombinations
Gaudi::Property< bool > m_verifyCombinationsSize
Gaudi::Property< bool > m_failOnDifference
bool combinationsEmpty(const CombinationsVector &combs) const
ToolHandle< Trig::IIParticleRetrievalTool > m_toolRun2
Gaudi::Property< std::vector< std::string > > m_chains
NavigationTesterAlg(const std::string &name, ISvcLocator *pSvcLocator)
Class providing the definition of the 4-vector interface.
std::vector< int > multiplicities(const std::string &chain)
const std::regex gammaXeChain
const std::regex specialElMuChain
const std::vector< std::string > excludedChains
const std::regex specialEchain
const std::regex mu2MunoL1Special
static const unsigned int allowResurrectedDecision
static const unsigned int Physics
The common trigger namespace for trigger analysis tools.
ostream & operator<<(ostream &s, const SG::VarHandleKey &m)
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
std::ostream & operator<<(std::ostream &out, const std::pair< FIRST, SECOND > &pair)
Helper print operator.
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.