CMS 3D CMS Logo

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

#include <DirManager.h>

Public Member Functions

bool checkDirEmpty (std::string &)
 
 DirManager (std::string &d)
 
unsigned int findHighestRun ()
 
std::string findHighestRunDir ()
 
std::string findRunDir (unsigned int)
 
virtual ~DirManager ()
 

Private Attributes

std::string dir_
 

Detailed Description

Definition at line 13 of file DirManager.h.

Constructor & Destructor Documentation

evf::DirManager::DirManager ( std::string &  d)
inline

Definition at line 15 of file DirManager.h.

15 : dir_(d) {}
tuple d
Definition: ztail.py:151
std::string dir_
Definition: DirManager.h:23
virtual evf::DirManager::~DirManager ( )
inlinevirtual

Definition at line 16 of file DirManager.h.

16 {}

Member Function Documentation

bool evf::DirManager::checkDirEmpty ( std::string &  d)

Definition at line 64 of file DirManager.cc.

References dqmPostProcessing_online::DIR, and DeadROC_duringRun::dir.

64  {
65  int filecount = 0;
66  DIR *dir = opendir(d.c_str());
67  while (readdir(dir)) {
68  filecount++;
69  }
70  return (filecount == 0);
71  }
tuple d
Definition: ztail.py:151
unsigned int evf::DirManager::findHighestRun ( )

Definition at line 7 of file DirManager.cc.

References visDQMUpload::buf, dqmPostProcessing_online::DIR, DeadROC_duringRun::dir, dir_, maxrun, and AlCaHLTBitMon_QueryRunRegistry::string.

7  {
8  DIR *dir = opendir(dir_.c_str());
9  struct dirent *buf;
10  int maxrun = 0;
11  while ((buf = readdir(dir))) {
12  std::string dirnameNum = buf->d_name;
13  if (dirnameNum.find("run") != std::string::npos)
14  dirnameNum = dirnameNum.substr(3, std::string::npos);
15  if (atoi(dirnameNum.c_str()) > maxrun) {
16  maxrun = atoi(dirnameNum.c_str());
17  }
18  }
19  closedir(dir);
20  return maxrun;
21  }
Int_t maxrun
std::string dir_
Definition: DirManager.h:23
std::string evf::DirManager::findHighestRunDir ( )

Definition at line 23 of file DirManager.cc.

References visDQMUpload::buf, dqmPostProcessing_online::DIR, DeadROC_duringRun::dir, dir_, maxrun, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by evf::EvFDaqDirector::preBeginRun().

23  {
24  std::string retval = dir_ + "/";
25  std::string tmpdir;
26  DIR *dir = opendir(dir_.c_str());
27  struct dirent *buf;
28  int maxrun = 0;
29  while ((buf = readdir(dir))) {
30  std::string dirnameNum = buf->d_name;
31  if (dirnameNum.find("run") != std::string::npos)
32  dirnameNum = dirnameNum.substr(3, std::string::npos);
33  if (atoi(dirnameNum.c_str()) > maxrun) {
34  tmpdir = buf->d_name;
35  maxrun = atoi(dirnameNum.c_str());
36  }
37  }
38  closedir(dir);
39  retval += tmpdir;
40  return retval;
41  }
Int_t maxrun
std::string dir_
Definition: DirManager.h:23
std::string evf::DirManager::findRunDir ( unsigned int  run)

Definition at line 43 of file DirManager.cc.

References visDQMUpload::buf, dqmPostProcessing_online::DIR, DeadROC_duringRun::dir, dir_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by evf::EvFDaqDirector::findCurrentRunDir().

43  {
44  std::string retval = dir_ + "/";
45  std::string tmpdir = "";
46  DIR *dir = opendir(dir_.c_str());
47  struct dirent *buf;
48  while ((buf = readdir(dir))) {
49  std::string dirnameNum = buf->d_name;
50  if (dirnameNum.find("run") != std::string::npos)
51  dirnameNum = dirnameNum.substr(3, std::string::npos);
52  if ((unsigned int)atoi(dirnameNum.c_str()) == run) {
53  tmpdir = buf->d_name;
54  break;
55  }
56  }
57  closedir(dir);
58  if (tmpdir.empty())
59  throw cms::Exception("LogicError") << "Run Directory for Run " << run << " Not Found";
60  retval += tmpdir;
61  return retval;
62  }
std::string dir_
Definition: DirManager.h:23

Member Data Documentation

std::string evf::DirManager::dir_
private

Definition at line 23 of file DirManager.h.

Referenced by findHighestRun(), findHighestRunDir(), and findRunDir().