CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch2/src/RecoLuminosity/ROOTSchema/src/ROOTFileBase.cc

Go to the documentation of this file.
00001 #include "RecoLuminosity/ROOTSchema/interface/ROOTFileBase.h"
00002 #include "RecoLuminosity/TCPReceiver/interface/LumiStructures.hh"
00003 
00004 #include <sstream>
00005 #include <typeinfo>
00006 #include <iomanip>
00007 #include <vector>
00008 #include <ctime>
00009 
00010 #include <stddef.h>
00011 
00012 // mkdir
00013 #include <sys/types.h>
00014 #include <sys/stat.h>
00015 
00016 #include <TROOT.h>
00017 #include <TChain.h>
00018 #include <TTree.h>
00019 #include <TFile.h>
00020 
00021 HCAL_HLX::ROOTFileBase::ROOTFileBase():filePrefix_("CMS_LUMI_RAW"),
00022                                        dirName_("./"),
00023                                        bEtSumOnly_(false),
00024                                        date_(""),
00025                                        fileType_("RAW")
00026 {}
00027 
00028 HCAL_HLX::ROOTFileBase::~ROOTFileBase(){}
00029 
00030 void HCAL_HLX::ROOTFileBase::Init(){
00031 
00032   lumiSection_     = new HCAL_HLX::LUMI_SECTION;
00033 }
00034 
00035 void HCAL_HLX::ROOTFileBase::CleanUp(){
00036 
00037   delete lumiSection_;
00038 }
00039 
00040 void HCAL_HLX::ROOTFileBase::SetDir(const std::string& dirName){
00041 
00042   dirName_ = dirName;
00043 }
00044 
00045 void HCAL_HLX::ROOTFileBase::SetFileType(const std::string &fileType){
00046   
00047   fileType_ = fileType;
00048 }
00049 
00050 void HCAL_HLX::ROOTFileBase::SetDate(const std::string &date){
00051 
00052   date_ = date;
00053 }
00054 
00055 void HCAL_HLX::ROOTFileBase::SetFileName(const unsigned int runNumber, 
00056                                          const unsigned int sectionNumber ){
00057   
00058   std::stringstream fileName;
00059   fileName.str(std::string());
00060   
00061   fileName << "CMS_LUMI_" << fileType_ << "_" << date_ << "_"
00062            << std::setfill('0') << std::setw(9) << runNumber << "_"
00063            << std::setfill('0') << std::setw(4) << sectionNumber << ".root";
00064   
00065   fileName_ = fileName.str();
00066   
00067   CreateTree();
00068 }
00069 
00070 void HCAL_HLX::ROOTFileBase::SetFileName(const HCAL_HLX::LUMI_SECTION &lumiSection){
00071 
00072   SetFileName( lumiSection.hdr.runNumber,
00073                lumiSection.hdr.sectionNumber);
00074 }
00075 
00076 void HCAL_HLX::ROOTFileBase::SetEtSumOnly( bool bEtSumOnly ){
00077 
00078   bEtSumOnly_ = bEtSumOnly;
00079 }