ATLAS Offline Software
Loading...
Searching...
No Matches
DQTDataFlowMonAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5// ********************************************************************
6//
7// NAME: DQTDataFlowMonAlg.cxx
8// PACKAGE: DataQualityTools
9//
10// AUTHORS: Peter Onyisi (ponyisi@cern.ch)
11//
12//
13// ********************************************************************
14
17
18DQTDataFlowMonAlg::DQTDataFlowMonAlg( const std::string& name,
19 ISvcLocator* pSvcLocator )
20 : AthMonitorAlgorithm(name, pSvcLocator)
21{
22}
23
24StatusCode
26{
28 ATH_CHECK(m_TileStatusKey.initialize());
29 ATH_CHECK(m_atlasReadyFilter.retrieve(/*not isMC*/));
30 return StatusCode::SUCCESS;
31}
32
33StatusCode
34DQTDataFlowMonAlg::fillHistograms( const EventContext& ctx ) const
35{
36 ATH_MSG_DEBUG("in fillHistograms()");
37
38 using namespace Monitored;
39
40 auto environment = Scalar("environment", (int) m_environment);
41 const auto & group = getGroup("default");
42 fill(group, environment);
43
46 if (! evtinfo.isValid()) {
47 ATH_MSG_ERROR("Could not retrieve EventInfo");
48 return StatusCode::FAILURE;
49 } else {
50 if (evtinfo->eventType(xAOD::EventInfo::IS_SIMULATION)) {
51 auto weight = Scalar<double>("mcweight", evtinfo->eventType(xAOD::EventInfo::IS_SIMULATION) ? evtinfo->mcEventWeight() : 1);
52 auto lb = Scalar("LB", evtinfo->lumiBlock());
53 fill(group, weight, lb);
54 } else {
55 //Monitor AtlasReady flag .. for real-data only
56 bool atlasReady=m_atlasReadyFilter->accept();
57 auto isReady=Scalar<short>("atlasready",atlasReady);
58 fill(group,isReady);
59 }
60 std::vector<int> detstatevec(xAOD::EventInfo::nDets+1);
61 std::vector<int> detstatevec_idx(xAOD::EventInfo::nDets+1);
62 std::iota(detstatevec_idx.begin(), detstatevec_idx.end(), 0);
63
64 auto detstates = Collection("detstates", detstatevec);
65 auto detstates_idx = Collection("detstates_idx", detstatevec_idx);
67 for (int i = 0; i < xAOD::EventInfo::nDets; i++) {
69 detstatevec[i] = detstate;
70 if (detstate > worststate) worststate = detstate;
71 }
72 detstatevec[xAOD::EventInfo::nDets] = worststate;
73 fill(group, detstates, detstates_idx);
74
75
76
77 }
78 }
79
80 return StatusCode::SUCCESS;
81}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
Header file to be included by clients of the Monitored infrastructure.
const ToolHandle< GenericMonitoringTool > & getGroup(const std::string &name) const
Get a specific monitoring tool from the tool handle array.
Environment_t environment() const
Accessor functions for the environment.
virtual StatusCode initialize() override
initialize
SG::ReadHandle< xAOD::EventInfo > GetEventInfo(const EventContext &) const
Return a ReadHandle for an EventInfo object (get run/event numbers, etc.)
AthMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
AthMonitorAlgorithm::Environment_t m_environment
Instance of the Environment_t enum.
SG::ReadDecorHandleKey< xAOD::EventInfo > m_TileStatusKey
ToolHandle< IDQFilterTool > m_atlasReadyFilter
virtual StatusCode fillHistograms(const EventContext &ctx) const override
adds event to the monitoring histograms
DQTDataFlowMonAlg(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode initialize() override
initialize
Declare a monitored scalar variable.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
EventFlagSubDet
Sub-detector types for which we store event-level flags.
@ nDets
Number of sub-detector type in this enumeration.
EventFlagErrorState
States that a given sub-detector could be in.
@ NotSet
The flag was not set to anything.
@ IS_SIMULATION
true: simulation, false: data
int lb
Definition globals.cxx:23
Generic monitoring tool for athena components.
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
void fill(H5::Group &out_file, size_t iterations)