ATLAS Offline Software
TrigDecisionMaker.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 /*
4  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 /**************************************************************************
8  **
9  ** File: TrigDecisionMaker.h
10  **
11  ** Description: - Algorithm-derived class to run after the Steering
12  ** - Finds the list of defined signatures at initialization
13  ** - For each event:
14  ** * Creates a TriggerDecision object
15  ** * Fills it with the outcome of each defined signature
16  ** * Stores it in StoreGate to be written to ESD/AOD
17  **
18  * @author Nicolas Berger <Nicolas.Berger@cern.ch> - CERN
19  * @author Till Eifert <Till.Eifert@cern.ch> - U. of Geneva, Switzerland
20  * @author Ricardo Goncalo <Jose.Goncalo@cern.ch> - Royal Holloway, U. of London
21  **
22  ** Created: Tue May 09 14:55:56 GMT 2006
23  ** Modified:
24  **
25  **************************************************************************/
26 #ifndef TrigDecisionMaker_TrigDecisionMaker_H
27 #define TrigDecisionMaker_TrigDecisionMaker_H
28 
30 
31 #include "GaudiKernel/ServiceHandle.h"
32 #include "GaudiKernel/ToolHandle.h"
33 
38 #include "TrigConfData/HLTMenu.h"
39 
40 #include <vector>
41 #include <string>
42 #include <atomic>
43 
44 namespace HLT {
45  class HLTResult;
46 }
47 
48 namespace LVL1CTP {
49  class Lvl1Result;
50 }
51 
52 namespace TrigDec {
53 
71  {
72 
74  enum TrigLevel {L1=1, L2, EF, HLT};
75 
76  public:
77 
78  TrigDecisionMaker(const std::string &name, ISvcLocator *pSvcLocator);
79  virtual ~TrigDecisionMaker();
80 
81  // IAlgorithm virtual methods to implement
82  virtual StatusCode initialize() override;
83  virtual StatusCode execute(const EventContext& ctx) const override;
84  virtual StatusCode finalize() override;
85 
86  ResultStatus getL1Result (const LVL1CTP::Lvl1Result*& result, const EventContext& ctx) const;
87  ResultStatus getHLTResult(const HLT::HLTResult*& result, TrigLevel level, const EventContext& ctx) const;
88 
89  private:
90 
91  Gaudi::Property<bool> m_doL1{this, "doL1", true, "flag whether or not to consider L1 trigger information"};
92  Gaudi::Property<bool> m_doL2{this, "doL2", true, "flag whether or not to consider L2 trigger information"};
93  Gaudi::Property<bool> m_doEF{this, "doEF", true, "flag whether or not to consider L3 (EF) trigger information"};
94  Gaudi::Property<bool> m_doHLT{this, "doHLT", true, "flag whether or not to consider merged L2EF=HLT trigger information"};
95 
96  SG::ReadCondHandleKey<TrigConf::L1BunchGroupSet> m_bgKey{this, "L1BunchGroup", "L1BunchGroup", "L1BunchGroupSet key name"};
97  SG::ReadHandleKey<TrigConf::HLTMenu> m_HLTMenuKey{this, "HLTTriggerMenu", "DetectorStore+HLTTriggerMenu", "HLT Menu key"};
98  SG::WriteHandleKey<TrigDecision> m_trigDecisionKey{this, "TrigDecisionKey", "TrigDecision", "SG key to save the TrigDecision object" };
99  SG::ReadHandleKey<ROIB::RoIBResult> m_l1roibResultKey{this, "L1ROIBResultKey", "RoIBResult", "SK key to retrieve the L1 ROIB result from SG" };
100  SG::ReadHandleKey<LVL1CTP::Lvl1Result> m_l1ResultKey{this, "L1ResultKey", "Lvl1Result", "SK key to retrieve the L1 result from SG" };
101  SG::ReadHandleKey<HLT::HLTResult> m_l2ResultKey{this, "L2ResultKey", "HLTResult_L2", "SK key to retrieve the L2 result from SG" };
102  SG::ReadHandleKey<HLT::HLTResult> m_efResultKey{this, "EFResultKey", "HLTResult_EF", "SK key to retrieve the EF result from SG" };
103  SG::ReadHandleKey<HLT::HLTResult> m_hltResultKey{this, "HLTResultKey", "HLTResult_HLT", " SK key to retrieve the merged HLT result from SG" };
104 
105  ToolHandle<HLT::ILvl1ResultAccessTool> m_lvl1Tool{this, "Lvl1ResultAccessTool", "HLT::Lvl1ResultAccessTool/Lvl1ResultAccessTool", "L1 tool to fetch"};
106 
107  // For statistics
108  mutable std::atomic<unsigned int> m_nEvents;
109  mutable std::atomic<unsigned int> m_l1_error, m_l2_error, m_ef_error, m_hlt_error, m_td_error, m_td_skip;
110  mutable std::atomic<unsigned int> m_l1_notFound, m_l2_notFound, m_ef_notFound, m_hlt_notFound;
111  mutable std::atomic<unsigned int> m_l1_notReq, m_l2_notReq, m_ef_notReq, m_hlt_notReq;
112  mutable std::atomic<unsigned int> m_l1_passed, m_l2_passed, m_ef_passed, m_hlt_passed;
113  };
114 }
115 
116 #endif
TrigDec::TrigDecisionMaker::TrigLevel
TrigLevel
Definition: TrigDecisionMaker.h:74
TrigDec::TrigDecisionMaker
Definition: TrigDecisionMaker.h:71
TrigDec
Definition: ITrigDecisionCnvTool.h:18
TrigDec::TrigDecisionMaker::m_doL1
Gaudi::Property< bool > m_doL1
Definition: TrigDecisionMaker.h:91
TrigDec::TrigDecisionMaker::m_td_error
std::atomic< unsigned int > m_td_error
Definition: TrigDecisionMaker.h:109
TrigDec::TrigDecisionMaker::OK
@ OK
Definition: TrigDecisionMaker.h:73
TrigDec::TrigDecisionMaker::Unknown
@ Unknown
Definition: TrigDecisionMaker.h:73
get_generator_info.result
result
Definition: get_generator_info.py:21
TrigDec::TrigDecisionMaker::getHLTResult
ResultStatus getHLTResult(const HLT::HLTResult *&result, TrigLevel level, const EventContext &ctx) const
retrieve HLT results (called in execute)
Definition: TrigDecisionMaker.cxx:279
TrigDec::TrigDecisionMaker::m_ef_notReq
std::atomic< unsigned int > m_ef_notReq
Definition: TrigDecisionMaker.h:111
TrigDec::TrigDecisionMaker::ResultStatus
ResultStatus
Definition: TrigDecisionMaker.h:73
RoIBResult.h
TrigDec::TrigDecisionMaker::m_l1_passed
std::atomic< unsigned int > m_l1_passed
Definition: TrigDecisionMaker.h:112
TrigDec::TrigDecisionMaker::execute
virtual StatusCode execute(const EventContext &ctx) const override
std Gaudi execute method -> fill event-wise TrigDecision object, save in SG
Definition: TrigDecisionMaker.cxx:140
TrigDec::TrigDecisionMaker::m_hlt_notReq
std::atomic< unsigned int > m_hlt_notReq
statistics: number of events where something was not requested
Definition: TrigDecisionMaker.h:111
TrigDec::TrigDecisionMaker::m_efResultKey
SG::ReadHandleKey< HLT::HLTResult > m_efResultKey
Definition: TrigDecisionMaker.h:102
TrigDec::TrigDecisionMaker::m_l1ResultKey
SG::ReadHandleKey< LVL1CTP::Lvl1Result > m_l1ResultKey
Definition: TrigDecisionMaker.h:100
TrigDec::TrigDecisionMaker::m_l1_notFound
std::atomic< unsigned int > m_l1_notFound
Definition: TrigDecisionMaker.h:110
TrigDec::TrigDecisionMaker::m_l1_error
std::atomic< unsigned int > m_l1_error
Definition: TrigDecisionMaker.h:109
TrigDec::TrigDecisionMaker::m_td_skip
std::atomic< unsigned int > m_td_skip
statistics: error numbers
Definition: TrigDecisionMaker.h:109
TrigDec::TrigDecisionMaker::NotRequested
@ NotRequested
Definition: TrigDecisionMaker.h:73
SG::ReadHandleKey< TrigConf::HLTMenu >
TrigDec::TrigDecisionMaker::m_l1roibResultKey
SG::ReadHandleKey< ROIB::RoIBResult > m_l1roibResultKey
Definition: TrigDecisionMaker.h:99
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
TrigDec::TrigDecisionMaker::m_ef_notFound
std::atomic< unsigned int > m_ef_notFound
Definition: TrigDecisionMaker.h:110
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
TrigDec::TrigDecisionMaker::m_trigDecisionKey
SG::WriteHandleKey< TrigDecision > m_trigDecisionKey
Definition: TrigDecisionMaker.h:98
TrigDec::TrigDecisionMaker::NotFound
@ NotFound
Definition: TrigDecisionMaker.h:73
TrigDec::TrigDecisionMaker::L1
@ L1
Definition: TrigDecisionMaker.h:74
ILvl1ResultAccessTool.h
TrigDec::TrigDecisionMaker::m_l2_notFound
std::atomic< unsigned int > m_l2_notFound
Definition: TrigDecisionMaker.h:110
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition: StoreGate/StoreGate/WriteHandleKey.h:40
TrigDec::TrigDecisionMaker::m_l2_error
std::atomic< unsigned int > m_l2_error
Definition: TrigDecisionMaker.h:109
HLT
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
Definition: HLTResultReader.h:26
TrigDecision.h
TrigDec::TrigDecisionMaker::initialize
virtual StatusCode initialize() override
std Gaudi initialize method -> read-in trigger configuration
Definition: TrigDecisionMaker.cxx:54
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TrigDec::TrigDecisionMaker::m_l2_notReq
std::atomic< unsigned int > m_l2_notReq
Definition: TrigDecisionMaker.h:111
TrigDec::TrigDecisionMaker::SGError
@ SGError
Definition: TrigDecisionMaker.h:73
HLT::HLTResult
HLT::HLTResult is sumarising result of trigger decision evaluation (online/offline) It contains basic...
Definition: HLTResult.h:57
TrigDec::TrigDecisionMaker::m_l2_passed
std::atomic< unsigned int > m_l2_passed
Definition: TrigDecisionMaker.h:112
TrigDec::TrigDecisionMaker::m_bgKey
SG::ReadCondHandleKey< TrigConf::L1BunchGroupSet > m_bgKey
Definition: TrigDecisionMaker.h:96
AthReentrantAlgorithm.h
TrigDec::TrigDecisionMaker::m_HLTMenuKey
SG::ReadHandleKey< TrigConf::HLTMenu > m_HLTMenuKey
Definition: TrigDecisionMaker.h:97
L1BunchGroupSet.h
LVL1CTP::Lvl1Result
Definition: Lvl1Result.h:32
TrigDec::TrigDecisionMaker::m_nEvents
std::atomic< unsigned int > m_nEvents
statistics: number of processed events
Definition: TrigDecisionMaker.h:108
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
TrigDec::TrigDecisionMaker::EF
@ EF
Definition: TrigDecisionMaker.h:74
TrigDec::TrigDecisionMaker::m_hltResultKey
SG::ReadHandleKey< HLT::HLTResult > m_hltResultKey
Definition: TrigDecisionMaker.h:103
TrigDec::TrigDecisionMaker::finalize
virtual StatusCode finalize() override
std Gaudi finalize method -> print out statistics
Definition: TrigDecisionMaker.cxx:105
TrigDec::TrigDecisionMaker::m_doL2
Gaudi::Property< bool > m_doL2
Definition: TrigDecisionMaker.h:92
TrigDec::TrigDecisionMaker::m_doEF
Gaudi::Property< bool > m_doEF
Definition: TrigDecisionMaker.h:93
SG::ReadCondHandleKey< TrigConf::L1BunchGroupSet >
TrigDec::TrigDecisionMaker::L2
@ L2
Definition: TrigDecisionMaker.h:74
TrigDec::TrigDecisionMaker::m_hlt_error
std::atomic< unsigned int > m_hlt_error
Definition: TrigDecisionMaker.h:109
TrigDec::TrigDecisionMaker::m_hlt_passed
std::atomic< unsigned int > m_hlt_passed
statistics: number of events that passed the given trigger lvl
Definition: TrigDecisionMaker.h:112
TrigDec::TrigDecisionMaker::m_doHLT
Gaudi::Property< bool > m_doHLT
Definition: TrigDecisionMaker.h:94
TrigDec::TrigDecisionMaker::~TrigDecisionMaker
virtual ~TrigDecisionMaker()
std deconstructor
Definition: TrigDecisionMaker.cxx:51
HLTMenu.h
TrigDec::TrigDecisionMaker::getL1Result
ResultStatus getL1Result(const LVL1CTP::Lvl1Result *&result, const EventContext &ctx) const
retrieve LVL1 result (called in execute)
Definition: TrigDecisionMaker.cxx:235
TrigDec::TrigDecisionMaker::m_ef_error
std::atomic< unsigned int > m_ef_error
Definition: TrigDecisionMaker.h:109
LVL1CTP
Definition: Lvl1ResultAccessTool.h:20
TrigDec::TrigDecisionMaker::m_hlt_notFound
std::atomic< unsigned int > m_hlt_notFound
statistics: number of events where L1, HLT results were not found
Definition: TrigDecisionMaker.h:110
TrigDec::TrigDecisionMaker::m_l2ResultKey
SG::ReadHandleKey< HLT::HLTResult > m_l2ResultKey
Definition: TrigDecisionMaker.h:101
TrigDec::TrigDecisionMaker::ProcError
@ ProcError
Definition: TrigDecisionMaker.h:73
TrigDec::TrigDecisionMaker::m_ef_passed
std::atomic< unsigned int > m_ef_passed
Definition: TrigDecisionMaker.h:112
TrigDec::TrigDecisionMaker::m_lvl1Tool
ToolHandle< HLT::ILvl1ResultAccessTool > m_lvl1Tool
tool to ease the access to the L1 results (RoIs, items, etc)
Definition: TrigDecisionMaker.h:105
TrigDec::TrigDecisionMaker::TrigDecisionMaker
TrigDecisionMaker(const std::string &name, ISvcLocator *pSvcLocator)
std Gaudi Algorithm constructor
Definition: TrigDecisionMaker.cxx:35
TrigDec::TrigDecisionMaker::m_l1_notReq
std::atomic< unsigned int > m_l1_notReq
Definition: TrigDecisionMaker.h:111