Skip to content
Snippets Groups Projects
Commit 83b5e89a authored by Vakhtang Tsulaia's avatar Vakhtang Tsulaia
Browse files

Merge branch 'montool_mt' into 'master'

GenericMonitoringTool: set correct default value for HistPath

See merge request !20292
parents 022c685c 71bbb1d5
9 merge requests!58791DataQualityConfigurations: Modify L1Calo config for web display,!46784MuonCondInterface: Enable thread-safety checking.,!46776Updated LArMonitoring config file for WD to match new files produced using MT,!45405updated ART test cron job,!42417Draft: DIRE and VINCIA Base Fragments for Pythia 8.3,!28528Revert 63f845ae,!27054Atr20369 210,!26342Monopole: Handle fractionally charged particles,!20292GenericMonitoringTool: set correct default value for HistPath
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#ifndef AthenaMonitoring_GenericMonitoringTool_h
......@@ -66,27 +66,28 @@
class GenericMonitoringTool : public AthAlgTool {
public:
static const InterfaceID& interfaceID();
GenericMonitoringTool(const std::string & type, const std::string & name, const IInterface* parent);
virtual ~GenericMonitoringTool();
virtual StatusCode initialize();
virtual std::vector<Monitored::HistogramFiller*> getHistogramsFillers(std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>> monitoredVariables);
virtual StatusCode initialize() override;
/// Retrieve the histogram fillers
std::vector<Monitored::HistogramFiller*> getHistogramsFillers(std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>> monitoredVariables);
/// Book histograms
StatusCode book();
/**
* Overrride configured booking path
**/
void setPath( const std::string& newPath );
/// Overrride configured booking path
void setPath( const std::string& newPath );
private:
ServiceHandle<ITHistSvc> m_histSvc { this, "THistSvc", "THistSvc/THistSvc", "Histogramming svc" };
Gaudi::Property<std::string> m_histoPath { this, "HistPath", "/EXPERT/", "Histogram base path" };
Gaudi::Property<std::string> m_histoPath { this, "HistPath", {}, "Directory for histograms [name of parent if not set]" };
Gaudi::Property<std::vector<std::string> > m_histograms { this, "Histograms", {}, "Definitions of histograms"};
Gaudi::Property<bool> m_explicitBooking { this, "ExplicitBooking", false, "Do not create histograms automatically in initialize but wait until the method book is called." };
std::vector<Monitored::HistogramFiller*> m_fillers; //!< list of fillers
std::vector<Monitored::HistogramFiller*> m_fillers; //!< list of fillers
};
/*
/**
* Helper class to declare an empty monitoring ToolHandle
*
* This can be used in case an empty monitoring tool needs to be declared in the constructor:
......
#
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
#
from AthenaMonitoring.AthenaMonitoringConf import GenericMonitoringTool as _GenericMonitoringTool
......@@ -16,7 +16,7 @@ class GenericMonitoringTool(_GenericMonitoringTool):
# For full details see the GenericMonitoringTool documentation.
# @param varname one (1D) or two (2D) variable names separated by comma
# @param type histogram type
# @param path top-level histrogram directory
# @param path top-level histogram directory (e.g. EXPERT, SHIFT, etc.)
# @param title Histogram title and optional axis title (same syntax as in TH constructor)
# @param opt Histrogram options (see GenericMonitoringTool)
# @param labels List of bin labels (for a 2D histogram, sequential list of x- and y-axis labels)
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#include <map>
......@@ -12,26 +12,17 @@
#include "AthenaMonitoring/GenericMonitoringTool.h"
#include "AthenaMonitoring/HistogramDef.h"
using namespace std;
using namespace Monitored;
const InterfaceID& GenericMonitoringTool::interfaceID() {
static InterfaceID GenericMonitoringTool_ID("GenericMonitoringTool", 1, 0);
return GenericMonitoringTool_ID;
}
GenericMonitoringTool::GenericMonitoringTool(const std::string & type, const std::string & name, const IInterface* parent)
: AthAlgTool(type, name, parent) {
declareInterface<GenericMonitoringTool>(this);
: AthAlgTool(type, name, parent) {
}
GenericMonitoringTool::~GenericMonitoringTool() { }
StatusCode GenericMonitoringTool::initialize() {
ATH_CHECK(m_histSvc.retrieve());
if ( not m_explicitBooking ) {
ATH_MSG_DEBUG("Proceeding to histograms booking");
ATH_MSG_DEBUG("Proceeding to histogram booking");
return book();
}
return StatusCode::SUCCESS;
......@@ -46,12 +37,12 @@ StatusCode GenericMonitoringTool::book() {
m_histoPath = named ? named->name() : name();
}
ATH_MSG_DEBUG("Booking hostograms in path:" << m_histoPath << ":");
ATH_MSG_DEBUG("Booking histograms in path: " << m_histoPath.value());
HistogramFillerFactory factory(m_histSvc, m_histoPath);
m_fillers.reserve(m_histograms.size());
for (const string& item : m_histograms) {
for (const std::string& item : m_histograms) {
ATH_MSG_DEBUG( "Configuring monitoring for: " << item );
HistogramDef def = HistogramDef::parse(item);
......@@ -61,7 +52,7 @@ StatusCode GenericMonitoringTool::book() {
if (filler != nullptr) {
m_fillers.push_back(filler);
} else {
ATH_MSG_WARNING( "The histogram filler can not be instantiated for: " << def.name );
ATH_MSG_WARNING( "The histogram filler cannot be instantiated for: " << def.name );
}
} else {
ATH_MSG_ERROR( "Unparsable histogram definition: " << item );
......@@ -81,12 +72,12 @@ StatusCode GenericMonitoringTool::book() {
return StatusCode::SUCCESS;
}
vector<HistogramFiller*> GenericMonitoringTool::getHistogramsFillers(vector<reference_wrapper<Monitored::IMonitoredVariable>> monitoredVariables) {
vector<HistogramFiller*> result;
std::vector<HistogramFiller*> GenericMonitoringTool::getHistogramsFillers(std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>> monitoredVariables) {
std::vector<HistogramFiller*> result;
for (auto filler : m_fillers) {
auto fillerVariables = filler->histogramVariablesNames();
vector<reference_wrapper<Monitored::IMonitoredVariable>> variables;
std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>> variables;
for (auto fillerVariable : fillerVariables) {
for (auto monValue : monitoredVariables) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment