CMS 3D CMS Logo

Public Member Functions | Private Attributes

HCAL_HLX::ROOTFileMerger Class Reference

#include <ROOTFileMerger.h>

List of all members.

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().

                                      :minSectionNumber_(99999)
{

  RFWriter_    = NULL;
  RFReader_    = NULL;
  lumiSection_ = NULL;

  RFWriter_ = new ROOTFileWriter;
  if( RFWriter_ == 0 ){
    // Could not allocate memory.
    // Do something.
  }

  RFReader_ = new ROOTFileReader; 
  if( RFReader_ == 0 ){
    // Could not allocate memory.
    // Do something.
  }

  lumiSection_ = new HCAL_HLX::LUMI_SECTION;
  if( lumiSection_ == 0 ){
    // Could not allocate memory.
    // Do something.
  }

  RFWriter_->SetMerge(true);
}
HCAL_HLX::ROOTFileMerger::~ROOTFileMerger ( )

Definition at line 41 of file ROOTFileMerger.cc.

                                       {

  if( RFWriter_ != 0){
    delete RFWriter_;
  }
  
  if( RFReader_ != 0){
    delete RFReader_;
  }

  if( lumiSection_ !=0 ){
    delete lumiSection_;
  }
}

Member Function Documentation

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

Definition at line 95 of file ROOTFileMerger.cc.

                                                   {

  return RFWriter_->GetFileName();
}
bool HCAL_HLX::ROOTFileMerger::Merge ( const unsigned int  runNumber,
const unsigned int  minSecNum 
)

Definition at line 56 of file ROOTFileMerger.cc.

                                                                                                    {

    /*
      TChain::Merge and TTree::CloneTree leak because we used TTree::Bronch to create the tree.
    */
  
  RFReader_->CreateFileNameList();
  
  // RFWriter_->SetFileName(runNumber, firstSectionNumber);
  RFWriter_->OpenFile(runNumber, minSectionNumber);
  
  unsigned int nentries = RFReader_->GetEntries();
  if( nentries == 0 ){
    RFWriter_->CloseFile();
    return false;
  }
  
  for(unsigned int iEntry = 0; iEntry < nentries; ++iEntry ){
    memset( lumiSection_, 0, sizeof(LUMI_SECTION));
    RFReader_->GetEntry(iEntry);
    RFReader_->GetLumiSection(*lumiSection_);
    
    // Must fill Threshold eventually  right now it contains fake data.
    RFWriter_->FillTree(*lumiSection_);
  }
  
  return RFWriter_->CloseFile();
}
void HCAL_HLX::ROOTFileMerger::SetDate ( const std::string &  date)

Definition at line 112 of file ROOTFileMerger.cc.

                                                           {
  
  RFWriter_->SetDate( date );
  RFReader_->SetDate( date );
}  
void HCAL_HLX::ROOTFileMerger::SetEtSumOnly ( const bool  bEtSumOnly)

Definition at line 100 of file ROOTFileMerger.cc.

                                                        {

  RFWriter_->SetEtSumOnly(bEtSumOnly);
  RFReader_->SetEtSumOnly(bEtSumOnly);
}
void HCAL_HLX::ROOTFileMerger::SetFileType ( const std::string &  fileType)

Definition at line 106 of file ROOTFileMerger.cc.

                                                                   {

  RFWriter_->SetFileType( fileType );
  RFReader_->SetFileType( fileType );
}
void HCAL_HLX::ROOTFileMerger::SetInputDir ( const std::string &  inputDir)

Definition at line 85 of file ROOTFileMerger.cc.

                                                                 {

  RFReader_->SetDir(dirName);
}
void HCAL_HLX::ROOTFileMerger::SetOutputDir ( const std::string &  outputDir)

Definition at line 90 of file ROOTFileMerger.cc.

                                                                 {

  RFWriter_->SetDir(dirName);
}

Member Data Documentation

Definition at line 38 of file ROOTFileMerger.h.

Referenced by ROOTFileMerger().

Definition at line 33 of file ROOTFileMerger.h.

Definition at line 36 of file ROOTFileMerger.h.

Referenced by ROOTFileMerger().

Definition at line 35 of file ROOTFileMerger.h.

Referenced by ROOTFileMerger().