CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ContentReader.cc
Go to the documentation of this file.
2 
3 
4 // fills the list with all subdirectories of dir containing something
5 void ContentReader::give_subdirs(std::string dir, std::list<std::string> &subdirs, std::string mode)
6 {
7 
8  std::string old = bei->pwd();
9  bei->setCurrentFolder(dir);
10 
11  std::vector<std::string> all_subdirs = bei->getSubdirs();
12 
13  // std::cout << "The directory " << bei->pwd() << " contains " << all_subdirs.size() << " subdirectories!" << std::endl;
14 
15  subdirs.push_back("..");
16  for (unsigned int i = 0; i < all_subdirs.size(); i++)
17  {
18  std::string subdir = dir + all_subdirs[i];
19  if (mode == "User")
20  {
21  if (bei->containsAnyMonitorable(subdir))
22  {
23  subdirs.push_back(all_subdirs[i]);
24  }
25  }
26  else if (mode == "SuperUser")
27  {
28  subdirs.push_back(all_subdirs[i]);
29  }
30  }
31 
32  bei->setCurrentFolder(old);
33 }
34 
35 // fills the list with existing files in dir
36 void ContentReader::give_files(std::string dir, std::list<std::string> &files, bool only_contents)
37 {
38  // std::cout << "ContentReader was asked to find the subfiles of : "
39 // << dir << std::endl;
40 
41  // for the interesting directory
42  std::string old = bei->pwd();
43  bei->setCurrentFolder(dir);
44  // get the monitorable files
45  std::vector<std::string> all_files = bei->getMEs();
46 
47  if (only_contents)
48  {
49  // and copy those that exist in the files list
50  for (unsigned int i = 0; i < all_files.size(); i++)
51  {
52  std::string filename = bei->pwd() + "/" + all_files[i];
53  // if it does exist
54  if (bei->get(filename) != NULL)
55  {
56  files.push_back(filename);
57  }
58  }
59  // go back to original folder:
60  bei->setCurrentFolder(old);
61  }
62  else
63  {
64  // and copy those that exist in the files list
65  for (unsigned int i = 0; i < all_files.size(); i++)
66  {
67  std::string filename = bei->pwd() + "/" + all_files[i];
68  files.push_back(filename);
69  }
70  // go back to original folder:
71  bei->setCurrentFolder(old);
72 
73  }
74 }
75 
76 
77 // returns a pointer to a requested filename, or NULL if not available
79 {
80  MonitorElement *requested = bei->get(filename);
81  return requested;
82 }
int i
Definition: DBlmapReader.cc:9
bool containsAnyMonitorable(const std::string &path) const
Definition: DQMStore.cc:1458
void give_files(std::string dir, std::list< std::string > &files, bool only_contents)
std::vector< std::string > getSubdirs(void) const
Definition: DQMStore.cc:1419
#define NULL
Definition: scimark2.h:8
tuple files
Definition: linker.py:146
DQMStore * bei
Definition: ContentReader.h:12
MonitorElement * give_ME(std::string filename)
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1468
void give_subdirs(std::string dir, std::list< std::string > &subdirs, std::string mode)
Definition: ContentReader.cc:5
std::vector< std::string > getMEs(void) const
get list of (non-dir) MEs of current directory
Definition: DQMStore.cc:1442
tuple filename
Definition: lut2db_cfg.py:20
dbl *** dir
Definition: mlp_gen.cc:35
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
const std::string & pwd(void) const
Definition: DQMStore.cc:401