6 #include "GaudiKernel/SystemOfUnits.h"
7 #include <Math/Vector4D.h>
8 #include <Math/Vector4Dfwd.h>
9 #include <Math/Vector2D.h>
10 #include <Math/Vector2Dfwd.h>
24 const std::map<std::string, TrigComboHypoTool::ComboHypoVars>
VarMap = {
25 {
"dR", TrigComboHypoTool::ComboHypoVars::DR},
26 {
"invm", TrigComboHypoTool::ComboHypoVars::INVM},
27 {
"dphi", TrigComboHypoTool::ComboHypoVars::DPHI},
29 {
"deta", TrigComboHypoTool::ComboHypoVars::DETA}
33 const std::string&
name,
41 errmsg =
"legA ID not set!";
45 errmsg=
"legB ID not set!";
49 errmsg=
"Trying to configure the Tool without setting at least one of UseMin or UseMax!";
53 errmsg =
"Cannot specify the same MET leg for both sides!";
73 ATH_MSG_ERROR(
"Trying to configure the Tool with legA and legB vectors of different size!");
74 return StatusCode::FAILURE;
77 ATH_MSG_ERROR(
"Trying to configure the Tool with UseMin and UseMax vectors of different size!");
78 return StatusCode::FAILURE;
81 ATH_MSG_ERROR(
"Trying to configure the Tool with legA/B and UseMax/Min vectors of different size!");
82 return StatusCode::FAILURE;
85 ATH_MSG_ERROR(
"Trying to configure the Tool with varTag and UseMax/Min(LegA/B) vectors of different size!");
86 return StatusCode::FAILURE;
96 ATH_MSG_ERROR(
"The variable is not present in the ComboHypoVars list");
97 return StatusCode::FAILURE;
113 std::string validmsg{
""};
114 if(!
info.validate(validmsg)) {
116 return StatusCode::FAILURE;
123 return StatusCode::SUCCESS;
129 bool lastDecision(
true);
130 std::vector<float>
values;
143 ATH_MSG_DEBUG( varInfo->varTag <<
" = " <<
value <<
" is in range " << varInfo->rangeStr() <<
".");
154 std::pair<KineInfo,KineInfo> kinepair;
156 ATH_MSG_ERROR(
"Failed to extract kinematics of feature pair!");
161 float eta_check, phi_check, pt_check;
162 std::tie(eta_check,phi_check,pt_check) = kinepair.first;
163 msg() <<
MSG::DEBUG <<
"Test filled legA kinematics: pt " << pt_check*
invGeV <<
", eta " << eta_check <<
", phi " << phi_check <<
endmsg;
165 std::tie(eta_check,phi_check,pt_check) = kinepair.second;
166 msg() <<
MSG::DEBUG <<
"Test filled legB kinematics: pt " << pt_check*
invGeV <<
", eta " << eta_check <<
", phi " << phi_check <<
endmsg;
190 return combId.numeric() == targetleg;
198 std::copy(combination.begin(),combination.end(),std::back_inserter(leg_features));
203 std::copy_if(combination.begin(),combination.end(),std::back_inserter(leg_features),isMyLeg);
206 if (leg_features.size()==2) {
207 legpair.first = leg_features[0];
208 legpair.second = leg_features[1];
210 ATH_MSG_ERROR(leg_features.size() <<
" Decision Objects supplied on leg " <<
leg
211 <<
", must be 2 for same-leg topo selection!");
226 std::copy_if(combination.begin(),combination.end(),std::back_inserter(legA_features),isLegA);
227 if(legA_features.size()!=1) {
228 ATH_MSG_ERROR(legA_features.size() <<
" Decision Objects supplied on leg " << legA
229 <<
", must be 1 for different-leg topo selection!");
233 std::copy_if(combination.begin(),combination.end(),std::back_inserter(legB_features),isLegB);
234 if (legB_features.size()!=1) {
235 ATH_MSG_ERROR(legB_features.size() <<
" Decision Objects supplied on leg " << legB
236 <<
", must be 1 for different-leg topo selection!");
240 legpair.first = legA_features[0];
241 legpair.second = legB_features[0];
248 ATH_MSG_DEBUG(
"Decision objects available = "<< combination);
250 size_t nFeatures(combination.size());
252 ATH_MSG_ERROR(
"Number of Decision Objects passed is less than 2! Sum over decision objects on all legs = " << combination.size() );
255 std::pair<Combo::LegDecision,Combo::LegDecision> legpair;
260 ATH_MSG_ERROR(
"Failed to extract requisite kinematic info from leg " << varInfo.
legA <<
"!");
265 ATH_MSG_ERROR(
"Failed to extract requisite kinematic info from leg " << varInfo.
legB <<
"!");
275 auto pLink = TrigCompositeUtils::findLink<xAOD::TrigMissingETContainer>( *decision.second,
featureString() ).link;
276 if (!pLink.isValid()){
280 ROOT::Math::XYVectorF metv((*pLink)->ex(),(*pLink)->ey());
285 auto pLink = TrigCompositeUtils::findLink<xAOD::IParticleContainer>( *decision.second,
featureString() ).link;
286 if (!pLink.isValid()){
290 eta = (*pLink)->p4().Eta();
291 phi = (*pLink)->p4().Phi();
292 pt = (*pLink)->p4().Pt();
295 kinematics = std::make_tuple(
eta,
phi,
pt);
301 const auto& [legA_kine,legB_kine] = kinepair;
302 const auto& [
eta1,phi1,pt1] = legA_kine;
303 const auto& [
eta2,phi2,pt2] = legB_kine;
310 case ComboHypoVars::DR:
315 case ComboHypoVars::DPHI:
320 case ComboHypoVars::INVM:
322 ROOT::Math::PtEtaPhiMVector
p1(pt1,
eta1,phi1,0.),
p2(pt2,
eta2,phi2,0.);
332 case ComboHypoVars::DETA:
339 ATH_MSG_ERROR(
"Undefined variable requested -- should never happen!");