ATLAS Offline Software
TrigComboHypoTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRIGCOMBOHYPO_TRIGCOMBOHYPOTOOL_H
6 #define TRIGCOMBOHYPO_TRIGCOMBOHYPOTOOL_H
7 
8 #include <string>
9 #include <vector>
10 #include <tuple>
11 #include <limits>
12 
14 
16 
19 
22 
23 
34 
35  public:
36  enum ComboHypoVars { UNDEF=-1, DR=0, DPHI, INVM, MT, DETA};
37 
38  TrigComboHypoTool(const std::string& type,
39  const std::string& name,
40  const IInterface* parent);
41 
42  virtual ~TrigComboHypoTool() {};
43  virtual StatusCode initialize() override;
44 
45  private:
46 
47  static constexpr float FLOATDEFAULT = std::numeric_limits<float>::lowest();
48 
50  struct VarInfo {
51  std::string varTag{""};
53  size_t index{0};
54  std::string monToolName{""};
55 
56  bool useMin{false};
58  bool useMax{false};
60 
61  bool legA_is_MET{false};
63  bool legB_is_MET{false};
65  bool legsAreEqual{false};
66 
68  bool validate(std::string& errmsg) const;
70  std::string rangeStr() const {
71  return (useMin ? std::to_string(varMin) + " < " : "") + varTag + (useMax ? " < " + std::to_string(varMax): "");
72  }
73  bool test(float value) const {
74  return (useMin ? value > varMin : true) && (useMax ? value < varMax : true);
75  }
76 
77  };
78 
80  typedef std::tuple<float,float,float> KineInfo;
81  typedef std::vector<Combo::LegDecision> Combination;
82 
85  virtual bool executeAlg(const Combination& combination) const override;
86 
88  bool executeAlgStep(const Combination& combination, const VarInfo&, std::vector<float>& values) const;
90  float compute(const std::pair<KineInfo,KineInfo>& kinepair, ComboHypoVars var) const;
91 
95  bool fillLegDecisions_sameLeg(std::pair<Combo::LegDecision,Combo::LegDecision>& legpair, const Combination& combination, uint32_t leg) const;
96  bool fillLegDecisions_diffLeg(std::pair<Combo::LegDecision,Combo::LegDecision>& legpair, const Combination& combination, uint32_t legA, uint32_t legB) const;
97  bool fillPairKinematics(std::pair<KineInfo,KineInfo>& kinepair, const Combination& combination, const VarInfo& varInfo) const;
98  bool fillKineInfo(KineInfo& kinematics, Combo::LegDecision decision, bool isMET) const;
99 
101  // flags
102  Gaudi::Property<std::vector<std::string>> m_varTag_vec {this, "Variables" , {""}, "Variables to cut on"};
103  Gaudi::Property<std::vector<bool> > m_useMin_vec {this, "UseMinVec" , {false}, "Array with the apply_min_cut setting"};
104  Gaudi::Property<std::vector<bool> > m_useMax_vec {this, "UseMaxVec" , {false}, "Array with the apply_max_cut setting"};
105 
106  //legs
107  Gaudi::Property<std::vector<uint32_t>> m_legA_vec {this, "LegAVec" , {0}, "Array with the first Leg ID"};
108  Gaudi::Property<std::vector<uint32_t>> m_legB_vec {this, "LegBVec" , {0}, "Array with the second Leg ID"};
109  Gaudi::Property<std::vector< bool >> m_isLegA_MET_vec {this, "IsLegA_METVec", {false}, "Array with the first Leg MET identifier"};
110  Gaudi::Property<std::vector< bool >> m_isLegB_MET_vec {this, "IsLegB_METVec", {false}, "Array with the second Leg MET identifier"};
111  Gaudi::Property<bool> m_skipLegCheck {this, "SkipLegCheck" , {false}, "Ignore leg IDs for chains with only one leg"};
112 
113  // cuts
114  Gaudi::Property<std::vector<float>> m_varMin_vec {this, "LowerCutVec", {FLOATDEFAULT}, "Array with the lower cut for legs pair"};
115  Gaudi::Property<std::vector<float>> m_varMax_vec {this, "UpperCutVec", {FLOATDEFAULT}, "Array with the upper cut for legs pair"};
116 
117  // monitoring
118  ToolHandleArray<GenericMonitoringTool> m_monTool_vec {this, "MonTools", {}, "Monitoring tools" };
119 
121  std::vector<VarInfo> m_varInfo_vec;
122 
123 }; // TRIGCOMBOHYPO_TRIGCOMBOHYPOTOOL_H
124 #endif
125 
126 
127 
TrigComboHypoTool::m_legB_vec
Gaudi::Property< std::vector< uint32_t > > m_legB_vec
Definition: TrigComboHypoTool.h:108
TrigComboHypoTool::VarInfo
Organise info per var selection in a struct.
Definition: TrigComboHypoTool.h:50
beamspotnt.var
var
Definition: bin/beamspotnt.py:1394
TrigComboHypoTool::m_monTool_vec
ToolHandleArray< GenericMonitoringTool > m_monTool_vec
Definition: TrigComboHypoTool.h:118
TrigComboHypoTool::m_varMax_vec
Gaudi::Property< std::vector< float > > m_varMax_vec
Definition: TrigComboHypoTool.h:115
TrigComboHypoTool::VarInfo::test
bool test(float value) const
Definition: TrigComboHypoTool.h:73
TrigCompositeUtils.h
TrigComboHypoTool::UNDEF
@ UNDEF
Definition: TrigComboHypoTool.h:36
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TrigComboHypoTool::initialize
virtual StatusCode initialize() override
Definition: TrigComboHypoTool.cxx:60
TrigComboHypoTool::fillPairKinematics
bool fillPairKinematics(std::pair< KineInfo, KineInfo > &kinepair, const Combination &combination, const VarInfo &varInfo) const
Definition: TrigComboHypoTool.cxx:247
index
Definition: index.py:1
TrigComboHypoTool::~TrigComboHypoTool
virtual ~TrigComboHypoTool()
Definition: TrigComboHypoTool.h:42
TrigComboHypoTool::MT
@ MT
Definition: TrigComboHypoTool.h:36
TrigComboHypoTool::DPHI
@ DPHI
Definition: TrigComboHypoTool.h:36
TrigComboHypoTool::m_isLegB_MET_vec
Gaudi::Property< std::vector< bool > > m_isLegB_MET_vec
Definition: TrigComboHypoTool.h:110
TrigComboHypoTool
TrigComboHypoTool is a ComboHypoTool that calculates topological quantities between two particles and...
Definition: TrigComboHypoTool.h:33
athena.value
value
Definition: athena.py:124
TrigComboHypoTool::m_varTag_vec
Gaudi::Property< std::vector< std::string > > m_varTag_vec
Gaudi configuration hooks.
Definition: TrigComboHypoTool.h:102
TrigComboHypoTool::VarInfo::monToolName
std::string monToolName
Definition: TrigComboHypoTool.h:54
ComboHypoToolBase
Base class for tools which cut on properties of multi-object or multi-leg chains. User should derive ...
Definition: ComboHypoToolBase.h:26
TrigComboHypoTool::executeAlg
virtual bool executeAlg(const Combination &combination) const override
Top-level function to make chain-level decision This applies the AND of all configured var selections...
Definition: TrigComboHypoTool.cxx:127
TrigComboHypoTool::VarInfo::legB
uint32_t legB
Definition: TrigComboHypoTool.h:64
TrigComboHypoTool::ComboHypoVars
ComboHypoVars
Definition: TrigComboHypoTool.h:36
TrigComboHypoTool::INVM
@ INVM
Definition: TrigComboHypoTool.h:36
python.Bindings.values
values
Definition: Control/AthenaPython/python/Bindings.py:805
TrigComboHypoTool::VarInfo::legB_is_MET
bool legB_is_MET
Definition: TrigComboHypoTool.h:63
TrigComboHypoTool::Combination
std::vector< Combo::LegDecision > Combination
Definition: TrigComboHypoTool.h:81
TrigComboHypoTool::VarInfo::varMax
float varMax
Definition: TrigComboHypoTool.h:59
GenericMonitoringTool.h
TrigComboHypoTool::fillKineInfo
bool fillKineInfo(KineInfo &kinematics, Combo::LegDecision decision, bool isMET) const
Definition: TrigComboHypoTool.cxx:272
TrigComboHypoTool::VarInfo::legA
uint32_t legA
Definition: TrigComboHypoTool.h:62
TrigComboHypoTool::fillLegDecisions_sameLeg
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...
Definition: TrigComboHypoTool.cxx:194
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
IParticleContainer.h
TrigComboHypoTool::m_isLegA_MET_vec
Gaudi::Property< std::vector< bool > > m_isLegA_MET_vec
Definition: TrigComboHypoTool.h:109
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TrigComboHypoTool::FLOATDEFAULT
static constexpr float FLOATDEFAULT
Definition: TrigComboHypoTool.h:47
compute_lumi.leg
leg
Definition: compute_lumi.py:95
TrigComboHypoTool::executeAlgStep
bool executeAlgStep(const Combination &combination, const VarInfo &, std::vector< float > &values) const
Implementation of selection on individual variables.
Definition: TrigComboHypoTool.cxx:151
TrigComboHypoTool::TrigComboHypoTool
TrigComboHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: TrigComboHypoTool.cxx:32
TrigComboHypoTool::KineInfo
std::tuple< float, float, float > KineInfo
Typedef for convenience, will contain eta/phi/pt info.
Definition: TrigComboHypoTool.h:80
TrigComboHypoTool::DR
@ DR
Definition: TrigComboHypoTool.h:36
Monitored.h
Header file to be included by clients of the Monitored infrastructure.
TrigComboHypoTool::m_varInfo_vec
std::vector< VarInfo > m_varInfo_vec
Internal variables for more efficient config lookup.
Definition: TrigComboHypoTool.h:121
ComboHypoToolBase.h
TrigComboHypoTool::compute
float compute(const std::pair< KineInfo, KineInfo > &kinepair, ComboHypoVars var) const
Computation of the variables from the specified kinematics.
Definition: TrigComboHypoTool.cxx:300
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
TrigComboHypoTool::VarInfo::rangeStr
std::string rangeStr() const
Generate range string for printing.
Definition: TrigComboHypoTool.h:70
TrigComboHypoTool::m_useMax_vec
Gaudi::Property< std::vector< bool > > m_useMax_vec
Definition: TrigComboHypoTool.h:104
TrigComboHypoTool::VarInfo::varMin
float varMin
Definition: TrigComboHypoTool.h:57
TrigComboHypoTool::m_varMin_vec
Gaudi::Property< std::vector< float > > m_varMin_vec
Definition: TrigComboHypoTool.h:114
TrigComboHypoTool::fillLegDecisions_diffLeg
bool fillLegDecisions_diffLeg(std::pair< Combo::LegDecision, Combo::LegDecision > &legpair, const Combination &combination, uint32_t legA, uint32_t legB) const
Definition: TrigComboHypoTool.cxx:219
TrigComboHypoTool::VarInfo::varTag
std::string varTag
Definition: TrigComboHypoTool.h:51
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
HLTIdentifier.h
TrigComboHypoTool::VarInfo::legA_is_MET
bool legA_is_MET
Definition: TrigComboHypoTool.h:61
TrigComboHypoTool::VarInfo::legsAreEqual
bool legsAreEqual
Definition: TrigComboHypoTool.h:65
TrigComboHypoTool::VarInfo::useMax
bool useMax
Definition: TrigComboHypoTool.h:58
TrigComboHypoTool::m_skipLegCheck
Gaudi::Property< bool > m_skipLegCheck
Definition: TrigComboHypoTool.h:111
TrigComboHypoTool::VarInfo::useMin
bool useMin
Definition: TrigComboHypoTool.h:56
TrigComboHypoTool::m_useMin_vec
Gaudi::Property< std::vector< bool > > m_useMin_vec
Definition: TrigComboHypoTool.h:103
TrigComboHypoTool::DETA
@ DETA
Definition: TrigComboHypoTool.h:36
TrigComboHypoTool::VarInfo::var
ComboHypoVars var
Definition: TrigComboHypoTool.h:52
Combo::LegDecision
std::pair< TrigCompositeUtils::DecisionID, ElementLink< TrigCompositeUtils::DecisionContainer > > LegDecision
LegDecision keeps a given Decision Object associated with a specific leg when being used inside a sin...
Definition: IComboHypoTool.h:33
TrigComboHypoTool::VarInfo::validate
bool validate(std::string &errmsg) const
Check consistency of single var config.
Definition: TrigComboHypoTool.cxx:39
TrigComboHypoTool::m_legA_vec
Gaudi::Property< std::vector< uint32_t > > m_legA_vec
Definition: TrigComboHypoTool.h:107