The TrigTauMatchingTool matches offline hadronic tau objects (TauJet) with a corresponding tau object at the trigger level that fired a specific trigger. It does so by retrieving the container associated with the fired trigger, and matching the objects at the trigger level with the given offline tau object within a cone in dR (default: dR < 0.2 for HLT, dR < 0.3 for L1). The first object in the trigger associated container that satisfies the dR requirement is selected as a match.
In RootCore:
// Trigger configuration tool
TrigConf::xAODConfigTool configTool("xAODConfigTool");
ToolHandle<TrigConf::ITrigConfigTool> configHandle(&configTool);
ASG_CHECK_SA("MyAlg", configHandle->initialize());
// The trigger decision tool
Trig::TrigDecisionTool trigDecTool("TrigDecTool");
ToolHandle<Trig::TrigDecisionTool> decisionToolHandle(&trigDecTool);
ASG_CHECK_SA("MyAlg", decisionToolHandle->setProperty("ConfigTool", configHandle));
ASG_CHECK_SA("MyAlg", decisionToolHandle->setProperty("TrigDecisionKey", "xTrigDecision"));
ASG_CHECK_SA("MyAlg", decisionToolHandle->initialize());
// The tau trigger matching tool
Trig::TrigTauMatchingTool matchTool("TrigTauMatching");
ASG_CHECK_SA("MyAlg", matchTool.setProperty("TrigDecisionTool", decisionToolHandle));
ASG_CHECK_SA("MyAlg", matchTool.initialize());
(See util/TrigTauMatching_example.cxx)
In AthAnalysisBase:
from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool
trigDecTool = Trig__TrigDecisionTool('TrigDecisionTool')
ToolSvc += trigDecTool
from TrigTauMatching.TrigTauMatchingConf import Trig__TrigTauMatchingTool
tauMatchingTool = Trig__TrigTauMatchingTool('TrigTauMatchingTool');
tauMatchingTool.TrigDecisionTool = trigDecTool
ToolSvc += tauMatchingTool
(See share/TrigTauMatching_test.py)
Options are accessible as properties, i.e. via TrigTauMatchingTool::setProperty in RootCore and through direct access in the job options file in AthAnalysisBase.
const xAOD::TauJetContainer *taus;
RETURN_CHECK("MyAlg", event->retrieve(taus, "TauJets"));
const std::string trigger("HLT_tau125_medium1_tracktwo");
// Match a tau with the default dR = 0.2
xAOD::TauJet *matchedTau = 0;
for (auto tau: taus)
{
if (matchTool.match(tau, trigger))
{
matchedTau = tau;
break;
}
}
// Get the HLT and L1 objects that matches the first offline tau
if (taus->size() > 0)
{
xAOD::TauJet *tau = taus->at(0);
// Get the matched HLT object (0 if no match)
xAOD::TauJet *hltTau = matchTool.getHLT(tau, trigger);
// Get the matched L1 object (0 if no match)
xAOD::EmTauRoI *l1Tau = matchTool.getL1FromHLT(tau, trigger);
}
// Match a tau with a looser dR requirement
xAOD::TauJet *looserMatchedTau = 0;
for (auto tau: taus)
{
if (matchTool.match(tau, trigger, 0.3))
{
looserMatchedTau = tau;
break;
}
}
TrigTauMatchingTool is written by Henrik Öhman <ohman@cern.ch>
JIRA: https://its.cern.ch/jira/browse/ATR-11094
Source: https://svnweb.cern.ch/trac/atlasoff/browser/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauMatching