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 Member Functions | Private Attributes
HCAL_HLX::ROOTSchema Class Reference

#include <ROOTSchema.h>

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

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 Member Functions inherited from HCAL_HLX::TimeStamp
std::string TimeStampLong (time_t rawtime=0)
 
std::string TimeStampYYYYMM (time_t rawtime=0)
 
std::string TimeStampYYYYMMDD (time_t rawtime=0)
 
- Private Member Functions inherited from FileToolKit
bool fileExists (const std::string &fileName)
 
 FileToolKit ()
 
void InsertLineAfter (const std::string &fileName, const std::string &newLine, const std::string &searchLine)
 
void InsertLineBefore (const std::string &fileName, const std::string &newLine, const std::string &searchLine)
 
int MakeDir (std::string dirName, mode_t writeMode)
 
void MakeEmptyWebPage (const std::string &fileName, const std::string &title)
 
void Tokenize (const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters=std::string(" "))
 
 ~FileToolKit ()
 

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_.

28  startTime_(0),
29  bMerge_(0), bWBM_(0), bTransfer_(0),
30  bEtSumOnly_(false),
31  fileType_("RAW"),
32  lsDir_(""),
33  mergeDir_(""),
34  dateDir_(""),
35  runDir_("")
36 {
37 
38  // Allocate memory for private members.
39  RFWriter_ = new ROOTFileWriter;
40  if( !RFWriter_ ){
41  //Could not allocate memory.
42  }
43  RFMerger_ = new ROOTFileMerger;
44  if( !RFMerger_ ){
45  //Could not allocate memory.
46  }
47  RFTransfer_ = new ROOTFileTransfer;
48  if( !RFTransfer_ ){
49  // Could not allocate memory.
50  }
51  LumiHTML_ = new HTMLGenerator;
52  if( !LumiHTML_ ){
53  // Could not allocate memory.
54  }
55 }
unsigned int firstSectionNumber_
Definition: ROOTSchema.h:56
HCAL_HLX::ROOTFileMerger * RFMerger_
Definition: ROOTSchema.h:50
unsigned int previousRun_
Definition: ROOTSchema.h:55
HCAL_HLX::ROOTFileTransfer * RFTransfer_
Definition: ROOTSchema.h:51
#define NULL
Definition: scimark2.h:8
HCAL_HLX::HTMLGenerator * LumiHTML_
Definition: ROOTSchema.h:52
std::string mergeDir_
Definition: ROOTSchema.h:67
HCAL_HLX::ROOTFileWriter * RFWriter_
Definition: ROOTSchema.h:53
std::string runDir_
Definition: ROOTSchema.h:70
std::string dateDir_
Definition: ROOTSchema.h:69
std::string fileType_
Definition: ROOTSchema.h:64
unsigned int startTime_
Definition: ROOTSchema.h:57
std::string lsDir_
Definition: ROOTSchema.h:66
HCAL_HLX::ROOTSchema::~ROOTSchema ( )

Definition at line 57 of file ROOTSchema.cc.

57  {
58  // Deallocate memory for private members.
59 
60  EndRun();
61 
62  if( RFWriter_ ){
63  delete RFWriter_;
64  RFWriter_ = 0;
65  }
66 
67  if( RFMerger_ ){
68  delete RFMerger_;
69  RFMerger_ = 0;
70  }
71 
72  if( RFTransfer_ ){
73  delete RFTransfer_;
74  RFTransfer_ = 0;
75  }
76 
77  if( LumiHTML_ ){
78  delete LumiHTML_;
79  LumiHTML_ = 0;
80  }
81 }
HCAL_HLX::ROOTFileMerger * RFMerger_
Definition: ROOTSchema.h:50
HCAL_HLX::ROOTFileTransfer * RFTransfer_
Definition: ROOTSchema.h:51
HCAL_HLX::HTMLGenerator * LumiHTML_
Definition: ROOTSchema.h:52
HCAL_HLX::ROOTFileWriter * RFWriter_
Definition: ROOTSchema.h:53

Member Function Documentation

void HCAL_HLX::ROOTSchema::EndRun ( )

Definition at line 221 of file ROOTSchema.cc.

221  {
222 
223  if( previousRun_ != 0 ){
224  if( bMerge_ ){
226 
227  if( bTransfer_ ){
230  }
231  }
232  previousRun_ = 0;
233  }
234 }
bool Merge(const unsigned int runNumber, const unsigned int minSecNum)
void SetFileName(const std::string &fileName)
unsigned int firstSectionNumber_
Definition: ROOTSchema.h:56
HCAL_HLX::ROOTFileMerger * RFMerger_
Definition: ROOTSchema.h:50
unsigned int previousRun_
Definition: ROOTSchema.h:55
HCAL_HLX::ROOTFileTransfer * RFTransfer_
Definition: ROOTSchema.h:51
std::string GetOutputFileName()
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.

178  {
179 
180  if( (previousRun_) != (lumiSection.hdr.runNumber) ){
181  EndRun();
182 
183  // Keep track of run information.
184  previousRun_ = lumiSection.hdr.runNumber;
185  firstSectionNumber_ = lumiSection.hdr.sectionNumber;
186  startTime_ = lumiSection.hdr.timestamp;
187 
190 
191  // Create directory structure for the new run.
192  std::stringstream runDirss;
193  runDirss.str(std::string(""));
195  runDirss << std::setw(9) << std::setfill('0') << previousRun_ << "/";
196  runDir_ = runDirss.str();
197 
198  MakeDir( lsDir_ + dateDir_ + runDir_ , 0775);
200 
202  MakeDir( mergeDir_ + dateDir_ , 0775);
204 
205  LumiHTML_->SetInputDir( lsDir_ + dateDir_ + runDir_ );
207  }
208 
209  // Write individual lumi section files.
210  RFWriter_->OpenFile( lumiSection );
211  RFWriter_->FillTree( lumiSection );
212  RFWriter_->CloseFile();
213 
214  // Create a web page.
215  if( bWBM_ ){
216  LumiHTML_->CreateWebPage( RFWriter_->GetFileName(), 0 );
217  }
218  return true;
219 }
std::string GetFileName()
Definition: ROOTFileBase.h:44
void SetInputDir(const std::string &inputDir)
unsigned int firstSectionNumber_
Definition: ROOTSchema.h:56
bool OpenFile(const HCAL_HLX::LUMI_SECTION &lumiSection)
HCAL_HLX::ROOTFileMerger * RFMerger_
Definition: ROOTSchema.h:50
unsigned int previousRun_
Definition: ROOTSchema.h:55
HCAL_HLX::ROOTFileTransfer * RFTransfer_
Definition: ROOTSchema.h:51
void SetInputDir(const std::string &dirName)
HCAL_HLX::HTMLGenerator * LumiHTML_
Definition: ROOTSchema.h:52
void SetOutputDir(const std::string &outputDir)
std::string mergeDir_
Definition: ROOTSchema.h:67
int MakeDir(std::string dirName, mode_t writeMode)
Definition: FileToolKit.cc:38
void FillTree(const HCAL_HLX::LUMI_SECTION &localSection)
HCAL_HLX::ROOTFileWriter * RFWriter_
Definition: ROOTSchema.h:53
void SetDate(const std::string &date)
std::string runDir_
Definition: ROOTSchema.h:70
void SetDir(const std::string &dir)
Definition: ROOTFileBase.cc:40
std::string dateDir_
Definition: ROOTSchema.h:69
std::string TimeStampYYYYMM(time_t rawtime=0)
Definition: TimeStamp.cc:14
std::string TimeStampYYYYMMDD(time_t rawtime=0)
Definition: TimeStamp.cc:20
unsigned int startTime_
Definition: ROOTSchema.h:57
void SetDate(const std::string &date)
Definition: ROOTFileBase.cc:50
std::string lsDir_
Definition: ROOTSchema.h:66
void HCAL_HLX::ROOTSchema::SetCreateWebPage ( const bool  bWBM)

Definition at line 161 of file ROOTSchema.cc.

161  {
162 
163  bWBM_ = bWBM;
164 }
void HCAL_HLX::ROOTSchema::SetEtSumOnly ( const bool  bEtSumOnly)
private

Definition at line 87 of file ROOTSchema.cc.

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

Definition at line 92 of file ROOTSchema.cc.

92  {
93 
94  if( fileType_ != fileType ){
95  fileType_ = fileType;
96  if( (fileType_ != "RAW") && (fileType_ != "VDM") && (fileType_ != "ET") ){
97  fileType_ = "RAW"; // Default to RAW.
98  }
99 
100  if( fileType_ != "ET" && bEtSumOnly_ ){
101  bEtSumOnly_ = false;
102  }
103  if( fileType_ == "ET" && !bEtSumOnly_ ){
104  bEtSumOnly_ = true;
105  }
106 
108  LumiHTML_->SetEtSumOnly( bEtSumOnly_ );
111 
113  LumiHTML_->SetFileType(fileType_);
116 
117  }
118 
119 }
void SetFileType(const std::string &fileType)
void SetFileType(const std::string &fileType)
void SetFileType(const std::string &type)
Definition: ROOTFileBase.cc:45
HCAL_HLX::ROOTFileMerger * RFMerger_
Definition: ROOTSchema.h:50
HCAL_HLX::ROOTFileTransfer * RFTransfer_
Definition: ROOTSchema.h:51
HCAL_HLX::HTMLGenerator * LumiHTML_
Definition: ROOTSchema.h:52
void SetEtSumOnly(const bool &bEtSumOnly)
HCAL_HLX::ROOTFileWriter * RFWriter_
Definition: ROOTSchema.h:53
void SetEtSumOnly(const bool bEtSumOnly)
void SetEtSumOnly(bool bEtSumOnly)
Definition: ROOTFileBase.cc:76
std::string fileType_
Definition: ROOTSchema.h:64
void HCAL_HLX::ROOTSchema::SetHistoBins ( const int  NBins,
const double  XMin,
const double  XMax 
)

Definition at line 171 of file ROOTSchema.cc.

171  {
172 
173  LumiHTML_->SetHistoBins( NBins, XMin, XMax );
174 }
HCAL_HLX::HTMLGenerator * LumiHTML_
Definition: ROOTSchema.h:52
void HCAL_HLX::ROOTSchema::SetLSDir ( const std::string &  lsDir)

Definition at line 123 of file ROOTSchema.cc.

123  {
124 
125  lsDir_ = lsDir;
126  if( lsDir_.substr( lsDir_.size() - 1) != "/" ){
127  lsDir_ += "/";
128  }
129 }
std::string lsDir_
Definition: ROOTSchema.h:66
void HCAL_HLX::ROOTSchema::SetMergeDir ( const std::string &  mergeDir)

Definition at line 141 of file ROOTSchema.cc.

141  {
142 
143  mergeDir_ = mergeDir;
144  if( mergeDir_.substr( mergeDir_.size() - 1) != "/" ){
145  mergeDir_ += "/";
146  }
147 }
std::string mergeDir_
Definition: ROOTSchema.h:67
void HCAL_HLX::ROOTSchema::SetMergeFiles ( const bool  bMerge)

Definition at line 133 of file ROOTSchema.cc.

133  {
134 
135  bMerge_ = bMerge;
136  if( !bMerge_ ){
137  bTransfer_ = false;
138  }
139 }
void HCAL_HLX::ROOTSchema::SetTransferFiles ( const bool  bTransfer)

Definition at line 151 of file ROOTSchema.cc.

151  {
152 
153  bTransfer_ = bTransfer;
154  if( bTransfer_ ){
155  bMerge_ = true;
156  }
157 }
void HCAL_HLX::ROOTSchema::SetWebDir ( const std::string &  webDir)

Definition at line 166 of file ROOTSchema.cc.

166  {
167 
168  LumiHTML_->SetOutputDir( webDir );
169 }
HCAL_HLX::HTMLGenerator * LumiHTML_
Definition: ROOTSchema.h:52

Member Data Documentation

bool HCAL_HLX::ROOTSchema::bEtSumOnly_
private

Definition at line 63 of file ROOTSchema.h.

bool HCAL_HLX::ROOTSchema::bMerge_
private

Definition at line 59 of file ROOTSchema.h.

bool HCAL_HLX::ROOTSchema::bTransfer_
private

Definition at line 61 of file ROOTSchema.h.

bool HCAL_HLX::ROOTSchema::bWBM_
private

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.

unsigned int HCAL_HLX::ROOTSchema::firstSectionNumber_
private

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.

HCAL_HLX::ROOTFileMerger* HCAL_HLX::ROOTSchema::RFMerger_
private

Definition at line 50 of file ROOTSchema.h.

Referenced by ROOTSchema().

HCAL_HLX::ROOTFileTransfer* HCAL_HLX::ROOTSchema::RFTransfer_
private

Definition at line 51 of file ROOTSchema.h.

Referenced by ROOTSchema().

HCAL_HLX::ROOTFileWriter* HCAL_HLX::ROOTSchema::RFWriter_
private

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.