14#include "GaudiKernel/ITHistSvc.h"
41 string histName =
h->GetName();
42 auto colPos = histName.find_first_of(
'/');
43 const string key = histName;
44 const string fullName(
m_baseDir + histName );
45 h->SetName(histName.substr(colPos+1).c_str());
46 std::unique_ptr<TH1> uhist(
h);
48 if( !
m_histSvc->regShared(fullName, std::move(uhist), lh).isSuccess() ) {
52 { m_hist1D[key] = lh; }
61 string histName =
h->GetName();
62 auto colPos = histName.find_first_of(
'/');
63 const string key = histName;
64 const string fullName(
m_baseDir + histName );
65 h->SetName(histName.substr(colPos+1).c_str());
66 std::unique_ptr<TH2> uhist(
h);
68 if( !
m_histSvc->regShared(fullName, std::move(uhist), lh).isSuccess() ) {
72 { m_hist2D[key] = lh; }
81 if ( !
m_histSvc->getHist(fullName,
h).isSuccess() )
82 {
TRG_MSG_WARNING(
"Could not find histogram with name : " << fullName ); }
84 {
TRG_MSG_DEBUG(
"findHist(" << histName <<
") found: " << (
void*)
h); }
89 const string key = histName;
90 if(m_hist1D.find(key) == m_hist1D.end()) {
91 TRG_MSG_ERROR(
"1D-hist with registration key " << key <<
" does not exist");
93 else { m_hist1D[key]->Fill(
x); }
97 const string key = histName;
98 if(m_hist2D.find(key) == m_hist2D.end()) {
99 TRG_MSG_ERROR(
"2D-hist with registration key " << key <<
" does not exist");
102 { m_hist2D[key]->Fill(
x,
y); }
106 auto colPos = baseDir.find_last_of(
':');
107 if( colPos != string::npos ) {
148 return m_impl->findHist( histName );
153 m_impl->fillHist1D(histName,
x);
163 m_impl->setBaseDir( baseDir );
Property holding a SG store/key/clid from which a ReadHandle is made.
Messaging base class for TrigConf code shared with Lvl1 ( AthMessaging)
#define TRG_MSG_WARNING(x)
AthenaL1TopoHistSvcImpl(const ServiceHandle< ITHistSvc > &histSvc)
ServiceHandle< ITHistSvc > m_histSvc
TH1 * findHist(const std::string &histName)
~AthenaL1TopoHistSvcImpl()
void setBaseDir(const std::string &baseDir)
void registerHist(TH2 *h)
void fillHist2D(const std::string &histName, double x, double y)
void registerHist(TH1 *h)
std::unordered_map< std::string, LockedHandle< TH1 > > m_hist1D ATLAS_THREAD_SAFE
void fillHist1D(const std::string &histName, double x)
virtual ~AthenaL1TopoHistSvc()
virtual void save() override
std::unique_ptr< AthenaL1TopoHistSvcImpl > m_impl
AthenaL1TopoHistSvc(const ServiceHandle< ITHistSvc > &histSvc)
virtual void registerHist(TH1 *h) override
virtual void fillHist2D(const std::string &histName, double x, double y) override
virtual void setBaseDir(const std::string &baseDir) override
virtual TH1 * findHist(const std::string &histName) override
virtual void fillHist1D(const std::string &histName, double x) override
Class to provide easy access to TrigConf::MsgStream for TrigConf classes.
TrigConfMessaging(const std::string &name)
Constructor with parameters.