#include <ROOTFileWriter.h>
Public Member Functions | |
bool | CloseFile () |
void | FillTree (const HCAL_HLX::LUMI_SECTION &localSection) |
bool | OpenFile (const HCAL_HLX::LUMI_SECTION &lumiSection) |
bool | OpenFile (const unsigned int runNumber, const unsigned int sectionNumber) |
ROOTFileWriter () | |
void | SetMerge (const bool bMerge) |
~ROOTFileWriter () | |
Protected Member Functions | |
void | CreateTree () |
void | InsertInformation () |
template<class T > | |
void | MakeBranch (const T &in, T **out, int HLXNum) |
Protected Attributes | |
bool | bMerge_ |
TFile * | m_file |
TTree * | m_tree |
Definition at line 22 of file ROOTFileWriter.h.
HCAL_HLX::ROOTFileWriter::ROOTFileWriter | ( | ) |
Definition at line 21 of file ROOTFileWriter.cc.
References HCAL_HLX::ROOTFileBase::Init().
HCAL_HLX::ROOTFileWriter::~ROOTFileWriter | ( | ) |
Definition at line 26 of file ROOTFileWriter.cc.
{ CleanUp(); // ROOTFileBase }
bool HCAL_HLX::ROOTFileWriter::CloseFile | ( | ) |
void HCAL_HLX::ROOTFileWriter::CreateTree | ( | ) | [protected, virtual] |
Implements HCAL_HLX::ROOTFileBase.
Definition at line 53 of file ROOTFileWriter.cc.
{ m_tree = new TTree("LumiTree",""); Header_ = &(lumiSection_->hdr); Summary_ = &(lumiSection_->lumiSummary); Detail_ = &(lumiSection_->lumiDetail); m_tree->Bronch("Header.", "HCAL_HLX::LUMI_SECTION_HEADER", &Header_, 1); if( !bEtSumOnly_ ){ m_tree->Bronch("Summary.", "HCAL_HLX::LUMI_SUMMARY", &Summary_, 1); m_tree->Bronch("Detail.", "HCAL_HLX::LUMI_DETAIL", &Detail_, 1); } for( unsigned int iHLX = 0; iHLX < 36; ++iHLX ){ EtSumPtr_[iHLX] = &( lumiSection_->etSum[iHLX] ); MakeBranch(lumiSection_->etSum[iHLX], &EtSumPtr_[iHLX], iHLX); if( !bEtSumOnly_ ){ OccupancyPtr_[iHLX] = &(lumiSection_->occupancy[iHLX]); MakeBranch(lumiSection_->occupancy[iHLX], &OccupancyPtr_[iHLX], iHLX); LHCPtr_[iHLX] = &(lumiSection_->lhc[iHLX]); MakeBranch(lumiSection_->lhc[iHLX], &LHCPtr_[iHLX], iHLX); } } }
void HCAL_HLX::ROOTFileWriter::FillTree | ( | const HCAL_HLX::LUMI_SECTION & | localSection | ) |
Definition at line 106 of file ROOTFileWriter.cc.
{ memcpy( lumiSection_, &localSection, sizeof(HCAL_HLX::LUMI_SECTION)); m_tree->Fill(); }
void HCAL_HLX::ROOTFileWriter::InsertInformation | ( | ) | [protected] |
void HCAL_HLX::ROOTFileWriter::MakeBranch | ( | const T & | in, |
T ** | out, | ||
int | HLXNum | ||
) | [protected] |
Definition at line 83 of file ROOTFileWriter.cc.
References className(), mergeVDriftHistosByStation::name, and dbtoconf::out.
{ const std::string typeName = typeid(T).name(); std::string className; std::string branchName; std::ostringstream numString; if(typeName == "N8HCAL_HLX11LHC_SECTIONE"){ className = "HCAL_HLX::LHC_SECTION"; branchName = "LHC"; }else if(typeName == "N8HCAL_HLX17OCCUPANCY_SECTIONE"){ className = "HCAL_HLX::OCCUPANCY_SECTION"; branchName = "Occupancy"; }else if(typeName == "N8HCAL_HLX14ET_SUM_SECTIONE"){ className = "HCAL_HLX::ET_SUM_SECTION"; branchName = "ETSum"; } numString << std::setfill('0') << std::setw(2) << HLXNum; branchName = branchName + numString.str() + "."; m_tree->Bronch(branchName.c_str(), className.c_str(), out, 1); }
bool HCAL_HLX::ROOTFileWriter::OpenFile | ( | const unsigned int | runNumber, |
const unsigned int | sectionNumber | ||
) |
Definition at line 37 of file ROOTFileWriter.cc.
{ SetFileName( runNumber, sectionNumber); m_file = new TFile( (dirName_ + fileName_).c_str(), "RECREATE"); if( !m_file ){ return false; } m_file->cd(); CreateTree(); return true; }
bool HCAL_HLX::ROOTFileWriter::OpenFile | ( | const HCAL_HLX::LUMI_SECTION & | lumiSection | ) |
Definition at line 31 of file ROOTFileWriter.cc.
References HCAL_HLX::LUMI_SECTION::hdr, HCAL_HLX::LUMI_SECTION_HEADER::runNumber, and HCAL_HLX::LUMI_SECTION_HEADER::sectionNumber.
{ return OpenFile( localSection.hdr.runNumber, localSection.hdr.sectionNumber); }
void HCAL_HLX::ROOTFileWriter::SetMerge | ( | const bool | bMerge | ) | [inline] |
Definition at line 36 of file ROOTFileWriter.h.
References bMerge_.
Referenced by HCAL_HLX::ROOTFileMerger::ROOTFileMerger().
{ bMerge_ = bMerge; }
bool HCAL_HLX::ROOTFileWriter::bMerge_ [protected] |
Definition at line 49 of file ROOTFileWriter.h.
Referenced by SetMerge().
TFile* HCAL_HLX::ROOTFileWriter::m_file [protected] |
Definition at line 46 of file ROOTFileWriter.h.
TTree* HCAL_HLX::ROOTFileWriter::m_tree [protected] |
Definition at line 47 of file ROOTFileWriter.h.