ATLAS Offline Software
DQTDataFlowMonAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 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 
19  ISvcLocator* pSvcLocator )
20  : AthMonitorAlgorithm(name, pSvcLocator)
21 {
22 }
23 
26 {
28  ATH_CHECK(m_TileStatusKey.initialize());
29  ATH_CHECK(m_atlasReadyFilter.retrieve(/*not isMC*/));
30  return StatusCode::SUCCESS;
31 }
32 
34 DQTDataFlowMonAlg::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  auto group = getGroup("default");
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 }
AthMonitorAlgorithm::environment
Environment_t environment() const
Accessor functions for the environment.
Definition: AthMonitorAlgorithm.h:205
AthMonitorAlgorithm::Environment_t::tier0Raw
@ tier0Raw
DQTDataFlowMonAlg::DQTDataFlowMonAlg
DQTDataFlowMonAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: DQTDataFlowMonAlg.cxx:18
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthMonitorAlgorithm::m_environment
AthMonitorAlgorithm::Environment_t m_environment
Instance of the Environment_t enum.
Definition: AthMonitorAlgorithm.h:350
xAOD::EventInfo_v1::NotSet
@ NotSet
The flag was not set to anything.
Definition: EventInfo_v1.h:347
xAOD::EventInfo_v1::IS_SIMULATION
@ IS_SIMULATION
true: simulation, false: data
Definition: EventInfo_v1.h:151
Monitored::Collection
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
Definition: MonitoredCollection.h:38
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:189
AthMonitorAlgorithm
Base class for Athena Monitoring Algorithms.
Definition: AthMonitorAlgorithm.h:36
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
python.BunchSpacingUtils.lb
lb
Definition: BunchSpacingUtils.py:88
lumiFormat.i
int i
Definition: lumiFormat.py:85
Monitored
Generic monitoring tool for athena components.
Definition: GenericMonitoringTool.h:30
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DeMoScan.atlasReady
dictionary atlasReady
Definition: DeMoScan.py:209
AthMonitorAlgorithm::fill
void fill(const ToolHandle< GenericMonitoringTool > &groupHandle, std::vector< std::reference_wrapper< Monitored::IMonitoredVariable >> &&variables) const
Fills a vector of variables to a group by reference.
AthMonitorAlgorithm::GetEventInfo
SG::ReadHandle< xAOD::EventInfo > GetEventInfo(const EventContext &) const
Return a ReadHandle for an EventInfo object (get run/event numbers, etc.)
Definition: AthMonitorAlgorithm.cxx:107
DQTDataFlowMonAlg::fillHistograms
virtual StatusCode fillHistograms(const EventContext &ctx) const override
adds event to the monitoring histograms
Definition: DQTDataFlowMonAlg.cxx:34
xAOD::EventInfo_v1::EventFlagErrorState
EventFlagErrorState
States that a given sub-detector could be in.
Definition: EventInfo_v1.h:346
Monitored.h
Header file to be included by clients of the Monitored infrastructure.
DQTDataFlowMonAlg::initialize
virtual StatusCode initialize() override
initialize
Definition: DQTDataFlowMonAlg.cxx:25
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
xAOD::EventInfo_v1::EventFlagSubDet
EventFlagSubDet
Sub-detector types for which we store event-level flags.
Definition: EventInfo_v1.h:331
DQTDataFlowMonAlg::m_TileStatusKey
SG::ReadDecorHandleKey< xAOD::EventInfo > m_TileStatusKey
Definition: DQTDataFlowMonAlg.h:35
AthMonitorAlgorithm::initialize
virtual StatusCode initialize() override
initialize
Definition: AthMonitorAlgorithm.cxx:18
CaloLCW_tf.group
group
Definition: CaloLCW_tf.py:28
xAOD::EventInfo_v1::nDets
@ nDets
Number of sub-detector type in this enumeration.
Definition: EventInfo_v1.h:342
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34
AthMonitorAlgorithm::getGroup
const ToolHandle< GenericMonitoringTool > & getGroup(const std::string &name) const
Get a specific monitoring tool from the tool handle array.
Definition: AthMonitorAlgorithm.cxx:164
DQTDataFlowMonAlg.h
DQTDataFlowMonAlg::m_atlasReadyFilter
ToolHandle< IDQFilterTool > m_atlasReadyFilter
Definition: DQTDataFlowMonAlg.h:32