ATLAS Offline Software
BasicTriggerFired.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //
6 // Basic trigger test - look for some number of triggers
7 // that have actually fired.
8 //
9 
12 
13 #include <iostream>
14 
15 using namespace std;
16 using namespace Trig;
17 using namespace xAOD;
18 
19 namespace {
20  // Dump out all chains in an event
21  void dumpTriggerInfo(TrigDecisionTool &trigDecTool) {
22  cout << "Dumping trigger info for event" << endl;
23  auto chainGroups = trigDecTool.getChainGroup(".*");
24  for(auto &trig : chainGroups->getListOfTriggers()) {
25  cout << " " << trig << endl;
26  }
27  }
28 }
29 
30 namespace TrigAnalysisTest {
31  //
32  // Init counters and get ready to run.
33  //
34  BasicTriggerFired::BasicTriggerFired()
35  : m_passed_l1(0),
36  m_passed_hlt(0),
37  m_first_call(true)
38  {
39  }
40 
41  // Actually process an event.
43 
44  // Did we pass a trigger level?
45  if (trigDecTool.isPassed("L1_.*"))
46  m_passed_l1++;
47  if (trigDecTool.isPassed("HLT_.*"))
48  m_passed_hlt++;
49 
50  // Dump for debugging the test
51  if (m_first_call) {
52  dumpTriggerInfo(trigDecTool);
53  m_first_call = false;
54  }
55  auto chainGroups = trigDecTool.getChainGroup(".*");
56  for(auto &trig : chainGroups->getListOfTriggers()) {
57  if(!m_trigger_counts.count(trig))
58  m_trigger_counts[trig] = 0;
59  if(trigDecTool.isPassed(trig))
60  m_trigger_counts[trig] += 1;
61  }
62  }
63 
64  // Dump everything and return a status.
66  {
67  // Dump for debugging.
68  cout << "L1 triggers passed: " << m_passed_l1 << endl;
69  cout << "HLT triggers passed; " << m_passed_hlt << endl;
70  cout << "START SUMMARY: BasicTriggerFired" << endl;
71  for (auto it = m_trigger_counts.begin(); it!=m_trigger_counts.end(); it++)
72  cout << (*it).first << "\t" << (*it).second <<endl;
73  cout << "END SUMMARY : BasicTriggerFired" << endl;
74 
75  // Good run if we found a trigger!
76  return (m_passed_l1 > 0 && m_passed_hlt > 0) ? 0 : 1;
77  }
78 }
Trig
The common trigger namespace for trigger analysis tools.
Definition: LArCellMonAlg.h:33
TrigAnalysisTest::BasicTriggerFired::processEvent
void processEvent(Trig::TrigDecisionTool &trigDecTool)
Definition: BasicTriggerFired.cxx:42
TrigAnalysisTest::BasicTriggerFired::m_passed_l1
unsigned int m_passed_l1
Definition: BasicTriggerFired.h:24
skel.it
it
Definition: skel.GENtoEVGEN.py:396
TrigDecisionTool.h
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
Trig::TrigDecisionTool
Definition: TrigDecisionTool.h:65
TrigAnalysisTest::BasicTriggerFired::m_first_call
bool m_first_call
Definition: BasicTriggerFired.h:26
Trig::TrigDecisionTool::isPassed
virtual bool isPassed(const std::string &chain, unsigned int condition) const
true if given chain passed
Definition: TrigDecisionTool.cxx:270
TrigAnalysisTest
Definition: BasicTriggerFired.cxx:30
TrigAnalysisTest::BasicTriggerFired::finalize
int finalize()
Definition: BasicTriggerFired.cxx:65
TrigAnalysisTest::BasicTriggerFired::m_trigger_counts
std::map< std::string, int > m_trigger_counts
Definition: BasicTriggerFired.h:27
BasicTriggerFired.h
Trig::TrigDecisionToolCore::getChainGroup
const Trig::ChainGroup * getChainGroup(const std::vector< std::string > &patterns, TrigDefs::Group props=TrigDefs::Group::Default) const
Create/get chain group (.
Definition: ChainGroupFunctions.cxx:38
TrigAnalysisTest::BasicTriggerFired::m_passed_hlt
unsigned int m_passed_hlt
Definition: BasicTriggerFired.h:25
dumpTriggerInfo
Definition: dumpTriggerInfo.py:1