ATLAS Offline Software
ByteStreamEmonInputSvc.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef BYTESTREAMCNVSVC_BYTESTREAMEVENTSTORAGEINPUTSVC_H
6 #define BYTESTREAMCNVSVC_BYTESTREAMEVENTSTORAGEINPUTSVC_H
7 
15 // Include files.
16 #define BOOST_BIND_GLOBAL_PLACEHOLDERS // Needed to silence Boost pragma message
17 #include "emon/EventIterator.h"
18 
19 #include "TrigConfData/L1Menu.h"
20 
25 #include "GaudiKernel/ServiceHandle.h"
26 #include "GaudiKernel/ITHistSvc.h"
27 
28 #include <vector>
29 #include <stdint.h>
30 #include <memory>
31 
32 #include <boost/regex.hpp>
33 
34 class OHRootProvider;
35 class StoreGateSvc;
36 
37 class ByteStreamEmonInputSvc: public extends<AthService, IByteStreamInputSvc> {
38 public:
39 
41  ByteStreamEmonInputSvc(const std::string& name, ISvcLocator* svcloc);
42 
43  virtual StatusCode initialize() override;
44  virtual StatusCode start() override;
45  virtual StatusCode finalize() override;
46 
48  virtual const RawEvent* previousEvent() override;
49  virtual const RawEvent* nextEvent() override;
50 
52  virtual const RawEvent* currentEvent() const override;
53 
54 private:
55 
56  bool getIterator();
57  void check_publish();
58  void get_runparams();
59 
60  void updateHandler(Gaudi::Details::PropertyBase& p);
61 
63 
64  std::unique_ptr<RawEvent> m_re{nullptr};
65 
66  // Properties
67  Gaudi::Property<std::string> m_partition{this, "Partition", {}, "Partition name, default taken from $TDAQ_PARTITION if not set"};
68  Gaudi::Property<std::string> m_key{this, "Key", {}, &ByteStreamEmonInputSvc::updateHandler, "EMON Selection key, e.g. SFI"};
69  Gaudi::Property<std::vector<std::string>> m_value{this, "KeyValue", {}, &ByteStreamEmonInputSvc::updateHandler, "EMON key values, e.g. [SFI-1, SFI-2]; if empty all SFIs"};
70  Gaudi::Property<unsigned int> m_key_count{this, "KeyCount", 0, &ByteStreamEmonInputSvc::updateHandler, "EMON key count, e.g. 5 to get five random SFIs"};
71  Gaudi::Property<std::string> m_publish{this, "PublishName", "Athena", &ByteStreamEmonInputSvc::updateHandler, "Name under which to publish histograms"};
72  Gaudi::Property<bool> m_exit {this, "ExitOnPartitionShutdown", false, &ByteStreamEmonInputSvc::updateHandler, "If true, exit if partition shuts down"};
73  Gaudi::Property<std::string> m_is_server{this, "ISServer", "", &ByteStreamEmonInputSvc::updateHandler, "IS Server to publish histograms to"};
74  Gaudi::Property<std::string> m_include{this, "Include", {}, &ByteStreamEmonInputSvc::updateHandler, "Regular expression to select histograms to publish"};
75  Gaudi::Property<std::string> m_exclude{this, "Exclude", {}, &ByteStreamEmonInputSvc::updateHandler, "Regular expression to select histograms not to publish"};
76  Gaudi::Property<int> m_frequency{this, "Frequency", 60, &ByteStreamEmonInputSvc::updateHandler, "Frequency (in number of events) of publishing histograms"};
77  Gaudi::Property<int> m_updatePeriod{this, "UpdatePeriod", 0, &ByteStreamEmonInputSvc::updateHandler, "Frequency (in seconds) of publishing histograms"};
78  Gaudi::Property<float> m_updatePeriodRange{this, "UpdatePeriodRange", 0.2, "A percentage number to determine how close we have to be to the next update time to publish now"};
79  Gaudi::Property<bool> m_clearHistograms{this, "ClearHistograms", true, &ByteStreamEmonInputSvc::updateHandler, "If true, clear histograms when new run starts (default: True)"};
80  Gaudi::Property<std::vector<std::string>> m_l1names{this, "LVL1Names", {}, &ByteStreamEmonInputSvc::updateHandler, "A list of L1 bit names"};
81  Gaudi::Property<std::vector<unsigned int>> m_l1items{this, "LVL1Items", {}, &ByteStreamEmonInputSvc::updateHandler, "A list of L1 bit numbers"};
82  Gaudi::Property<std::string> m_l1logic{this, "LVL1Logic", "Ignore", &ByteStreamEmonInputSvc::updateHandler, "'And', 'Or' or 'Ignore' (default: Ignore)"};
83  Gaudi::Property<std::string> m_l1origin{this, "LVL1Origin", "TAV", &ByteStreamEmonInputSvc::updateHandler, "TBP, TAP, TAV (default: TAV"};
84  Gaudi::Property<std::string> m_stream_type{this, "StreamType", "physics", &ByteStreamEmonInputSvc::updateHandler, "HLT stream type (e.g. physics or calibration)"};
85  Gaudi::Property<std::vector<std::string>> m_stream_names{this, "StreamNames", {}, &ByteStreamEmonInputSvc::updateHandler, "List of HLT stream names"};
86  Gaudi::Property<std::string> m_stream_logic{this, "StreamLogic", "Ignore", &ByteStreamEmonInputSvc::updateHandler, "'And', 'Or' or 'Ignore' (default: Ignore)"};
87 
88  Gaudi::Property<unsigned int> m_trigger_type{this, "TriggerType", 256, &ByteStreamEmonInputSvc::updateHandler, "LVL1 8 bit trigger type"};
89  Gaudi::Property<std::string> m_groupName{this, "GroupName", {}, &ByteStreamEmonInputSvc::updateHandler, "Name of the monitoring group"};
90  Gaudi::Property<unsigned int> m_buffer_size{this, "BufferSize", 2, "Number of buffers"};
91  Gaudi::Property<bool> m_readDetectorMask{this, "ReadDetectorMaskFromIS", true, "Read detector mask from IS"};
92  Gaudi::Property<int> m_timeout{this, "Timeout", 3600000, &ByteStreamEmonInputSvc::updateHandler, "Timeout in seconds, -1 == infinity"};
93  Gaudi::Property<bool> m_corrupted_events{this, "ProcessCorruptedEvents", false, &ByteStreamEmonInputSvc::updateHandler, "Process corrupted events not passing check_tree()"};
94  Gaudi::Property<std::string> m_state{this, "State", "None", "Read-only property showing the state"};
95  Gaudi::Property<bool> m_convertEfficiency{this, "ConvertEfficiency", true, "Convert TEfficiency to TProfile before publishing"};
96 
97  // Data handles
98  SG::ReadHandleKey<TrigConf::L1Menu> m_l1MenuKey{this, "L1TriggerMenu", "DetectorStore+L1TriggerMenu", "Name of the L1Menu object to read configuration from"};
99 
100  // internal
101  bool m_connect{false};
102  std::auto_ptr<emon::EventIterator> m_eventIt;
103 
104  OHRootProvider* m_provider{nullptr};
105 
108 
111 
116 };
117 
118 #endif
ByteStreamEmonInputSvc::m_re
std::unique_ptr< RawEvent > m_re
current event
Definition: ByteStreamEmonInputSvc.h:64
ByteStreamEmonInputSvc::m_exit
Gaudi::Property< bool > m_exit
Definition: ByteStreamEmonInputSvc.h:72
ByteStreamEmonInputSvc::m_sgSvc
ServiceHandle< StoreGateSvc > m_sgSvc
Definition: ByteStreamEmonInputSvc.h:113
ByteStreamEmonInputSvc::m_connect
bool m_connect
Definition: ByteStreamEmonInputSvc.h:101
ByteStreamEmonInputSvc::m_stream_type
Gaudi::Property< std::string > m_stream_type
Definition: ByteStreamEmonInputSvc.h:84
ByteStreamEmonInputSvc::m_totalEventCounter
int m_totalEventCounter
event Counter
Definition: ByteStreamEmonInputSvc.h:62
ByteStreamEmonInputSvc::m_publish_target
int m_publish_target
Definition: ByteStreamEmonInputSvc.h:110
ByteStreamEmonInputSvc::m_l1logic
Gaudi::Property< std::string > m_l1logic
Definition: ByteStreamEmonInputSvc.h:82
ByteStreamEmonInputSvc::check_publish
void check_publish()
Definition: ByteStreamEmonInputSvc.cxx:483
ByteStreamEmonInputSvc::nextEvent
virtual const RawEvent * nextEvent() override
Definition: ByteStreamEmonInputSvc.cxx:352
ByteStreamEmonInputSvc::m_groupName
Gaudi::Property< std::string > m_groupName
Definition: ByteStreamEmonInputSvc.h:89
ByteStreamEmonInputSvc::m_state
Gaudi::Property< std::string > m_state
Definition: ByteStreamEmonInputSvc.h:94
ByteStreamEmonInputSvc::m_robProvider
ServiceHandle< IROBDataProviderSvc > m_robProvider
Definition: ByteStreamEmonInputSvc.h:114
RawEvent
OFFLINE_FRAGMENTS_NAMESPACE::FullEventFragment RawEvent
data type for reading raw event
Definition: RawEvent.h:37
ByteStreamEmonInputSvc::m_exclude
Gaudi::Property< std::string > m_exclude
Definition: ByteStreamEmonInputSvc.h:75
ByteStreamEmonInputSvc::m_trigger_type
Gaudi::Property< unsigned int > m_trigger_type
Definition: ByteStreamEmonInputSvc.h:88
ByteStreamEmonInputSvc::ByteStreamEmonInputSvc
ByteStreamEmonInputSvc(const std::string &name, ISvcLocator *svcloc)
Constructors:
Definition: ByteStreamEmonInputSvc.cxx:152
ByteStreamEmonInputSvc::m_partition
Gaudi::Property< std::string > m_partition
Definition: ByteStreamEmonInputSvc.h:67
ByteStreamEmonInputSvc::initialize
virtual StatusCode initialize() override
Definition: ByteStreamEmonInputSvc.cxx:162
ByteStreamEmonInputSvc::start
virtual StatusCode start() override
Definition: ByteStreamEmonInputSvc.cxx:616
SG::ReadHandleKey< TrigConf::L1Menu >
ByteStreamEmonInputSvc::m_l1origin
Gaudi::Property< std::string > m_l1origin
Definition: ByteStreamEmonInputSvc.h:83
ByteStreamEmonInputSvc::m_l1MenuKey
SG::ReadHandleKey< TrigConf::L1Menu > m_l1MenuKey
Definition: ByteStreamEmonInputSvc.h:98
ByteStreamEmonInputSvc::getIterator
bool getIterator()
Definition: ByteStreamEmonInputSvc.cxx:222
ByteStreamEmonInputSvc::m_frequency_counter
int m_frequency_counter
Definition: ByteStreamEmonInputSvc.h:109
ByteStreamEmonInputSvc::m_l1items
Gaudi::Property< std::vector< unsigned int > > m_l1items
Definition: ByteStreamEmonInputSvc.h:81
PrepareReferenceFile.regex
regex
Definition: PrepareReferenceFile.py:43
ByteStreamEmonInputSvc::finalize
virtual StatusCode finalize() override
Definition: ByteStreamEmonInputSvc.cxx:652
ByteStreamEmonInputSvc::m_convertEfficiency
Gaudi::Property< bool > m_convertEfficiency
Definition: ByteStreamEmonInputSvc.h:95
ByteStreamEmonInputSvc::m_include_rex
boost::regex m_include_rex
Definition: ByteStreamEmonInputSvc.h:106
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:125
ByteStreamEmonInputSvc::m_timeout
Gaudi::Property< int > m_timeout
Definition: ByteStreamEmonInputSvc.h:92
ByteStreamEmonInputSvc::m_eventIt
std::auto_ptr< emon::EventIterator > m_eventIt
Event iterator.
Definition: ByteStreamEmonInputSvc.h:102
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ByteStreamEmonInputSvc::m_buffer_size
Gaudi::Property< unsigned int > m_buffer_size
Definition: ByteStreamEmonInputSvc.h:90
ByteStreamEmonInputSvc::m_frequency
Gaudi::Property< int > m_frequency
Definition: ByteStreamEmonInputSvc.h:76
ByteStreamEmonInputSvc::updateHandler
void updateHandler(Gaudi::Details::PropertyBase &p)
Definition: ByteStreamEmonInputSvc.cxx:642
ByteStreamEmonInputSvc::m_stream_names
Gaudi::Property< std::vector< std::string > > m_stream_names
Definition: ByteStreamEmonInputSvc.h:85
RawEvent.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ByteStreamEmonInputSvc::get_runparams
void get_runparams()
Definition: ByteStreamEmonInputSvc.cxx:576
ByteStreamEmonInputSvc::m_inputMetaDataStore
ServiceHandle< StoreGateSvc > m_inputMetaDataStore
Definition: ByteStreamEmonInputSvc.h:112
ByteStreamEmonInputSvc::m_corrupted_events
Gaudi::Property< bool > m_corrupted_events
Definition: ByteStreamEmonInputSvc.h:93
ByteStreamEmonInputSvc::previousEvent
virtual const RawEvent * previousEvent() override
Implementation of the ByteStreamInputSvc interface methods.
Definition: ByteStreamEmonInputSvc.cxx:344
ByteStreamEmonInputSvc::m_exclude_rex
boost::regex m_exclude_rex
Definition: ByteStreamEmonInputSvc.h:107
ByteStreamEmonInputSvc::m_provider
OHRootProvider * m_provider
Definition: ByteStreamEmonInputSvc.h:104
ByteStreamEmonInputSvc::m_publish
Gaudi::Property< std::string > m_publish
Definition: ByteStreamEmonInputSvc.h:71
ByteStreamEmonInputSvc::m_readDetectorMask
Gaudi::Property< bool > m_readDetectorMask
Definition: ByteStreamEmonInputSvc.h:91
ByteStreamEmonInputSvc::m_histSvc
ServiceHandle< ITHistSvc > m_histSvc
Definition: ByteStreamEmonInputSvc.h:115
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
IByteStreamInputSvc.h
This file contains the interface for the ByteStreamInputSvc classes.
ByteStreamEmonInputSvc::currentEvent
virtual const RawEvent * currentEvent() const override
Implementation of the ByteStreamInputSvc interface methods.
Definition: ByteStreamEmonInputSvc.cxx:478
ByteStreamEmonInputSvc::m_key_count
Gaudi::Property< unsigned int > m_key_count
Definition: ByteStreamEmonInputSvc.h:70
ByteStreamEmonInputSvc::m_is_server
Gaudi::Property< std::string > m_is_server
Definition: ByteStreamEmonInputSvc.h:73
ByteStreamEmonInputSvc::m_include
Gaudi::Property< std::string > m_include
Definition: ByteStreamEmonInputSvc.h:74
ByteStreamEmonInputSvc::m_clearHistograms
Gaudi::Property< bool > m_clearHistograms
Definition: ByteStreamEmonInputSvc.h:79
ByteStreamEmonInputSvc::m_updatePeriod
Gaudi::Property< int > m_updatePeriod
Definition: ByteStreamEmonInputSvc.h:77
ByteStreamEmonInputSvc
implements the interface IByteStreamInputSvc for reading events from emon.
Definition: ByteStreamEmonInputSvc.h:37
ByteStreamEmonInputSvc::m_value
Gaudi::Property< std::vector< std::string > > m_value
Definition: ByteStreamEmonInputSvc.h:69
ByteStreamEmonInputSvc::m_l1names
Gaudi::Property< std::vector< std::string > > m_l1names
Definition: ByteStreamEmonInputSvc.h:80
AthService.h
ByteStreamEmonInputSvc::m_stream_logic
Gaudi::Property< std::string > m_stream_logic
Definition: ByteStreamEmonInputSvc.h:86
L1Menu.h
IROBDataProviderSvc.h
ByteStreamEmonInputSvc::m_updatePeriodRange
Gaudi::Property< float > m_updatePeriodRange
Definition: ByteStreamEmonInputSvc.h:78
ByteStreamEmonInputSvc::m_key
Gaudi::Property< std::string > m_key
Definition: ByteStreamEmonInputSvc.h:68
ServiceHandle< StoreGateSvc >