CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

HCAL_HLX::ROOTSchema Class Reference

#include <ROOTSchema.h>

Inheritance diagram for HCAL_HLX::ROOTSchema:
HCAL_HLX::TimeStamp FileToolKit

List of all members.

Public Member Functions

void EndRun ()
bool ProcessSection (const HCAL_HLX::LUMI_SECTION &lumiSection)
 ROOTSchema ()
void SetCreateWebPage (const bool bWBM)
void SetFileType (const std::string &fileType)
void SetHistoBins (const int NBins, const double XMin, const double XMax)
void SetLSDir (const std::string &lsDir)
void SetMergeDir (const std::string &mergeDir)
void SetMergeFiles (const bool bMerge)
void SetTransferFiles (const bool bTransfer)
void SetWebDir (const std::string &webDir)
 ~ROOTSchema ()

Private Member Functions

void SetEtSumOnly (const bool bEtSumOnly)

Private Attributes

bool bEtSumOnly_
bool bMerge_
bool bTransfer_
bool bWBM_
std::string dateDir_
std::string fileType_
unsigned int firstSectionNumber_
std::string lsDir_
HCAL_HLX::HTMLGenerator * LumiHTML_
std::string mergeDir_
unsigned int previousRun_
HCAL_HLX::ROOTFileMergerRFMerger_
HCAL_HLX::ROOTFileTransferRFTransfer_
HCAL_HLX::ROOTFileWriterRFWriter_
std::string runDir_
unsigned int startTime_

Detailed Description

Definition at line 25 of file ROOTSchema.h.


Constructor & Destructor Documentation

HCAL_HLX::ROOTSchema::ROOTSchema ( )

Definition at line 25 of file ROOTSchema.cc.

References LumiHTML_, RFMerger_, RFTransfer_, and RFWriter_.

                              :RFMerger_(NULL), RFTransfer_(NULL),
                                   LumiHTML_(NULL), RFWriter_(NULL),
                                   previousRun_(0), firstSectionNumber_(0),
                                   startTime_(0),
                                   bMerge_(0), bWBM_(0), bTransfer_(0),
                                   bEtSumOnly_(false),
                                   fileType_("RAW"),
                                   lsDir_(""),
                                   mergeDir_(""),
                                   dateDir_(""),
                                   runDir_("")
{

  // Allocate memory for private members.
  RFWriter_   = new ROOTFileWriter;
  if( !RFWriter_ ){
    //Could not allocate memory.
  }
  RFMerger_   = new ROOTFileMerger;
  if( !RFMerger_ ){
    //Could not allocate memory.
  }
  RFTransfer_ = new ROOTFileTransfer;
  if( !RFTransfer_ ){
    // Could not allocate memory.
  }
  LumiHTML_ = new HTMLGenerator;
  if( !LumiHTML_ ){
    // Could not allocate memory.
  }
}
HCAL_HLX::ROOTSchema::~ROOTSchema ( )

Definition at line 57 of file ROOTSchema.cc.

                               {
  // Deallocate memory for private members.

  EndRun();

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

  if( RFMerger_ ){
    delete RFMerger_;
    RFMerger_ = 0;
  }

  if( RFTransfer_ ){
    delete RFTransfer_;
    RFTransfer_ = 0;
  }

  if( LumiHTML_ ){
    delete LumiHTML_;
    LumiHTML_ = 0;
  }
}

Member Function Documentation

void HCAL_HLX::ROOTSchema::EndRun ( )
bool HCAL_HLX::ROOTSchema::ProcessSection ( const HCAL_HLX::LUMI_SECTION lumiSection)

Definition at line 178 of file ROOTSchema.cc.

References HCAL_HLX::LUMI_SECTION::hdr, HCAL_HLX::LUMI_SECTION_HEADER::runNumber, HCAL_HLX::LUMI_SECTION_HEADER::sectionNumber, and HCAL_HLX::LUMI_SECTION_HEADER::timestamp.

                                                                              {

  if( (previousRun_) != (lumiSection.hdr.runNumber) ){
    EndRun();
    
    // Keep track of run information.
    previousRun_        = lumiSection.hdr.runNumber;
    firstSectionNumber_ = lumiSection.hdr.sectionNumber;
    startTime_          = lumiSection.hdr.timestamp;

    RFWriter_->SetDate( TimeStampYYYYMMDD( startTime_ ));
    RFMerger_->SetDate( TimeStampYYYYMMDD( startTime_ ));
     
    // Create directory structure for the new run.
    std::stringstream runDirss;
    runDirss.str(std::string(""));
    dateDir_ = TimeStampYYYYMM( startTime_ ) + "/";
    runDirss << std::setw(9) << std::setfill('0') << previousRun_ << "/";
    runDir_ = runDirss.str();

    MakeDir( lsDir_ + dateDir_ + runDir_ , 0775);
    RFWriter_->SetDir( lsDir_ + dateDir_ + runDir_ );

    RFMerger_->SetInputDir(  lsDir_ + dateDir_ + runDir_ );
    MakeDir( mergeDir_ + dateDir_ , 0775);
    RFMerger_->SetOutputDir( mergeDir_ + dateDir_ );

    LumiHTML_->SetInputDir(  lsDir_ + dateDir_ + runDir_ );
    RFTransfer_->SetInputDir( mergeDir_ + dateDir_ );
  }

  // Write individual lumi section files.
  RFWriter_->OpenFile( lumiSection );
  RFWriter_->FillTree( lumiSection );
  RFWriter_->CloseFile();

  // Create a web page.
  if( bWBM_ ){
    LumiHTML_->CreateWebPage( RFWriter_->GetFileName(), 0 );
  }
  return true;
}
void HCAL_HLX::ROOTSchema::SetCreateWebPage ( const bool  bWBM)

Definition at line 161 of file ROOTSchema.cc.

                                                        {

  bWBM_ = bWBM;
}
void HCAL_HLX::ROOTSchema::SetEtSumOnly ( const bool  bEtSumOnly) [private]

Definition at line 87 of file ROOTSchema.cc.

                                                          {
  
  bEtSumOnly_ = bEtSumOnly;
}
void HCAL_HLX::ROOTSchema::SetFileType ( const std::string &  fileType)

Definition at line 92 of file ROOTSchema.cc.

                                                               {

  if( fileType_ != fileType ){
    fileType_ = fileType;
    if(  (fileType_ != "RAW") && (fileType_ != "VDM") && (fileType_ != "ET") ){
      fileType_ = "RAW";  // Default to RAW.
    }
    
    if( fileType_ != "ET" && bEtSumOnly_ ){
      bEtSumOnly_ = false;
    }
    if( fileType_ == "ET" && !bEtSumOnly_ ){
      bEtSumOnly_ = true;
    }

    RFWriter_->SetEtSumOnly( bEtSumOnly_ );
    LumiHTML_->SetEtSumOnly( bEtSumOnly_ );
    RFMerger_->SetEtSumOnly( bEtSumOnly_ );
    RFTransfer_->SetEtSumOnly( bEtSumOnly_ );

    RFWriter_->SetFileType(fileType_);
    LumiHTML_->SetFileType(fileType_);
    RFMerger_->SetFileType(fileType_);
    RFTransfer_->SetFileType(fileType_);

  }

}
void HCAL_HLX::ROOTSchema::SetHistoBins ( const int  NBins,
const double  XMin,
const double  XMax 
)

Definition at line 171 of file ROOTSchema.cc.

                                                                                          {

  LumiHTML_->SetHistoBins( NBins, XMin, XMax );
}
void HCAL_HLX::ROOTSchema::SetLSDir ( const std::string &  lsDir)

Definition at line 123 of file ROOTSchema.cc.

                                                        {
  
  lsDir_ = lsDir;
  if( lsDir_.substr( lsDir_.size() - 1) != "/" ){
    lsDir_ += "/";
  }
}
void HCAL_HLX::ROOTSchema::SetMergeDir ( const std::string &  mergeDir)

Definition at line 141 of file ROOTSchema.cc.

                                                              {

  mergeDir_ = mergeDir;
  if( mergeDir_.substr( mergeDir_.size() - 1) != "/" ){
    mergeDir_ += "/";
  }
}
void HCAL_HLX::ROOTSchema::SetMergeFiles ( const bool  bMerge)

Definition at line 133 of file ROOTSchema.cc.

                                                 {
  
  bMerge_ = bMerge;
  if( !bMerge_ ){
    bTransfer_ = false;
  } 
}
void HCAL_HLX::ROOTSchema::SetTransferFiles ( const bool  bTransfer)

Definition at line 151 of file ROOTSchema.cc.

                                                             {

  bTransfer_ = bTransfer;
  if( bTransfer_ ){
    bMerge_ = true;
  }
}
void HCAL_HLX::ROOTSchema::SetWebDir ( const std::string &  webDir)

Definition at line 166 of file ROOTSchema.cc.

                                                         {

  LumiHTML_->SetOutputDir( webDir );
}

Member Data Documentation

Definition at line 63 of file ROOTSchema.h.

Definition at line 59 of file ROOTSchema.h.

Definition at line 61 of file ROOTSchema.h.

Definition at line 60 of file ROOTSchema.h.

std::string HCAL_HLX::ROOTSchema::dateDir_ [private]

Definition at line 69 of file ROOTSchema.h.

std::string HCAL_HLX::ROOTSchema::fileType_ [private]

Definition at line 64 of file ROOTSchema.h.

Definition at line 56 of file ROOTSchema.h.

std::string HCAL_HLX::ROOTSchema::lsDir_ [private]

Definition at line 66 of file ROOTSchema.h.

HCAL_HLX::HTMLGenerator* HCAL_HLX::ROOTSchema::LumiHTML_ [private]

Definition at line 52 of file ROOTSchema.h.

Referenced by ROOTSchema().

std::string HCAL_HLX::ROOTSchema::mergeDir_ [private]

Definition at line 67 of file ROOTSchema.h.

unsigned int HCAL_HLX::ROOTSchema::previousRun_ [private]

Definition at line 55 of file ROOTSchema.h.

Definition at line 50 of file ROOTSchema.h.

Referenced by ROOTSchema().

Definition at line 51 of file ROOTSchema.h.

Referenced by ROOTSchema().

Definition at line 53 of file ROOTSchema.h.

Referenced by ROOTSchema().

std::string HCAL_HLX::ROOTSchema::runDir_ [private]

Definition at line 70 of file ROOTSchema.h.

unsigned int HCAL_HLX::ROOTSchema::startTime_ [private]

Definition at line 57 of file ROOTSchema.h.