ATLAS Offline Software
Loading...
Searching...
No Matches
TrigComboHypoTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TRIGCOMBOHYPO_TRIGCOMBOHYPOTOOL_H
6#define TRIGCOMBOHYPO_TRIGCOMBOHYPOTOOL_H
7
8
9
11
13
16
19
20#include <string>
21#include <vector>
22#include <tuple>
23#include <limits>
24
32
33
35
36 public:
37 enum ComboHypoVars { UNDEF=-1, DR=0, DPHI, INVM, MT, DETA};
38
39 TrigComboHypoTool(const std::string& type,
40 const std::string& name,
41 const IInterface* parent);
42
43 virtual ~TrigComboHypoTool() {};
44 virtual StatusCode initialize() override;
45
46 private:
47
48 static constexpr float FLOATDEFAULT = std::numeric_limits<float>::lowest();
49
51 struct VarInfo {
52 std::string varTag{""};
54 size_t index{0};
55 std::string monToolName{""};
56
57 bool useMin{false};
59 bool useMax{false};
61
62 bool legA_is_MET{false};
63 uint32_t legA{0};
64 bool legB_is_MET{false};
65 uint32_t legB{0};
66 bool legsAreEqual{false};
67
69 bool validate(std::string& errmsg) const;
71 std::string rangeStr() const {
72 return (useMin ? std::to_string(varMin) + " < " : "") + varTag + (useMax ? " < " + std::to_string(varMax): "");
73 }
74 bool test(float value) const {
75 return (useMin ? value > varMin : true) && (useMax ? value < varMax : true);
76 }
77
78 };
79
81 typedef std::tuple<float,float,float> KineInfo;
82 typedef std::vector<Combo::LegDecision> Combination;
83
86 StatusCode decide(Combo::LegDecisionsMap& passingLegs, const EventContext& /*ctx*/) const final;
87
89 bool executeAlgStep(const Combination& combination, const VarInfo&, std::vector<float>& values) const;
91 float compute(const std::pair<KineInfo,KineInfo>& kinepair, ComboHypoVars var) const;
92
96 bool fillLegDecisions_sameLeg(std::pair<Combo::LegDecision,Combo::LegDecision>& legpair, const Combination& combination, uint32_t leg) const;
97 bool fillLegDecisions_diffLeg(std::pair<Combo::LegDecision,Combo::LegDecision>& legpair, const Combination& combination, uint32_t legA, uint32_t legB) const;
98 bool fillPairKinematics(std::pair<KineInfo,KineInfo>& kinepair, const Combination& combination, const VarInfo& varInfo) const;
99 bool fillKineInfo(KineInfo& kinematics, Combo::LegDecision decision, bool isMET) const;
100
102 // flags
103 Gaudi::Property<std::vector<std::string>> m_varTag_vec {this, "Variables" , {""}, "Variables to cut on"};
104 Gaudi::Property<std::vector<bool> > m_useMin_vec {this, "UseMinVec" , {false}, "Array with the apply_min_cut setting"};
105 Gaudi::Property<std::vector<bool> > m_useMax_vec {this, "UseMaxVec" , {false}, "Array with the apply_max_cut setting"};
106
107 //legs
108 Gaudi::Property<std::vector<uint32_t>> m_legA_vec {this, "LegAVec" , {0}, "Array with the first Leg ID"};
109 Gaudi::Property<std::vector<uint32_t>> m_legB_vec {this, "LegBVec" , {0}, "Array with the second Leg ID"};
110 Gaudi::Property<std::vector< bool >> m_isLegA_MET_vec {this, "IsLegA_METVec", {false}, "Array with the first Leg MET identifier"};
111 Gaudi::Property<std::vector< bool >> m_isLegB_MET_vec {this, "IsLegB_METVec", {false}, "Array with the second Leg MET identifier"};
112 Gaudi::Property<bool> m_skipLegCheck {this, "SkipLegCheck" , {false}, "Ignore leg IDs for chains with only one leg"};
113
114 // cuts
115 Gaudi::Property<std::vector<float>> m_varMin_vec {this, "LowerCutVec", {FLOATDEFAULT}, "Array with the lower cut for legs pair"};
116 Gaudi::Property<std::vector<float>> m_varMax_vec {this, "UpperCutVec", {FLOATDEFAULT}, "Array with the upper cut for legs pair"};
117
118 // monitoring
119 ToolHandleArray<GenericMonitoringTool> m_monTool_vec {this, "MonTools", {}, "Monitoring tools" };
120
122 std::vector<VarInfo> m_varInfo_vec;
123
124}; // TRIGCOMBOHYPO_TRIGCOMBOHYPOTOOL_H
125#endif
126
127
128
Header file to be included by clients of the Monitored infrastructure.
static thread_local std::ostringstream errmsg
Definition WaferTree.h:25
ComboHypoToolBase(const std::string &type, const std::string &name, const IInterface *parent)
Gaudi::Property< std::vector< float > > m_varMax_vec
float compute(const std::pair< KineInfo, KineInfo > &kinepair, ComboHypoVars var) const
Computation of the variables from the specified kinematics.
StatusCode decide(Combo::LegDecisionsMap &passingLegs, const EventContext &) const final
Override the ComboHypoToolBase::decide in order to optimise combination generation This is to avoid e...
bool executeAlgStep(const Combination &combination, const VarInfo &, std::vector< float > &values) const
Implementation of selection on individual variables.
Gaudi::Property< std::vector< bool > > m_isLegB_MET_vec
bool fillLegDecisions_diffLeg(std::pair< Combo::LegDecision, Combo::LegDecision > &legpair, const Combination &combination, uint32_t legA, uint32_t legB) const
Gaudi::Property< std::vector< bool > > m_useMin_vec
bool fillLegDecisions_sameLeg(std::pair< Combo::LegDecision, Combo::LegDecision > &legpair, const Combination &combination, uint32_t leg) const
Helpers to extract kinematics from the specified legs of the chain Specialised for two cases – exactl...
bool fillKineInfo(KineInfo &kinematics, Combo::LegDecision decision, bool isMET) const
Gaudi::Property< std::vector< uint32_t > > m_legA_vec
static constexpr float FLOATDEFAULT
std::vector< Combo::LegDecision > Combination
Gaudi::Property< std::vector< bool > > m_isLegA_MET_vec
bool fillPairKinematics(std::pair< KineInfo, KineInfo > &kinepair, const Combination &combination, const VarInfo &varInfo) const
std::tuple< float, float, float > KineInfo
Typedef for convenience, will contain eta/phi/pt info.
Gaudi::Property< std::vector< bool > > m_useMax_vec
Gaudi::Property< bool > m_skipLegCheck
Gaudi::Property< std::vector< float > > m_varMin_vec
TrigComboHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
virtual StatusCode initialize() override
ToolHandleArray< GenericMonitoringTool > m_monTool_vec
std::vector< VarInfo > m_varInfo_vec
Internal variables for more efficient config lookup.
Gaudi::Property< std::vector< std::string > > m_varTag_vec
Gaudi configuration hooks.
Gaudi::Property< std::vector< uint32_t > > m_legB_vec
Definition index.py:1
Organise info per var selection in a struct.
bool validate(std::string &errmsg) const
Check consistency of single var config.
std::string rangeStr() const
Generate range string for printing.
bool test(float value) const