ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
AthenaL1TopoHistSvc::AthenaL1TopoHistSvcImpl Class Reference
Inheritance diagram for AthenaL1TopoHistSvc::AthenaL1TopoHistSvcImpl:
Collaboration diagram for AthenaL1TopoHistSvc::AthenaL1TopoHistSvcImpl:

Public Member Functions

 AthenaL1TopoHistSvcImpl (ServiceHandle< ITHistSvc > histSvc)
 
 ~AthenaL1TopoHistSvcImpl ()
 
void registerHist (TH1 *h)
 
void registerHist (TH2 *h)
 
TH1findHist (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. More...
 
MsgStreamTC & msg () const
 The standard message stream. More...
 
MsgStreamTC & msg (const MSGTC::Level lvl) const
 The standard message stream. More...
 

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) More...
 
std::string m_name
 

Detailed Description

Definition at line 23 of file AthenaL1TopoHistSvc.cxx.

Constructor & Destructor Documentation

◆ AthenaL1TopoHistSvcImpl()

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

Definition at line 27 of file AthenaL1TopoHistSvc.cxx.

27  :
28  TrigConfMessaging("AthenaL1TopoHistSvc"),
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  }

◆ 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  }

◆ 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  }

◆ 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 81 of file TrigConfMessaging.h.

82  {
83  MsgStreamTC* ms = m_msg_tls.get();
84  if (!ms) {
85  ms = new MsgStreamTC(m_name);
86  m_msg_tls.reset(ms);
87  }
88  return *ms;
89  }

◆ 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 91 of file TrigConfMessaging.h.

92  {
93  return msg() << lvl;
94  }

◆ 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 70 of file TrigConfMessaging.h.

71  {
72  if (msg().level() <= lvl) {
73  msg() << lvl;
74  return true;
75  }
76  else {
77  return false;
78  }
79  }

◆ 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 {
110  m_baseDir = baseDir;
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.

◆ 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 66 of file TrigConfMessaging.h.

◆ m_name

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

Definition at line 67 of file TrigConfMessaging.h.


The documentation for this class was generated from the following file:
TRG_MSG_ERROR
#define TRG_MSG_ERROR(x)
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStreamMacros.h:29
DiTauMassTools::TauTypes::lh
@ lh
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:49
AddEmptyComponent.histName
string histName
Definition: AddEmptyComponent.py:64
TrigConf::TrigConfMessaging::m_msg_tls
boost::thread_specific_ptr< MsgStreamTC > m_msg_tls
MsgStreamTC instance (a std::cout like with print-out levels)
Definition: TrigConfMessaging.h:66
WriteCellNoiseToCool.fullName
fullName
Definition: WriteCellNoiseToCool.py:461
x
#define x
python.SystemOfUnits.ms
int ms
Definition: SystemOfUnits.py:132
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
TrigConf::TrigConfMessaging::m_name
std::string m_name
Definition: TrigConfMessaging.h:67
h
TrigConf::TrigConfMessaging::msg
MsgStreamTC & msg() const
The standard message stream.
Definition: TrigConfMessaging.h:81
extractSporadic.h
list h
Definition: extractSporadic.py:97
TrigConf::TrigConfMessaging::TrigConfMessaging
TrigConfMessaging()=delete
MuonSegmentReaderConfig.histSvc
histSvc
Definition: MuonSegmentReaderConfig.py:96
TRG_MSG_INFO
#define TRG_MSG_INFO(x)
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStreamMacros.h:27
TRG_MSG_WARNING
#define TRG_MSG_WARNING(x)
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStreamMacros.h:28
AthenaL1TopoHistSvc::AthenaL1TopoHistSvcImpl::m_baseDir
string m_baseDir
Definition: AthenaL1TopoHistSvc.cxx:120
AthenaL1TopoHistSvc::AthenaL1TopoHistSvcImpl::m_histSvc
ServiceHandle< ITHistSvc > m_histSvc
Definition: AthenaL1TopoHistSvc.cxx:119
y
#define y
TRG_MSG_DEBUG
#define TRG_MSG_DEBUG(x)
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStreamMacros.h:25
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37