ATLAS Offline Software
Loading...
Searching...
No Matches
AthenaL1TopoHistSvc::AthenaL1TopoHistSvcImpl Class Reference
Inheritance diagram for AthenaL1TopoHistSvc::AthenaL1TopoHistSvcImpl:
Collaboration diagram for AthenaL1TopoHistSvc::AthenaL1TopoHistSvcImpl:

Public Member Functions

 AthenaL1TopoHistSvcImpl (const ServiceHandle< ITHistSvc > &histSvc)
 ~AthenaL1TopoHistSvcImpl ()
void registerHist (TH1 *h)
void registerHist (TH2 *h)
TH1 * findHist (const std::string &histName)
void fillHist1D (const std::string &histName, double x)
void fillHist2D (const std::string &histName, double x, double y)
void setBaseDir (const std::string &baseDir)
bool msgLvl (const MSGTC::Level lvl) const
 Test the output level.
MsgStreamTC & msg () const
 The standard message stream.
MsgStreamTC & msg (const MSGTC::Level lvl) const
 The standard message stream.
const std::string & getName () const
 name accessor

Private Attributes

ServiceHandle< ITHistSvc > m_histSvc
string m_baseDir {""}
std::unordered_map< std::string, LockedHandle< TH1 > > m_hist1D ATLAS_THREAD_SAFE
std::unordered_map< std::string, LockedHandle< TH2 > > m_hist2D ATLAS_THREAD_SAFE
boost::thread_specific_ptr< MsgStreamTC > m_msg_tls
 MsgStreamTC instance (a std::cout like with print-out levels)
std::string m_name

Detailed Description

Definition at line 23 of file AthenaL1TopoHistSvc.cxx.

Constructor & Destructor Documentation

◆ AthenaL1TopoHistSvcImpl()

AthenaL1TopoHistSvc::AthenaL1TopoHistSvcImpl::AthenaL1TopoHistSvcImpl ( const ServiceHandle< ITHistSvc > & histSvc)
inline

Definition at line 27 of file AthenaL1TopoHistSvc.cxx.

27 :
28 TrigConfMessaging("AthenaL1TopoHistSvc"),
29 m_histSvc(histSvc)
30 {
31 TRG_MSG_INFO("Activating");
32 }

◆ ~AthenaL1TopoHistSvcImpl()

AthenaL1TopoHistSvc::AthenaL1TopoHistSvcImpl::~AthenaL1TopoHistSvcImpl ( )
inline

Definition at line 34 of file AthenaL1TopoHistSvc.cxx.

35 {}

Member Function Documentation

◆ fillHist1D()

void AthenaL1TopoHistSvc::AthenaL1TopoHistSvcImpl::fillHist1D ( const std::string & histName,
double x )
inline

Definition at line 88 of file AthenaL1TopoHistSvc.cxx.

88 {
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");
92 }
93 else { m_hist1D[key]->Fill(x); }
94 }
#define x

◆ fillHist2D()

void AthenaL1TopoHistSvc::AthenaL1TopoHistSvcImpl::fillHist2D ( const std::string & histName,
double x,
double y )
inline

Definition at line 96 of file AthenaL1TopoHistSvc.cxx.

96 {
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");
100 }
101 else
102 { m_hist2D[key]->Fill(x,y); }
103 }
#define y

◆ findHist()

TH1 * AthenaL1TopoHistSvc::AthenaL1TopoHistSvcImpl::findHist ( const std::string & histName)
inline

Definition at line 78 of file AthenaL1TopoHistSvc.cxx.

78 {
79 TH1 * h;
80 string fullName( m_baseDir + histName );
81 if ( ! m_histSvc->getHist(fullName, h).isSuccess() )
82 { TRG_MSG_WARNING("Could not find histogram with name : " << fullName ); }
83 else
84 { TRG_MSG_DEBUG("findHist(" << histName << ") found: " << (void*)h); }
85 return h;
86 }

◆ getName()

const std::string & TrigConf::TrigConfMessaging::getName ( ) const
inlineinherited

name accessor

Returns
the name

Definition at line 101 of file TrigConfMessaging.h.

101 {
102 return m_name;
103 }

◆ msg() [1/2]

MsgStreamTC & TrigConf::TrigConfMessaging::msg ( ) const
inlineinherited

The standard message stream.

Returns a reference to the message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 86 of file TrigConfMessaging.h.

87 {
88 MsgStreamTC* ms = m_msg_tls.get();
89 if (!ms) {
90 ms = new MsgStreamTC(m_name);
91 m_msg_tls.reset(ms);
92 }
93 return *ms;
94 }
boost::thread_specific_ptr< MsgStreamTC > m_msg_tls
MsgStreamTC instance (a std::cout like with print-out levels)

◆ msg() [2/2]

MsgStreamTC & TrigConf::TrigConfMessaging::msg ( const MSGTC::Level lvl) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 96 of file TrigConfMessaging.h.

97 {
98 return msg() << lvl;
99 }
MsgStreamTC & msg() const
The standard message stream.

◆ msgLvl()

bool TrigConf::TrigConfMessaging::msgLvl ( const MSGTC::Level lvl) const
inlineinherited

Test the output level.

Parameters
lvlThe message level to test against
Returns
boolean Indicting if messages at given level will be printed
Return values
trueMessages at level "lvl" will be printed

Definition at line 75 of file TrigConfMessaging.h.

76 {
77 if (msg().level() <= lvl) {
78 msg() << lvl;
79 return true;
80 }
81 else {
82 return false;
83 }
84 }

◆ registerHist() [1/2]

void AthenaL1TopoHistSvc::AthenaL1TopoHistSvcImpl::registerHist ( TH1 * h)
inline

Definition at line 38 of file AthenaL1TopoHistSvc.cxx.

38 {
39 TRG_MSG_DEBUG("Registration of " << h->GetName() );
40 if(m_histSvc) {
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);
47 LockedHandle<TH1> lh;
48 if( ! m_histSvc->regShared(fullName, std::move(uhist), lh).isSuccess() ) {
49 TRG_MSG_WARNING("Could not register histogram " << fullName << " with " << m_histSvc->name() );
50 }
51 else
52 { m_hist1D[key] = lh; }
53 } else {
54 TRG_MSG_WARNING("No THistSvc available, can't register histogram");
55 }
56 }

◆ registerHist() [2/2]

void AthenaL1TopoHistSvc::AthenaL1TopoHistSvcImpl::registerHist ( TH2 * h)
inline

Definition at line 58 of file AthenaL1TopoHistSvc.cxx.

58 {
59 TRG_MSG_DEBUG("Registration of " << h->GetName() );
60 if(m_histSvc) {
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);
67 LockedHandle<TH2> lh;
68 if( ! m_histSvc->regShared(fullName, std::move(uhist), lh).isSuccess() ) {
69 TRG_MSG_WARNING("Could not register histogram " << fullName << " with " << m_histSvc->name() );
70 }
71 else
72 { m_hist2D[key] = lh; }
73 } else {
74 TRG_MSG_WARNING("No THistSvc available, can't register histogram");
75 }
76 }

◆ setBaseDir()

void AthenaL1TopoHistSvc::AthenaL1TopoHistSvcImpl::setBaseDir ( const std::string & baseDir)
inline

Definition at line 105 of file AthenaL1TopoHistSvc.cxx.

105 {
106 auto colPos = baseDir.find_last_of(':');
107 if( colPos != string::npos ) {
108 m_baseDir = baseDir.substr(colPos+1);
109 } else {
111 }
112 if( '/' != m_baseDir[m_baseDir.size()-1] ) {
113 // add a '/' at the end
114 m_baseDir += "/";
115 }
116 }

Member Data Documentation

◆ ATLAS_THREAD_SAFE [1/2]

std::unordered_map<std::string, LockedHandle<TH1> > m_hist1D AthenaL1TopoHistSvc::AthenaL1TopoHistSvcImpl::ATLAS_THREAD_SAFE
private

Definition at line 122 of file AthenaL1TopoHistSvc.cxx.

◆ ATLAS_THREAD_SAFE [2/2]

std::unordered_map<std::string, LockedHandle<TH2> > m_hist2D AthenaL1TopoHistSvc::AthenaL1TopoHistSvcImpl::ATLAS_THREAD_SAFE
private

Definition at line 123 of file AthenaL1TopoHistSvc.cxx.

◆ m_baseDir

string AthenaL1TopoHistSvc::AthenaL1TopoHistSvcImpl::m_baseDir {""}
private

Definition at line 120 of file AthenaL1TopoHistSvc.cxx.

120{""};

◆ m_histSvc

ServiceHandle<ITHistSvc> AthenaL1TopoHistSvc::AthenaL1TopoHistSvcImpl::m_histSvc
private

Definition at line 119 of file AthenaL1TopoHistSvc.cxx.

◆ m_msg_tls

boost::thread_specific_ptr<MsgStreamTC> TrigConf::TrigConfMessaging::m_msg_tls
mutableprivateinherited

MsgStreamTC instance (a std::cout like with print-out levels)

Definition at line 71 of file TrigConfMessaging.h.

◆ m_name

std::string TrigConf::TrigConfMessaging::m_name
privateinherited

Definition at line 72 of file TrigConfMessaging.h.


The documentation for this class was generated from the following file: