ATLAS Offline Software
L1PrescaleCondAlg.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRIGCONFIGSVC__L1PRESCALECONDALG
6 #define TRIGCONFIGSVC__L1PRESCALECONDALG
7 
10 
14 
16 
17 #include <tbb/concurrent_unordered_map.h>
18 
19 #include <memory>
20 
21 namespace TrigConf {
22 
34  public:
35  L1PrescaleCondAlg(const std::string& name, ISvcLocator* pSvcLocator);
36  virtual ~L1PrescaleCondAlg() override = default;
37 
38  virtual StatusCode initialize() override;
39  virtual StatusCode execute(const EventContext& ctx) const override;
40 
41  // avoids running CondAlg multiple times for the same input (ATEAM-617)
42  virtual bool isReEntrant() const override final { return false; }
43 
44  private:
45 
46  // helper function to load a L1 prescales set from a file
47  std::shared_ptr<L1PrescalesSet> createFromFile( const std::string & filename ) const;
48 
49  // helper function to load a L1 prescales set from a prescale key
50  std::shared_ptr<L1PrescalesSet> createFromDB( unsigned int psk, bool isRun3 ) const;
51 
52  // map the prescale key to a L1PrescalesSet
53  mutable tbb::concurrent_unordered_map<unsigned int, std::shared_ptr<const L1PrescalesSet>> m_pssMap ATLAS_THREAD_SAFE;
54 
55  // input key to the L1 Prescale Key folder
56  SG::ReadCondHandleKey<AthenaAttributeList> m_pskFolderInputKey{ this, "PSKFolder", "/TRIGGER/LVL1/Lvl1ConfigKey", "SG Key of AthenaAttributeList containing l1 psk"};
57 
58  // output key to store the L1PrescalesSet
59  SG::WriteCondHandleKey<TrigConf::L1PrescalesSet> m_l1PrescalesSetOutputKey{ this, "L1Prescales", "L1Prescales", "L1 prescales"};
60 
61  // properties
62  Gaudi::Property< std::string > m_configSource { this, "Source", "FILE", "Configuration source, can be 'FILE', 'DB', or 'COOL'" };
63  Gaudi::Property< std::string > m_dbConnection { this, "TriggerDB", "", "DB connection alias or 'JOSVC', used when property Source set to 'DB' or set to 'COOL'." };
64  Gaudi::Property< unsigned int > m_psk { this, "L1Psk", 0, "L1 prescale key, used when property 'Source' set to 'DB' or 'FILE'" };
65  Gaudi::Property< std::string > m_filename { this, "Filename", "", "L1 prescale json file, used when property 'Source' set to 'FILE'" };
66 
67  };
68 
69 }
70 #endif
TrigConf::L1PrescaleCondAlg::createFromFile
std::shared_ptr< L1PrescalesSet > createFromFile(const std::string &filename) const
Definition: L1PrescaleCondAlg.cxx:21
TrigConf::L1PrescaleCondAlg::m_l1PrescalesSetOutputKey
SG::WriteCondHandleKey< TrigConf::L1PrescalesSet > m_l1PrescalesSetOutputKey
Definition: L1PrescaleCondAlg.h:59
TrigConf::L1PrescaleCondAlg::m_configSource
Gaudi::Property< std::string > m_configSource
Definition: L1PrescaleCondAlg.h:62
WriteCondHandleKey.h
TrigConf::L1PrescaleCondAlg::m_dbConnection
Gaudi::Property< std::string > m_dbConnection
Definition: L1PrescaleCondAlg.h:63
L1PrescalesSet.h
TrigConf::L1PrescaleCondAlg::createFromDB
std::shared_ptr< L1PrescalesSet > createFromDB(unsigned int psk, bool isRun3) const
Definition: L1PrescaleCondAlg.cxx:41
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:562
AthenaAttributeList.h
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
TrigConf
Forward iterator to traverse the main components of the trigger configuration.
Definition: Config.h:22
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TrigConf::L1PrescaleCondAlg::m_psk
Gaudi::Property< unsigned int > m_psk
Definition: L1PrescaleCondAlg.h:64
TrigConf::L1PrescaleCondAlg::m_filename
Gaudi::Property< std::string > m_filename
Definition: L1PrescaleCondAlg.h:65
TrigConf::name
Definition: HLTChainList.h:35
ReadCondHandleKey.h
AthReentrantAlgorithm.h
TrigConf::L1PrescaleCondAlg::isReEntrant
virtual bool isReEntrant() const override final
Definition: L1PrescaleCondAlg.h:42
TrigConf::L1PrescaleCondAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: L1PrescaleCondAlg.cxx:113
TrigConf::L1PrescaleCondAlg::initialize
virtual StatusCode initialize() override
Definition: L1PrescaleCondAlg.cxx:66
SG::ReadCondHandleKey< AthenaAttributeList >
TrigConf::L1PrescaleCondAlg::~L1PrescaleCondAlg
virtual ~L1PrescaleCondAlg() override=default
TrigConf::L1PrescaleCondAlg::m_pskFolderInputKey
SG::ReadCondHandleKey< AthenaAttributeList > m_pskFolderInputKey
Definition: L1PrescaleCondAlg.h:56
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
SG::WriteCondHandleKey< TrigConf::L1PrescalesSet >
TrigConf::L1PrescaleCondAlg::L1PrescaleCondAlg
L1PrescaleCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: L1PrescaleCondAlg.cxx:15
TrigConf::L1PrescaleCondAlg::ATLAS_THREAD_SAFE
tbb::concurrent_unordered_map< unsigned int, std::shared_ptr< const L1PrescalesSet > > m_pssMap ATLAS_THREAD_SAFE
Definition: L1PrescaleCondAlg.h:53
TrigConf::L1PrescaleCondAlg
Condition algorithm to provide the L1 trigger menu.
Definition: L1PrescaleCondAlg.h:33
checker_macros.h
Define macros for attributes used to control the static checker.