00001 #include "otsdaq-core/RootUtilities/DQMHistosBase.h"
00002 #include "otsdaq-core/Macros/CoutHeaderMacros.h"
00003
00004 #include <TDirectory.h>
00005 #include <TFile.h>
00006 #include <TObject.h>
00007 #include <TStyle.h>
00008
00009 #include <iostream>
00010
00011 using namespace ots;
00012
00013
00014
00015 DQMHistosBase::DQMHistosBase(void)
00016 : theFile_ (0)
00017 , myDirectory_ (0)
00018 {
00019 gStyle->SetPalette(1);
00020 }
00021
00022
00023 DQMHistosBase::~DQMHistosBase(void)
00024 {
00025 closeFile();
00026 }
00027
00028
00029 void DQMHistosBase::openFile (std::string fileName)
00030 {
00031 closeFile();
00032 myDirectory_ = 0;
00033 theFile_ = TFile::Open(fileName.c_str(), "RECREATE");
00034 theFile_->cd();
00035 }
00036
00037
00038 void DQMHistosBase::save(void)
00039 {
00040 std::cout << __COUT_HDR_FL__ << __PRETTY_FUNCTION__ << "Saving file!" << std::endl;
00041 if (theFile_ != 0)
00042 theFile_->Write();
00043 }
00044
00045
00046 void DQMHistosBase::closeFile(void)
00047 {
00048 if (theFile_ != 0)
00049 {
00050 theFile_->Close();
00051 theFile_ = 0;
00052 }
00053 }
00054
00055
00056 TObject* DQMHistosBase::get(std::string name)
00057 {
00058 if (theFile_ != 0)
00059 return theFile_->Get(name.c_str());
00060 return 0;
00061 }