ATLAS Offline Software
TrigTauMatching.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
8 
9 const std::string Trig::TrigTauMatchingTool::
10  kDefaultHLTLabel = "TrigTauRecMerged";
11 
12 const std::string Trig::TrigTauMatchingTool::
13  kDefaultL1Label = "LVL1EmTauRoIs";
14 
16  asg::AsgTool(name),
17  m_trigDecTool("TrigDecisionTool"),
18  m_hltLabel(kDefaultHLTLabel),
19  m_l1Label(kDefaultL1Label),
20  m_allowResurrectedDecision(false)
21 {
22  declareProperty("TrigDecisionTool", m_trigDecTool,
23  "Trigger decision tool for the trigger navigagtion");
24  declareProperty("HLTLabel", m_hltLabel,
25  "Label of the HLT tau jet container to use for matching");
26  declareProperty("L1Label", m_l1Label,
27  "Label of the L1 EmTau container to use for matching");
28  declareProperty("AllowResurrectedDecision", m_allowResurrectedDecision,
29  "Allow use of resurrected decision when retrieving "
30  "trigger decisions and features.");
31 }
32 
34 {
35  ATH_MSG_INFO("Initialising TrigTauMatchingTool");
36 
37  ATH_CHECK(m_trigDecTool.retrieve());
38 
39  return StatusCode::SUCCESS;
40 }
41 
43  const std::string &trigger,
44  double deltaRCut)
45 {
46  return getHLT(p, trigger, deltaRCut) != 0;
47 }
48 
50  const std::string &trigger,
51  const xAOD::TauJetContainer *c,
52  double deltaRCut)
53 {
54  if (m_trigDecTool->isPassed(trigger, getCondition()))
55  {
56  for (auto it : *c)
57  {
58  double dR = it->p4().DeltaR(p->p4());
59  if (dR < deltaRCut)
60  {
61  return true;
62  }
63  }
64  }
65  return false;
66 }
67 
69  const std::string &trigger,
71  double deltaRCut)
72 {
73  if (m_trigDecTool->isPassed(trigger, getCondition()))
74  {
75  if (c)
76  {
77  for (const xAOD::EmTauRoI* it : *c)
78  {
79  if (it->roiType() == xAOD::EmTauRoI::TauRoIWord)
80  {
81  TLorentzVector l1;
82  double dR;
83  l1.SetPtEtaPhiM(it->tauClus(), it->eta(), it->phi(), 1.0);
84  dR = l1.DeltaR(p->p4());
85 
86  if (dR < deltaRCut)
87  {
88  return true;
89  }
90  }
91  }
92  }
93  }
94 
95  return false;
96 }
97 
98 const xAOD::TauJet *
100  const std::string &trigger,
101  double deltaRCut)
102 {
103  if (m_trigDecTool->isPassed(trigger, getCondition()))
104  {
105  auto features = m_trigDecTool->features(trigger, getCondition());
106  decltype(features.containerFeature<xAOD::TauJetContainer>()) tauFeatures;
107 
108  if (!m_hltLabel.empty())
109  {
110  tauFeatures = features.containerFeature<xAOD::TauJetContainer>(
111  m_hltLabel);
112  }
113  else
114  {
115  tauFeatures = features.containerFeature<xAOD::TauJetContainer>();
116  }
117 
118  if (tauFeatures.size() == 0)
119  {
120  ATH_MSG_WARNING("Trigger " << trigger
121  << " has no features of type xAOD::TauJetContainer");
122  }
123 
124  for (auto &tauContainer : tauFeatures)
125  {
126  // Access the tau jet container stored in the container feature
127  if (tauContainer.cptr())
128  {
129  for (auto itTauHLT : *tauContainer.cptr())
130  {
131  double dR = itTauHLT->p4().DeltaR(p->p4());
132  if (dR < deltaRCut)
133  {
134  return itTauHLT;
135  }
136  }
137  }
138  }
139  }
140  return 0;
141 }
142 
143 const xAOD::EmTauRoI *
145  const std::string &trigger,
146  const xAOD::EmTauRoIContainer *c,
147  double deltaRCut)
148 {
149  const xAOD::TauJet *hltTau = getHLT(p, trigger, deltaRCut);
150  if (hltTau)
151  {
152  for (auto it : *c)
153  {
154  if (hltTau->ROIWord() == it->roiWord())
155  {
156  return it;
157  }
158  }
159  }
160  return 0;
161 }
162 
163 unsigned int
165 {
166  if (m_allowResurrectedDecision)
167  {
168  return TrigDefs::Physics | TrigDefs::allowResurrectedDecision;
169  }
170  else
171  {
172  return TrigDefs::Physics;
173  }
174 }
Trig::TrigTauMatchingTool::matchL1
virtual bool matchL1(const xAOD::TauJet *p, const std::string &trigger, const xAOD::EmTauRoIContainer *c, double deltaRCut=0.3)
Definition: TrigTauMatching.cxx:68
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
Trig::TrigTauMatchingTool::getL1FromHLT
virtual const xAOD::EmTauRoI * getL1FromHLT(const xAOD::TauJet *p, const std::string &trigger, const xAOD::EmTauRoIContainer *c, double deltaRCut=0.3)
Definition: TrigTauMatching.cxx:144
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
skel.it
it
Definition: skel.GENtoEVGEN.py:423
asg
Definition: DataHandleTestTool.h:28
Trig::TrigTauMatchingTool::m_hltLabel
std::string m_hltLabel
Definition: TrigTauMatching.h:73
xAOD::TauJet_v3::ROIWord
unsigned int ROIWord() const
the ROIWord, in case TauJet is used in EF trigger
Trig::TrigTauMatchingTool::getCondition
virtual unsigned int getCondition()
Definition: TrigTauMatching.cxx:164
Trig::TrigTauMatchingTool::initialize
virtual StatusCode initialize(void)
Dummy implementation of the initialisation function.
Definition: TrigTauMatching.cxx:33
xAOD::EmTauRoI_v2
Class describing a LVL1 em/tau region of interest.
Definition: EmTauRoI_v2.h:35
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Trig::TrigTauMatchingTool::m_l1Label
std::string m_l1Label
Definition: TrigTauMatching.h:74
xAOD::TauJet_v3
Class describing a tau jet.
Definition: TauJet_v3.h:41
Trig::TrigTauMatchingTool::match
virtual bool match(const xAOD::TauJet *p, const std::string &trigger, double deltaRCut=0.2)
Definition: TrigTauMatching.cxx:42
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
xAOD::EmTauRoI_v2::TauRoIWord
@ TauRoIWord
This is a Run 2 Tau RoI word.
Definition: EmTauRoI_v2.h:48
TrigTauMatching.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
Trig::TrigTauMatchingTool::TrigTauMatchingTool
TrigTauMatchingTool(const std::string &name)
Proper constructor for Athena.
Definition: TrigTauMatching.cxx:15
EmTauRoIContainer.h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Trig::TrigTauMatchingTool::getHLT
virtual const xAOD::TauJet * getHLT(const xAOD::TauJet *p, const std::string &trigger, double deltaRCut=0.2)
Definition: TrigTauMatching.cxx:99
skel.l1
l1
Definition: skel.GENtoEVGEN.py:425
python.compressB64.c
def c
Definition: compressB64.py:93
PhysDESDM_Quirks.trigger
trigger
Definition: PhysDESDM_Quirks.py:27
Trig::TrigTauMatchingTool::m_allowResurrectedDecision
bool m_allowResurrectedDecision
Definition: TrigTauMatching.h:75
Trig::TrigTauMatchingTool::m_trigDecTool
ToolHandle< Trig::TrigDecisionTool > m_trigDecTool
Definition: TrigTauMatching.h:72