$treeview $search $mathjax $extrastylesheet
otsdaq
v2_03_00
$projectbrief
|
$projectbrief
|
$searchbox |
00001 #include "otsdaq-core/RootUtilities/DQMHistosBase.h" 00002 #include "otsdaq-core/Macros/CoutMacros.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 DQMHistosBase::DQMHistosBase(void) : theFile_(0), myDirectory_(0) 00015 { 00016 gStyle->SetPalette(1); 00017 } 00018 00019 //======================================================================================================================== 00020 DQMHistosBase::~DQMHistosBase(void) { closeFile(); } 00021 00022 //======================================================================================================================== 00023 void DQMHistosBase::openFile(std::string fileName) 00024 { 00025 closeFile(); 00026 myDirectory_ = 0; 00027 theFile_ = TFile::Open(fileName.c_str(), "RECREATE"); 00028 theFile_->cd(); 00029 } 00030 00031 //======================================================================================================================== 00032 void DQMHistosBase::save(void) 00033 { 00034 std::cout << __COUT_HDR_FL__ << __PRETTY_FUNCTION__ << "Saving file!" << std::endl; 00035 if(theFile_ != 0) 00036 theFile_->Write(); 00037 } 00038 00039 //======================================================================================================================== 00040 void DQMHistosBase::closeFile(void) 00041 { 00042 if(theFile_ != 0) 00043 { 00044 theFile_->Close(); 00045 theFile_ = 0; 00046 } 00047 } 00048 00049 //======================================================================================================================== 00050 TObject* DQMHistosBase::get(std::string name) 00051 { 00052 if(theFile_ != 0) 00053 return theFile_->Get(name.c_str()); 00054 return 0; 00055 }