ATLAS Offline Software
Loading...
Searching...
No Matches
dqutils::MonitoringFile::PostProcessorFileWrapper Class Reference

#include <MonitoringFile.h>

Inheritance diagram for dqutils::MonitoringFile::PostProcessorFileWrapper:
Collaboration diagram for dqutils::MonitoringFile::PostProcessorFileWrapper:

Public Member Functions

 PostProcessorFileWrapper (const std::string &inFilename, const std::string &name)
 ~PostProcessorFileWrapper ()
template<class T>
void get (const char *namecycle, T *&ptr, TDirectory *baseDir=0, TDirectory *target=0)
void setDirectory (TH1 *h, TDirectory *dir=0)
void setDirectory (TH2 *h, TDirectory *dir=0)
void setDirectory (TGraph *g, TDirectory *dir=0)
void setMetaData (TDirectory *targetDir, TH1 *h1, TH1 *h2=0, TH1 *h3=0)
void error ()

Private Attributes

std::set< TObject * > m_garbage
std::string m_name
bool m_error {}

Detailed Description

Definition at line 217 of file MonitoringFile.h.

Constructor & Destructor Documentation

◆ PostProcessorFileWrapper()

dqutils::MonitoringFile::PostProcessorFileWrapper::PostProcessorFileWrapper ( const std::string & inFilename,
const std::string & name )

Definition at line 38 of file MonitoringFile_PPFileWrapper.cxx.

39 :
40 TFile(inFilename.c_str(), "UPDATE"),
41 m_name(name),
42 m_error(0) {
43 if (this->IsOpen()) {
44 //std::cout << "Begin " << m_name << " MonitoringFile: " << this->GetName() << " Size: " << this->GetSize() <<
45 // std::endl;
46 } else {
47 std::cerr << "ERROR " << m_name << " Could not open MonitoringFile: " << inFilename << std::endl;
48 }
49 }

◆ ~PostProcessorFileWrapper()

dqutils::MonitoringFile::PostProcessorFileWrapper::~PostProcessorFileWrapper ( )

Definition at line 51 of file MonitoringFile_PPFileWrapper.cxx.

51 {
52 //std::cout << "Destructing " << m_name << " Collected " << m_garbage.size() << " Objects to be deleted" <<
53 // std::endl;
54 if (!m_error) {
55 this->Write();
56 } else {
57 std::cerr << "ERROR " << m_name << " Chose Not To Write " << this->GetName() << std::endl;
58 }
59 this->Close();
60 for (std::set<TObject*>::const_iterator git = m_garbage.begin(); git != m_garbage.end(); ++git) {
61 delete *git;
62 }
63 //std::cout << "\n";
64 }

Member Function Documentation

◆ error()

void dqutils::MonitoringFile::PostProcessorFileWrapper::error ( )

Definition at line 92 of file MonitoringFile_PPFileWrapper.cxx.

92{m_error = true;}

◆ get()

template<class T>
void dqutils::MonitoringFile::PostProcessorFileWrapper::get ( const char * namecycle,
T *& ptr,
TDirectory * baseDir = 0,
TDirectory * target = 0 )

Definition at line 463 of file MonitoringFile.h.

464 {
465 if (baseDir) baseDir->GetObject(namecycle, ptr); // suggested root function
466 else this->GetObject(namecycle, ptr); //suggested root function
467 if (!ptr) return;
468
469 if ((T::Class())->InheritsFrom("TH1")) {
470 TH1* obj = reinterpret_cast<TH1*> (ptr);
471
472 obj->SetDirectory(target);
473 if (target == 0) m_garbage.insert(obj);
474 } else {
475 TObject* obj = reinterpret_cast<TObject*>(ptr);
476
477 if (target == 0) m_garbage.insert(obj);
478 }
479 }
void * ptr(T *p)
Definition SGImplSvc.cxx:74

◆ setDirectory() [1/3]

void dqutils::MonitoringFile::PostProcessorFileWrapper::setDirectory ( TGraph * g,
TDirectory * dir = 0 )

Definition at line 108 of file MonitoringFile_PPFileWrapper.cxx.

108 {
109 // Cannot set directory for TGraph
110 if (dir == 0) {
111 m_garbage.insert(g);
112 }
113 }

◆ setDirectory() [2/3]

void dqutils::MonitoringFile::PostProcessorFileWrapper::setDirectory ( TH1 * h,
TDirectory * dir = 0 )

Definition at line 94 of file MonitoringFile_PPFileWrapper.cxx.

94 {
95 h->SetDirectory(dir);
96 if (dir == 0) {
97 m_garbage.insert(h);
98 }
99 }

◆ setDirectory() [3/3]

void dqutils::MonitoringFile::PostProcessorFileWrapper::setDirectory ( TH2 * h,
TDirectory * dir = 0 )

Definition at line 101 of file MonitoringFile_PPFileWrapper.cxx.

101 {
102 h->SetDirectory(dir);
103 if (dir == 0) {
104 m_garbage.insert(h);
105 }
106 }

◆ setMetaData()

void dqutils::MonitoringFile::PostProcessorFileWrapper::setMetaData ( TDirectory * targetDir,
TH1 * h1,
TH1 * h2 = 0,
TH1 * h3 = 0 )

Definition at line 115 of file MonitoringFile_PPFileWrapper.cxx.

115 {
116 //we will collect the garbage and set the directory to zero
117 h1->SetDirectory(0);
118 m_garbage.insert(h1);
119 if (h2) {
120 h2->SetDirectory(0);
121 m_garbage.insert(h2);
122 }
123 if (h3) {
124 h3->SetDirectory(0);
125 m_garbage.insert(h3);
126 }
127 //now call old function being sure not to fill a garbage set
128 return MonitoringFile::TGCSetMetaData(targetDir, h1, h2, h3);
129 }
static void TGCSetMetaData(TDirectory *targetDir, TH1 *h1, TH1 *h2=0, TH1 *h3=0)

Member Data Documentation

◆ m_error

bool dqutils::MonitoringFile::PostProcessorFileWrapper::m_error {}
private

Definition at line 240 of file MonitoringFile.h.

240{};

◆ m_garbage

std::set<TObject*> dqutils::MonitoringFile::PostProcessorFileWrapper::m_garbage
private

Definition at line 238 of file MonitoringFile.h.

◆ m_name

std::string dqutils::MonitoringFile::PostProcessorFileWrapper::m_name
private

Definition at line 239 of file MonitoringFile.h.


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