Public Member Functions | Private Attributes | List of all members
om::HistoFile Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-11-28/OnlineMonitoring/viewer/HistoSource.h"

Inheritance diagram for om::HistoFile:
om::HistoSourceBase

Public Member Functions

 HistoFile (const char *n)
 
 ~HistoFile ()
 
void SetName (const char *nm)
 Set the source name. More...
 
TH1F * GetTH1FCopy (const char *n)
 
TH2F * GetTH2FCopy (const char *n)
 
void GetHistogramList (std::list< std::string > &h)
 Get a list of all histograms held by this source. More...
 
virtual void GetStatus (std::string &nm, unsigned int *run, unsigned int *subrun, unsigned int *event, pid_t *pid, long *stime, long *utime, long *cpu, long *rsize, time_t *t)
 Get the histogram server status. More...
 
void FindAllMatches (const char *include_pattern, const char *exclude_pattern, std::list< std::string > &objs)
 

Private Attributes

TFile * fFile
 The root histogram file. More...
 

Detailed Description

Histograms from a root file

Definition at line 63 of file HistoSource.h.

Constructor & Destructor Documentation

HistoFile::HistoFile ( const char *  n)

Definition at line 32 of file HistoSource.cxx.

References SetName().

32  : fFile(0)
33 {
34  if (n) this->SetName(n);
35 }
void SetName(const char *nm)
Set the source name.
Definition: HistoSource.cxx:46
TFile * fFile
The root histogram file.
Definition: HistoSource.h:74
HistoFile::~HistoFile ( )

Definition at line 39 of file HistoSource.cxx.

References fFile.

40 {
41  if (fFile) { delete fFile; fFile = 0; }
42 }
TFile * fFile
The root histogram file.
Definition: HistoSource.h:74

Member Function Documentation

void HistoSourceBase::FindAllMatches ( const char *  include_pattern,
const char *  exclude_pattern,
std::list< std::string > &  objs 
)
inherited

Return the names of all objects in the file who's names match a particular set of patterns

Parameters
include_pattern- Names must match this expression
exclude_pattern- Names must not match this expression
objs- List of object names that satisfy the above

Definition at line 10 of file HistoSource.cxx.

References om::HistoSourceBase::GetHistogramList(), make_syst_table_plots::h, MECModelEnuComparisons::i, in, om::regex_match(), and string.

Referenced by om::HistoSourceBase::GetStatus().

13 {
14  std::string include_p(include_pattern);
15  std::string exclude_p(exclude_pattern);
16  bool in, ex;
17 
18  std::list<std::string> h;
19  this->GetHistogramList(h);
20 
21  std::list<std::string>::iterator i(h.begin());
22  std::list<std::string>::iterator iend(h.end());
23  for (; i!=iend; ++i) {
24  in = (regex_match(*i, include_p)==0);
25  ex = (regex_match(*i, exclude_p)==0);
26  if (in && !ex) objs.push_back(*i);
27  }
28 }
virtual void GetHistogramList(std::list< std::string > &h)=0
Get a list of all histograms held by this source.
ifstream in
Definition: comparison.C:7
int regex_match(const std::string &s, const std::string &p)
Definition: RegexMatch.cxx:7
enum BeamMode string
void HistoFile::GetHistogramList ( std::list< std::string > &  h)
virtual

Get a list of all histograms held by this source.

Implements om::HistoSourceBase.

Definition at line 75 of file HistoSource.cxx.

References fFile, and next().

76 {
77  TIter next(fFile->GetListOfKeys());
78  TObject* obj = 0;
79  while ((obj = next())) {
80  h.push_back(obj->GetName());
81  }
82 }
TFile * fFile
The root histogram file.
Definition: HistoSource.h:74
void next()
Definition: show_event.C:84
virtual void om::HistoSourceBase::GetStatus ( std::string nm,
unsigned int run,
unsigned int subrun,
unsigned int event,
pid_t *  pid,
long *  stime,
long *  utime,
long *  cpu,
long *  rsize,
time_t *  t 
)
inlinevirtualinherited

Get the histogram server status.

Reimplemented in om::HistoSource, and om::HistoSHM.

Definition at line 36 of file HistoSource.h.

References om::HistoSourceBase::FindAllMatches().

Referenced by om::HistoSource::GetStatus().

45  { }
TH1F * HistoFile::GetTH1FCopy ( const char *  n)
virtual

Read a copy of a named histogram into memory. User accepts ownership and responsibility for deletetion

Implements om::HistoSourceBase.

Definition at line 57 of file HistoSource.cxx.

References fFile.

58 {
59  TObject* obj = fFile->FindObjectAny(n);
60  if (obj==0) return 0;
61  return (TH1F*)obj;
62 }
TFile * fFile
The root histogram file.
Definition: HistoSource.h:74
TH2F * HistoFile::GetTH2FCopy ( const char *  n)
virtual

Read a copy of a named histogram into memory. User accepts ownership and responsibility for deletion.

Implements om::HistoSourceBase.

Definition at line 66 of file HistoSource.cxx.

References fFile.

67 {
68  TObject* obj = fFile->FindObjectAny(n);
69  if (obj==0) return 0;
70  return (TH2F*)obj;
71 }
TFile * fFile
The root histogram file.
Definition: HistoSource.h:74
void HistoFile::SetName ( const char *  nm)
virtual

Set the source name.

Implements om::HistoSourceBase.

Definition at line 46 of file HistoSource.cxx.

References om::cout, and fFile.

Referenced by HistoFile().

47 {
48  if (fFile) { delete fFile; fFile = 0; }
49  fFile = new TFile(nm, "READ");
50  if (fFile==0) {
51  om::cout << "Unable to open root file " << nm << " for read." << "";
52  }
53 }
static constexpr Double_t nm
Definition: Munits.h:133
TFile * fFile
The root histogram file.
Definition: HistoSource.h:74
OStream cout
Definition: OStream.cxx:6

Member Data Documentation

TFile* om::HistoFile::fFile
private

The root histogram file.

Definition at line 74 of file HistoSource.h.

Referenced by GetHistogramList(), GetTH1FCopy(), GetTH2FCopy(), SetName(), and ~HistoFile().


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