ATLAS Offline Software
AFPSiStationMonitor.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
8 
9 #include <sstream>
10 
12  const std::string& name,
13  const IInterface* parent) :
15 {
16  declareInterface<IAFPSiStationMonitor>(this);
17 
18  declareProperty("stationID", m_stationID = -1, "ID number of station in which is the monitored layer.");
19  declareProperty("layersMonitors", m_layersMonitors, "Array of tools monitoring layers.");
20 }
21 
23 {
24  if (!m_layersMonitors.empty()) {
25  // loop over tools
26  for (ToolHandle<IAFPSiLayerMonitor>& layerMon : m_layersMonitors) {
27  // retrieve tools
28  if (layerMon.retrieve().isFailure())
29  ATH_MSG_WARNING("Failed to retrieve layerMon " << layerMon);
30  }
31  }
32  else
33  ATH_MSG_WARNING("No layers monitors in station "<<m_stationID);
34 
35  return StatusCode::SUCCESS;
36 }
37 
39 {
40  return StatusCode::SUCCESS;
41 }
42 
44 {
45 }
46 
47 // Description: Used for re-booking managed histograms
49 {
50  // if( toolToStoreHistograms->m_environment == AthenaMonManager::online ) {
51  // // book histograms that are only made in the online environment...
52  // }
53 
54  // if( toolToStoreHistograms->m_dataType == AthenaMonManager::cosmics ) {
55  // // book histograms that are only relevant for cosmics data...
56  // }
57 
58  std::string histsDirName = toolToStoreHistograms->histsDirectoryName();
59  histsDirName += makeName("");
60 
61  // register histograms in layers
62  for (ToolHandle<IAFPSiLayerMonitor>& layerMonitor : m_layersMonitors)
63  layerMonitor->bookHistograms(toolToStoreHistograms, histsDirName);
64 }
65 
67 {
68  const int hitLayerID = hit.pixelLayerID();
69  for (ToolHandle<IAFPSiLayerMonitor> layerMonitor : m_layersMonitors)
70  if (layerMonitor->layerID() == hitLayerID) {
71  layerMonitor->fillHistograms(hit);
72  break;
73  }
74 }
75 
77 {
78  // must be at the end because it zeroes hitsInEvent
79  for (ToolHandle<IAFPSiLayerMonitor> layerMonitor : m_layersMonitors)
80  layerMonitor->eventEnd();
81 }
82 
83 
85 {
86  // Calls endOfLumiBlock on each layer.
87  for (ToolHandle<IAFPSiLayerMonitor> layer : m_layersMonitors)
88  layer->endOfLumiBlock();
89 }
90 
91 std::string AFPSiStationMonitor::makeName (const std::string& name) const
92 {
93  std::stringstream histName;
94  histName <<name<<"Station"<<m_stationID;
95 
96  return histName.str();
97 }
98 
99 std::string AFPSiStationMonitor::makeTitle (const std::string& title) const
100 {
101  std::stringstream histTitle;
102  histTitle <<title<<" in station "<<m_stationID;
103 
104  return histTitle.str();
105 }
106 
108 {
109  for (ToolHandle<IAFPSiLayerMonitor> layer : m_layersMonitors)
110  layer->setParentMonitor(parent);
111 }
IAFPSiLayerMonitor.h
AFPHitsMonitorTool.h
AddEmptyComponent.histName
string histName
Definition: AddEmptyComponent.py:64
AFPSiStationMonitor::fillHistograms
void fillHistograms(const xAOD::AFPSiHit &hit) override
Fills stations monitoring histograms.
Definition: AFPSiStationMonitor.cxx:66
AFPSiStationMonitor::eventEnd
void eventEnd() override
Method called once per event after processing all hits.
Definition: AFPSiStationMonitor.cxx:76
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
AFPHitsMonitorTool
Main monitoring class for silicon detectors.
Definition: AFPHitsMonitorTool.h:32
xAOD::AFPSiHit_v2::pixelLayerID
int pixelLayerID() const
Index of the layer of pixels, i.e.
xAOD::AFPSiHit_v2
Class representing a hit in silicon detector.
Definition: AFPSiHit_v2.h:30
AFPSiStationMonitor::initialize
StatusCode initialize() override
Retrieves all tools in array m_layersMonitors.
Definition: AFPSiStationMonitor.cxx:22
AFPSiStationMonitor::bookHistograms
void bookHistograms(AFPHitsMonitorTool *toolToStoreHistograms) override
Books histograms for stations monitoring.
Definition: AFPSiStationMonitor.cxx:48
AFPHitsMonitorTool::histsDirectoryName
std::string histsDirectoryName()
name of directory to store histograms
Definition: AFPHitsMonitorTool.h:74
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
covarianceTool.title
title
Definition: covarianceTool.py:542
AFPSiStationMonitor::m_layersMonitors
ToolHandleArray< IAFPSiLayerMonitor > m_layersMonitors
Array of tools monitoring planes in the station.
Definition: AFPSiStationMonitor.h:95
test_pyathena.parent
parent
Definition: test_pyathena.py:15
AFPSiStationMonitor::makeName
std::string makeName(const std::string &name) const override
Return a string useful for creating a name of the distribution.
Definition: AFPSiStationMonitor.cxx:91
AFPSiStationMonitor.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
AFPSiStationMonitor::makeTitle
std::string makeTitle(const std::string &title) const override
Return a string useful for creating a name of the distribution.
Definition: AFPSiStationMonitor.cxx:99
AFPSiStationMonitor::finalize
StatusCode finalize() override
Does nothing.
Definition: AFPSiStationMonitor.cxx:38
AFPSiStationMonitor::endOfLumiBlock
void endOfLumiBlock(AFPHitsMonitorTool *toolToStoreHistograms) override
Method called at the end of luminosity block to process histograms.
Definition: AFPSiStationMonitor.cxx:84
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
AFPSiStationMonitor::AFPSiStationMonitor
AFPSiStationMonitor(const std::string &type, const std::string &name, const IInterface *parent)
Declares python properties.
Definition: AFPSiStationMonitor.cxx:11
AFPSiStationMonitor::m_stationID
int m_stationID
ID number of the monitored station.
Definition: AFPSiStationMonitor.h:92
AthAlgTool
Definition: AthAlgTool.h:26
AFPSiStationMonitor::setAllLayersParent
void setAllLayersParent(AFPHitsMonitorTool *parent) override
Sets main monitor tool as a parent in all layers tools.
Definition: AFPSiStationMonitor.cxx:107
AFPSiStationMonitor::~AFPSiStationMonitor
~AFPSiStationMonitor()
Does nothing.
Definition: AFPSiStationMonitor.cxx:43