ATLAS Offline Software
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
TrigMonTHistSvc Class Reference

HLT online histogram service. More...

#include <TrigMonTHistSvc.h>

Inheritance diagram for TrigMonTHistSvc:
Collaboration diagram for TrigMonTHistSvc:

Classes

struct  THistID
 Helper struct that bundles the histogram, name and mutex. More...
 

Public Member Functions

 TrigMonTHistSvc (const std::string &name, ISvcLocator *svc)
 
virtual StatusCode initialize ATLAS_NOT_THREAD_SAFE () override
 
virtual StatusCode stop () override
 
virtual StatusCode finalize () override
 
virtual StatusCode regHist (const std::string &name) override
 
virtual StatusCode regHist (const std::string &name, std::unique_ptr< TH1 > hist) override
 
virtual StatusCode regHist (const std::string &name, TH1 *) override
 
virtual StatusCode getHist (const std::string &id, TH1 *&hist, size_t ind) const override
 
virtual StatusCode getHist (const std::string &id, TH2 *&hist, size_t ind) const override
 
virtual StatusCode getHist (const std::string &id, TH3 *&hist, size_t ind) const override
 
virtual StatusCode deReg (TObject *obj) override
 
virtual StatusCode deReg (const std::string &name) override
 
virtual std::vector< std::string > getHists () const override
 
virtual StatusCode regShared (const std::string &, std::unique_ptr< TH1 >, LockedHandle< TH1 > &) override
 
virtual StatusCode regShared (const std::string &, std::unique_ptr< TH2 >, LockedHandle< TH2 > &) override
 
virtual StatusCode regShared (const std::string &, std::unique_ptr< TH3 >, LockedHandle< TH3 > &) override
 
virtual StatusCode getShared (const std::string &, LockedHandle< TH1 > &) const override
 
virtual StatusCode getShared (const std::string &, LockedHandle< TH2 > &) const override
 
virtual StatusCode getShared (const std::string &, LockedHandle< TH3 > &) const override
 
virtual StatusCode getTHists (TDirectory *td, TList &, bool recurse=false) const override
 
virtual StatusCode getTHists (const std::string &name, TList &, bool recurse=false) const override
 
virtual StatusCode getTHists (TDirectory *td, TList &tl, bool recurse=false, bool reg=false) override
 
virtual StatusCode getTHists (const std::string &name, TList &tl, bool recurse=false, bool reg=false) override
 
virtual bool exists (const std::string &name) const override
 
virtual bool existsHist (const std::string &name) const override
 
virtual StatusCode regTree (const std::string &) override
 
virtual StatusCode regTree (const std::string &, std::unique_ptr< TTree >) override
 
virtual StatusCode regTree (const std::string &, TTree *) override
 
virtual StatusCode getTree (const std::string &, TTree *&) const override
 
virtual std::vector< std::string > getTrees () const override
 
virtual StatusCode getTTrees (TDirectory *, TList &, bool) const override
 
virtual StatusCode getTTrees (const std::string &, TList &, bool) const override
 
virtual StatusCode getTTrees (TDirectory *, TList &, bool, bool) override
 
virtual StatusCode getTTrees (const std::string &, TList &, bool, bool) override
 
virtual StatusCode regGraph (const std::string &) override
 
virtual StatusCode regGraph (const std::string &, std::unique_ptr< TGraph >) override
 
virtual StatusCode regGraph (const std::string &, TGraph *) override
 
virtual std::vector< std::string > getGraphs () const override
 
virtual StatusCode getGraph (const std::string &, TGraph *&) const override
 
virtual StatusCode regEfficiency (const std::string &) override
 
virtual StatusCode regEfficiency (const std::string &, std::unique_ptr< TEfficiency >) override
 
virtual StatusCode regEfficiency (const std::string &, TEfficiency *) override
 
virtual StatusCode getEfficiency (const std::string &, TEfficiency *&) const override
 
virtual std::vector< std::string > getEfficiencies () const override
 
virtual StatusCode getTEfficiencies (TDirectory *, TList &, bool) const override
 
virtual StatusCode getTEfficiencies (const std::string &, TList &, bool) const override
 
virtual StatusCode getTEfficiencies (TDirectory *, TList &, bool, bool) override
 
virtual StatusCode getTEfficiencies (const std::string &, TList &, bool, bool) override
 
virtual StatusCode regShared (const std::string &, std::unique_ptr< TGraph >, LockedHandle< TGraph > &) override
 
virtual StatusCode getShared (const std::string &, LockedHandle< TGraph > &) const override
 
virtual StatusCode regShared (const std::string &, std::unique_ptr< TEfficiency >, LockedHandle< TEfficiency > &) override
 
virtual StatusCode getShared (const std::string &, LockedHandle< TEfficiency > &) const override
 
virtual StatusCode merge (const std::string &) override
 
virtual StatusCode merge (TObject *) override
 
virtual bool existsTree (const std::string &) const override
 
virtual bool existsGraph (const std::string &) const override
 
virtual bool existsEfficiency (const std::string &) const override
 

Private Member Functions

bool isObjectAllowed (const std::string &path, const TObject *o) const
 Does the histogram follow the naming rules ? More...
 
StatusCode getTHists_i (const std::string &name, TList &) const
 Get TList of registered histograms. More...
 
template<typename T >
StatusCode regHist_i (std::unique_ptr< T > hist, const std::string &name, bool shared, THistID *&phid)
 
template<typename T >
T * getHist_i (const std::string &id, const size_t &ind, bool quiet=false) const
 
template<typename T >
LockedHandle< T > regShared_i (const std::string &id, std::unique_ptr< T > hist)
 
template<typename T >
LockedHandle< T > getShared_i (const std::string &id) const
 

Private Attributes

std::unordered_map< std::string, THistIDm_hists
 Registered histograms. More...
 
Gaudi::Property< std::string > m_excludeType {this, "ExcludeType", "()"}
 
Gaudi::Property< std::string > m_includeType {this, "IncludeType", ".+"}
 
Gaudi::Property< std::string > m_excludeName {this, "ExcludeName", ".*\\..*"}
 
Gaudi::Property< std::string > m_includeName
 
Gaudi::Property< int > m_autoSave {this, "AutoSave", 0, "Not supported by TrigMonTHistSvc"}
 
Gaudi::Property< int > m_autoFlush {this, "AutoFlush", 0, "Not supported by TrigMonTHistSvc"}
 
Gaudi::Property< bool > m_print {this, "PrintAll", false, "Not supported by TrigMonTHistSvc"}
 
Gaudi::Property< int > m_maxFileSize {this, "MaxFileSize", 10240, "Not supported by TrigMonTHistSvc"}
 
Gaudi::Property< std::vector< std::string > > m_outputfile {this, "Output", {}, "Not supported by TrigMonTHistSvc"}
 
Gaudi::Property< std::vector< std::string > > m_inputfile {this, "Input", {}, "Not supported by TrigMonTHistSvc"}
 
boost::regex m_excludeTypeRegex
 
boost::regex m_includeTypeRegex
 
boost::regex m_excludeNameRegex
 
boost::regex m_includeNameRegex
 
std::recursive_mutex m_svcMut
 Protect access to histogram list. More...
 

Detailed Description

HLT online histogram service.

The main difference to the offline THistSvc are:

Definition at line 43 of file TrigMonTHistSvc.h.

Constructor & Destructor Documentation

◆ TrigMonTHistSvc()

TrigMonTHistSvc::TrigMonTHistSvc ( const std::string &  name,
ISvcLocator *  svc 
)

Definition at line 23 of file TrigMonTHistSvc.cxx.

23  : base_class(name, svc)
24 {}

Member Function Documentation

◆ ATLAS_NOT_THREAD_SAFE()

virtual StatusCode initialize TrigMonTHistSvc::ATLAS_NOT_THREAD_SAFE ( )
overridevirtual

◆ deReg() [1/2]

StatusCode TrigMonTHistSvc::deReg ( const std::string &  name)
overridevirtual

Definition at line 213 of file TrigMonTHistSvc.cxx.

214 {
215  // This lock should not be needed but the MonSvc implementation in the
216  // HLTMMPPU is not thread-safe (maybe related to ATR-28222).
217  std::scoped_lock lock(m_svcMut);
218  hltinterface::IInfoRegister::instance()->releaseTObject(name(), id);
219  ATH_MSG_DEBUG("Deregistration of " << id << " done");
220  return StatusCode::SUCCESS;
221 }

◆ deReg() [2/2]

StatusCode TrigMonTHistSvc::deReg ( TObject *  obj)
overridevirtual

Definition at line 199 of file TrigMonTHistSvc.cxx.

200 {
201  std::scoped_lock lock(m_svcMut);
202  // Find the relevant histogram and deregister it
203  for (const auto& [name, histid] : m_hists) {
204  if (histid.obj == optr) {
205  ATH_MSG_DEBUG("Found histogram " << optr << " booked under " << name
206  << " and will deregister it");
207  return deReg(name);
208  }
209  }
210  return StatusCode::FAILURE;
211 }

◆ exists()

virtual bool TrigMonTHistSvc::exists ( const std::string &  name) const
inlineoverridevirtual

Definition at line 76 of file TrigMonTHistSvc.h.

76 { return existsHist(name); }

◆ existsEfficiency()

virtual bool TrigMonTHistSvc::existsEfficiency ( const std::string &  ) const
inlineoverridevirtual

Definition at line 118 of file TrigMonTHistSvc.h.

118 { NOSUPPORT(WARNING, "TEfficiency"); }

◆ existsGraph()

virtual bool TrigMonTHistSvc::existsGraph ( const std::string &  ) const
inlineoverridevirtual

Definition at line 117 of file TrigMonTHistSvc.h.

117 { NOSUPPORT(WARNING, "TGraph"); }

◆ existsHist()

bool TrigMonTHistSvc::existsHist ( const std::string &  name) const
overridevirtual

Definition at line 261 of file TrigMonTHistSvc.cxx.

262 {
263  return (getHist_i<TH1>(name, 0, true) != nullptr);
264 }

◆ existsTree()

virtual bool TrigMonTHistSvc::existsTree ( const std::string &  ) const
inlineoverridevirtual

Definition at line 116 of file TrigMonTHistSvc.h.

116 { NOSUPPORT(DEBUG, "TTree"); }

◆ finalize()

StatusCode TrigMonTHistSvc::finalize ( )
overridevirtual

Definition at line 59 of file TrigMonTHistSvc.cxx.

60 {
61  // Reset OH mutex
62  ATH_MSG_DEBUG("Resetting OH histogram mutex");
64 
65  return StatusCode::SUCCESS;
66 }

◆ getEfficiencies()

virtual std::vector<std::string> TrigMonTHistSvc::getEfficiencies ( ) const
inlineoverridevirtual

Definition at line 101 of file TrigMonTHistSvc.h.

101 { NOSUPPORT(WARNING, "TEfficiency"); }

◆ getEfficiency()

virtual StatusCode TrigMonTHistSvc::getEfficiency ( const std::string &  ,
TEfficiency *&   
) const
inlineoverridevirtual

Definition at line 100 of file TrigMonTHistSvc.h.

100 { NOSUPPORT(WARNING, "TEfficiency"); }

◆ getGraph()

virtual StatusCode TrigMonTHistSvc::getGraph ( const std::string &  ,
TGraph *&   
) const
inlineoverridevirtual

Definition at line 95 of file TrigMonTHistSvc.h.

95 { NOSUPPORT(DEBUG, "TGraph"); }

◆ getGraphs()

virtual std::vector<std::string> TrigMonTHistSvc::getGraphs ( ) const
inlineoverridevirtual

Definition at line 94 of file TrigMonTHistSvc.h.

94 { NOSUPPORT(DEBUG, "TGraph"); }

◆ getHist() [1/3]

StatusCode TrigMonTHistSvc::getHist ( const std::string &  id,
TH1 *&  hist,
size_t  ind 
) const
overridevirtual

Definition at line 292 of file TrigMonTHistSvc.cxx.

293 {
294  hist = getHist_i<TH1>(id, ind);
295  return (hist != nullptr ? StatusCode::SUCCESS : StatusCode::FAILURE);
296 }

◆ getHist() [2/3]

StatusCode TrigMonTHistSvc::getHist ( const std::string &  id,
TH2 *&  hist,
size_t  ind 
) const
overridevirtual

Definition at line 298 of file TrigMonTHistSvc.cxx.

299 {
300  hist = getHist_i<TH2>(id, ind);
301  return (hist != nullptr ? StatusCode::SUCCESS : StatusCode::FAILURE);
302 }

◆ getHist() [3/3]

StatusCode TrigMonTHistSvc::getHist ( const std::string &  id,
TH3 *&  hist,
size_t  ind 
) const
overridevirtual

Definition at line 304 of file TrigMonTHistSvc.cxx.

305 {
306  hist = getHist_i<TH3>(id, ind);
307  return (hist != nullptr ? StatusCode::SUCCESS : StatusCode::FAILURE);
308 }

◆ getHist_i()

template<typename T >
T * TrigMonTHistSvc::getHist_i ( const std::string &  id,
const size_t &  ind,
bool  quiet = false 
) const
private

Definition at line 144 of file TrigMonTHistSvc.cxx.

145 {
146  std::scoped_lock lock(m_svcMut);
147 
148  const auto& h = m_hists.find(id);
149  if (h == m_hists.end()) {
150  if (!quiet) ATH_MSG_ERROR("could not locate Hist with id \"" << id << "\"");
151  return nullptr;
152  }
153 
154  T* phist = dynamic_cast<T*>(h->second.obj);
155  if (phist == nullptr) {
156  ATH_MSG_ERROR("getHist: unable to dcast retrieved shared hist \""
157  << id << "\" of type " << h->second.obj->IsA()->GetName() << " to requested type "
158  << System::typeinfoName(typeid(T)));
159  return nullptr;
160  }
161  return phist;
162 }

◆ getHists()

std::vector< std::string > TrigMonTHistSvc::getHists ( ) const
overridevirtual

Definition at line 223 of file TrigMonTHistSvc.cxx.

224 {
225  std::scoped_lock lock(m_svcMut);
226  std::vector<std::string> l;
227  l.reserve(m_hists.size());
228  for (const auto& h : m_hists) l.push_back(h.first);
229  return l;
230 }

◆ getShared() [1/5]

virtual StatusCode TrigMonTHistSvc::getShared ( const std::string &  ,
LockedHandle< TEfficiency > &   
) const
inlineoverridevirtual

Definition at line 111 of file TrigMonTHistSvc.h.

111 { NOSUPPORT(WARNING, "TEfficiency"); }

◆ getShared() [2/5]

virtual StatusCode TrigMonTHistSvc::getShared ( const std::string &  ,
LockedHandle< TGraph > &   
) const
inlineoverridevirtual

Definition at line 109 of file TrigMonTHistSvc.h.

109 { NOSUPPORT(WARNING, "TGraph"); }

◆ getShared() [3/5]

StatusCode TrigMonTHistSvc::getShared ( const std::string &  id,
LockedHandle< TH1 > &  lh 
) const
overridevirtual

Definition at line 365 of file TrigMonTHistSvc.cxx.

366 {
367  lh = getShared_i<TH1>(id);
368  return (lh ? StatusCode::SUCCESS : StatusCode::FAILURE);
369 }

◆ getShared() [4/5]

StatusCode TrigMonTHistSvc::getShared ( const std::string &  id,
LockedHandle< TH2 > &  lh 
) const
overridevirtual

Definition at line 371 of file TrigMonTHistSvc.cxx.

372 {
373  lh = getShared_i<TH2>(id);
374  return (lh ? StatusCode::SUCCESS : StatusCode::FAILURE);
375 }

◆ getShared() [5/5]

StatusCode TrigMonTHistSvc::getShared ( const std::string &  id,
LockedHandle< TH3 > &  lh 
) const
overridevirtual

Definition at line 377 of file TrigMonTHistSvc.cxx.

378 {
379  lh = getShared_i<TH3>(id);
380  return (lh ? StatusCode::SUCCESS : StatusCode::FAILURE);
381 }

◆ getShared_i()

template<typename T >
LockedHandle< T > TrigMonTHistSvc::getShared_i ( const std::string &  id) const
private

Definition at line 176 of file TrigMonTHistSvc.cxx.

177 {
178  std::scoped_lock lock(m_svcMut);
179  const auto& h = m_hists.find(id);
180  if (h != m_hists.end()) {
181  if (h->second.mutex == nullptr) {
182  ATH_MSG_ERROR("getShared: found Hist with id \"" << id
183  << "\", but it's not marked as shared");
184  return {};
185  }
186  T* phist = dynamic_cast<T*>(h->second.obj);
187  if (phist == nullptr) {
188  ATH_MSG_ERROR("getShared: unable to dcast retrieved shared hist \""
189  << id << "\" of type " << h->second.obj->IsA()->GetName()
190  << " to requested type " << System::typeinfoName(typeid(T)));
191  return {};
192  }
193  return LockedHandle<T>(phist, h->second.mutex);
194  }
195  ATH_MSG_ERROR("getShared: cannot find histogram with id \"" << id << "\"");
196  return {};
197 }

◆ getTEfficiencies() [1/4]

virtual StatusCode TrigMonTHistSvc::getTEfficiencies ( const std::string &  ,
TList &  ,
bool   
) const
inlineoverridevirtual

Definition at line 104 of file TrigMonTHistSvc.h.

104 { NOSUPPORT(WARNING, "TEfficiency"); }

◆ getTEfficiencies() [2/4]

virtual StatusCode TrigMonTHistSvc::getTEfficiencies ( const std::string &  ,
TList &  ,
bool  ,
bool   
)
inlineoverridevirtual

Definition at line 106 of file TrigMonTHistSvc.h.

106 { NOSUPPORT(WARNING, "TEfficiency"); }

◆ getTEfficiencies() [3/4]

virtual StatusCode TrigMonTHistSvc::getTEfficiencies ( TDirectory *  ,
TList &  ,
bool   
) const
inlineoverridevirtual

Definition at line 103 of file TrigMonTHistSvc.h.

103 { NOSUPPORT(WARNING, "TEfficiency"); }

◆ getTEfficiencies() [4/4]

virtual StatusCode TrigMonTHistSvc::getTEfficiencies ( TDirectory *  ,
TList &  ,
bool  ,
bool   
)
inlineoverridevirtual

Definition at line 105 of file TrigMonTHistSvc.h.

105 { NOSUPPORT(WARNING, "TEfficiency"); }

◆ getTHists() [1/4]

StatusCode TrigMonTHistSvc::getTHists ( const std::string &  name,
TList &  tl,
bool  recurse = false 
) const
overridevirtual

Definition at line 318 of file TrigMonTHistSvc.cxx.

319 {
320  if (recurse) ATH_MSG_DEBUG("Recursive flag is not supported in this implementation");
321  return getTHists_i(dir, tl);
322 }

◆ getTHists() [2/4]

StatusCode TrigMonTHistSvc::getTHists ( const std::string &  name,
TList &  tl,
bool  recurse = false,
bool  reg = false 
)
overridevirtual

Definition at line 332 of file TrigMonTHistSvc.cxx.

333 {
334  if (recurse || reg)
335  ATH_MSG_DEBUG("Recursive flag and automatic registration flag is not "
336  "supported in this implementation");
337  return getTHists_i(dir, tl);
338 }

◆ getTHists() [3/4]

StatusCode TrigMonTHistSvc::getTHists ( TDirectory *  td,
TList &  tl,
bool  recurse = false 
) const
overridevirtual

Definition at line 312 of file TrigMonTHistSvc.cxx.

313 {
314  if (recurse) ATH_MSG_DEBUG("Recursive flag is not supported in this implementation");
315  return getTHists_i(std::string(td->GetPath()), tl);
316 }

◆ getTHists() [4/4]

StatusCode TrigMonTHistSvc::getTHists ( TDirectory *  td,
TList &  tl,
bool  recurse = false,
bool  reg = false 
)
overridevirtual

Definition at line 324 of file TrigMonTHistSvc.cxx.

325 {
326  if (recurse || reg)
327  ATH_MSG_DEBUG("Recursive flag and automatic registration flag is not "
328  "supported in this implementation");
329  return getTHists_i(std::string(td->GetPath()), tl);
330 }

◆ getTHists_i()

StatusCode TrigMonTHistSvc::getTHists_i ( const std::string &  name,
TList &  tl 
) const
private

Get TList of registered histograms.

Definition at line 164 of file TrigMonTHistSvc.cxx.

165 {
166  std::scoped_lock lock(m_svcMut);
167  for (const auto& [id, h] : m_hists) {
168  if (id.find(dir) == 0) { // histogram booking path starts from the dir
169  tl.Add(h.obj);
170  }
171  }
172  return StatusCode::SUCCESS;
173 }

◆ getTree()

virtual StatusCode TrigMonTHistSvc::getTree ( const std::string &  ,
TTree *&   
) const
inlineoverridevirtual

Definition at line 83 of file TrigMonTHistSvc.h.

83 { NOSUPPORT(WARNING, "TTree"); }

◆ getTrees()

virtual std::vector<std::string> TrigMonTHistSvc::getTrees ( ) const
inlineoverridevirtual

Definition at line 85 of file TrigMonTHistSvc.h.

85 { NOSUPPORT(DEBUG, "TTree"); }

◆ getTTrees() [1/4]

virtual StatusCode TrigMonTHistSvc::getTTrees ( const std::string &  ,
TList &  ,
bool   
) const
inlineoverridevirtual

Definition at line 87 of file TrigMonTHistSvc.h.

87 { NOSUPPORT(DEBUG, "TTree"); }

◆ getTTrees() [2/4]

virtual StatusCode TrigMonTHistSvc::getTTrees ( const std::string &  ,
TList &  ,
bool  ,
bool   
)
inlineoverridevirtual

Definition at line 89 of file TrigMonTHistSvc.h.

89 { NOSUPPORT(DEBUG, "TTree"); }

◆ getTTrees() [3/4]

virtual StatusCode TrigMonTHistSvc::getTTrees ( TDirectory *  ,
TList &  ,
bool   
) const
inlineoverridevirtual

Definition at line 86 of file TrigMonTHistSvc.h.

86 { NOSUPPORT(DEBUG, "TTree"); }

◆ getTTrees() [4/4]

virtual StatusCode TrigMonTHistSvc::getTTrees ( TDirectory *  ,
TList &  ,
bool  ,
bool   
)
inlineoverridevirtual

Definition at line 88 of file TrigMonTHistSvc.h.

88 { NOSUPPORT(DEBUG, "TTree"); }

◆ isObjectAllowed()

bool TrigMonTHistSvc::isObjectAllowed ( const std::string &  path,
const TObject *  o 
) const
private

Does the histogram follow the naming rules ?

Definition at line 232 of file TrigMonTHistSvc.cxx.

233 {
234  boost::cmatch what;
235 
236  if (not boost::regex_match(o->ClassName(), what, m_includeTypeRegex)) {
237  ATH_MSG_WARNING("Object " << path << " of type " << o->ClassName()
238  << " does NOT match IncludeType \"" << m_includeType << "\"");
239  return false;
240  }
241 
242  if (boost::regex_match(o->ClassName(), what, m_excludeTypeRegex)) {
243  ATH_MSG_WARNING("Object " << path << " of type " << o->ClassName() << " matches ExcludeType \""
244  << m_excludeType << "\"");
245  return false;
246  }
247 
248  if (not boost::regex_match(path.c_str(), what, m_includeNameRegex)) {
249  ATH_MSG_WARNING("Object " << path << " does NOT match IncludeName \"" << m_includeName << "\"");
250  return false;
251  }
252 
253  if (boost::regex_match(path.c_str(), what, m_excludeNameRegex)) {
254  ATH_MSG_WARNING("Object " << path << " matches ExcludeName \"" << m_excludeName << "\"");
255  return false;
256  }
257 
258  return true;
259 }

◆ merge() [1/2]

virtual StatusCode TrigMonTHistSvc::merge ( const std::string &  )
inlineoverridevirtual

Definition at line 113 of file TrigMonTHistSvc.h.

113 { NOSUPPORT(WARNING, "merge"); }

◆ merge() [2/2]

virtual StatusCode TrigMonTHistSvc::merge ( TObject *  )
inlineoverridevirtual

Definition at line 114 of file TrigMonTHistSvc.h.

114 { NOSUPPORT(WARNING, "merge"); }

◆ regEfficiency() [1/3]

virtual StatusCode TrigMonTHistSvc::regEfficiency ( const std::string &  )
inlineoverridevirtual

Definition at line 97 of file TrigMonTHistSvc.h.

97 { NOSUPPORT(WARNING, "TEfficiency"); }

◆ regEfficiency() [2/3]

virtual StatusCode TrigMonTHistSvc::regEfficiency ( const std::string &  ,
std::unique_ptr< TEfficiency >   
)
inlineoverridevirtual

Definition at line 98 of file TrigMonTHistSvc.h.

98 { NOSUPPORT(WARNING, "TEfficiency"); }

◆ regEfficiency() [3/3]

virtual StatusCode TrigMonTHistSvc::regEfficiency ( const std::string &  ,
TEfficiency *   
)
inlineoverridevirtual

Definition at line 99 of file TrigMonTHistSvc.h.

99 { NOSUPPORT(WARNING, "TEfficiency"); }

◆ regGraph() [1/3]

virtual StatusCode TrigMonTHistSvc::regGraph ( const std::string &  )
inlineoverridevirtual

Definition at line 91 of file TrigMonTHistSvc.h.

91 { NOSUPPORT(WARNING, "TGraph"); }

◆ regGraph() [2/3]

virtual StatusCode TrigMonTHistSvc::regGraph ( const std::string &  ,
std::unique_ptr< TGraph >   
)
inlineoverridevirtual

Definition at line 92 of file TrigMonTHistSvc.h.

92 { NOSUPPORT(WARNING, "TGraph"); }

◆ regGraph() [3/3]

virtual StatusCode TrigMonTHistSvc::regGraph ( const std::string &  ,
TGraph *   
)
inlineoverridevirtual

Definition at line 93 of file TrigMonTHistSvc.h.

93 { NOSUPPORT(WARNING, "TGraph"); }

◆ regHist() [1/3]

StatusCode TrigMonTHistSvc::regHist ( const std::string &  name)
overridevirtual

Definition at line 270 of file TrigMonTHistSvc.cxx.

271 {
272  std::unique_ptr<TH1> hist = nullptr;
273  THistID* hid = nullptr;
274  return regHist_i(std::move(hist), id, false, hid);
275 }

◆ regHist() [2/3]

StatusCode TrigMonTHistSvc::regHist ( const std::string &  name,
std::unique_ptr< TH1 >  hist 
)
overridevirtual

Definition at line 277 of file TrigMonTHistSvc.cxx.

278 {
279  THistID* hid = nullptr;
280  return regHist_i(std::move(hist), id, false, hid);
281 }

◆ regHist() [3/3]

StatusCode TrigMonTHistSvc::regHist ( const std::string &  name,
TH1 *  hist_ptr 
)
overridevirtual

Definition at line 283 of file TrigMonTHistSvc.cxx.

284 {
285  THistID* hid = nullptr;
286  std::unique_ptr<TH1> hist(hist_ptr);
287  return regHist_i(std::move(hist), id, false, hid);
288 }

◆ regHist_i()

template<typename T >
StatusCode TrigMonTHistSvc::regHist_i ( std::unique_ptr< T >  hist,
const std::string &  name,
bool  shared,
THistID *&  phid 
)
private

Definition at line 69 of file TrigMonTHistSvc.cxx.

71 {
72  std::scoped_lock lock(m_svcMut);
73 
74  // We need to pass ownership to the hist registry now
75  phid = nullptr;
76  if (not isObjectAllowed(id, hist_unique.get())) {
77  return StatusCode::FAILURE;
78  }
79 
80  if (hist_unique->Class()->InheritsFrom(TH1::Class())) {
81  T* hist = hist_unique.release();
82  if (hltinterface::IInfoRegister::instance()->registerTObject(name(), id, hist)) {
83  auto [iter,inserted] = m_hists.try_emplace(id, id, hist);
84  if (not inserted) {
85  ATH_MSG_ERROR("Histogram with name " << id << " already registered");
86  return StatusCode::FAILURE;
87  }
88  if (shared) iter->second.mutex = new std::mutex;
89  phid = &iter->second;
90  ATH_MSG_DEBUG((shared ? "Shared histogram " : "Histogram ")
91  << hist->GetName() << " registered under " << id << " " << name());
92  }
93  else {
94  ATH_MSG_ERROR("Registration of " << hist->ClassName() << " with IInfoRegister failed");
95  delete hist;
96  return StatusCode::FAILURE;
97  }
98  }
99  else {
100  ATH_MSG_ERROR("Cannot register " << hist_unique->ClassName()
101  << " because it does not inherit from TH1");
102  return StatusCode::FAILURE;
103  }
104  return StatusCode::SUCCESS;
105 }

◆ regShared() [1/5]

virtual StatusCode TrigMonTHistSvc::regShared ( const std::string &  ,
std::unique_ptr< TEfficiency >  ,
LockedHandle< TEfficiency > &   
)
inlineoverridevirtual

Definition at line 110 of file TrigMonTHistSvc.h.

110 { NOSUPPORT(WARNING, "TEfficiency"); }

◆ regShared() [2/5]

virtual StatusCode TrigMonTHistSvc::regShared ( const std::string &  ,
std::unique_ptr< TGraph >  ,
LockedHandle< TGraph > &   
)
inlineoverridevirtual

Definition at line 108 of file TrigMonTHistSvc.h.

108 { NOSUPPORT(WARNING, "TGraph"); }

◆ regShared() [3/5]

StatusCode TrigMonTHistSvc::regShared ( const std::string &  id,
std::unique_ptr< TH1 >  hist,
LockedHandle< TH1 > &  lh 
)
overridevirtual

Definition at line 342 of file TrigMonTHistSvc.cxx.

344 {
345  lh = regShared_i<TH1>(id, std::move(hist));
346  return (lh ? StatusCode::SUCCESS : StatusCode::FAILURE);
347 }

◆ regShared() [4/5]

StatusCode TrigMonTHistSvc::regShared ( const std::string &  id,
std::unique_ptr< TH2 >  hist,
LockedHandle< TH2 > &  lh 
)
overridevirtual

Definition at line 349 of file TrigMonTHistSvc.cxx.

351 {
352  lh = regShared_i<TH2>(id, std::move(hist));
353  return (lh ? StatusCode::SUCCESS : StatusCode::FAILURE);
354 }

◆ regShared() [5/5]

StatusCode TrigMonTHistSvc::regShared ( const std::string &  id,
std::unique_ptr< TH3 >  hist,
LockedHandle< TH3 > &  lh 
)
overridevirtual

Definition at line 356 of file TrigMonTHistSvc.cxx.

358 {
359  lh = regShared_i<TH3>(id, std::move(hist));
360  return (lh ? StatusCode::SUCCESS : StatusCode::FAILURE);
361 }

◆ regShared_i()

template<typename T >
LockedHandle< T > TrigMonTHistSvc::regShared_i ( const std::string &  id,
std::unique_ptr< T >  hist 
)
private

Definition at line 108 of file TrigMonTHistSvc.cxx.

109 {
110  std::scoped_lock lock(m_svcMut);
111 
112  LockedHandle<T> lh(nullptr, nullptr);
113  const auto& h = m_hists.find(id);
114 
115  // No histogram under that id yet
116  if (h == m_hists.end()) {
117  T* phist = hist.get();
118  THistID* phid = nullptr;
119  if (regHist_i(std::move(hist), id, true, phid).isSuccess()) {
120  lh.set(phist, phid->mutex);
121  }
122  }
123  // Histogram already registered under that id
124  else {
125  if (h->second.mutex == nullptr) {
126  ATH_MSG_ERROR("regShared: previously registered histogram \"" << id
127  << "\" was not marked shared");
128  }
129  T* phist = dynamic_cast<T*>(h->second.obj);
130  if (phist == nullptr) {
131  ATH_MSG_ERROR("regShared: unable to dcast retrieved shared hist \""
132  << id << "\" of type " << h->second.obj->IsA()->GetName()
133  << " to requested type " << System::typeinfoName(typeid(T)));
134  }
135  else {
136  lh.set(phist, h->second.mutex);
137  //hist is automatically deleted at end of method
138  }
139  }
140  return lh;
141 }

◆ regTree() [1/3]

virtual StatusCode TrigMonTHistSvc::regTree ( const std::string &  )
inlineoverridevirtual

Definition at line 80 of file TrigMonTHistSvc.h.

80 { NOSUPPORT(WARNING, "TTree"); }

◆ regTree() [2/3]

virtual StatusCode TrigMonTHistSvc::regTree ( const std::string &  ,
std::unique_ptr< TTree >   
)
inlineoverridevirtual

Definition at line 81 of file TrigMonTHistSvc.h.

81 { NOSUPPORT(WARNING, "TTree"); }

◆ regTree() [3/3]

virtual StatusCode TrigMonTHistSvc::regTree ( const std::string &  ,
TTree *   
)
inlineoverridevirtual

Definition at line 82 of file TrigMonTHistSvc.h.

82 { NOSUPPORT(WARNING, "TTree"); }

◆ stop()

StatusCode TrigMonTHistSvc::stop ( )
overridevirtual

Definition at line 51 of file TrigMonTHistSvc.cxx.

52 {
53  // Clear list of histograms (actual TH is not owned by us)
54  m_hists.clear();
55 
56  return StatusCode::SUCCESS;
57 }

Member Data Documentation

◆ m_autoFlush

Gaudi::Property<int> TrigMonTHistSvc::m_autoFlush {this, "AutoFlush", 0, "Not supported by TrigMonTHistSvc"}
private

Definition at line 154 of file TrigMonTHistSvc.h.

◆ m_autoSave

Gaudi::Property<int> TrigMonTHistSvc::m_autoSave {this, "AutoSave", 0, "Not supported by TrigMonTHistSvc"}
private

Definition at line 153 of file TrigMonTHistSvc.h.

◆ m_excludeName

Gaudi::Property<std::string> TrigMonTHistSvc::m_excludeName {this, "ExcludeName", ".*\\..*"}
private

Definition at line 148 of file TrigMonTHistSvc.h.

◆ m_excludeNameRegex

boost::regex TrigMonTHistSvc::m_excludeNameRegex
private

Definition at line 163 of file TrigMonTHistSvc.h.

◆ m_excludeType

Gaudi::Property<std::string> TrigMonTHistSvc::m_excludeType {this, "ExcludeType", "()"}
private

Definition at line 146 of file TrigMonTHistSvc.h.

◆ m_excludeTypeRegex

boost::regex TrigMonTHistSvc::m_excludeTypeRegex
private

Definition at line 161 of file TrigMonTHistSvc.h.

◆ m_hists

std::unordered_map<std::string, THistID> TrigMonTHistSvc::m_hists
private

Registered histograms.

Definition at line 131 of file TrigMonTHistSvc.h.

◆ m_includeName

Gaudi::Property<std::string> TrigMonTHistSvc::m_includeName
private
Initial value:
{this, "IncludeName",
"^/((run_[0-9]+/lb_[0-9]+/LB)|(SHIFT)|(EXPERT)|(DEBUG)|(EXPRESS)|(RUNSTAT))/.+/.+"}

Definition at line 149 of file TrigMonTHistSvc.h.

◆ m_includeNameRegex

boost::regex TrigMonTHistSvc::m_includeNameRegex
private

Definition at line 164 of file TrigMonTHistSvc.h.

◆ m_includeType

Gaudi::Property<std::string> TrigMonTHistSvc::m_includeType {this, "IncludeType", ".+"}
private

Definition at line 147 of file TrigMonTHistSvc.h.

◆ m_includeTypeRegex

boost::regex TrigMonTHistSvc::m_includeTypeRegex
private

Definition at line 162 of file TrigMonTHistSvc.h.

◆ m_inputfile

Gaudi::Property<std::vector<std::string> > TrigMonTHistSvc::m_inputfile {this, "Input", {}, "Not supported by TrigMonTHistSvc"}
private

Definition at line 158 of file TrigMonTHistSvc.h.

◆ m_maxFileSize

Gaudi::Property<int> TrigMonTHistSvc::m_maxFileSize {this, "MaxFileSize", 10240, "Not supported by TrigMonTHistSvc"}
private

Definition at line 156 of file TrigMonTHistSvc.h.

◆ m_outputfile

Gaudi::Property<std::vector<std::string> > TrigMonTHistSvc::m_outputfile {this, "Output", {}, "Not supported by TrigMonTHistSvc"}
private

Definition at line 157 of file TrigMonTHistSvc.h.

◆ m_print

Gaudi::Property<bool> TrigMonTHistSvc::m_print {this, "PrintAll", false, "Not supported by TrigMonTHistSvc"}
private

Definition at line 155 of file TrigMonTHistSvc.h.

◆ m_svcMut

std::recursive_mutex TrigMonTHistSvc::m_svcMut
mutableprivate

Protect access to histogram list.

Definition at line 167 of file TrigMonTHistSvc.h.


The documentation for this class was generated from the following files:
TrigMonTHistSvc::m_hists
std::unordered_map< std::string, THistID > m_hists
Registered histograms.
Definition: TrigMonTHistSvc.h:131
TrigMonTHistSvc::m_excludeName
Gaudi::Property< std::string > m_excludeName
Definition: TrigMonTHistSvc.h:148
DiTauMassTools::TauTypes::lh
@ lh
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:53
athena.path
path
python interpreter configuration --------------------------------------—
Definition: athena.py:128
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
quiet
bool quiet
Definition: TrigGlobEffCorrValidation.cxx:190
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
plotmaker.hist
hist
Definition: plotmaker.py:148
TrigMonTHistSvc::m_includeName
Gaudi::Property< std::string > m_includeName
Definition: TrigMonTHistSvc.h:149
TrigMonTHistSvc::m_excludeTypeRegex
boost::regex m_excludeTypeRegex
Definition: TrigMonTHistSvc.h:161
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
TrigMonTHistSvc::m_svcMut
std::recursive_mutex m_svcMut
Protect access to histogram list.
Definition: TrigMonTHistSvc.h:167
TrigMonTHistSvc::m_excludeNameRegex
boost::regex m_excludeNameRegex
Definition: TrigMonTHistSvc.h:163
dq_make_web_display.recurse
def recurse(rdir, dqregion, ignorepath, reffile=None)
Definition: dq_make_web_display.py:23
TrigMonTHistSvc::m_excludeType
Gaudi::Property< std::string > m_excludeType
Definition: TrigMonTHistSvc.h:146
instance
std::map< std::string, double > instance
Definition: Run_To_Get_Tags.h:8
TrigMonTHistSvc::deReg
virtual StatusCode deReg(TObject *obj) override
Definition: TrigMonTHistSvc.cxx:199
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
TrigMonTHistSvc::m_includeTypeRegex
boost::regex m_includeTypeRegex
Definition: TrigMonTHistSvc.h:162
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
oh_lock_histogram_mutex::reset_histogram_mutex
static void reset_histogram_mutex()
Reset (disable) histogram mutex.
Definition: OHLockedHist.h:39
TrigMonTHistSvc::isObjectAllowed
bool isObjectAllowed(const std::string &path, const TObject *o) const
Does the histogram follow the naming rules ?
Definition: TrigMonTHistSvc.cxx:232
TrigMonTHistSvc::existsHist
virtual bool existsHist(const std::string &name) const override
Definition: TrigMonTHistSvc.cxx:261
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
python.Constants.WARNING
int WARNING
Definition: Control/AthenaCommon/python/Constants.py:17
TrigMonTHistSvc::getTHists_i
StatusCode getTHists_i(const std::string &name, TList &) const
Get TList of registered histograms.
Definition: TrigMonTHistSvc.cxx:164
beamspotman.dir
string dir
Definition: beamspotman.py:623
TrigMonTHistSvc::regHist_i
StatusCode regHist_i(std::unique_ptr< T > hist, const std::string &name, bool shared, THistID *&phid)
Definition: TrigMonTHistSvc.cxx:69
python.ExitCodes.what
def what(code)
Definition: ExitCodes.py:73
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
NOSUPPORT
#define NOSUPPORT(lvl, what)
Definition: TrigMonTHistSvc.h:27
TrigMonTHistSvc::m_includeType
Gaudi::Property< std::string > m_includeType
Definition: TrigMonTHistSvc.h:147
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
DEBUG
#define DEBUG
Definition: page_access.h:11
dqt_zlumi_alleff_HIST.tl
tl
Definition: dqt_zlumi_alleff_HIST.py:73
TrigMonTHistSvc::m_includeNameRegex
boost::regex m_includeNameRegex
Definition: TrigMonTHistSvc.h:164
checkFileSG.ind
list ind
Definition: checkFileSG.py:118
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35