ATLAS Offline Software
src/TrigTauMatching_example.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
8 const std::string tauTrigger = "HLT_tau125_medium1_tracktwo";
9 const std::string diTauTrigger = "HLT_tau35_medium1_tracktwo_tau25_medium1_tracktwo";
10 
12  ISvcLocator *svcLoc)
13  : AthAlgorithm(name, svcLoc),
14  m_eventCount(0),
15  m_tauEvents(0, 0),
16  m_diTauEvents(0, 0),
17  m_trigDecTool("TrigDecisionTool"),
18  m_matchTool("TrigTauMatchingTool")
19 {
20  declareProperty("TrigDecisionTool", m_trigDecTool);
21  declareProperty("TrigTauMatchingTool", m_matchTool);
22 }
23 
25 {
26  //ATH_CHECK(m_trigDecTool.retrieve());
27  ATH_CHECK(m_matchTool.retrieve());
28  return StatusCode::SUCCESS;
29 }
30 
32 {
33 
34  bool tauTriggered = false;
35  bool diTauTriggered = false;
36  int tauMatches = 0;
37  int diTauMatches = 0;
38 
39  const xAOD::TauJetContainer* taus = 0;
40  ATH_CHECK(evtStore()->retrieve(taus, "TauJets"));
41 
42  m_eventCount++;
43 
44  tauTriggered = m_trigDecTool->isPassed(tauTrigger);
45  diTauTriggered = m_trigDecTool->isPassed(diTauTrigger);
46 
47  for (auto it: *taus)
48  {
49  // Cut on tau pT >= 25 GeV, |eta| <= 2.5, and medium ID
50  if ( it->pt() < 25000
51  || std::abs(it->eta()) > 2.5
53  {
54  continue;
55  }
56 
57 
58  if (m_matchTool->match(it, tauTrigger))
59  {
60  tauMatches++;
61  }
62 
63  if (m_matchTool->match(it, diTauTrigger))
64  {
65  diTauMatches++;
66  }
67  }
68 
69  if (tauTriggered)
70  {
71  m_tauEvents.first++;
72  m_tauEvents.second += (tauMatches > 0);
73  std::cout << "[" << m_eventCount << "] " << tauMatches
74  << " taus matched with " << tauTrigger << std::endl;
75  }
76 
77  if (diTauTriggered)
78  {
79  m_diTauEvents.first++;
80  m_diTauEvents.second += (diTauMatches > 1);
81  std::cout << "[" << m_eventCount << "] " << diTauMatches
82  << " taus matched with " << diTauTrigger << std::endl;
83  }
84 
85  return StatusCode::SUCCESS;
86 }
87 
89 {
90  std::cout << m_tauEvents.second << "/" << m_tauEvents.first
91  << " events for " << tauTrigger << std::endl;
92  std::cout << m_diTauEvents.second << "/" << m_diTauEvents.first
93  << " events for " << diTauTrigger << std::endl;
94  return StatusCode::SUCCESS;
95 }
96 
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
TrigTauMatching_example::m_eventCount
Long64_t m_eventCount
Definition: TrigTauMatching_example.h:28
TrigTauMatching_example::m_matchTool
ToolHandle< Trig::ITrigTauMatchingTool > m_matchTool
Definition: TrigTauMatching_example.h:32
TrigTauMatching_example::execute
virtual StatusCode execute()
Definition: src/TrigTauMatching_example.cxx:31
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
skel.it
it
Definition: skel.GENtoEVGEN.py:423
tauTrigger
const std::string tauTrigger
Definition: src/TrigTauMatching_example.cxx:8
xAOD::TauJetParameters::JetBDTSigMedium
@ JetBDTSigMedium
Definition: TauDefs.h:137
diTauTrigger
const std::string diTauTrigger
Definition: src/TrigTauMatching_example.cxx:9
TrigTauMatching_example::initialize
virtual StatusCode initialize()
Definition: src/TrigTauMatching_example.cxx:24
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
TrigTauMatching_example::TrigTauMatching_example
TrigTauMatching_example(const std::string &name, ISvcLocator *svcLoc)
Definition: src/TrigTauMatching_example.cxx:11
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TrigTauMatching_example::m_trigDecTool
ToolHandle< Trig::TrigDecisionTool > m_trigDecTool
Definition: TrigTauMatching_example.h:31
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TauJetContainer.h
TrigTauMatching_example::finalize
virtual StatusCode finalize()
Definition: src/TrigTauMatching_example.cxx:88
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
AthAlgorithm
Definition: AthAlgorithm.h:47
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
TrigTauMatching_example::m_diTauEvents
std::pair< int, int > m_diTauEvents
Definition: TrigTauMatching_example.h:30
TrigTauMatching_example.h
TrigTauMatching_example::m_tauEvents
std::pair< int, int > m_tauEvents
Definition: TrigTauMatching_example.h:29