CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
HCAL_HLX::ROOTFileMerger Class Reference

#include <ROOTFileMerger.h>

Public Member Functions

std::string GetInputFileName ()
 
std::string GetOutputFileName ()
 
bool Merge (const unsigned int runNumber, const unsigned int minSecNum)
 
 ROOTFileMerger ()
 
void SetDate (const std::string &date)
 
void SetEtSumOnly (const bool bEtSumOnly)
 
void SetFileType (const std::string &fileType)
 
void SetInputDir (const std::string &inputDir)
 
void SetOutputDir (const std::string &outputDir)
 
 ~ROOTFileMerger ()
 

Private Attributes

LUMI_SECTIONlumiSection_
 
unsigned int minSectionNumber_
 
ROOTFileReaderRFReader_
 
ROOTFileWriterRFWriter_
 

Detailed Description

Definition at line 14 of file ROOTFileMerger.h.

Constructor & Destructor Documentation

HCAL_HLX::ROOTFileMerger::ROOTFileMerger ( )

Definition at line 13 of file ROOTFileMerger.cc.

References lumiSection_, NULL, RFReader_, RFWriter_, and HCAL_HLX::ROOTFileWriter::SetMerge().

13  :minSectionNumber_(99999)
14 {
15 
16  RFWriter_ = NULL;
17  RFReader_ = NULL;
19 
20  RFWriter_ = new ROOTFileWriter;
21  if( RFWriter_ == 0 ){
22  // Could not allocate memory.
23  // Do something.
24  }
25 
26  RFReader_ = new ROOTFileReader;
27  if( RFReader_ == 0 ){
28  // Could not allocate memory.
29  // Do something.
30  }
31 
33  if( lumiSection_ == 0 ){
34  // Could not allocate memory.
35  // Do something.
36  }
37 
38  RFWriter_->SetMerge(true);
39 }
ROOTFileWriter * RFWriter_
void SetMerge(const bool bMerge)
#define NULL
Definition: scimark2.h:8
ROOTFileReader * RFReader_
unsigned int minSectionNumber_
LUMI_SECTION * lumiSection_
HCAL_HLX::ROOTFileMerger::~ROOTFileMerger ( )

Definition at line 41 of file ROOTFileMerger.cc.

41  {
42 
43  if( RFWriter_ != 0){
44  delete RFWriter_;
45  }
46 
47  if( RFReader_ != 0){
48  delete RFReader_;
49  }
50 
51  if( lumiSection_ !=0 ){
52  delete lumiSection_;
53  }
54 }
ROOTFileWriter * RFWriter_
ROOTFileReader * RFReader_
LUMI_SECTION * lumiSection_

Member Function Documentation

std::string HCAL_HLX::ROOTFileMerger::GetInputFileName ( )
std::string HCAL_HLX::ROOTFileMerger::GetOutputFileName ( )

Definition at line 95 of file ROOTFileMerger.cc.

95  {
96 
97  return RFWriter_->GetFileName();
98 }
std::string GetFileName()
Definition: ROOTFileBase.h:44
ROOTFileWriter * RFWriter_
bool HCAL_HLX::ROOTFileMerger::Merge ( const unsigned int  runNumber,
const unsigned int  minSecNum 
)

Definition at line 56 of file ROOTFileMerger.cc.

56  {
57 
58  /*
59  TChain::Merge and TTree::CloneTree leak because we used TTree::Bronch to create the tree.
60  */
61 
63 
64  // RFWriter_->SetFileName(runNumber, firstSectionNumber);
65  RFWriter_->OpenFile(runNumber, minSectionNumber);
66 
67  unsigned int nentries = RFReader_->GetEntries();
68  if( nentries == 0 ){
70  return false;
71  }
72 
73  for(unsigned int iEntry = 0; iEntry < nentries; ++iEntry ){
74  memset( lumiSection_, 0, sizeof(LUMI_SECTION));
75  RFReader_->GetEntry(iEntry);
77 
78  // Must fill Threshold eventually right now it contains fake data.
80  }
81 
82  return RFWriter_->CloseFile();
83 }
bool OpenFile(const HCAL_HLX::LUMI_SECTION &lumiSection)
ROOTFileWriter * RFWriter_
ROOTFileReader * RFReader_
void FillTree(const HCAL_HLX::LUMI_SECTION &localSection)
int GetLumiSection(HCAL_HLX::LUMI_SECTION &section)
LUMI_SECTION * lumiSection_
void HCAL_HLX::ROOTFileMerger::SetDate ( const std::string &  date)

Definition at line 112 of file ROOTFileMerger.cc.

112  {
113 
114  RFWriter_->SetDate( date );
115  RFReader_->SetDate( date );
116 }
ROOTFileWriter * RFWriter_
ROOTFileReader * RFReader_
void SetDate(const std::string &date)
Definition: ROOTFileBase.cc:50
void HCAL_HLX::ROOTFileMerger::SetEtSumOnly ( const bool  bEtSumOnly)

Definition at line 100 of file ROOTFileMerger.cc.

100  {
101 
102  RFWriter_->SetEtSumOnly(bEtSumOnly);
103  RFReader_->SetEtSumOnly(bEtSumOnly);
104 }
ROOTFileWriter * RFWriter_
ROOTFileReader * RFReader_
void SetEtSumOnly(bool bEtSumOnly)
Definition: ROOTFileBase.cc:76
void HCAL_HLX::ROOTFileMerger::SetFileType ( const std::string &  fileType)

Definition at line 106 of file ROOTFileMerger.cc.

106  {
107 
108  RFWriter_->SetFileType( fileType );
109  RFReader_->SetFileType( fileType );
110 }
ROOTFileWriter * RFWriter_
void SetFileType(const std::string &type)
Definition: ROOTFileBase.cc:45
ROOTFileReader * RFReader_
void HCAL_HLX::ROOTFileMerger::SetInputDir ( const std::string &  inputDir)

Definition at line 85 of file ROOTFileMerger.cc.

85  {
86 
88 }
ROOTFileReader * RFReader_
void SetDir(const std::string &dir)
Definition: ROOTFileBase.cc:40
void HCAL_HLX::ROOTFileMerger::SetOutputDir ( const std::string &  outputDir)

Definition at line 90 of file ROOTFileMerger.cc.

90  {
91 
93 }
ROOTFileWriter * RFWriter_
void SetDir(const std::string &dir)
Definition: ROOTFileBase.cc:40

Member Data Documentation

LUMI_SECTION* HCAL_HLX::ROOTFileMerger::lumiSection_
private

Definition at line 38 of file ROOTFileMerger.h.

Referenced by ROOTFileMerger().

unsigned int HCAL_HLX::ROOTFileMerger::minSectionNumber_
private

Definition at line 33 of file ROOTFileMerger.h.

ROOTFileReader* HCAL_HLX::ROOTFileMerger::RFReader_
private

Definition at line 36 of file ROOTFileMerger.h.

Referenced by ROOTFileMerger().

ROOTFileWriter* HCAL_HLX::ROOTFileMerger::RFWriter_
private

Definition at line 35 of file ROOTFileMerger.h.

Referenced by ROOTFileMerger().