ATLAS Offline Software
Loading...
Searching...
No Matches
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
15using namespace std;
16using namespace Trig;
17using namespace xAOD;
18
19namespace {
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
31 //
32 // Init counters and get ready to run.
33 //
40
41 // Actually process an event.
43
44 // Did we pass a trigger level?
45 if (trigDecTool.isPassed("L1_.*"))
47 if (trigDecTool.isPassed("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}
std::map< std::string, int > m_trigger_counts
void processEvent(Trig::TrigDecisionTool &trigDecTool)
const Trig::ChainGroup * getChainGroup(const std::vector< std::string > &patterns, TrigDefs::Group props=TrigDefs::Group::Default) const
Create/get chain group (.
virtual bool isPassed(const std::string &chain, unsigned int condition) const
true if given chain passed
The common trigger namespace for trigger analysis tools.
STL namespace.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.